stripe-ruby-mock 2.4.0 → 2.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.env +2 -0
  3. data/.travis.yml +8 -4
  4. data/README.md +12 -5
  5. data/lib/stripe_mock/api/account_balance.rb +14 -0
  6. data/lib/stripe_mock/api/client.rb +4 -4
  7. data/lib/stripe_mock/api/conversion_rate.rb +14 -0
  8. data/lib/stripe_mock/api/errors.rb +25 -14
  9. data/lib/stripe_mock/api/instance.rb +6 -6
  10. data/lib/stripe_mock/api/webhooks.rb +5 -1
  11. data/lib/stripe_mock/client.rb +18 -2
  12. data/lib/stripe_mock/data/list.rb +14 -2
  13. data/lib/stripe_mock/data.rb +217 -56
  14. data/lib/stripe_mock/instance.rb +93 -8
  15. data/lib/stripe_mock/request_handlers/accounts.rb +34 -2
  16. data/lib/stripe_mock/request_handlers/balance.rb +17 -0
  17. data/lib/stripe_mock/request_handlers/balance_transactions.rb +18 -2
  18. data/lib/stripe_mock/request_handlers/charges.rb +25 -17
  19. data/lib/stripe_mock/request_handlers/coupons.rb +5 -4
  20. data/lib/stripe_mock/request_handlers/customers.rb +26 -8
  21. data/lib/stripe_mock/request_handlers/ephemeral_key.rb +13 -0
  22. data/lib/stripe_mock/request_handlers/external_accounts.rb +55 -0
  23. data/lib/stripe_mock/request_handlers/helpers/bank_account_helpers.rb +1 -1
  24. data/lib/stripe_mock/request_handlers/helpers/card_helpers.rb +9 -7
  25. data/lib/stripe_mock/request_handlers/helpers/coupon_helpers.rb +10 -6
  26. data/lib/stripe_mock/request_handlers/helpers/external_account_helpers.rb +49 -0
  27. data/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb +55 -15
  28. data/lib/stripe_mock/request_handlers/helpers/token_helpers.rb +2 -2
  29. data/lib/stripe_mock/request_handlers/invoices.rb +93 -14
  30. data/lib/stripe_mock/request_handlers/orders.rb +5 -5
  31. data/lib/stripe_mock/request_handlers/payouts.rb +32 -0
  32. data/lib/stripe_mock/request_handlers/plans.rb +1 -0
  33. data/lib/stripe_mock/request_handlers/products.rb +43 -0
  34. data/lib/stripe_mock/request_handlers/refunds.rb +10 -7
  35. data/lib/stripe_mock/request_handlers/subscription_items.rb +36 -0
  36. data/lib/stripe_mock/request_handlers/subscriptions.rb +95 -34
  37. data/lib/stripe_mock/request_handlers/tax_rates.rb +36 -0
  38. data/lib/stripe_mock/request_handlers/tokens.rb +9 -3
  39. data/lib/stripe_mock/request_handlers/transfers.rb +11 -5
  40. data/lib/stripe_mock/request_handlers/validators/param_validators.rb +10 -1
  41. data/lib/stripe_mock/server.rb +14 -1
  42. data/lib/stripe_mock/test_strategies/base.rb +7 -5
  43. data/lib/stripe_mock/test_strategies/live.rb +5 -0
  44. data/lib/stripe_mock/test_strategies/mock.rb +8 -0
  45. data/lib/stripe_mock/util.rb +8 -2
  46. data/lib/stripe_mock/version.rb +1 -1
  47. data/lib/stripe_mock/webhook_fixtures/account.updated.json +1 -1
  48. data/lib/stripe_mock/webhook_fixtures/charge.dispute.funds_reinstated.json +88 -0
  49. data/lib/stripe_mock/webhook_fixtures/charge.dispute.funds_withdrawn.json +88 -0
  50. data/lib/stripe_mock/webhook_fixtures/charge.updated.json +58 -0
  51. data/lib/stripe_mock/webhook_fixtures/customer.subscription.created.json +40 -10
  52. data/lib/stripe_mock/webhook_fixtures/customer.subscription.deleted.json +39 -10
  53. data/lib/stripe_mock/webhook_fixtures/customer.subscription.trial_will_end.json +39 -10
  54. data/lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json +40 -11
  55. data/lib/stripe_mock/webhook_fixtures/invoice.created.json +3 -2
  56. data/lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json +1 -1
  57. data/lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json +92 -85
  58. data/lib/stripe_mock/webhook_fixtures/invoice.updated.json +3 -2
  59. data/lib/stripe_mock/webhook_fixtures/plan.created.json +1 -1
  60. data/lib/stripe_mock/webhook_fixtures/plan.deleted.json +1 -1
  61. data/lib/stripe_mock/webhook_fixtures/plan.updated.json +1 -1
  62. data/lib/stripe_mock.rb +13 -0
  63. data/spec/instance_spec.rb +54 -4
  64. data/spec/integration_examples/prepare_error_examples.rb +6 -6
  65. data/spec/list_spec.rb +16 -3
  66. data/spec/readme_spec.rb +2 -0
  67. data/spec/server_spec.rb +6 -2
  68. data/spec/shared_stripe_examples/account_examples.rb +35 -0
  69. data/spec/shared_stripe_examples/balance_examples.rb +11 -0
  70. data/spec/shared_stripe_examples/balance_transaction_examples.rb +28 -0
  71. data/spec/shared_stripe_examples/bank_examples.rb +28 -1
  72. data/spec/shared_stripe_examples/card_examples.rb +10 -3
  73. data/spec/shared_stripe_examples/charge_examples.rb +73 -17
  74. data/spec/shared_stripe_examples/coupon_examples.rb +8 -2
  75. data/spec/shared_stripe_examples/customer_examples.rb +54 -2
  76. data/spec/shared_stripe_examples/dispute_examples.rb +19 -8
  77. data/spec/shared_stripe_examples/ephemeral_key_examples.rb +17 -0
  78. data/spec/shared_stripe_examples/error_mock_examples.rb +3 -3
  79. data/spec/shared_stripe_examples/external_account_examples.rb +170 -0
  80. data/spec/shared_stripe_examples/extra_features_examples.rb +2 -0
  81. data/spec/shared_stripe_examples/invoice_examples.rb +314 -51
  82. data/spec/shared_stripe_examples/payout_examples.rb +68 -0
  83. data/spec/shared_stripe_examples/plan_examples.rb +37 -5
  84. data/spec/shared_stripe_examples/product_example.rb +65 -0
  85. data/spec/shared_stripe_examples/recipient_examples.rb +7 -7
  86. data/spec/shared_stripe_examples/refund_examples.rb +17 -11
  87. data/spec/shared_stripe_examples/subscription_examples.rb +463 -33
  88. data/spec/shared_stripe_examples/subscription_items_examples.rb +75 -0
  89. data/spec/shared_stripe_examples/tax_rate_examples.rb +42 -0
  90. data/spec/shared_stripe_examples/transfer_examples.rb +72 -23
  91. data/spec/shared_stripe_examples/webhook_event_examples.rb +74 -5
  92. data/spec/spec_helper.rb +7 -6
  93. data/spec/stripe_mock_spec.rb +16 -3
  94. data/spec/support/stripe_examples.rb +7 -1
  95. data/spec/util_spec.rb +35 -1
  96. data/stripe-ruby-mock.gemspec +1 -1
  97. metadata +34 -7
  98. data/ChangeLog.rdoc +0 -4
