1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

[ongoing] renew subscription test

This commit is contained in:
Sylvain 2016-04-07 17:46:23 +02:00
parent 7748d601f8
commit e0dca6c744
19 changed files with 1508 additions and 113 deletions

View File

@ -6,7 +6,7 @@ availability_1:
available_type: training
created_at: 2016-04-04 15:24:01.517486000 Z
updated_at: 2016-04-04 15:24:01.517486000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_2:
@ -16,7 +16,7 @@ availability_2:
available_type: training
created_at: 2016-04-04 15:24:09.169364000 Z
updated_at: 2016-04-04 15:24:09.169364000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_3:
@ -26,7 +26,7 @@ availability_3:
available_type: machines
created_at: 2016-04-04 15:24:27.587583000 Z
updated_at: 2016-04-04 15:24:27.587583000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_4:
@ -36,7 +36,7 @@ availability_4:
available_type: machines
created_at: 2016-04-04 15:24:44.044908000 Z
updated_at: 2016-04-04 15:24:44.044908000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_5:
@ -46,7 +46,7 @@ availability_5:
available_type: machines
created_at: 2016-04-04 15:25:48.584444000 Z
updated_at: 2016-04-04 15:25:48.584444000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_6:
@ -56,7 +56,7 @@ availability_6:
available_type: machines
created_at: 2016-04-04 15:26:17.953216000 Z
updated_at: 2016-04-04 15:26:17.953216000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_7:
@ -66,7 +66,7 @@ availability_7:
available_type: machines
created_at: 2016-04-04 15:26:39.278627000 Z
updated_at: 2016-04-04 15:26:39.278627000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_8:
@ -76,7 +76,7 @@ availability_8:
available_type: training
created_at: 2016-04-04 15:26:49.572724000 Z
updated_at: 2016-04-04 15:26:49.572724000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_9:
@ -86,7 +86,7 @@ availability_9:
available_type: event
created_at: 2016-04-04 15:44:02.228661000 Z
updated_at: 2016-04-04 15:44:02.228661000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_10:
@ -96,7 +96,7 @@ availability_10:
available_type: event
created_at: 2016-04-04 15:44:03.156629000 Z
updated_at: 2016-04-04 15:44:03.156629000 Z
nb_total_places:
nb_total_places:
destroying: false
availability_11:
@ -106,5 +106,15 @@ availability_11:
available_type: event
created_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
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

View File

@ -5,8 +5,8 @@ credit_1:
creditable_type: Training
plan_id: 1
hours:
created_at: 2016-04-04 15:19:28.414019000 Z
updated_at: 2016-04-04 15:19:28.414019000 Z
created_at: 2001-01-01 14:11:33.852721000 Z
updated_at: 2001-01-01 14:11:33.852721000 Z
credit_2:
id: 2
@ -106,3 +106,12 @@ credit_14:
hours: 1
created_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

View File

@ -8,16 +8,40 @@ invoice_item_1:
updated_at: 2016-04-05 08:35:52.934725000 Z
description: Sleede - standard, association - month
subscription_id: 1
invoice_item_id:
invoice_item_id:
invoice_item_2:
id: 2
invoice_id: 2
stp_invoice_item_id:
stp_invoice_item_id:
amount: 2000
created_at: 2016-04-05 08:36:46.856021000 Z
updated_at: 2016-04-05 08:36:46.856021000 Z
description: Mensuel tarif réduit - étudiant, - de 25 ans, enseignant, demandeur
d'emploi - month
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:

View File

@ -9,26 +9,61 @@ invoice_1:
updated_at: 2016-04-05 08:35:52.931187000 Z
user_id: 3
reference: 1604001/VL
avoir_mode:
avoir_date:
invoice_id:
type:
subscription_to_expire:
description:
avoir_mode:
avoir_date:
invoice_id:
type:
subscription_to_expire:
description:
invoice_2:
id: 2
invoiced_id: 2
invoiced_type: Subscription
stp_invoice_id:
stp_invoice_id:
total: 2000
created_at: 2016-04-05 08:36:46.853368000 Z
updated_at: 2016-04-05 08:36:46.853368000 Z
user_id: 4
reference: '1604002'
avoir_mode:
avoir_date:
invoice_id:
type:
subscription_to_expire:
description:
avoir_mode:
avoir_date:
invoice_id:
type:
subscription_to_expire:
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:

View File

@ -64,8 +64,8 @@ machine_4:
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
fichier acceptés: STL \r\nMatériaux utilisés: PLA (en stock)."
created_at: 2016-04-04 14:11:34.341810000 Z
updated_at: 2016-04-04 14:11:34.341810000 Z
created_at: 2001-01-01 14:11:34.341810000 Z
updated_at: 2001-01-01 14:11:34.341810000 Z
slug: imprimante-3d
machine_5:

View File

