mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
[ongoing] renew subscription test
This commit is contained in:
parent
7748d601f8
commit
e0dca6c744
10
test/fixtures/availabilities.yml
vendored
10
test/fixtures/availabilities.yml
vendored
@ -108,3 +108,13 @@ availability_11:
|
|||||||
updated_at: 2016-04-04 15:44:04.023557000 Z
|
updated_at: 2016-04-04 15:44:04.023557000 Z
|
||||||
nb_total_places:
|
nb_total_places:
|
||||||
destroying: false
|
destroying: false
|
||||||
|
|
||||||
|
availability_12:
|
||||||
|
id: 12
|
||||||
|
start_at: 2012-04-11 06:00:00.000000000 Z
|
||||||
|
end_at: 2012-04-11 10:00:00.000000000 Z
|
||||||
|
available_type: training
|
||||||
|
created_at: 2012-04-04 15:24:01.517486000 Z
|
||||||
|
updated_at: 2012-04-04 15:24:01.517486000 Z
|
||||||
|
nb_total_places:
|
||||||
|
destroying: false
|
13
test/fixtures/credits.yml
vendored
13
test/fixtures/credits.yml
vendored
@ -5,8 +5,8 @@ credit_1:
|
|||||||
creditable_type: Training
|
creditable_type: Training
|
||||||
plan_id: 1
|
plan_id: 1
|
||||||
hours:
|
hours:
|
||||||
created_at: 2016-04-04 15:19:28.414019000 Z
|
created_at: 2001-01-01 14:11:33.852721000 Z
|
||||||
updated_at: 2016-04-04 15:19:28.414019000 Z
|
updated_at: 2001-01-01 14:11:33.852721000 Z
|
||||||
|
|
||||||
credit_2:
|
credit_2:
|
||||||
id: 2
|
id: 2
|
||||||
@ -106,3 +106,12 @@ credit_14:
|
|||||||
hours: 1
|
hours: 1
|
||||||
created_at: 2016-04-04 15:21:57.547939000 Z
|
created_at: 2016-04-04 15:21:57.547939000 Z
|
||||||
updated_at: 2016-04-04 15:21:57.547939000 Z
|
updated_at: 2016-04-04 15:21:57.547939000 Z
|
||||||
|
|
||||||
|
credit_15:
|
||||||
|
id: 15
|
||||||
|
creditable_id: 4
|
||||||
|
creditable_type: Machine
|
||||||
|
plan_id: 1
|
||||||
|
hours: 1
|
||||||
|
created_at: 2001-01-01 14:11:33.852721000 Z
|
||||||
|
updated_at: 2001-01-01 14:11:33.852721000 Z
|
||||||
|
24
test/fixtures/invoice_items.yml
vendored
24
test/fixtures/invoice_items.yml
vendored
@ -21,3 +21,27 @@ invoice_item_2:
|
|||||||
d'emploi - month
|
d'emploi - month
|
||||||
subscription_id: 2
|
subscription_id: 2
|
||||||
invoice_item_id:
|
invoice_item_id:
|
||||||
|
|
||||||
|
invoice_item_3:
|
||||||
|
id: 3
|
||||||
|
invoice_id: 3
|
||||||
|
stp_invoice_item_id:
|
||||||
|
amount: 3000
|
||||||
|
created_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
updated_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
description: Mensuel - standard, association - month
|
||||||
|
subscription_id: 3
|
||||||
|
invoice_item_id:
|
||||||
|
|
||||||
|
|
||||||
|
invoice_item_4:
|
||||||
|
id: 4
|
||||||
|
invoice_id: 4
|
||||||
|
stp_invoice_item_id:
|
||||||
|
amount: 0
|
||||||
|
created_at: 2012-03-12 13:40:22.342717000 Z
|
||||||
|
updated_at: 2012-03-12 13:40:22.342717000 Z
|
||||||
|
description: Formation Laser / Vinyle April 11, 2012 08:00 - 12:00 PM
|
||||||
|
subscription_id:
|
||||||
|
invoice_item_id:
|
||||||
|
|
||||||
|
35
test/fixtures/invoices.yml
vendored
35
test/fixtures/invoices.yml
vendored
@ -32,3 +32,38 @@ invoice_2:
|
|||||||
type:
|
type:
|
||||||
subscription_to_expire:
|
subscription_to_expire:
|
||||||
description:
|
description:
|
||||||
|
|
||||||
|
invoice_3:
|
||||||
|
id: 3
|
||||||
|
invoiced_id: 3
|
||||||
|
invoiced_type: Subscription
|
||||||
|
stp_invoice_id:
|
||||||
|
total: 3000
|
||||||
|
created_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
updated_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
user_id: 7
|
||||||
|
reference: '1203001'
|
||||||
|
avoir_mode:
|
||||||
|
avoir_date:
|
||||||
|
invoice_id:
|
||||||
|
type:
|
||||||
|
subscription_to_expire:
|
||||||
|
description:
|
||||||
|
|
||||||
|
|
||||||
|
invoice_4:
|
||||||
|
id: 4
|
||||||
|
invoiced_id: 1
|
||||||
|
invoiced_type: Reservation
|
||||||
|
stp_invoice_id:
|
||||||
|
total: 0
|
||||||
|
created_at: 2012-03-12 13:40:22.342717000 Z
|
||||||
|
updated_at: 2012-03-12 13:40:22.342717000 Z
|
||||||
|
user_id: 7
|
||||||
|
reference: '1203002'
|
||||||
|
avoir_mode:
|
||||||
|
avoir_date:
|
||||||
|
invoice_id:
|
||||||
|
type:
|
||||||
|
subscription_to_expire:
|
||||||
|
description:
|
4
test/fixtures/machines.yml
vendored
4
test/fixtures/machines.yml
vendored
@ -64,8 +64,8 @@ machine_4:
|
|||||||
spec: "Surface maximale de travail: 210x210x220mm \r\nRésolution méchanique: 0,02
|
spec: "Surface maximale de travail: 210x210x220mm \r\nRésolution méchanique: 0,02
|
||||||
mm \r\nPrécision de position: +/- 0,05 \r\nLogiciel utilisé: Cura\r\nFormats de
|
mm \r\nPrécision de position: +/- 0,05 \r\nLogiciel utilisé: Cura\r\nFormats de
|
||||||
fichier acceptés: STL \r\nMatériaux utilisés: PLA (en stock)."
|
fichier acceptés: STL \r\nMatériaux utilisés: PLA (en stock)."
|
||||||
created_at: 2016-04-04 14:11:34.341810000 Z
|
created_at: 2001-01-01 14:11:34.341810000 Z
|
||||||
updated_at: 2016-04-04 14:11:34.341810000 Z
|
updated_at: 2001-01-01 14:11:34.341810000 Z
|
||||||
slug: imprimante-3d
|
slug: imprimante-3d
|
||||||
|
|
||||||
machine_5:
|
machine_5:
|
||||||
|
4
test/fixtures/plans.yml
vendored
4
test/fixtures/plans.yml
vendored
@ -6,8 +6,8 @@ plan_1:
|
|||||||
interval: month
|
interval: month
|
||||||
group_id: 1
|
group_id: 1
|
||||||
stp_plan_id: mensuel-standard-month-20160404171519
|
stp_plan_id: mensuel-standard-month-20160404171519
|
||||||
created_at: 2016-04-04 15:15:19.860064000 Z
|
created_at: 2001-01-01 15:15:19.860064000 Z
|
||||||
updated_at: 2016-04-04 15:19:28.367161000 Z
|
updated_at: 2001-01-01 15:19:28.367161000 Z
|
||||||
training_credit_nb: 1
|
training_credit_nb: 1
|
||||||
is_rolling:
|
is_rolling:
|
||||||
description:
|
description:
|
||||||
|
13
test/fixtures/profiles.yml
vendored
13
test/fixtures/profiles.yml
vendored
@ -76,3 +76,16 @@ profile_3:
|
|||||||
software_mastered: ''
|
software_mastered: ''
|
||||||
created_at: 2016-04-04 15:07:46.687390000 Z
|
created_at: 2016-04-04 15:07:46.687390000 Z
|
||||||
updated_at: 2016-04-05 08:35:18.580745000 Z
|
updated_at: 2016-04-05 08:35:18.580745000 Z
|
||||||
|
|
||||||
|
profile_7:
|
||||||
|
id: 7
|
||||||
|
user_id: 7
|
||||||
|
first_name: Lucile
|
||||||
|
last_name: Seguin
|
||||||
|
gender: false
|
||||||
|
birthday: 1969-02-03
|
||||||
|
phone: '0241853679'
|
||||||
|
interest:
|
||||||
|
software_mastered:
|
||||||
|
created_at: 2012-03-12 11:00:21.411067000 Z
|
||||||
|
updated_at: 2016-04-07 11:00:37.643112000 Z
|
||||||
|
12
test/fixtures/reservations.yml
vendored
12
test/fixtures/reservations.yml
vendored
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
reservation_1:
|
||||||
|
id: 1
|
||||||
|
user_id: 7
|
||||||
|
message:
|
||||||
|
created_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
updated_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
reservable_id: 2
|
||||||
|
reservable_type: Training
|
||||||
|
stp_invoice_id:
|
||||||
|
nb_reserve_places:
|
||||||
|
nb_reserve_reduced_places:
|
13
test/fixtures/slots.yml
vendored
13
test/fixtures/slots.yml
vendored
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
slot_1:
|
||||||
|
id: 1
|
||||||
|
start_at: 2012-04-11 06:00:00.000000000 Z
|
||||||
|
end_at: 2012-04-11 10:00:00.000000000 Z
|
||||||
|
reservation_id: 12
|
||||||
|
created_at: 2012-03-12 13:40:22.342717000 Z
|
||||||
|
updated_at: 2012-03-12 13:40:22.342717000 Z
|
||||||
|
availability_id: 1
|
||||||
|
ex_start_at:
|
||||||
|
canceled_at:
|
||||||
|
ex_end_at:
|
||||||
|
offered:
|
11
test/fixtures/subscriptions.yml
vendored
11
test/fixtures/subscriptions.yml
vendored
@ -18,3 +18,14 @@ subscription_2:
|
|||||||
updated_at: 2016-04-05 08:36:46.829879000 Z
|
updated_at: 2016-04-05 08:36:46.829879000 Z
|
||||||
expired_at: 2016-05-05 08:36:46.828332000 Z
|
expired_at: 2016-05-05 08:36:46.828332000 Z
|
||||||
canceled_at:
|
canceled_at:
|
||||||
|
|
||||||
|
# subscription has expired (do not change dates)
|
||||||
|
subscription_3:
|
||||||
|
id: 3
|
||||||
|
plan_id: 1
|
||||||
|
user_id: 7
|
||||||
|
stp_subscription_id:
|
||||||
|
created_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
updated_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
expired_at: 2012-04-12 11:03:31.648274000 Z
|
||||||
|
canceled_at:
|
||||||
|
4
test/fixtures/trainings.yml
vendored
4
test/fixtures/trainings.yml
vendored
@ -11,8 +11,8 @@ training_1:
|
|||||||
training_2:
|
training_2:
|
||||||
id: 2
|
id: 2
|
||||||
name: Formation Laser / Vinyle
|
name: Formation Laser / Vinyle
|
||||||
created_at: 2016-04-04 14:11:34.075249000 Z
|
created_at: 2001-01-01 14:11:33.852721000 Z
|
||||||
updated_at: 2016-04-04 14:11:34.075249000 Z
|
updated_at: 2001-01-01 14:11:34.075249000 Z
|
||||||
nb_total_places:
|
nb_total_places:
|
||||||
slug: formation-laser-vinyle
|
slug: formation-laser-vinyle
|
||||||
description:
|
description:
|
||||||
|
48
test/fixtures/users.yml
vendored
48
test/fixtures/users.yml
vendored
@ -10,8 +10,8 @@ user_2:
|
|||||||
sign_in_count: 1
|
sign_in_count: 1
|
||||||
current_sign_in_at: 2016-04-04 15:00:29.439018000 Z
|
current_sign_in_at: 2016-04-04 15:00:29.439018000 Z
|
||||||
last_sign_in_at: 2016-04-04 15:00:29.439018000 Z
|
last_sign_in_at: 2016-04-04 15:00:29.439018000 Z
|
||||||
current_sign_in_ip: 127.0.0.1
|
current_sign_in_ip: 5.196.0.99
|
||||||
last_sign_in_ip: 127.0.0.1
|
last_sign_in_ip: 5.196.0.99
|
||||||
confirmation_token:
|
confirmation_token:
|
||||||
confirmed_at: 2016-04-04 15:00:43.555678000 Z
|
confirmed_at: 2016-04-04 15:00:43.555678000 Z
|
||||||
confirmation_sent_at: 2016-04-04 15:00:29.424011000 Z
|
confirmation_sent_at: 2016-04-04 15:00:29.424011000 Z
|
||||||
@ -109,8 +109,8 @@ user_5:
|
|||||||
sign_in_count: 1
|
sign_in_count: 1
|
||||||
current_sign_in_at: 2016-04-04 15:34:23.343596000 Z
|
current_sign_in_at: 2016-04-04 15:34:23.343596000 Z
|
||||||
last_sign_in_at: 2016-04-04 15:34:23.343596000 Z
|
last_sign_in_at: 2016-04-04 15:34:23.343596000 Z
|
||||||
current_sign_in_ip: 127.0.0.1
|
current_sign_in_ip: 37.64.230.6
|
||||||
last_sign_in_ip: 127.0.0.1
|
last_sign_in_ip: 37.67.211.2
|
||||||
confirmation_token: 59cfd407491c4e1d95a9f91f81e710a62a83a6fd7171ad22823b4c4395312c4d
|
confirmation_token: 59cfd407491c4e1d95a9f91f81e710a62a83a6fd7171ad22823b4c4395312c4d
|
||||||
confirmed_at:
|
confirmed_at:
|
||||||
confirmation_sent_at: 2016-04-04 15:14:08.599603000 Z
|
confirmation_sent_at: 2016-04-04 15:14:08.599603000 Z
|
||||||
@ -142,8 +142,8 @@ user_3:
|
|||||||
sign_in_count: 2
|
sign_in_count: 2
|
||||||
current_sign_in_at: 2016-04-05 08:35:05.676918000 Z
|
current_sign_in_at: 2016-04-05 08:35:05.676918000 Z
|
||||||
last_sign_in_at: 2016-04-04 15:07:46.733781000 Z
|
last_sign_in_at: 2016-04-04 15:07:46.733781000 Z
|
||||||
current_sign_in_ip: 127.0.0.1
|
current_sign_in_ip: 81.45.10.6
|
||||||
last_sign_in_ip: 127.0.0.1
|
last_sign_in_ip: 81.45.10.6
|
||||||
confirmation_token:
|
confirmation_token:
|
||||||
confirmed_at: 2016-04-04 15:08:00.893381000 Z
|
confirmed_at: 2016-04-04 15:08:00.893381000 Z
|
||||||
confirmation_sent_at: 2016-04-04 15:07:46.726886000 Z
|
confirmation_sent_at: 2016-04-04 15:07:46.726886000 Z
|
||||||
@ -184,7 +184,7 @@ user_1:
|
|||||||
failed_attempts: 0
|
failed_attempts: 0
|
||||||
unlock_token:
|
unlock_token:
|
||||||
locked_at:
|
locked_at:
|
||||||
created_at: 2016-04-04 14:11:33.852719000 Z
|
created_at: 2001-01-01 14:11:33.852719000 Z
|
||||||
updated_at: 2016-04-05 08:36:08.362215000 Z
|
updated_at: 2016-04-05 08:36:08.362215000 Z
|
||||||
is_allow_contact: true
|
is_allow_contact: true
|
||||||
group_id: 1
|
group_id: 1
|
||||||
@ -196,3 +196,37 @@ user_1:
|
|||||||
uid:
|
uid:
|
||||||
auth_token:
|
auth_token:
|
||||||
merged_at:
|
merged_at:
|
||||||
|
|
||||||
|
|
||||||
|
user_7:
|
||||||
|
id: 7
|
||||||
|
username: lseguin
|
||||||
|
email: lucile.seguin@live.fr
|
||||||
|
encrypted_password: $2a$10$5dThoeez738sWt6sILHs7eqlOMHSa0M3GXo6VL05DPu.Kdyxl.Qdm
|
||||||
|
reset_password_token:
|
||||||
|
reset_password_sent_at:
|
||||||
|
remember_created_at:
|
||||||
|
sign_in_count: 1
|
||||||
|
current_sign_in_at: 2016-04-07 11:00:21.779594000 Z
|
||||||
|
last_sign_in_at: 2016-04-07 11:00:21.779594000 Z
|
||||||
|
current_sign_in_ip: 37.72.235.1
|
||||||
|
last_sign_in_ip: 37.72.199.5
|
||||||
|
confirmation_token:
|
||||||
|
confirmed_at: 2012-03-12 11:00:37.642349000 Z
|
||||||
|
confirmation_sent_at: 2012-03-12 11:00:21.762686000 Z
|
||||||
|
unconfirmed_email:
|
||||||
|
failed_attempts: 0
|
||||||
|
unlock_token:
|
||||||
|
locked_at:
|
||||||
|
created_at: 2012-03-12 11:00:21.411067000 Z
|
||||||
|
updated_at: 2016-04-07 11:00:37.643112000 Z
|
||||||
|
is_allow_contact: true
|
||||||
|
group_id: 1
|
||||||
|
stp_customer_id: cus_8E2ys9zDZgetWX
|
||||||
|
slug: lseguin
|
||||||
|
is_active: true
|
||||||
|
invoicing_disabled: false
|
||||||
|
provider:
|
||||||
|
uid:
|
||||||
|
auth_token:
|
||||||
|
merged_at:
|
||||||
|
8
test/fixtures/users_credits.yml
vendored
8
test/fixtures/users_credits.yml
vendored
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
users_credits_1:
|
||||||
|
id: 1
|
||||||
|
user_id: 7
|
||||||
|
credit_id: 1
|
||||||
|
hours_used:
|
||||||
|
created_at: 2012-03-12 11:03:31.651441000 Z
|
||||||
|
updated_at: 2012-03-12 11:03:31.651441000 Z
|
@ -1,4 +1,5 @@
|
|||||||
class CreateAsUserTest < ActionDispatch::IntegrationTest
|
module Subscriptions
|
||||||
|
class CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@ -6,7 +7,7 @@ class CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
login_as(@admin, scope: :user)
|
login_as(@admin, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "admin takes a subscription for a user" do
|
test "admin successfully takes a subscription for a user" do
|
||||||
user = User.find_by_username('jdupond')
|
user = User.find_by_username('jdupond')
|
||||||
plan = Plan.find_by(group_id: user.group.id, type: 'Plan', base_name: 'Mensuel')
|
plan = Plan.find_by(group_id: user.group.id, type: 'Plan', base_name: 'Mensuel')
|
||||||
|
|
||||||
@ -55,3 +56,4 @@ class CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
class CreateAsUserTest < ActionDispatch::IntegrationTest
|
class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@ -6,7 +6,7 @@ class CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
login_as(@user, scope: :user)
|
login_as(@user, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'user takes a subscription successfully' do
|
test 'user successfully takes a subscription' do
|
||||||
plan = Plan.find_by(group_id: @user.group.id, type: 'Plan', base_name: 'Mensuel')
|
plan = Plan.find_by(group_id: @user.group.id, type: 'Plan', base_name: 'Mensuel')
|
||||||
|
|
||||||
VCR.use_cassette("subscriptions_user_create_success") do
|
VCR.use_cassette("subscriptions_user_create_success") do
|
||||||
@ -58,7 +58,7 @@ class CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
test 'user takes a subscription with error' do
|
test 'user fails to take a subscription' do
|
||||||
# get plan for wrong group
|
# get plan for wrong group
|
||||||
plan = Plan.where.not(group_id: @user.group.id).first
|
plan = Plan.where.not(group_id: @user.group.id).first
|
||||||
|
|
||||||
@ -78,7 +78,6 @@ class CreateAsUserTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal Mime::JSON, response.content_type
|
assert_equal Mime::JSON, response.content_type
|
||||||
|
|
||||||
# Check the error was handled
|
# Check the error was handled
|
||||||
subscription = json_response(response.body)
|
|
||||||
assert_match /plan is not compatible/, response.body
|
assert_match /plan is not compatible/, response.body
|
||||||
|
|
||||||
# Check that the user has no subscription
|
# Check that the user has no subscription
|
||||||
|
83
test/integration/subscriptions/renew_as_user_test.rb
Normal file
83
test/integration/subscriptions/renew_as_user_test.rb
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
|
|
||||||
|
setup do
|
||||||
|
@user = User.find_by_username('lseguin')
|
||||||
|
login_as(@user, scope: :user)
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'user successfully renew a subscription after it has ended' do
|
||||||
|
plan = Plan.find_by(group_id: @user.group.id, type: 'Plan', base_name: 'Mensuel')
|
||||||
|
|
||||||
|
VCR.use_cassette("subscriptions_user_renew_success") do
|
||||||
|
post '/api/subscriptions',
|
||||||
|
{
|
||||||
|
subscription: {
|
||||||
|
plan_id: plan.id,
|
||||||
|
user_id: @user.id,
|
||||||
|
card_token: stripe_card_token
|
||||||
|
}
|
||||||
|
}.to_json, default_headers
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check response format & status
|
||||||
|
assert_equal 201, response.status, "API does not return the expected status."+response.body
|
||||||
|
assert_equal Mime::JSON, response.content_type
|
||||||
|
|
||||||
|
# Check the correct plan was subscribed
|
||||||
|
subscription = json_response(response.body)
|
||||||
|
assert_equal plan.id, subscription[:plan_id], 'subscribed plan does not match'
|
||||||
|
|
||||||
|
# Check that the user has the correct subscription
|
||||||
|
assert_not_nil @user.subscription, "user's subscription was not found"
|
||||||
|
assert (@user.subscription.expired_at > DateTime.now), "user's subscription expiration was not updated"
|
||||||
|
assert_in_delta 5, (DateTime.now.to_i - @user.subscription.updated_at.to_i), 10, "user's subscription was not updated recently"
|
||||||
|
|
||||||
|
# Check that the credits were reset correctly
|
||||||
|
assert_empty @user.users_credits, 'credits were not reset'
|
||||||
|
|
||||||
|
# Check notifications were sent for every admins
|
||||||
|
notifications = Notification.where(notification_type_id: NotificationType.find_by_name('notify_admin_subscribed_plan'), attached_object_type: 'Subscription', attached_object_id: subscription[:id])
|
||||||
|
assert_not_empty notifications, 'no notifications were created'
|
||||||
|
notified_users_ids = notifications.map {|n| n.receiver_id }
|
||||||
|
User.admins.each do |adm|
|
||||||
|
assert_includes notified_users_ids, adm.id, "Admin #{adm.id} was not notified"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check generated invoice
|
||||||
|
invoice = Invoice.find_by(invoiced_type: 'Subscription', invoiced_id: subscription[:id])
|
||||||
|
assert_not_nil invoice, 'Invoice was not created'
|
||||||
|
#FIXME assert File.exist?(invoice.file), 'Invoice PDF was not generated'
|
||||||
|
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test 'user fails to renew a subscription' do
|
||||||
|
plan = Plan.find_by(group_id: @user.group.id, type: 'Plan', base_name: 'Mensuel')
|
||||||
|
|
||||||
|
previous_expiration = @user.subscription.expired_at.to_i
|
||||||
|
|
||||||
|
VCR.use_cassette("subscriptions_user_renew_failed") do
|
||||||
|
post '/api/subscriptions',
|
||||||
|
{
|
||||||
|
subscription: {
|
||||||
|
plan_id: plan.id,
|
||||||
|
user_id: @user.id,
|
||||||
|
card_token: 'invalid_card_token'
|
||||||
|
}
|
||||||
|
}.to_json, default_headers
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check response format & status
|
||||||
|
assert_equal 422, response.status, "API does not return the expected status."+response.body
|
||||||
|
assert_equal Mime::JSON, response.content_type
|
||||||
|
|
||||||
|
# Check the error was handled
|
||||||
|
assert_match /No such token/, response.body
|
||||||
|
|
||||||
|
# Check that the user's subscription has not changed
|
||||||
|
#FIXME assert_equal previous_expiration, @user.subscription.expired_at.to_i, "user's subscription has changed"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -10,7 +10,9 @@ VCR.configure do |config|
|
|||||||
config.hook_into :webmock
|
config.hook_into :webmock
|
||||||
end
|
end
|
||||||
|
|
||||||
Sidekiq::Testing.inline!
|
Sidekiq::Testing.inline! do |pp|
|
||||||
|
puts pp
|
||||||
|
end
|
||||||
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new({ color: true })]
|
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new({ color: true })]
|
||||||
|
|
||||||
|
|
||||||
|
246
test/vcr_cassettes/subscriptions_user_renew_failed.yml
Normal file
246
test/vcr_cassettes/subscriptions_user_renew_failed.yml
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
---
|
||||||
|
http_interactions:
|
||||||
|
- request:
|
||||||
|
method: get
|
||||||
|
uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX
|
||||||
|
body:
|
||||||
|
encoding: US-ASCII
|
||||||
|
string: ''
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:18:06 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '3454'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E69echXR3qGGa
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"id": "cus_8E2ys9zDZgetWX",
|
||||||
|
"object": "customer",
|
||||||
|
"account_balance": 0,
|
||||||
|
"created": 1460026822,
|
||||||
|
"currency": "usd",
|
||||||
|
"default_source": "card_17xdxN2sOmf47Nz9eyRuY12a",
|
||||||
|
"delinquent": false,
|
||||||
|
"description": "Lucile Seguin",
|
||||||
|
"discount": null,
|
||||||
|
"email": "lucile.seguin@live.fr",
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"shipping": null,
|
||||||
|
"sources": {
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "card_17xdxN2sOmf47Nz9eyRuY12a",
|
||||||
|
"object": "card",
|
||||||
|
"address_city": null,
|
||||||
|
"address_country": null,
|
||||||
|
"address_line1": null,
|
||||||
|
"address_line1_check": null,
|
||||||
|
"address_line2": null,
|
||||||
|
"address_state": null,
|
||||||
|
"address_zip": null,
|
||||||
|
"address_zip_check": null,
|
||||||
|
"brand": "Visa",
|
||||||
|
"country": "US",
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"cvc_check": "pass",
|
||||||
|
"dynamic_last4": null,
|
||||||
|
"exp_month": 4,
|
||||||
|
"exp_year": 2017,
|
||||||
|
"fingerprint": "o52jybR7bnmNn6AT",
|
||||||
|
"funding": "credit",
|
||||||
|
"last4": "4242",
|
||||||
|
"metadata": {},
|
||||||
|
"name": null,
|
||||||
|
"tokenization_method": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": false,
|
||||||
|
"total_count": 1,
|
||||||
|
"url": "/v1/customers/cus_8E2ys9zDZgetWX/sources"
|
||||||
|
},
|
||||||
|
"subscriptions": {
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "sub_8E694MZ1FBtXBg",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462630683,
|
||||||
|
"current_period_start": 1460038683,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460038683,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_8E67Z0lSjjVxBn",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462630527,
|
||||||
|
"current_period_start": 1460038527,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460038527,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": false,
|
||||||
|
"total_count": 2,
|
||||||
|
"url": "/v1/customers/cus_8E2ys9zDZgetWX/subscriptions"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:18:06 GMT
|
||||||
|
- request:
|
||||||
|
method: post
|
||||||
|
uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: plan=mensuel-standard-month-20160404171519&card=invalid_card_token
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
Content-Length:
|
||||||
|
- '66'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 400
|
||||||
|
message: Bad Request
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:18:07 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '130'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E69jMRCeshYc1
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"error": {
|
||||||
|
"type": "invalid_request_error",
|
||||||
|
"message": "No such token: invalid_card_token",
|
||||||
|
"param": "card"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:18:07 GMT
|
||||||
|
recorded_with: VCR 3.0.1
|
894
test/vcr_cassettes/subscriptions_user_renew_success.yml
Normal file
894
test/vcr_cassettes/subscriptions_user_renew_success.yml
Normal file
@ -0,0 +1,894 @@
|
|||||||
|
---
|
||||||
|
http_interactions:
|
||||||
|
- request:
|
||||||
|
method: post
|
||||||
|
uri: https://api.stripe.com/v1/tokens
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: card[number]=4242424242424242&card[exp_month]=4&card[exp_year]=2017&card[cvc]=314
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
Content-Length:
|
||||||
|
- '81'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:57:45 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '780'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E6ntokZYBap5o
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"id": "tok_17xeZp2sOmf47Nz9U7isup9R",
|
||||||
|
"object": "token",
|
||||||
|
"card": {
|
||||||
|
"id": "card_17xeZp2sOmf47Nz9Nw38pLma",
|
||||||
|
"object": "card",
|
||||||
|
"address_city": null,
|
||||||
|
"address_country": null,
|
||||||
|
"address_line1": null,
|
||||||
|
"address_line1_check": null,
|
||||||
|
"address_line2": null,
|
||||||
|
"address_state": null,
|
||||||
|
"address_zip": null,
|
||||||
|
"address_zip_check": null,
|
||||||
|
"brand": "Visa",
|
||||||
|
"country": "US",
|
||||||
|
"cvc_check": "unchecked",
|
||||||
|
"dynamic_last4": null,
|
||||||
|
"exp_month": 4,
|
||||||
|
"exp_year": 2017,
|
||||||
|
"fingerprint": "o52jybR7bnmNn6AT",
|
||||||
|
"funding": "credit",
|
||||||
|
"last4": "4242",
|
||||||
|
"metadata": {},
|
||||||
|
"name": null,
|
||||||
|
"tokenization_method": null
|
||||||
|
},
|
||||||
|
"client_ip": "90.52.157.226",
|
||||||
|
"created": 1460041065,
|
||||||
|
"livemode": false,
|
||||||
|
"type": "card",
|
||||||
|
"used": false
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:57:45 GMT
|
||||||
|
- request:
|
||||||
|
method: get
|
||||||
|
uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX
|
||||||
|
body:
|
||||||
|
encoding: US-ASCII
|
||||||
|
string: ''
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:57:46 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '3454'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E6nN7HdnY2Zr2
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"id": "cus_8E2ys9zDZgetWX",
|
||||||
|
"object": "customer",
|
||||||
|
"account_balance": 0,
|
||||||
|
"created": 1460026822,
|
||||||
|
"currency": "usd",
|
||||||
|
"default_source": "card_17xdxN2sOmf47Nz9eyRuY12a",
|
||||||
|
"delinquent": false,
|
||||||
|
"description": "Lucile Seguin",
|
||||||
|
"discount": null,
|
||||||
|
"email": "lucile.seguin@live.fr",
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"shipping": null,
|
||||||
|
"sources": {
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "card_17xdxN2sOmf47Nz9eyRuY12a",
|
||||||
|
"object": "card",
|
||||||
|
"address_city": null,
|
||||||
|
"address_country": null,
|
||||||
|
"address_line1": null,
|
||||||
|
"address_line1_check": null,
|
||||||
|
"address_line2": null,
|
||||||
|
"address_state": null,
|
||||||
|
"address_zip": null,
|
||||||
|
"address_zip_check": null,
|
||||||
|
"brand": "Visa",
|
||||||
|
"country": "US",
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"cvc_check": "pass",
|
||||||
|
"dynamic_last4": null,
|
||||||
|
"exp_month": 4,
|
||||||
|
"exp_year": 2017,
|
||||||
|
"fingerprint": "o52jybR7bnmNn6AT",
|
||||||
|
"funding": "credit",
|
||||||
|
"last4": "4242",
|
||||||
|
"metadata": {},
|
||||||
|
"name": null,
|
||||||
|
"tokenization_method": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": false,
|
||||||
|
"total_count": 1,
|
||||||
|
"url": "/v1/customers/cus_8E2ys9zDZgetWX/sources"
|
||||||
|
},
|
||||||
|
"subscriptions": {
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "sub_8E694MZ1FBtXBg",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462630683,
|
||||||
|
"current_period_start": 1460038683,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460038683,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_8E67Z0lSjjVxBn",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462630527,
|
||||||
|
"current_period_start": 1460038527,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460038527,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": false,
|
||||||
|
"total_count": 2,
|
||||||
|
"url": "/v1/customers/cus_8E2ys9zDZgetWX/subscriptions"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:57:46 GMT
|
||||||
|
- request:
|
||||||
|
method: post
|
||||||
|
uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: plan=mensuel-standard-month-20160404171519&card=tok_17xeZp2sOmf47Nz9U7isup9R
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
Content-Length:
|
||||||
|
- '76'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:57:47 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '821'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E6nkvdYjkxZ3A
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"id": "sub_8E6nlabIu0FNDK",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462633067,
|
||||||
|
"current_period_start": 1460041067,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460041067,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:57:47 GMT
|
||||||
|
- request:
|
||||||
|
method: get
|
||||||
|
uri: https://api.stripe.com/v1/invoices?customer=cus_8E2ys9zDZgetWX&limit=1
|
||||||
|
body:
|
||||||
|
encoding: US-ASCII
|
||||||
|
string: ''
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:57:48 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '2207'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E6nsHStsgJ8uR
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "in_17xeZr2sOmf47Nz9JTOtgIXv",
|
||||||
|
"object": "invoice",
|
||||||
|
"amount_due": 3000,
|
||||||
|
"application_fee": null,
|
||||||
|
"attempt_count": 1,
|
||||||
|
"attempted": true,
|
||||||
|
"charge": "ch_17xeZr2sOmf47Nz9KgHCuwK0",
|
||||||
|
"closed": true,
|
||||||
|
"currency": "usd",
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"date": 1460041067,
|
||||||
|
"description": null,
|
||||||
|
"discount": null,
|
||||||
|
"ending_balance": 0,
|
||||||
|
"forgiven": false,
|
||||||
|
"lines": {
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "sub_8E6nlabIu0FNDK",
|
||||||
|
"object": "line_item",
|
||||||
|
"amount": 3000,
|
||||||
|
"currency": "usd",
|
||||||
|
"description": null,
|
||||||
|
"discountable": true,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"period": {
|
||||||
|
"start": 1460041067,
|
||||||
|
"end": 1462633067
|
||||||
|
},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"proration": false,
|
||||||
|
"quantity": 1,
|
||||||
|
"subscription": null,
|
||||||
|
"type": "subscription"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": false,
|
||||||
|
"total_count": 1,
|
||||||
|
"url": "/v1/invoices/in_17xeZr2sOmf47Nz9JTOtgIXv/lines"
|
||||||
|
},
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"next_payment_attempt": null,
|
||||||
|
"paid": true,
|
||||||
|
"period_end": 1460041067,
|
||||||
|
"period_start": 1460038527,
|
||||||
|
"receipt_number": null,
|
||||||
|
"starting_balance": 0,
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"subscription": "sub_8E6nlabIu0FNDK",
|
||||||
|
"subtotal": 3000,
|
||||||
|
"tax": null,
|
||||||
|
"tax_percent": null,
|
||||||
|
"total": 3000,
|
||||||
|
"webhooks_delivered_at": 1460041067
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": true,
|
||||||
|
"url": "/v1/invoices"
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:57:48 GMT
|
||||||
|
- request:
|
||||||
|
method: get
|
||||||
|
uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX
|
||||||
|
body:
|
||||||
|
encoding: US-ASCII
|
||||||
|
string: ''
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:57:49 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '4474'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E6nTDGRZ4k0vh
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"id": "cus_8E2ys9zDZgetWX",
|
||||||
|
"object": "customer",
|
||||||
|
"account_balance": 0,
|
||||||
|
"created": 1460026822,
|
||||||
|
"currency": "usd",
|
||||||
|
"default_source": "card_17xeZp2sOmf47Nz9Nw38pLma",
|
||||||
|
"delinquent": false,
|
||||||
|
"description": "Lucile Seguin",
|
||||||
|
"discount": null,
|
||||||
|
"email": "lucile.seguin@live.fr",
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"shipping": null,
|
||||||
|
"sources": {
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "card_17xeZp2sOmf47Nz9Nw38pLma",
|
||||||
|
"object": "card",
|
||||||
|
"address_city": null,
|
||||||
|
"address_country": null,
|
||||||
|
"address_line1": null,
|
||||||
|
"address_line1_check": null,
|
||||||
|
"address_line2": null,
|
||||||
|
"address_state": null,
|
||||||
|
"address_zip": null,
|
||||||
|
"address_zip_check": null,
|
||||||
|
"brand": "Visa",
|
||||||
|
"country": "US",
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"cvc_check": "pass",
|
||||||
|
"dynamic_last4": null,
|
||||||
|
"exp_month": 4,
|
||||||
|
"exp_year": 2017,
|
||||||
|
"fingerprint": "o52jybR7bnmNn6AT",
|
||||||
|
"funding": "credit",
|
||||||
|
"last4": "4242",
|
||||||
|
"metadata": {},
|
||||||
|
"name": null,
|
||||||
|
"tokenization_method": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": false,
|
||||||
|
"total_count": 1,
|
||||||
|
"url": "/v1/customers/cus_8E2ys9zDZgetWX/sources"
|
||||||
|
},
|
||||||
|
"subscriptions": {
|
||||||
|
"object": "list",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "sub_8E6nlabIu0FNDK",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462633067,
|
||||||
|
"current_period_start": 1460041067,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460041067,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_8E694MZ1FBtXBg",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462630683,
|
||||||
|
"current_period_start": 1460038683,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460038683,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_8E67Z0lSjjVxBn",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462630527,
|
||||||
|
"current_period_start": 1460038527,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460038527,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"has_more": false,
|
||||||
|
"total_count": 3,
|
||||||
|
"url": "/v1/customers/cus_8E2ys9zDZgetWX/subscriptions"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:57:49 GMT
|
||||||
|
- request:
|
||||||
|
method: get
|
||||||
|
uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions/sub_8E6nlabIu0FNDK
|
||||||
|
body:
|
||||||
|
encoding: US-ASCII
|
||||||
|
string: ''
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:57:50 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '821'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E6nOZSSSXyv3E
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"id": "sub_8E6nlabIu0FNDK",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": false,
|
||||||
|
"canceled_at": null,
|
||||||
|
"current_period_end": 1462633067,
|
||||||
|
"current_period_start": 1460041067,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460041067,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:57:50 GMT
|
||||||
|
- request:
|
||||||
|
method: delete
|
||||||
|
uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions/sub_8E6nlabIu0FNDK?at_period_end=true
|
||||||
|
body:
|
||||||
|
encoding: US-ASCII
|
||||||
|
string: ''
|
||||||
|
headers:
|
||||||
|
Accept:
|
||||||
|
- "*/*; q=0.5, application/xml"
|
||||||
|
Accept-Encoding:
|
||||||
|
- gzip, deflate
|
||||||
|
User-Agent:
|
||||||
|
- Stripe/v1 RubyBindings/1.30.2
|
||||||
|
Authorization:
|
||||||
|
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||||
|
Content-Type:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
X-Stripe-Client-User-Agent:
|
||||||
|
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||||
|
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||||
|
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||||
|
response:
|
||||||
|
status:
|
||||||
|
code: 200
|
||||||
|
message: OK
|
||||||
|
headers:
|
||||||
|
Server:
|
||||||
|
- nginx
|
||||||
|
Date:
|
||||||
|
- Thu, 07 Apr 2016 14:57:51 GMT
|
||||||
|
Content-Type:
|
||||||
|
- application/json
|
||||||
|
Content-Length:
|
||||||
|
- '826'
|
||||||
|
Connection:
|
||||||
|
- keep-alive
|
||||||
|
Access-Control-Allow-Credentials:
|
||||||
|
- 'true'
|
||||||
|
Access-Control-Allow-Methods:
|
||||||
|
- GET, POST, HEAD, OPTIONS, DELETE
|
||||||
|
Access-Control-Allow-Origin:
|
||||||
|
- "*"
|
||||||
|
Access-Control-Max-Age:
|
||||||
|
- '300'
|
||||||
|
Cache-Control:
|
||||||
|
- no-cache, no-store
|
||||||
|
Request-Id:
|
||||||
|
- req_8E6nip0fkOtET5
|
||||||
|
Stripe-Version:
|
||||||
|
- '2015-10-16'
|
||||||
|
Strict-Transport-Security:
|
||||||
|
- max-age=31556926; includeSubDomains
|
||||||
|
body:
|
||||||
|
encoding: UTF-8
|
||||||
|
string: |
|
||||||
|
{
|
||||||
|
"id": "sub_8E6nlabIu0FNDK",
|
||||||
|
"object": "subscription",
|
||||||
|
"application_fee_percent": null,
|
||||||
|
"cancel_at_period_end": true,
|
||||||
|
"canceled_at": 1460041071,
|
||||||
|
"current_period_end": 1462633067,
|
||||||
|
"current_period_start": 1460041067,
|
||||||
|
"customer": "cus_8E2ys9zDZgetWX",
|
||||||
|
"discount": null,
|
||||||
|
"ended_at": null,
|
||||||
|
"metadata": {},
|
||||||
|
"plan": {
|
||||||
|
"id": "mensuel-standard-month-20160404171519",
|
||||||
|
"object": "plan",
|
||||||
|
"amount": 3000,
|
||||||
|
"created": 1459782921,
|
||||||
|
"currency": "usd",
|
||||||
|
"interval": "month",
|
||||||
|
"interval_count": 1,
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "Mensuel - standard, association - month",
|
||||||
|
"statement_descriptor": null,
|
||||||
|
"trial_period_days": null
|
||||||
|
},
|
||||||
|
"quantity": 1,
|
||||||
|
"start": 1460041067,
|
||||||
|
"status": "active",
|
||||||
|
"tax_percent": null,
|
||||||
|
"trial_end": null,
|
||||||
|
"trial_start": null
|
||||||
|
}
|
||||||
|
http_version:
|
||||||
|
recorded_at: Thu, 07 Apr 2016 14:57:51 GMT
|
||||||
|
recorded_with: VCR 3.0.1
|
Loading…
Reference in New Issue
Block a user