@@ -10,13 +10,19 @@ module StripeMock
10
10
  end
11
11
 
12
12
  def get_all_transfers(route, method_url, params, headers)
13
- if recipient = params[:recipient]
14
- assert_existence :recipient, recipient, recipients[recipient]
13
+ extra_params = params.keys - [:created, :destination, :ending_before,
14
+ :limit, :starting_after, :transfer_group]
15
+ unless extra_params.empty?
16
+ raise Stripe::InvalidRequestError.new("Received unknown parameter: #{extra_params[0]}", extra_params[0].to_s, http_status: 400)
17
+ end
18
+
19
+ if destination = params[:destination]
20
+ assert_existence :destination, destination, accounts[destination]
15
21
  end
16
22
 
17
23
  _transfers = transfers.each_with_object([]) do |(_, transfer), array|
18
- if recipient
19
- array << transfer if transfer[:recipient] == recipient
24
+ if destination
25
+ array << transfer if transfer[:destination] == destination
20
26
  else
21
27
  array << transfer
22
28
  end
@@ -36,7 +42,7 @@ module StripeMock
36
42
  end
37
43
 
38
44
  unless params[:amount].is_a?(Integer) || (params[:amount].is_a?(String) && /^\d+$/.match(params[:amount]))
39
- raise Stripe::InvalidRequestError.new("Invalid integer: #{params[:amount]}", 'amount', 400)
45
+ raise Stripe::InvalidRequestError.new("Invalid integer: #{params[:amount]}", 'amount', http_status: 400)
40
46
  end