@ -6,11 +6,11 @@ plan_1:
interval: month
group_id: 1
stp_plan_id: mensuel-standard-month-20160404171519
created_at: 2016-04-04 15:15:19.860064000 Z
updated_at: 2016-04-04 15:19:28.367161000 Z
created_at: 2001-01-01 15:15:19.860064000 Z
updated_at: 2001-01-01 15:19:28.367161000 Z
training_credit_nb: 1
is_rolling:
description:
is_rolling:
description:
type: Plan
base_name: Mensuel
ui_weight: 1
@ -26,8 +26,8 @@ plan_2:
created_at: 2016-04-04 15:17:24.026385000 Z
updated_at: 2016-04-04 15:19:39.357636000 Z
training_credit_nb: 2
is_rolling:
description:
is_rolling:
description:
type: PartnerPlan
base_name: Sleede
ui_weight: 5
@ -44,8 +44,8 @@ plan_3:
created_at: 2016-04-04 15:18:27.734657000 Z
updated_at: 2016-04-04 15:21:35.501739000 Z
training_credit_nb: 1
is_rolling:
description:
is_rolling:
description:
type: Plan
base_name: Mensuel tarif réduit
ui_weight: 0

View File

@ -7,8 +7,8 @@ profile_1:
gender: true
birthday: 2016-04-04
phone: 0123456789
interest:
software_mastered:
interest:
software_mastered:
created_at: 2016-04-04 14:11:33.858015000 Z
updated_at: 2016-04-04 14:11:33.858015000 Z
@ -59,8 +59,8 @@ profile_6:
gender: true
birthday: 2016-04-04
phone: '0000000000'
interest:
software_mastered:
interest:
software_mastered:
created_at: 2016-04-04 15:17:12.535971000 Z
updated_at: 2016-04-04 15:17:12.535971000 Z
@ -76,3 +76,16 @@ profile_3:
software_mastered: ''
created_at: 2016-04-04 15:07:46.687390000 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

View File

@ -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:

View File

@ -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:

View File

@ -13,8 +13,19 @@ subscription_2:
id: 2
plan_id: 3
user_id: 4
stp_subscription_id:
stp_subscription_id:
created_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
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:

View File

@ -4,42 +4,42 @@ training_1:
name: Formation Imprimante 3D
created_at: 2016-04-04 14:11:34.033464000 Z
updated_at: 2016-04-04 14:11:34.033464000 Z
nb_total_places:
nb_total_places:
slug: formation-imprimante-3d
description:
description:
training_2:
id: 2
name: Formation Laser / Vinyle
created_at: 2016-04-04 14:11:34.075249000 Z
updated_at: 2016-04-04 14:11:34.075249000 Z
nb_total_places:
created_at: 2001-01-01 14:11:33.852721000 Z
updated_at: 2001-01-01 14:11:34.075249000 Z
nb_total_places:
slug: formation-laser-vinyle
description:
description:
training_3:
id: 3
name: Formation Petite fraiseuse numerique
created_at: 2016-04-04 14:11:34.103077000 Z
updated_at: 2016-04-04 14:11:34.103077000 Z
nb_total_places:
nb_total_places:
slug: formation-petite-fraiseuse-numerique
description:
description:
training_4:
id: 4
name: Formation Shopbot Grande Fraiseuse
created_at: 2016-04-04 14:11:34.132899000 Z
updated_at: 2016-04-04 14:11:34.132899000 Z
nb_total_places:
nb_total_places:
slug: formation-shopbot-grande-fraiseuse
description:
description:
training_5:
id: 5
name: Formation logiciel 2D
created_at: 2016-04-04 14:11:34.152000000 Z
updated_at: 2016-04-04 14:11:34.152000000 Z
nb_total_places:
nb_total_places:
slug: formation-logiciel-2d
description:
description:

View File

@ -10,8 +10,8 @@ user_2:
sign_in_count: 1
current_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
last_sign_in_ip: 127.0.0.1
current_sign_in_ip: 5.196.0.99
last_sign_in_ip: 5.196.0.99
confirmation_token:
confirmed_at: 2016-04-04 15:00:43.555678000 Z
confirmation_sent_at: 2016-04-04 15:00:29.424011000 Z
@ -109,8 +109,8 @@ user_5:
sign_in_count: 1
current_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
last_sign_in_ip: 127.0.0.1
current_sign_in_ip: 37.64.230.6
last_sign_in_ip: 37.67.211.2
confirmation_token: 59cfd407491c4e1d95a9f91f81e710a62a83a6fd7171ad22823b4c4395312c4d
confirmed_at:
confirmation_sent_at: 2016-04-04 15:14:08.599603000 Z
@ -142,8 +142,8 @@ user_3:
sign_in_count: 2
current_sign_in_at: 2016-04-05 08:35:05.676918000 Z
last_sign_in_at: 2016-04-04 15:07:46.733781000 Z
current_sign_in_ip: 127.0.0.1
last_sign_in_ip: 127.0.0.1
current_sign_in_ip: 81.45.10.6
last_sign_in_ip: 81.45.10.6
confirmation_token:
confirmed_at: 2016-04-04 15:08:00.893381000 Z
confirmation_sent_at: 2016-04-04 15:07:46.726886000 Z
@ -184,7 +184,7 @@ user_1:
failed_attempts: 0
unlock_token:
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
is_allow_contact: true
group_id: 1
@ -196,3 +196,37 @@ user_1:
uid:
auth_token:
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:

