diff --git a/app/controllers/api/subscriptions_controller.rb b/app/controllers/api/subscriptions_controller.rb index 2ecd429e4..857e4ad87 100644 --- a/app/controllers/api/subscriptions_controller.rb +++ b/app/controllers/api/subscriptions_controller.rb @@ -32,8 +32,12 @@ class API::SubscriptionsController < API::ApiController free_days = params[:subscription][:free] || false - if Subscriptions::Subscribe.new(@subscription.user_id) - .extend_subscription(@subscription, subscription_update_params[:expired_at], free_days) + res = Subscriptions::Subscribe.new(@subscription.user_id) + .extend_subscription(@subscription, subscription_update_params[:expired_at], free_days) + if res.is_a?(Subscription) + @subscription = res + render status: :created + elsif res render status: :ok else render status: :unprocessable_entity diff --git a/app/models/reservation.rb b/app/models/reservation.rb index 302d874c6..585da2fa8 100644 --- a/app/models/reservation.rb +++ b/app/models/reservation.rb @@ -12,17 +12,17 @@ class Reservation < ActiveRecord::Base has_many :tickets accepts_nested_attributes_for :tickets, allow_destroy: false - has_one :invoice, -> {where(type: nil)}, as: :invoiced, dependent: :destroy + has_one :invoice, -> { where(type: nil) }, as: :invoiced, dependent: :destroy validates_presence_of :reservable_id, :reservable_type - validate :machine_not_already_reserved, if: -> { self.reservable.is_a?(Machine) } - validate :training_not_fully_reserved, if: -> { self.reservable.is_a?(Training) } + validate :machine_not_already_reserved, if: -> { reservable.is_a?(Machine) } + validate :training_not_fully_reserved, if: -> { reservable.is_a?(Training) } attr_accessor :card_token, :plan_id, :subscription after_commit :notify_member_create_reservation, on: :create after_commit :notify_admin_member_create_reservation, on: :create - after_save :update_event_nb_free_places, if: Proc.new { |reservation| reservation.reservable_type == 'Event' } + after_save :update_event_nb_free_places, if: proc { |reservation| reservation.reservable_type == 'Event' } after_create :debit_user_wallet ## @@ -161,7 +161,7 @@ class Reservation < ActiveRecord::Base ii_amount = index < users_credits_manager.free_hours_count ? 0 : base_amount end - ii_amount = 0 if slot.offered and on_site # if it's a local payment and slot is offered free + ii_amount = 0 if slot.offered && on_site # if it's a local payment and slot is offered free unless on_site # if it's local payment then do not create Stripe::InvoiceItem ii = Stripe::InvoiceItem.create( @@ -188,33 +188,30 @@ class Reservation < ActiveRecord::Base # === Coupon === unless coupon_code.nil? @coupon = Coupon.find_by(code: coupon_code) - if not @coupon.nil? and @coupon.status(user.id) == 'active' - total = get_cart_total + raise InvalidCouponError if @coupon.nil? || @coupon.status(user.id) != 'active' - discount = 0 - if @coupon.type == 'percent_off' - discount = (total * @coupon.percent_off / 100).to_i - elsif @coupon.type == 'amount_off' - discount = @coupon.amount_off - else - raise InvalidCouponError - end + total = get_cart_total - unless on_site - invoice_items << Stripe::InvoiceItem.create( - customer: user.stp_customer_id, - amount: -discount, - currency: Rails.application.secrets.stripe_currency, - description: "coupon #{@coupon.code}" - ) - end - else - raise InvalidCouponError + discount = if @coupon.type == 'percent_off' + (total * @coupon.percent_off / 100).to_i + elsif @coupon.type == 'amount_off' + @coupon.amount_off + else + raise InvalidCouponError + end + + unless on_site + invoice_items << Stripe::InvoiceItem.create( + customer: user.stp_customer_id, + amount: -discount, + currency: Rails.application.secrets.stripe_currency, + description: "coupon #{@coupon.code}" + ) end end @wallet_amount_debit = get_wallet_amount_debit - if @wallet_amount_debit != 0 and !on_site + if @wallet_amount_debit != 0 && !on_site invoice_items << Stripe::InvoiceItem.create( customer: user.stp_customer_id, amount: -@wallet_amount_debit.to_i, diff --git a/app/services/subscriptions/subscribe.rb b/app/services/subscriptions/subscribe.rb index b0efd0021..58d1981dc 100644 --- a/app/services/subscriptions/subscribe.rb +++ b/app/services/subscriptions/subscribe.rb @@ -25,7 +25,7 @@ module Subscriptions ) if new_sub.save new_sub.user.generate_subscription_invoice - return true + return new_sub end false end diff --git a/app/views/api/notifications/_notify_member_subscription_extended.json.jbuilder b/app/views/api/notifications/_notify_member_subscription_extended.json.jbuilder index bb9ce437f..7c6b0f225 100644 --- a/app/views/api/notifications/_notify_member_subscription_extended.json.jbuilder +++ b/app/views/api/notifications/_notify_member_subscription_extended.json.jbuilder @@ -1,8 +1,8 @@ json.title notification.notification_type json.description _t('.your_subscription_PLAN_has_been_extended_FREE_until_DATE_html', { - PLAN: notification.attached_object.plan.name, - FREE: notification.get_meta_data(:free_days).to_s, - DATE: I18n.l(notification.attached_object.expired_at.to_date) + PLAN: notification.attached_object.plan.name, + FREE: notification.get_meta_data(:free_days).to_s, + DATE: I18n.l(notification.attached_object.expired_at.to_date) }) # messageFormat json.url notification_url(notification, format: :json) diff --git a/test/integration/credits/training_test.rb b/test/integration/credits/training_test.rb index 2ba4a46e4..44631b6d2 100644 --- a/test/integration/credits/training_test.rb +++ b/test/integration/credits/training_test.rb @@ -12,14 +12,14 @@ module Credits # First, we create a new credit post '/api/credits', - { - credit: { - creditable_id: 4, - creditable_type: 'Training', - plan_id: '1', - } - }.to_json, - default_headers + { + credit: { + creditable_id: 4, + creditable_type: 'Training', + plan_id: '1', + } + }.to_json, + default_headers # Check response format & status assert_equal 201, response.status, response.body @@ -37,11 +37,11 @@ module Credits test 'create a existing credit' do post '/api/credits', { - credit: { - creditable_id: 4, - creditable_type: 'Training', - plan_id: '2', - } + credit: { + creditable_id: 4, + creditable_type: 'Training', + plan_id: '2' + } }.to_json, default_headers diff --git a/test/integration/subscriptions/renew_as_admin_test.rb b/test/integration/subscriptions/renew_as_admin_test.rb index 228b92dd9..05027c956 100644 --- a/test/integration/subscriptions/renew_as_admin_test.rb +++ b/test/integration/subscriptions/renew_as_admin_test.rb @@ -33,6 +33,11 @@ class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest 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 the expiration date + assert_equal (user.subscription.created_at + plan.interval_count.send(plan.interval)).iso8601, + subscription[:expired_at], + 'subscription expiration date does not match' + # 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' @@ -60,7 +65,7 @@ class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest test 'admin successfully offer free days' do user = User.find_by(username: 'pdurand') - subscription = user.subscription + subscription = user.subscription.clone new_date = (1.month.from_now - 4.days).utc VCR.use_cassette('subscriptions_admin_offer_free_days') do @@ -90,6 +95,44 @@ class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest attached_object_id: subscription[:id] ) assert_not_nil notification, 'user notification was not created' + assert_not_nil notification.get_meta_data(:free_days), + "notification didn't says to the user that her extent was for free" + assert_equal user.id, notification.receiver_id, 'wrong user notified' + end + + test 'admin successfully extends a subscription' do + user = User.find_by(username: 'pdurand') + subscription = user.subscription.clone + new_date = (1.month.from_now - 4.days).utc + + VCR.use_cassette('subscriptions_admin_extends_subscription') do + put "/api/subscriptions/#{subscription.id}", + { + subscription: { + expired_at: new_date.strftime('%Y-%m-%d %H:%M:%S.%9N Z') + } + }.to_json, default_headers + end + + # Check response format & status + assert_equal 201, response.status, response.body + assert_equal Mime::JSON, response.content_type + + # Check that the subscribed plan is still the same + res_subscription = json_response(response.body) + assert_equal subscription.plan_id, res_subscription[:plan_id], 'subscribed plan does not match' + + # Check that the subscription is new + assert_not_equal subscription.id, res_subscription[:id], 'subscription id has not changed' + assert_dates_equal new_date, res_subscription[:expired_at], 'subscription end date 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' end diff --git a/test/integration/subscriptions/renew_as_user_test.rb b/test/integration/subscriptions/renew_as_user_test.rb index 89356107d..cd440b7e0 100644 --- a/test/integration/subscriptions/renew_as_user_test.rb +++ b/test/integration/subscriptions/renew_as_user_test.rb @@ -8,6 +8,7 @@ class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest 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') + stripe_subscription = nil VCR.use_cassette('subscriptions_user_renew_success', erb: true) do post '/api/subscriptions', @@ -18,6 +19,7 @@ class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest card_token: stripe_card_token } }.to_json, default_headers + stripe_subscription = Stripe::Customer.retrieve(@user.stp_customer_id).subscriptions.retrieve(@user.subscription.stp_subscription_id) end # Check response format & status @@ -30,8 +32,14 @@ class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest # Check that the user has the correct subscription assert_not_nil @user.subscription, "user's subscription was not found" + + # Check the expiration date assert (@user.subscription.expired_at > DateTime.now), "user's subscription expiration was not updated ... VCR cassettes may be outdated, please check the gitlab wiki" + assert_equal @user.subscription.expired_at.iso8601, + Time.at(stripe_subscription.current_period_end).iso8601, + 'subscription expiration date does not match' + assert_in_delta 5, (DateTime.now.to_i - @user.subscription.updated_at.to_i), 10, diff --git a/test/vcr_cassettes/subscriptions_user_renew_success.yml b/test/vcr_cassettes/subscriptions_user_renew_success.yml index 09938db85..fb8b8ba3b 100644 --- a/test/vcr_cassettes/subscriptions_user_renew_success.yml +++ b/test/vcr_cassettes/subscriptions_user_renew_success.yml @@ -33,7 +33,7 @@ http_interactions: Server: - nginx Date: - - Tue, 11 Dec 2018 14:02:59 GMT + - Tue, 11 Dec 2018 15:29:19 GMT Content-Type: - application/json Content-Length: @@ -53,7 +53,7 @@ http_interactions: Cache-Control: - no-cache, no-store Request-Id: - - req_oK8ExZLyURVh5j + - req_wScFYeIB9A36LG Stripe-Version: - '2015-10-16' Strict-Transport-Security: @@ -62,10 +62,10 @@ http_interactions: encoding: UTF-8 string: | { - "id": "tok_1DgBp92sOmf47Nz9egeX4aXo", + "id": "tok_1DgDAh2sOmf47Nz9zx73trkr", "object": "token", "card": { - "id": "card_1DgBp92sOmf47Nz9RNvlwx8S", + "id": "card_1DgDAh2sOmf47Nz9jxDWEvnO", "object": "card", "address_city": null, "address_country": null, @@ -90,13 +90,13 @@ http_interactions: "tokenization_method": null }, "client_ip": "92.157.28.112", - "created": 1544536979, + "created": 1544542159, "livemode": false, "type": "card", "used": false } http_version: - recorded_at: Tue, 11 Dec 2018 14:02:59 GMT + recorded_at: Tue, 11 Dec 2018 15:29:19 GMT - request: method: get uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX @@ -128,11 +128,11 @@ http_interactions: Server: - nginx Date: - - Tue, 11 Dec 2018 14:03:00 GMT + - Tue, 11 Dec 2018 15:29:20 GMT Content-Type: - application/json Content-Length: - - '10388' + - '16310' Connection: - keep-alive Access-Control-Allow-Credentials: @@ -148,7 +148,7 @@ http_interactions: Cache-Control: - no-cache, no-store Request-Id: - - req_oiiBCO0jNBQCNg + - req_8EWmgCLlALNEkq Stripe-Version: - '2015-10-16' Strict-Transport-Security: @@ -162,7 +162,7 @@ http_interactions: "account_balance": 0, "created": 1460026822, "currency": "usd", - "default_source": "card_1Dfps22sOmf47Nz99LtrBTfC", + "default_source": "card_1DgCTx2sOmf47Nz9rpH1o5DR", "delinquent": false, "description": "Lucile Seguin", "discount": null, @@ -176,7 +176,7 @@ http_interactions: "object": "list", "data": [ { - "id": "card_1Dfps22sOmf47Nz99LtrBTfC", + "id": "card_1DgCTx2sOmf47Nz9rpH1o5DR", "object": "card", "address_city": null, "address_country": null, @@ -210,16 +210,16 @@ http_interactions: "object": "list", "data": [ { - "id": "sub_E864buS6hivDwg", + "id": "sub_E8TQfnN1GdMBd0", "object": "subscription", "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1544452592, + "billing_cycle_anchor": 1544539511, "cancel_at_period_end": true, - "canceled_at": 1544452597, - "created": 1544452592, - "current_period_end": 1547130992, - "current_period_start": 1544452592, + "canceled_at": 1544539516, + "created": 1544539511, + "current_period_end": 1547217911, + "current_period_start": 1544539511, "customer": "cus_8E2ys9zDZgetWX", "days_until_due": null, "default_source": null, @@ -229,9 +229,9 @@ http_interactions: "object": "list", "data": [ { - "id": "si_E864fXEFlCkbRR", + "id": "si_E8TQcF8covaIwa", "object": "subscription_item", - "created": 1544452592, + "created": 1544539511, "metadata": { }, "plan": { @@ -259,12 +259,12 @@ http_interactions: "usage_type": "licensed" }, "quantity": 1, - "subscription": "sub_E864buS6hivDwg" + "subscription": "sub_E8TQfnN1GdMBd0" } ], "has_more": false, "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_E864buS6hivDwg" + "url": "/v1/subscription_items?subscription=sub_E8TQfnN1GdMBd0" }, "livemode": false, "metadata": { @@ -294,644 +294,20 @@ http_interactions: "usage_type": "licensed" }, "quantity": 1, - "start": 1544452592, + "start": 1544539511, "status": "active", "tax_percent": null, "trial_end": null, "trial_start": null }, - { - "id": "sub_E84hFvNBlPia7R", - "object": "subscription", - "application_fee_percent": null, - "billing": "charge_automatically", - "billing_cycle_anchor": 1544447514, - "cancel_at_period_end": false, - "canceled_at": null, - "created": 1544447514, - "current_period_end": 1547125914, - "current_period_start": 1544447514, - "customer": "cus_8E2ys9zDZgetWX", - "days_until_due": null, - "default_source": null, - "discount": null, - "ended_at": null, - "items": { - "object": "list", - "data": [ - { - "id": "si_E84hhZgnjOkD73", - "object": "subscription_item", - "created": 1544447515, - "metadata": { - }, - "plan": { - "id": "mensuel-standard-month-20160404171519", - "object": "plan", - "active": true, - "aggregate_usage": null, - "amount": 3000, - "billing_scheme": "per_unit", - "created": 1459782921, - "currency": "usd", - "interval": "month", - "interval_count": 1, - "livemode": false, - "metadata": { - }, - "name": "Mensuel - standard, association - month", - "nickname": null, - "product": "prod_BV0emghsuiUJDn", - "statement_descriptor": null, - "tiers": null, - "tiers_mode": null, - "transform_usage": null, - "trial_period_days": null, - "usage_type": "licensed" - }, - "quantity": 1, - "subscription": "sub_E84hFvNBlPia7R" - } - ], - "has_more": false, - "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_E84hFvNBlPia7R" - }, - "livemode": false, - "metadata": { - }, - "plan": { - "id": "mensuel-standard-month-20160404171519", - "object": "plan", - "active": true, - "aggregate_usage": null, - "amount": 3000, - "billing_scheme": "per_unit", - "created": 1459782921, - "currency": "usd", - "interval": "month", - "interval_count": 1, - "livemode": false, - "metadata": { - }, - "name": "Mensuel - standard, association - month", - "nickname": null, - "product": "prod_BV0emghsuiUJDn", - "statement_descriptor": null, - "tiers": null, - "tiers_mode": null, - "transform_usage": null, - "trial_period_days": null, - "usage_type": "licensed" - }, - "quantity": 1, - "start": 1544447514, - "status": "active", - "tax_percent": null, - "trial_end": null, - "trial_start": null - }, - { - "id": "sub_E38nTN5QSSC53T", - "object": "subscription", - "application_fee_percent": null, - "billing": "charge_automatically", - "billing_cycle_anchor": 1543309532, - "cancel_at_period_end": true, - "canceled_at": 1543309537, - "created": 1543309532, - "current_period_end": 1545901532, - "current_period_start": 1543309532, - "customer": "cus_8E2ys9zDZgetWX", - "days_until_due": null, - "default_source": null, - "discount": null, - "ended_at": null, - "items": { - "object": "list", - "data": [ - { - "id": "si_E38nQ0v6q1jFhp", - "object": "subscription_item", - "created": 1543309533, - "metadata": { - }, - "plan": { - "id": "mensuel-standard-month-20160404171519", - "object": "plan", - "active": true, - "aggregate_usage": null, - "amount": 3000, - "billing_scheme": "per_unit", - "created": 1459782921, - "currency": "usd", - "interval": "month", - "interval_count": 1, - "livemode": false, - "metadata": { - }, - "name": "Mensuel - standard, association - month", - "nickname": null, - "product": "prod_BV0emghsuiUJDn", - "statement_descriptor": null, - "tiers": null, - "tiers_mode": null, - "transform_usage": null, - "trial_period_days": null, - "usage_type": "licensed" - }, - "quantity": 1, - "subscription": "sub_E38nTN5QSSC53T" - } - ], - "has_more": false, - "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_E38nTN5QSSC53T" - }, - "livemode": false, - "metadata": { - }, - "plan": { - "id": "mensuel-standard-month-20160404171519", - "object": "plan", - "active": true, - "aggregate_usage": null, - "amount": 3000, - "billing_scheme": "per_unit", - "created": 1459782921, - "currency": "usd", - "interval": "month", - "interval_count": 1, - "livemode": false, - "metadata": { - }, - "name": "Mensuel - standard, association - month", - "nickname": null, - "product": "prod_BV0emghsuiUJDn", - "statement_descriptor": null, - "tiers": null, - "tiers_mode": null, - "transform_usage": null, - "trial_period_days": null, - "usage_type": "licensed" - }, - "quantity": 1, - "start": 1543309532, - "status": "active", - "tax_percent": null, - "trial_end": null, - "trial_start": null - } - ], - "has_more": false, - "total_count": 3, - "url": "/v1/customers/cus_8E2ys9zDZgetWX/subscriptions" - }, - "tax_info": null, - "tax_info_verification": null - } - http_version: - recorded_at: Tue, 11 Dec 2018 14:03:00 GMT -- request: - method: post - uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions - body: - encoding: UTF-8 - string: plan=mensuel-standard-month-20160404171519&source=tok_1DgBp92sOmf47Nz9egeX4aXo - headers: - Accept: - - "*/*; q=0.5, application/xml" - Accept-Encoding: - - gzip, deflate - User-Agent: - - Stripe/v1 RubyBindings/1.30.2 - Authorization: - - Bearer sk_test_testfaketestfaketestfake - Content-Type: - - application/x-www-form-urlencoded - Stripe-Version: - - '2015-10-16' - X-Stripe-Client-User-Agent: - - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 - (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' - Content-Length: - - '78' - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Tue, 11 Dec 2018 14:03:02 GMT - Content-Type: - - application/json - Content-Length: - - '2409' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Access-Control-Allow-Methods: - - GET, POST, HEAD, OPTIONS, DELETE - Access-Control-Allow-Origin: - - "*" - Access-Control-Expose-Headers: - - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required - Access-Control-Max-Age: - - '300' - Cache-Control: - - no-cache, no-store - Request-Id: - - req_lUw2phHQJc2o6E - Stripe-Version: - - '2015-10-16' - Strict-Transport-Security: - - max-age=31556926; includeSubDomains; preload - body: - encoding: UTF-8 - string: | - { - "id": "sub_E8SkGkxWBPYxq4", - "object": "subscription", - "application_fee_percent": null, - "billing": "charge_automatically", - "billing_cycle_anchor": 1544536981, - "cancel_at_period_end": false, - "canceled_at": null, - "created": 1544536981, - "current_period_end": 1547215381, - "current_period_start": 1544536981, - "customer": "cus_8E2ys9zDZgetWX", - "days_until_due": null, - "default_source": null, - "discount": null, - "ended_at": null, - "items": { - "object": "list", - "data": [ - { - "id": "si_E8Skkn572vP54b", - "object": "subscription_item", - "created": 1544536981, - "metadata": { - }, - "plan": { - "id": "mensuel-standard-month-20160404171519", - "object": "plan", - "active": true, - "aggregate_usage": null, - "amount": 3000, - "billing_scheme": "per_unit", - "created": 1459782921, - "currency": "usd", - "interval": "month", - "interval_count": 1, - "livemode": false, - "metadata": { - }, - "name": "Mensuel - standard, association - month", - "nickname": null, - "product": "prod_BV0emghsuiUJDn", - "statement_descriptor": null, - "tiers": null, - "tiers_mode": null, - "transform_usage": null, - "trial_period_days": null, - "usage_type": "licensed" - }, - "quantity": 1, - "subscription": "sub_E8SkGkxWBPYxq4" - } - ], - "has_more": false, - "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_E8SkGkxWBPYxq4" - }, - "livemode": false, - "metadata": { - }, - "plan": { - "id": "mensuel-standard-month-20160404171519", - "object": "plan", - "active": true, - "aggregate_usage": null, - "amount": 3000, - "billing_scheme": "per_unit", - "created": 1459782921, - "currency": "usd", - "interval": "month", - "interval_count": 1, - "livemode": false, - "metadata": { - }, - "name": "Mensuel - standard, association - month", - "nickname": null, - "product": "prod_BV0emghsuiUJDn", - "statement_descriptor": null, - "tiers": null, - "tiers_mode": null, - "transform_usage": null, - "trial_period_days": null, - "usage_type": "licensed" - }, - "quantity": 1, - "start": 1544536981, - "status": "active", - "tax_percent": null, - "trial_end": null, - "trial_start": null - } - http_version: - recorded_at: Tue, 11 Dec 2018 14:03:02 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_testfaketestfaketestfake - Content-Type: - - application/x-www-form-urlencoded - Stripe-Version: - - '2015-10-16' - X-Stripe-Client-User-Agent: - - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 - (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Tue, 11 Dec 2018 14:03:03 GMT - Content-Type: - - application/json - Content-Length: - - '3162' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Access-Control-Allow-Methods: - - GET, POST, HEAD, OPTIONS, DELETE - Access-Control-Allow-Origin: - - "*" - Access-Control-Expose-Headers: - - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required - Access-Control-Max-Age: - - '300' - Cache-Control: - - no-cache, no-store - Request-Id: - - req_kEiuT5JpYrHrBA - Stripe-Version: - - '2015-10-16' - Strict-Transport-Security: - - max-age=31556926; includeSubDomains; preload - body: - encoding: UTF-8 - string: | - { - "object": "list", - "data": [ - { - "id": "in_1DgBpB2sOmf47Nz9ucNyuvJy", - "object": "invoice", - "amount_due": 3000, - "amount_paid": 3000, - "amount_remaining": 0, - "application_fee": null, - "attempt_count": 1, - "attempted": true, - "auto_advance": false, - "billing": "charge_automatically", - "billing_reason": "subscription_update", - "charge": "ch_1DgBpB2sOmf47Nz98BGLYWLe", - "closed": true, - "currency": "usd", - "customer": "cus_8E2ys9zDZgetWX", - "date": 1544536981, - "default_source": null, - "description": null, - "discount": null, - "due_date": null, - "ending_balance": 0, - "finalized_at": 1544536981, - "forgiven": false, - "hosted_invoice_url": "https://pay.stripe.com/invoice/invst_vDFXXYvBlsfxXaylDEicf9MgF6", - "invoice_pdf": "https://pay.stripe.com/invoice/invst_vDFXXYvBlsfxXaylDEicf9MgF6/pdf", - "lines": { - "object": "list", - "data": [ - { - "id": "sub_E8SkGkxWBPYxq4", - "object": "line_item", - "amount": 3000, - "currency": "usd", - "description": null, - "discountable": true, - "livemode": false, - "metadata": { - }, - "period": { - "end": 1547215381, - "start": 1544536981 - }, - "plan": { - "id": "mensuel-standard-month-20160404171519", - "object": "plan", - "active": true, - "aggregate_usage": null, - "amount": 3000, - "billing_scheme": "per_unit", - "created": 1459782921, - "currency": "usd", - "interval": "month", - "interval_count": 1, - "livemode": false, - "metadata": { - }, - "name": "Mensuel - standard, association - month", - "nickname": null, - "product": "prod_BV0emghsuiUJDn", - "statement_descriptor": null, - "tiers": null, - "tiers_mode": null, - "transform_usage": null, - "trial_period_days": null, - "usage_type": "licensed" - }, - "proration": false, - "quantity": 1, - "subscription": null, - "subscription_item": "si_E8Skkn572vP54b", - "type": "subscription" - } - ], - "has_more": false, - "total_count": 1, - "url": "/v1/invoices/in_1DgBpB2sOmf47Nz9ucNyuvJy/lines" - }, - "livemode": false, - "metadata": { - }, - "next_payment_attempt": null, - "number": "BCC32B8-0017", - "paid": true, - "payment_intent": null, - "period_end": 1544536981, - "period_start": 1544536981, - "receipt_number": null, - "starting_balance": 0, - "statement_descriptor": null, - "status": "paid", - "subscription": "sub_E8SkGkxWBPYxq4", - "subtotal": 3000, - "tax": 0, - "tax_percent": null, - "total": 3000, - "webhooks_delivered_at": 1544536982 - } - ], - "has_more": true, - "url": "/v1/invoices" - } - http_version: - recorded_at: Tue, 11 Dec 2018 14:03:03 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_testfaketestfaketestfake - Content-Type: - - application/x-www-form-urlencoded - Stripe-Version: - - '2015-10-16' - X-Stripe-Client-User-Agent: - - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 - (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Tue, 11 Dec 2018 14:03:04 GMT - Content-Type: - - application/json - Content-Length: - - '13344' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Access-Control-Allow-Methods: - - GET, POST, HEAD, OPTIONS, DELETE - Access-Control-Allow-Origin: - - "*" - Access-Control-Expose-Headers: - - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required - Access-Control-Max-Age: - - '300' - Cache-Control: - - no-cache, no-store - Request-Id: - - req_Yobv5EVCgC1wEh - Stripe-Version: - - '2015-10-16' - Strict-Transport-Security: - - max-age=31556926; includeSubDomains; preload - body: - encoding: UTF-8 - string: | - { - "id": "cus_8E2ys9zDZgetWX", - "object": "customer", - "account_balance": 0, - "created": 1460026822, - "currency": "usd", - "default_source": "card_1DgBp92sOmf47Nz9RNvlwx8S", - "delinquent": false, - "description": "Lucile Seguin", - "discount": null, - "email": "lucile.seguin@live.fr", - "invoice_prefix": "BCC32B8", - "livemode": false, - "metadata": { - }, - "shipping": null, - "sources": { - "object": "list", - "data": [ - { - "id": "card_1DgBp92sOmf47Nz9RNvlwx8S", - "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": 2019, - "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_E8SkGkxWBPYxq4", "object": "subscription", "application_fee_percent": null, "billing": "charge_automatically", "billing_cycle_anchor": 1544536981, - "cancel_at_period_end": false, - "canceled_at": null, + "cancel_at_period_end": true, + "canceled_at": 1544536986, "created": 1544536981, "current_period_end": 1547215381, "current_period_start": 1544536981, @@ -1290,20 +666,20 @@ http_interactions: } ], "has_more": false, - "total_count": 4, + "total_count": 5, "url": "/v1/customers/cus_8E2ys9zDZgetWX/subscriptions" }, "tax_info": null, "tax_info_verification": null } http_version: - recorded_at: Tue, 11 Dec 2018 14:03:04 GMT + recorded_at: Tue, 11 Dec 2018 15:29:20 GMT - request: - method: get - uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions/sub_E8SkGkxWBPYxq4 + method: post + uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions body: - encoding: US-ASCII - string: '' + encoding: UTF-8 + string: plan=mensuel-standard-month-20160404171519&source=tok_1DgDAh2sOmf47Nz9zx73trkr headers: Accept: - "*/*; q=0.5, application/xml" @@ -1321,6 +697,8 @@ http_interactions: - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' + Content-Length: + - '78' response: status: code: 200 @@ -1329,7 +707,7 @@ http_interactions: Server: - nginx Date: - - Tue, 11 Dec 2018 14:03:05 GMT + - Tue, 11 Dec 2018 15:29:22 GMT Content-Type: - application/json Content-Length: @@ -1349,7 +727,7 @@ http_interactions: Cache-Control: - no-cache, no-store Request-Id: - - req_qMys6hWUIGGyWx + - req_5an49z8Itrg1wS Stripe-Version: - '2015-10-16' Strict-Transport-Security: @@ -1358,16 +736,16 @@ http_interactions: encoding: UTF-8 string: | { - "id": "sub_E8SkGkxWBPYxq4", + "id": "sub_E8U986dZhAepEP", "object": "subscription", "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1544536981, + "billing_cycle_anchor": 1544542161, "cancel_at_period_end": false, "canceled_at": null, - "created": 1544536981, - "current_period_end": 1547215381, - "current_period_start": 1544536981, + "created": 1544542161, + "current_period_end": 1547220561, + "current_period_start": 1544542161, "customer": "cus_8E2ys9zDZgetWX", "days_until_due": null, "default_source": null, @@ -1377,9 +755,9 @@ http_interactions: "object": "list", "data": [ { - "id": "si_E8Skkn572vP54b", + "id": "si_E8U9JH2h5zb9D8", "object": "subscription_item", - "created": 1544536981, + "created": 1544542161, "metadata": { }, "plan": { @@ -1407,12 +785,12 @@ http_interactions: "usage_type": "licensed" }, "quantity": 1, - "subscription": "sub_E8SkGkxWBPYxq4" + "subscription": "sub_E8U986dZhAepEP" } ], "has_more": false, "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_E8SkGkxWBPYxq4" + "url": "/v1/subscription_items?subscription=sub_E8U986dZhAepEP" }, "livemode": false, "metadata": { @@ -1442,17 +820,17 @@ http_interactions: "usage_type": "licensed" }, "quantity": 1, - "start": 1544536981, + "start": 1544542161, "status": "active", "tax_percent": null, "trial_end": null, "trial_start": null } http_version: - recorded_at: Tue, 11 Dec 2018 14:03:05 GMT + recorded_at: Tue, 11 Dec 2018 15:29:22 GMT - request: - method: delete - uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions/sub_E8SkGkxWBPYxq4?at_period_end=true + method: get + uri: https://api.stripe.com/v1/invoices?customer=cus_8E2ys9zDZgetWX&limit=1 body: encoding: US-ASCII string: '' @@ -1481,11 +859,11 @@ http_interactions: Server: - nginx Date: - - Tue, 11 Dec 2018 14:03:06 GMT + - Tue, 11 Dec 2018 15:29:23 GMT Content-Type: - application/json Content-Length: - - '2414' + - '3162' Connection: - keep-alive Access-Control-Allow-Credentials: @@ -1501,7 +879,7 @@ http_interactions: Cache-Control: - no-cache, no-store Request-Id: - - req_aMVRGbb1I1oN24 + - req_MN5bbRqjJOIKeq Stripe-Version: - '2015-10-16' Strict-Transport-Security: @@ -1510,28 +888,282 @@ http_interactions: encoding: UTF-8 string: | { - "id": "sub_E8SkGkxWBPYxq4", - "object": "subscription", - "application_fee_percent": null, - "billing": "charge_automatically", - "billing_cycle_anchor": 1544536981, - "cancel_at_period_end": true, - "canceled_at": 1544536986, - "created": 1544536981, - "current_period_end": 1547215381, - "current_period_start": 1544536981, - "customer": "cus_8E2ys9zDZgetWX", - "days_until_due": null, - "default_source": null, + "object": "list", + "data": [ + { + "id": "in_1DgDAj2sOmf47Nz9rjxakQnI", + "object": "invoice", + "amount_due": 3000, + "amount_paid": 3000, + "amount_remaining": 0, + "application_fee": null, + "attempt_count": 1, + "attempted": true, + "auto_advance": false, + "billing": "charge_automatically", + "billing_reason": "subscription_update", + "charge": "ch_1DgDAj2sOmf47Nz9brVR8ScB", + "closed": true, + "currency": "usd", + "customer": "cus_8E2ys9zDZgetWX", + "date": 1544542161, + "default_source": null, + "description": null, + "discount": null, + "due_date": null, + "ending_balance": 0, + "finalized_at": 1544542161, + "forgiven": false, + "hosted_invoice_url": "https://pay.stripe.com/invoice/invst_WfNOWkHSDWMzrGIiEgu34HbhGA", + "invoice_pdf": "https://pay.stripe.com/invoice/invst_WfNOWkHSDWMzrGIiEgu34HbhGA/pdf", + "lines": { + "object": "list", + "data": [ + { + "id": "sub_E8U986dZhAepEP", + "object": "line_item", + "amount": 3000, + "currency": "usd", + "description": null, + "discountable": true, + "livemode": false, + "metadata": { + }, + "period": { + "end": 1547220561, + "start": 1544542161 + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "proration": false, + "quantity": 1, + "subscription": null, + "subscription_item": "si_E8U9JH2h5zb9D8", + "type": "subscription" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/invoices/in_1DgDAj2sOmf47Nz9rjxakQnI/lines" + }, + "livemode": false, + "metadata": { + }, + "next_payment_attempt": null, + "number": "BCC32B8-0019", + "paid": true, + "payment_intent": null, + "period_end": 1544542161, + "period_start": 1544542161, + "receipt_number": null, + "starting_balance": 0, + "statement_descriptor": null, + "status": "paid", + "subscription": "sub_E8U986dZhAepEP", + "subtotal": 3000, + "tax": 0, + "tax_percent": null, + "total": 3000, + "webhooks_delivered_at": 1544542162 + } + ], + "has_more": true, + "url": "/v1/invoices" + } + http_version: + recorded_at: Tue, 11 Dec 2018 15:29:23 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_testfaketestfaketestfake + Content-Type: + - application/x-www-form-urlencoded + Stripe-Version: + - '2015-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 + (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Tue, 11 Dec 2018 15:29:24 GMT + Content-Type: + - application/json + Content-Length: + - '19266' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET, POST, HEAD, OPTIONS, DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Request-Id: + - req_8rtX91lldEg0to + Stripe-Version: + - '2015-10-16' + Strict-Transport-Security: + - max-age=31556926; includeSubDomains; preload + body: + encoding: UTF-8 + string: | + { + "id": "cus_8E2ys9zDZgetWX", + "object": "customer", + "account_balance": 0, + "created": 1460026822, + "currency": "usd", + "default_source": "card_1DgDAh2sOmf47Nz9jxDWEvnO", + "delinquent": false, + "description": "Lucile Seguin", "discount": null, - "ended_at": null, - "items": { + "email": "lucile.seguin@live.fr", + "invoice_prefix": "BCC32B8", + "livemode": false, + "metadata": { + }, + "shipping": null, + "sources": { "object": "list", "data": [ { - "id": "si_E8Skkn572vP54b", - "object": "subscription_item", - "created": 1544536981, + "id": "card_1DgDAh2sOmf47Nz9jxDWEvnO", + "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": 2019, + "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_E8U986dZhAepEP", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544542161, + "cancel_at_period_end": false, + "canceled_at": null, + "created": 1544542161, + "current_period_end": 1547220561, + "current_period_start": 1544542161, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8U9JH2h5zb9D8", + "object": "subscription_item", + "created": 1544542161, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8U986dZhAepEP" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8U986dZhAepEP" + }, + "livemode": false, "metadata": { }, "plan": { @@ -1559,12 +1191,592 @@ http_interactions: "usage_type": "licensed" }, "quantity": 1, - "subscription": "sub_E8SkGkxWBPYxq4" + "start": 1544542161, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E8TQfnN1GdMBd0", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544539511, + "cancel_at_period_end": true, + "canceled_at": 1544539516, + "created": 1544539511, + "current_period_end": 1547217911, + "current_period_start": 1544539511, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8TQcF8covaIwa", + "object": "subscription_item", + "created": 1544539511, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8TQfnN1GdMBd0" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8TQfnN1GdMBd0" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544539511, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E8SkGkxWBPYxq4", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544536981, + "cancel_at_period_end": true, + "canceled_at": 1544536986, + "created": 1544536981, + "current_period_end": 1547215381, + "current_period_start": 1544536981, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8Skkn572vP54b", + "object": "subscription_item", + "created": 1544536981, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8SkGkxWBPYxq4" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8SkGkxWBPYxq4" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544536981, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E864buS6hivDwg", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544452592, + "cancel_at_period_end": true, + "canceled_at": 1544452597, + "created": 1544452592, + "current_period_end": 1547130992, + "current_period_start": 1544452592, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E864fXEFlCkbRR", + "object": "subscription_item", + "created": 1544452592, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E864buS6hivDwg" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E864buS6hivDwg" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544452592, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E84hFvNBlPia7R", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544447514, + "cancel_at_period_end": false, + "canceled_at": null, + "created": 1544447514, + "current_period_end": 1547125914, + "current_period_start": 1544447514, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E84hhZgnjOkD73", + "object": "subscription_item", + "created": 1544447515, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E84hFvNBlPia7R" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E84hFvNBlPia7R" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544447514, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E38nTN5QSSC53T", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1543309532, + "cancel_at_period_end": true, + "canceled_at": 1543309537, + "created": 1543309532, + "current_period_end": 1545901532, + "current_period_start": 1543309532, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E38nQ0v6q1jFhp", + "object": "subscription_item", + "created": 1543309533, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E38nTN5QSSC53T" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E38nTN5QSSC53T" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1543309532, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + } + ], + "has_more": false, + "total_count": 6, + "url": "/v1/customers/cus_8E2ys9zDZgetWX/subscriptions" + }, + "tax_info": null, + "tax_info_verification": null + } + http_version: + recorded_at: Tue, 11 Dec 2018 15:29:25 GMT +- request: + method: get + uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions/sub_E8U986dZhAepEP + 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_testfaketestfaketestfake + Content-Type: + - application/x-www-form-urlencoded + Stripe-Version: + - '2015-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 + (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Tue, 11 Dec 2018 15:29:25 GMT + Content-Type: + - application/json + Content-Length: + - '2409' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET, POST, HEAD, OPTIONS, DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Request-Id: + - req_sVE7oYCQpk4Ewq + Stripe-Version: + - '2015-10-16' + Strict-Transport-Security: + - max-age=31556926; includeSubDomains; preload + body: + encoding: UTF-8 + string: | + { + "id": "sub_E8U986dZhAepEP", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544542161, + "cancel_at_period_end": false, + "canceled_at": null, + "created": 1544542161, + "current_period_end": 1547220561, + "current_period_start": 1544542161, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8U9JH2h5zb9D8", + "object": "subscription_item", + "created": 1544542161, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8U986dZhAepEP" } ], "has_more": false, "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_E8SkGkxWBPYxq4" + "url": "/v1/subscription_items?subscription=sub_E8U986dZhAepEP" }, "livemode": false, "metadata": { @@ -1594,12 +1806,984 @@ http_interactions: "usage_type": "licensed" }, "quantity": 1, - "start": 1544536981, + "start": 1544542161, "status": "active", "tax_percent": null, "trial_end": null, "trial_start": null } http_version: - recorded_at: Tue, 11 Dec 2018 14:03:06 GMT + recorded_at: Tue, 11 Dec 2018 15:29:25 GMT +- request: + method: delete + uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions/sub_E8U986dZhAepEP?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_testfaketestfaketestfake + Content-Type: + - application/x-www-form-urlencoded + Stripe-Version: + - '2015-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 + (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Tue, 11 Dec 2018 15:29:27 GMT + Content-Type: + - application/json + Content-Length: + - '2414' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET, POST, HEAD, OPTIONS, DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Request-Id: + - req_PxuWuGO6CHJTks + Stripe-Version: + - '2015-10-16' + Strict-Transport-Security: + - max-age=31556926; includeSubDomains; preload + body: + encoding: UTF-8 + string: | + { + "id": "sub_E8U986dZhAepEP", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544542161, + "cancel_at_period_end": true, + "canceled_at": 1544542166, + "created": 1544542161, + "current_period_end": 1547220561, + "current_period_start": 1544542161, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8U9JH2h5zb9D8", + "object": "subscription_item", + "created": 1544542161, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8U986dZhAepEP" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8U986dZhAepEP" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544542161, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + } + http_version: + recorded_at: Tue, 11 Dec 2018 15:29:27 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_testfaketestfaketestfake + Content-Type: + - application/x-www-form-urlencoded + Stripe-Version: + - '2015-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 + (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Tue, 11 Dec 2018 15:29:28 GMT + Content-Type: + - application/json + Content-Length: + - '19271' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET, POST, HEAD, OPTIONS, DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Request-Id: + - req_w6FWdroefKqM8k + Stripe-Version: + - '2015-10-16' + Strict-Transport-Security: + - max-age=31556926; includeSubDomains; preload + body: + encoding: UTF-8 + string: | + { + "id": "cus_8E2ys9zDZgetWX", + "object": "customer", + "account_balance": 0, + "created": 1460026822, + "currency": "usd", + "default_source": "card_1DgDAh2sOmf47Nz9jxDWEvnO", + "delinquent": false, + "description": "Lucile Seguin", + "discount": null, + "email": "lucile.seguin@live.fr", + "invoice_prefix": "BCC32B8", + "livemode": false, + "metadata": { + }, + "shipping": null, + "sources": { + "object": "list", + "data": [ + { + "id": "card_1DgDAh2sOmf47Nz9jxDWEvnO", + "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": 2019, + "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_E8U986dZhAepEP", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544542161, + "cancel_at_period_end": true, + "canceled_at": 1544542166, + "created": 1544542161, + "current_period_end": 1547220561, + "current_period_start": 1544542161, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8U9JH2h5zb9D8", + "object": "subscription_item", + "created": 1544542161, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8U986dZhAepEP" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8U986dZhAepEP" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544542161, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E8TQfnN1GdMBd0", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544539511, + "cancel_at_period_end": true, + "canceled_at": 1544539516, + "created": 1544539511, + "current_period_end": 1547217911, + "current_period_start": 1544539511, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8TQcF8covaIwa", + "object": "subscription_item", + "created": 1544539511, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8TQfnN1GdMBd0" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8TQfnN1GdMBd0" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544539511, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E8SkGkxWBPYxq4", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544536981, + "cancel_at_period_end": true, + "canceled_at": 1544536986, + "created": 1544536981, + "current_period_end": 1547215381, + "current_period_start": 1544536981, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8Skkn572vP54b", + "object": "subscription_item", + "created": 1544536981, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8SkGkxWBPYxq4" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8SkGkxWBPYxq4" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544536981, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E864buS6hivDwg", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544452592, + "cancel_at_period_end": true, + "canceled_at": 1544452597, + "created": 1544452592, + "current_period_end": 1547130992, + "current_period_start": 1544452592, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E864fXEFlCkbRR", + "object": "subscription_item", + "created": 1544452592, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E864buS6hivDwg" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E864buS6hivDwg" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544452592, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E84hFvNBlPia7R", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544447514, + "cancel_at_period_end": false, + "canceled_at": null, + "created": 1544447514, + "current_period_end": 1547125914, + "current_period_start": 1544447514, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E84hhZgnjOkD73", + "object": "subscription_item", + "created": 1544447515, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E84hFvNBlPia7R" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E84hFvNBlPia7R" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544447514, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + }, + { + "id": "sub_E38nTN5QSSC53T", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1543309532, + "cancel_at_period_end": true, + "canceled_at": 1543309537, + "created": 1543309532, + "current_period_end": 1545901532, + "current_period_start": 1543309532, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E38nQ0v6q1jFhp", + "object": "subscription_item", + "created": 1543309533, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E38nTN5QSSC53T" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E38nTN5QSSC53T" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1543309532, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + } + ], + "has_more": false, + "total_count": 6, + "url": "/v1/customers/cus_8E2ys9zDZgetWX/subscriptions" + }, + "tax_info": null, + "tax_info_verification": null + } + http_version: + recorded_at: Tue, 11 Dec 2018 15:29:28 GMT +- request: + method: get + uri: https://api.stripe.com/v1/customers/cus_8E2ys9zDZgetWX/subscriptions/sub_E8U986dZhAepEP + 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_testfaketestfaketestfake + Content-Type: + - application/x-www-form-urlencoded + Stripe-Version: + - '2015-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.6 p384 (2017-12-14)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 4.19.8-arch1-1-ARCH (builduser@heftig-1129) (gcc version 8.2.1 20181127 + (GCC)) #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018","hostname":"Sylvain-desktop"}' + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Tue, 11 Dec 2018 15:29:29 GMT + Content-Type: + - application/json + Content-Length: + - '2414' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET, POST, HEAD, OPTIONS, DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Request-Id: + - req_78uefNrbDq98k9 + Stripe-Version: + - '2015-10-16' + Strict-Transport-Security: + - max-age=31556926; includeSubDomains; preload + body: + encoding: UTF-8 + string: | + { + "id": "sub_E8U986dZhAepEP", + "object": "subscription", + "application_fee_percent": null, + "billing": "charge_automatically", + "billing_cycle_anchor": 1544542161, + "cancel_at_period_end": true, + "canceled_at": 1544542166, + "created": 1544542161, + "current_period_end": 1547220561, + "current_period_start": 1544542161, + "customer": "cus_8E2ys9zDZgetWX", + "days_until_due": null, + "default_source": null, + "discount": null, + "ended_at": null, + "items": { + "object": "list", + "data": [ + { + "id": "si_E8U9JH2h5zb9D8", + "object": "subscription_item", + "created": 1544542161, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "subscription": "sub_E8U986dZhAepEP" + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/subscription_items?subscription=sub_E8U986dZhAepEP" + }, + "livemode": false, + "metadata": { + }, + "plan": { + "id": "mensuel-standard-month-20160404171519", + "object": "plan", + "active": true, + "aggregate_usage": null, + "amount": 3000, + "billing_scheme": "per_unit", + "created": 1459782921, + "currency": "usd", + "interval": "month", + "interval_count": 1, + "livemode": false, + "metadata": { + }, + "name": "Mensuel - standard, association - month", + "nickname": null, + "product": "prod_BV0emghsuiUJDn", + "statement_descriptor": null, + "tiers": null, + "tiers_mode": null, + "transform_usage": null, + "trial_period_days": null, + "usage_type": "licensed" + }, + "quantity": 1, + "start": 1544542161, + "status": "active", + "tax_percent": null, + "trial_end": null, + "trial_start": null + } + http_version: + recorded_at: Tue, 11 Dec 2018 15:29:29 GMT recorded_with: VCR 3.0.1