41
47
 
42
48
  transfers[id] = Data.mock_transfer(params.merge :id => id)
@@ -6,7 +6,13 @@ module StripeMock
6
6
  params[:id] = params[:id].to_s
7
7
 
8
8
  @base_strategy.create_plan_params.keys.each do |name|
9
- raise Stripe::InvalidRequestError.new("Missing required param: #{name}.", name) if params[name].nil?
9
+ message =
10
+ if name == :amount
11
+ "Plans require an `#{name}` parameter to be set."
12
+ else
13
+ "Missing required param: #{name}."
14
+ end
15
+ raise Stripe::InvalidRequestError.new(message, name) if params[name].nil?
10
16
  end
11
17
 
12
18
  if plans[ params[:id] ]
@@ -18,6 +24,9 @@ module StripeMock
18
24
  end
19
25
  end
20
26
 
27
+ def require_param(param_name)
28
+ raise Stripe::InvalidRequestError.new("Missing required param: #{param_name}.", param_name.to_s, http_status: 400)
29
+ end
21
30
  end
22
31
  end
23
32
  end
@@ -23,7 +23,7 @@ module StripeMock
23
23
  {
24
24
  :error_raised => 'invalid_request',
25
25
  :error_params => [
26
- e.message, e.param, e.http_status, e.http_body, e.json_body
26
+ e.message, e.param, { http_status: e.http_status, http_body: e.http_body, json_body: e.json_body}
27
27
  ]
28
28
  }
29
29
  end
@@ -65,6 +65,14 @@ module StripeMock
65
65
  @instance.generate_webhook_event(event_data)
66
66
  end
67
67
 
68
+ def set_conversion_rate(value)
69
+ @instance.conversion_rate = value
70
+ end
71
+
72
+ def set_account_balance(value)
73
+ @instance.account_balance = value
74
+ end
75
+
68
76
  def error_queue
69
77
  @instance.error_queue
70
78
  end
@@ -76,5 +84,10 @@ module StripeMock
76
84
  def ping
77
85
  true
78
86
  end
87
+
88
+ def upsert_stripe_object(object, attributes)
89
+ @instance.upsert_stripe_object(object, attributes)
90
+ end
91
+
79
92
  end
80
93
  end
@@ -3,10 +3,12 @@ module StripeMock
3
3
  class Base
4
4
 
5
5
  def create_plan_params(params={})