View File

@ -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

View File

@ -1,57 +1,59 @@
class CreateAsUserTest < ActionDispatch::IntegrationTest
module Subscriptions
class CreateAsAdminTest < ActionDispatch::IntegrationTest
setup do
@admin = User.find_by_username('admin')
login_as(@admin, scope: :user)
end
test "admin takes a subscription for a user" do
user = User.find_by_username('jdupond')
plan = Plan.find_by(group_id: user.group.id, type: 'Plan', base_name: 'Mensuel')
VCR.use_cassette("subscriptions_admin_create_success") do
post '/api/subscriptions',
{
subscription: {
plan_id: plan.id,
user_id: user.id
}
}.to_json, default_headers
setup do
@admin = User.find_by_username('admin')
login_as(@admin, scope: :user)
end
test "admin successfully takes a subscription for a user" do
user = User.find_by_username('jdupond')
plan = Plan.find_by(group_id: user.group.id, type: 'Plan', base_name: 'Mensuel')
# Check response format & status
assert_equal 201, response.status, response.body
assert_equal Mime::JSON, response.content_type
VCR.use_cassette("subscriptions_admin_create_success") do
post '/api/subscriptions',
{
subscription: {
plan_id: plan.id,
user_id: user.id
}
}.to_json, default_headers
end
# 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_not_nil user.subscription.plan, "user's subscribed plan was not found"
assert_equal plan.id, user.subscription.plan_id, "user's plan does not match"
# Check response format & status
assert_equal 201, response.status, response.body
assert_equal Mime::JSON, response.content_type
# Check that the training credits were set correctly
assert_empty user.training_credits, 'training credits were not reset'
assert_equal user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
# 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 benefit from prices of his plan
printer = Machine.find_by_slug('imprimante-3d')
assert_equal 15, (printer.prices.find_by(group_id: user.group_id, plan_id: user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
# Check that the user has the correct subscription
assert_not_nil user.subscription, "user's subscription was not found"
assert_not_nil user.subscription.plan, "user's subscribed plan was not found"
assert_equal plan.id, user.subscription.plan_id, "user's plan does not match"
# Check notification was sent to the user
notification = Notification.find_by(notification_type_id: NotificationType.find_by_name('notify_member_subscribed_plan'), attached_object_type: 'Subscription', attached_object_id: subscription[:id])
assert_not_nil notification, 'user notification was not created'
assert_equal user.id, notification.receiver_id, 'wrong user notified'
# Check that the training credits were set correctly
assert_empty user.training_credits, 'training credits were not reset'
assert_equal user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
# Check that the user benefit from prices of his plan
printer = Machine.find_by_slug('imprimante-3d')
assert_equal 15, (printer.prices.find_by(group_id: user.group_id, plan_id: user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
# Check notification was sent to the user
notification = Notification.find_by(notification_type_id: NotificationType.find_by_name('notify_member_subscribed_plan'), attached_object_type: 'Subscription', attached_object_id: subscription[:id])
assert_not_nil notification, 'user notification was not created'
assert_equal user.id, notification.receiver_id, 'wrong user notified'
# Check generated invoice
invoice = Invoice.find_by(invoiced_type: 'Subscription', invoiced_id: subscription[:id])
assert_not_nil invoice, 'Invoice was not created'
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
# Check generated invoice
invoice = Invoice.find_by(invoiced_type: 'Subscription', invoiced_id: subscription[:id])
assert_not_nil invoice, 'Invoice was not created'
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
end

View File

@ -1,4 +1,4 @@
class CreateAsUserTest < ActionDispatch::IntegrationTest
class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
setup do
@ -6,7 +6,7 @@ class CreateAsUserTest < ActionDispatch::IntegrationTest
login_as(@user, scope: :user)
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')
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
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
# Check the error was handled
subscription = json_response(response.body)
assert_match /plan is not compatible/, response.body
# Check that the user has no subscription

View 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

View File

@ -10,7 +10,9 @@ VCR.configure do |config|
config.hook_into :webmock
end
Sidekiq::Testing.inline!
Sidekiq::Testing.inline! do |pp|
puts pp
end
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new({ color: true })]

View 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

View 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