6
- currency = params[:currency] || 'usd'
6
+ currency = params[:currency] || StripeMock.default_currency
7
7
  {
8
8
  :id => 'stripe_mock_default_plan_id',
9
- :name => 'StripeMock Default Plan ID',
9
+ :product => {
10
+ :name => 'StripeMock Default Plan ID'
11
+ },
10
12
  :amount => 1337,
11
13
  :currency => currency,
12
14
  :interval => 'month'
@@ -14,7 +16,7 @@ module StripeMock
14
16
  end
15
17
 
16
18
  def generate_card_token(card_params={})
17
- card_data = { :number => "4242424242424242", :exp_month => 9, :exp_year => 2018, :cvc => "999", :tokenization_method => nil }
19
+ card_data = { :number => "4242424242424242", :exp_month => 9, :exp_year => (Time.now.year + 5), :cvc => "999", :tokenization_method => nil }
18
20
  card = StripeMock::Util.card_merge(card_data, card_params)
19
21
  card[:fingerprint] = StripeMock::Util.fingerprint(card[:number]) if StripeMock.state == 'local'
20
22
 
@@ -23,7 +25,7 @@ module StripeMock
23
25
  end
24
26
 
25
27
  def generate_bank_token(bank_account_params={})
26
- currency = bank_account_params[:currency] || 'usd'
28
+ currency = bank_account_params[:currency] || StripeMock.default_currency
27
29
  bank_account = {
28
30
  :country => "US",
29
31
  :currency => currency,
@@ -39,7 +41,7 @@ module StripeMock
39
41
  end
40
42
 
41
43
  def create_coupon_params(params = {})
42
- currency = params[:currency] || 'usd'
44
+ currency = params[:currency] || StripeMock.default_currency
43
45
  {
44
46
  id: '10BUCKS',
45
47
  amount_off: 1000,
@@ -30,6 +30,11 @@ module StripeMock
30
30
  # do nothing
31
31
  end
32
32
  end
33
+
34
+ def upsert_stripe_object(object, attributes)
35
+ raise UnsupportedRequestError.new "Updating or inserting Stripe objects in Live mode not supported"
36
+ end
37
+
33
38
  end
34
39
  end
35
40
  end
@@ -14,6 +14,14 @@ module StripeMock
14
14
  end
15
15
  end
16
16
 
17
+ def upsert_stripe_object(object, attributes = {})
18
+ if StripeMock.state == 'remote'
19
+ StripeMock.client.upsert_stripe_object(object, attributes)
20
+ elsif StripeMock.state == 'local'
21
+ StripeMock.instance.upsert_stripe_object(object, attributes)
22
+ end
23
+ end
24
+
17
25
  end
18
26
  end
19
27
  end
@@ -9,8 +9,14 @@ module StripeMock
9
9
  if oldval.is_a?(Array) && newval.is_a?(Array)
10
10
  oldval.fill(nil, oldval.length...newval.length)
11
11
  oldval.zip(newval).map {|elems|
12
- elems[1].nil? ? elems[0] : rmerge(elems[0], elems[1])
13
- }
12
+ if elems[1].nil?
13
+ elems[0]
14
+ elsif elems[1].is_a?(Hash) && elems[1].is_a?(Hash)
15
+ rmerge(elems[0], elems[1])
16
+ else
17
+ [elems[0], elems[1]].compact
18
+ end
19
+ }.flatten
14
20
  elsif oldval.is_a?(Hash) && newval.is_a?(Hash)
15
21
  rmerge(oldval, newval)
16
22
  else
@@ -1,4 +1,4 @@
1
1
  module StripeMock
2
2
  # stripe-ruby-mock version
3
- VERSION = "2.4.0"
3
+ VERSION = "2.5.8"
4
4
  end
@@ -11,7 +11,7 @@
11
11
  "statement_descriptor": "TEST",
12
12
  "details_submitted": true,
13
13
  "charge_enabled": false,
14
- "transfer_enabled": false,
14
+ "payouts_enabled": false,
15
15
  "currencies_supported": [
16
16
  "USD"
17
17
  ],
@@ -0,0 +1,88 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "charge.dispute.funds_reinstated",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2017-12-14",
10
+ "data": {
11
+ "object": {
12
+ "id": "dp_00000000000000",
13
+ "object": "dispute",
14
+ "amount": 25000,
15
+ "balance_transaction": "txn_00000000000000",
16
+ "balance_transactions": [
17
+ {
18
+ "id": "txn_1Bl3mMGWCopOTFn18p8iALq8",
19
+ "object": "balance_transaction",
20
+ "amount": -25000,
21
+ "available_on": 1516233600,
22
+ "created": 1516145022,
23
+ "currency": "usd",
24
+ "description": "Chargeback withdrawal for ch_1Bl3mKGWCopOTFn1LKoN557r",
25
+ "exchange_rate": null,
26
+ "fee": 1500,
27
+ "fee_details": [
28
+ {
29
+ "amount": 1500,
30
+ "application": null,
31
+ "currency": "usd",
32
+ "description": "Dispute fee",
33
+ "type": "stripe_fee"
34
+ }
35
+ ],
36
+ "net": -26500,
37
+ "source": "dp_1Bl3mMGWCopOTFn1jpVaJDrU",
38
+ "status": "pending",
39
+ "type": "adjustment"
40
+ }
41
+ ],
42
+ "charge": "ch_00000000000000",
43
+ "created": 1516145022,
44
+ "currency": "usd",
45
+ "evidence": {
46
+ "access_activity_log": null,
47
+ "billing_address": null,
48
+ "cancellation_policy": null,
49
+ "cancellation_policy_disclosure": null,
50
+ "cancellation_rebuttal": null,
51
+ "customer_communication": null,
52
+ "customer_email_address": "amitree.apu@gmail.com",
53
+ "customer_name": "amitree.apu@gmail.com",
54
+ "customer_purchase_ip": "157.131.133.10",
55
+ "customer_signature": null,
56
+ "duplicate_charge_documentation": null,
57
+ "duplicate_charge_explanation": null,
58
+ "duplicate_charge_id": null,
59
+ "product_description": null,
60
+ "receipt": null,
61
+ "refund_policy": null,
62
+ "refund_policy_disclosure": null,
63
+ "refund_refusal_explanation": null,
64
+ "service_date": null,
65
+ "service_documentation": null,
66
+ "shipping_address": null,
67
+ "shipping_carrier": null,
68
+ "shipping_date": null,
69
+ "shipping_documentation": null,
70
+ "shipping_tracking_number": null,
71
+ "uncategorized_file": null,
72
+ "uncategorized_text": null
73
+ },
74
+ "evidence_details": {
75
+ "due_by": 1517529599,
76
+ "has_evidence": false,
77
+ "past_due": false,
78
+ "submission_count": 0
79
+ },
80
+ "is_charge_refundable": false,
81
+ "livemode": false,
82
+ "metadata": {
83
+ },
84
+ "reason": "fraudulent",
85
+ "status": "needs_response"
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "charge.dispute.funds_withdrawn",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2017-12-14",
10
+ "data": {
11
+ "object": {
12
+ "id": "dp_00000000000000",
13
+ "object": "dispute",
14
+ "amount": 25000,
15
+ "balance_transaction": "txn_00000000000000",
16
+ "balance_transactions": [
17
+ {
18
+ "id": "txn_1Bl3mMGWCopOTFn18p8iALq8",
19
+ "object": "balance_transaction",
20
+ "amount": -25000,
21
+ "available_on": 1516233600,
22
+ "created": 1516145022,
23
+ "currency": "usd",
24
+ "description": "Chargeback withdrawal for ch_1Bl3mKGWCopOTFn1LKoN557r",
25
+ "exchange_rate": null,
26
+ "fee": 1500,
27
+ "fee_details": [
28
+ {
29
+ "amount": 1500,
30
+ "application": null,
31
+ "currency": "usd",
32
+ "description": "Dispute fee",
33
+ "type": "stripe_fee"
34
+ }
35
+ ],
36
+ "net": -26500,
37
+ "source": "dp_1Bl3mMGWCopOTFn1jpVaJDrU",
38
+ "status": "pending",
39
+ "type": "adjustment"
40
+ }
41
+ ],
42
+ "charge": "ch_00000000000000",
43
+ "created": 1516145022,
44
+ "currency": "usd",
45
+ "evidence": {
46
+ "access_activity_log": null,
47
+ "billing_address": null,
48
+ "cancellation_policy": null,
49
+ "cancellation_policy_disclosure": null,
50
+ "cancellation_rebuttal": null,
51
+ "customer_communication": null,
52
+ "customer_email_address": "amitree.apu@gmail.com",
53
+ "customer_name": "amitree.apu@gmail.com",
54
+ "customer_purchase_ip": "157.131.133.10",
55
+ "customer_signature": null,
56
+ "duplicate_charge_documentation": null,
57
+ "duplicate_charge_explanation": null,
58
+ "duplicate_charge_id": null,
59
+ "product_description": null,
60
+ "receipt": null,
61
+ "refund_policy": null,
62
+ "refund_policy_disclosure": null,
63
+ "refund_refusal_explanation": null,
64
+ "service_date": null,
65
+ "service_documentation": null,
66
+ "shipping_address": null,
67
+ "shipping_carrier": null,
68
+ "shipping_date": null,
69
+ "shipping_documentation": null,
70
+ "shipping_tracking_number": null,
71
+ "uncategorized_file": null,
72
+ "uncategorized_text": null
73
+ },
74
+ "evidence_details": {
75
+ "due_by": 1517529599,
76
+ "has_evidence": false,
77
+ "past_due": false,
78
+ "submission_count": 0
79
+ },
80
+ "is_charge_refundable": false,
81
+ "livemode": false,
82
+ "metadata": {
83
+ },
84
+ "reason": "fraudulent",
85
+ "status": "needs_response"
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "charge.updated",
6
+ "object": "event",
7
+ "data": {
8
+ "object": {
9
+ "id": "ch_00000000000000",
10
+ "object": "charge",
11
+ "created": 1380933505,
12
+ "livemode": false,
13
+ "paid": true,
14
+ "amount": 1000,
15
+ "currency": "usd",
16
+ "refunded": false,
17
+ "source": {
18
+ "id": "cc_00000000000000",
19
+ "object": "card",
20
+ "last4": "4242",
21
+ "type": "Visa",
22
+ "brand": "Visa",
23
+ "exp_month": 12,
24
+ "exp_year": 2013,
25
+ "fingerprint": "wXWJT135mEK107G8",
26
+ "customer": "cus_00000000000000",
27
+ "country": "US",
28
+ "name": "Actual Nothing",
29
+ "address_line1": null,
30
+ "address_line2": null,
31
+ "address_city": null,
32
+ "address_state": null,
33
+ "address_zip": null,
34
+ "address_country": null,
35
+ "cvc_check": null,
36
+ "address_line1_check": null,
37
+ "address_zip_check": null
38
+ },
39
+ "captured": true,
40
+ "refunds": {
41
+
42
+ },
43
+ "balance_transaction": "txn_00000000000000",
44
+ "failure_message": null,
45
+ "failure_code": null,
46
+ "amount_refunded": 0,
47
+ "customer": "cus_00000000000000",
48
+ "invoice": "in_00000000000000",
49
+ "description": "Sample description" ,
50
+ "dispute": null,
51
+ "metadata": {
52
+ }
53
+ },
54
+ "previous_attributes": {
55
+ "description": null
56
+ }
57
+ }
58
+ }
@@ -7,16 +7,46 @@
7
7
  "data": {
8
8
  "object": {
9
9
  "id": "su_00000000000000",
10
- "plan": {
11
- "interval": "month",
12
- "name": "Member's Club",
13
- "amount": 100,
14
- "currency": "usd",
15
- "id": "fkx0AFo_00000000000000",
16
- "object": "plan",
17
- "livemode": false,
18
- "interval_count": 1,
19
- "trial_period_days": null
10
+ "items": {
11
+ "object": "list",
12
+ "data": [
13
+ {
14
+ "id": "si_00000000000000",
15
+ "object": "subscription_item",
16
+ "created": 1497881783,
17
+ "plan": {
18
+ "interval": "month",
19
+ "product": "pr_00000000000000",
20
+ "amount": 100,
21
+ "currency": "usd",
22
+ "id": "fkx0AFo_00000000000000",
23
+ "object": "plan",
24
+ "livemode": false,
25
+ "interval_count": 1,
26
+ "trial_period_days": null,
27
+ "metadata": {}
28
+ },
29
+ "quantity": 1
30
+ },
31
+ {
32
+ "id": "si_00000000000001",
33
+ "object": "subscription_item",
34
+ "created": 1497881788,
35
+ "plan": {
36
+ "interval": "month",
37
+ "product": "pr_00000000000001",
38
+ "amount": 200,
39
+ "currency": "eur",
40
+ "id": "fkx0AFo_00000000000001",
41
+ "object": "plan",
42
+ "livemode": false,
43
+ "interval_count": 1,
44
+ "trial_period_days": null,
45
+ "metadata": {}
46
+ },
47
+ "quantity": 5
48
+ }
49
+ ]
20
50
  },
21
51
  "object": "subscription",
22
52
  "start": 1381080557,
@@ -7,16 +7,45 @@
7
7
  "data": {
8
8
  "object": {
9
9
  "id": "su_00000000000000",
10
- "plan": {
11
- "interval": "month",
12
- "name": "Member's Club",
13
- "amount": 100,
14
- "currency": "usd",
15
- "id": "fkx0AFo_00000000000000",
16
- "object": "plan",
17
- "livemode": false,
18
- "interval_count": 1,
19
- "trial_period_days": null
10
+ "items": {
11
+ "object": "list",
12
+ "data": [{
13
+ "id": "si_00000000000000",
14
+ "object": "subscription_item",
15
+ "created": 1497881783,
16
+ "plan": {
17
+ "interval": "month",
18
+ "product": "pr_00000000000000",
19
+ "amount": 100,
20
+ "currency": "usd",
21
+ "id": "fkx0AFo_00000000000000",
22
+ "object": "plan",
23
+ "livemode": false,
24
+ "interval_count": 1,
25
+ "trial_period_days": null,
26
+ "metadata": {}
27
+ },
28
+ "quantity": 1
29
+ },
30
+ {
31
+ "id": "si_00000000000001",
32
+ "object": "subscription_item",
33
+ "created": 1497881788,
34
+ "plan": {
35
+ "interval": "month",
36
+ "product": "pr_00000000000001",
37
+ "amount": 200,
38
+ "currency": "eur",
39
+ "id": "fkx0AFo_00000000000001",
40
+ "object": "plan",
41
+ "livemode": false,
42
+ "interval_count": 1,
43
+ "trial_period_days": null,
44
+ "metadata": {}
45
+ },
46
+ "quantity": 5
47
+ }
48
+ ]
20
49
  },
21
50
  "object": "subscription",
22
51
  "start": 1381080564,
@@ -7,16 +7,45 @@
7
7
  "data": {
8
8
  "object": {
9
9
  "id": "su_00000000000000",
10
- "plan": {
11
- "interval": "month",
12
- "name": "Member's Club",
13
- "amount": 100,
14
- "currency": "usd",
15
- "id": "fkx0AFo_00000000000000",
16
- "object": "plan",
17
- "livemode": false,
18
- "interval_count": 1,
19
- "trial_period_days": null
10
+ "items": {
11
+ "object": "list",
12
+ "data": [{
13
+ "id": "si_00000000000000",
14
+ "object": "subscription_item",
15
+ "created": 1497881783,
16
+ "plan": {
17
+ "interval": "month",
18
+ "product": "pr_00000000000000",
19
+ "amount": 100,
20
+ "currency": "usd",
21
+ "id": "fkx0AFo_00000000000000",
22
+ "object": "plan",
23
+ "livemode": false,
24
+ "interval_count": 1,
25
+ "trial_period_days": null,
26
+ "metadata": {}
27
+ },
28
+ "quantity": 1
29
+ },
30
+ {
31
+ "id": "si_00000000000001",
32
+ "object": "subscription_item",
33
+ "created": 1497881788,
34
+ "plan": {
35
+ "interval": "month",
36
+ "product": "pr_00000000000001",
37
+ "amount": 200,
38
+ "currency": "eur",
39
+ "id": "fkx0AFo_00000000000001",
40
+ "object": "plan",
41
+ "livemode": false,
42
+ "interval_count": 1,
43
+ "trial_period_days": null,
44
+ "metadata": {}
45
+ },
46
+ "quantity": 5
47
+ }
48
+ ]
20
49
  },
21
50
  "object": "subscription",
22
51
  "start": 1381080623,
@@ -7,16 +7,45 @@
7
7
  "data": {
8
8
  "object": {
9
9
  "id": "su_00000000000000",
10
- "plan": {
11
- "interval": "month",
12
- "name": "Member's Club",
13
- "amount": 100,
14
- "currency": "usd",
15
- "id": "fkx0AFo_00000000000000",
16
- "object": "plan",
17
- "livemode": false,
18
- "interval_count": 1,
19
- "trial_period_days": null
10
+ "items": {
11
+ "object": "list",
12
+ "data": [{
13
+ "id": "si_00000000000000",
14
+ "object": "subscription_item",
15
+ "created": 1497881783,
16
+ "plan": {
17
+ "interval": "month",
18
+ "product": "pr_00000000000000",
19
+ "amount": 100,
20
+ "currency": "usd",
21
+ "id": "fkx0AFo_00000000000000",
22
+ "object": "plan",
23
+ "livemode": false,
24
+ "interval_count": 1,
25
+ "trial_period_days": null,
26
+ "metadata": {}
27
+ },
28
+ "quantity": 1
29
+ },
30
+ {
31
+ "id": "si_00000000000001",
32
+ "object": "subscription_item",
33
+ "created": 1497881788,
34
+ "plan": {
35
+ "interval": "month",
36
+ "product": "pr_00000000000001",
37
+ "amount": 200,
38
+ "currency": "eur",
39
+ "id": "fkx0AFo_00000000000001",
40
+ "object": "plan",
41
+ "livemode": false,
42
+ "interval_count": 1,
43
+ "trial_period_days": null,
44
+ "metadata": {}
45
+ },
46
+ "quantity": 5
47
+ }
48
+ ]
20
49
  },
21
50
  "object": "subscription",
22
51
  "start": 1381080561,
@@ -35,7 +64,7 @@
35
64
  "previous_attributes": {
36
65
  "plan": {
37
66
  "interval": "month",
38
- "name": "Old plan",
67
+ "product": "pr_00000000000002",
39
68
  "amount": 100,
40
69
  "currency": "usd",
41
70
  "id": "OLD_PLAN_ID",