stripe-ruby-mock 3.1.0.rc3 → 3.1.0

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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rspec_tests.yml +38 -0
  3. data/.rspec +2 -1
  4. data/CHANGELOG.md +28 -0
  5. data/README.md +5 -3
  6. data/lib/stripe_mock/api/webhooks.rb +65 -26
  7. data/lib/stripe_mock/data.rb +80 -11
  8. data/lib/stripe_mock/instance.rb +6 -2
  9. data/lib/stripe_mock/request_handlers/accounts.rb +17 -6
  10. data/lib/stripe_mock/request_handlers/charges.rb +5 -0
  11. data/lib/stripe_mock/request_handlers/checkout_session.rb +158 -1
  12. data/lib/stripe_mock/request_handlers/events.rb +30 -3
  13. data/lib/stripe_mock/request_handlers/helpers/coupon_helpers.rb +1 -0
  14. data/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb +28 -9
  15. data/lib/stripe_mock/request_handlers/invoices.rb +6 -1
  16. data/lib/stripe_mock/request_handlers/payment_intents.rb +13 -2
  17. data/lib/stripe_mock/request_handlers/payment_methods.rb +5 -1
  18. data/lib/stripe_mock/request_handlers/prices.rb +18 -0
  19. data/lib/stripe_mock/request_handlers/promotion_codes.rb +43 -0
  20. data/lib/stripe_mock/request_handlers/refunds.rb +13 -2
  21. data/lib/stripe_mock/request_handlers/setup_intents.rb +16 -9
  22. data/lib/stripe_mock/request_handlers/subscriptions.rb +93 -4
  23. data/lib/stripe_mock/request_handlers/transfers.rb +12 -1
  24. data/lib/stripe_mock/request_handlers/validators/param_validators.rb +5 -4
  25. data/lib/stripe_mock/test_strategies/base.rb +51 -24
  26. data/lib/stripe_mock/version.rb +1 -1
  27. data/lib/stripe_mock/webhook_fixtures/account.updated.json +1 -1
  28. data/lib/stripe_mock/webhook_fixtures/balance.available.json +26 -20
  29. data/lib/stripe_mock/webhook_fixtures/charge.captured.json +143 -0
  30. data/lib/stripe_mock/webhook_fixtures/charge.dispute.created.json +63 -16
  31. data/lib/stripe_mock/webhook_fixtures/charge.failed.json +49 -120
  32. data/lib/stripe_mock/webhook_fixtures/charge.refund.updated.json +35 -0
  33. data/lib/stripe_mock/webhook_fixtures/charge.refunded.json +145 -50
  34. data/lib/stripe_mock/webhook_fixtures/charge.succeeded.json +114 -43
  35. data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.json +79 -0
  36. data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.payment_mode.json +53 -0
  37. data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.setup_mode.json +45 -0
  38. data/lib/stripe_mock/webhook_fixtures/customer.created.json +37 -46
  39. data/lib/stripe_mock/webhook_fixtures/customer.deleted.json +36 -32
  40. data/lib/stripe_mock/webhook_fixtures/customer.source.created.json +31 -22
  41. data/lib/stripe_mock/webhook_fixtures/customer.source.updated.json +36 -25
  42. data/lib/stripe_mock/webhook_fixtures/customer.subscription.created.json +135 -47
  43. data/lib/stripe_mock/webhook_fixtures/customer.subscription.deleted.json +134 -45
  44. data/lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json +135 -56
  45. data/lib/stripe_mock/webhook_fixtures/customer.updated.json +38 -47
  46. data/lib/stripe_mock/webhook_fixtures/invoice.created.json +176 -49
  47. data/lib/stripe_mock/webhook_fixtures/invoice.finalized.json +171 -0
  48. data/lib/stripe_mock/webhook_fixtures/invoice.paid.json +171 -0
  49. data/lib/stripe_mock/webhook_fixtures/invoice.payment_action_required.json +171 -0
  50. data/lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json +149 -83
  51. data/lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json +149 -90
  52. data/lib/stripe_mock/webhook_fixtures/invoice.upcoming.json +70 -0
  53. data/lib/stripe_mock/webhook_fixtures/invoice.updated.json +178 -50
  54. data/lib/stripe_mock/webhook_fixtures/invoiceitem.created.json +87 -13
  55. data/lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json +88 -14
  56. data/lib/stripe_mock/webhook_fixtures/mandate.updated.json +34 -0
  57. data/lib/stripe_mock/webhook_fixtures/payment_intent.amount_capturable_updated.json +170 -0
  58. data/lib/stripe_mock/webhook_fixtures/payment_intent.canceled.json +73 -0
  59. data/lib/stripe_mock/webhook_fixtures/payment_intent.created.json +86 -0
  60. data/lib/stripe_mock/webhook_fixtures/payment_intent.payment_failed.json +118 -79
  61. data/lib/stripe_mock/webhook_fixtures/payment_intent.processing.json +162 -0
  62. data/lib/stripe_mock/webhook_fixtures/payment_intent.requires_action.json +191 -0
  63. data/lib/stripe_mock/webhook_fixtures/payment_intent.succeeded.json +85 -53
  64. data/lib/stripe_mock/webhook_fixtures/payment_link.created.json +47 -0
  65. data/lib/stripe_mock/webhook_fixtures/payment_link.updated.json +50 -0
  66. data/lib/stripe_mock/webhook_fixtures/payment_method.attached.json +63 -0
  67. data/lib/stripe_mock/webhook_fixtures/payment_method.detached.json +62 -0
  68. data/lib/stripe_mock/webhook_fixtures/payout.created.json +40 -0
  69. data/lib/stripe_mock/webhook_fixtures/payout.paid.json +40 -0
  70. data/lib/stripe_mock/webhook_fixtures/payout.updated.json +46 -0
  71. data/lib/stripe_mock/webhook_fixtures/plan.created.json +30 -13
  72. data/lib/stripe_mock/webhook_fixtures/plan.deleted.json +30 -13
  73. data/lib/stripe_mock/webhook_fixtures/plan.updated.json +34 -14
  74. data/lib/stripe_mock/webhook_fixtures/price.created.json +42 -0
  75. data/lib/stripe_mock/webhook_fixtures/price.deleted.json +42 -0
  76. data/lib/stripe_mock/webhook_fixtures/price.updated.json +48 -0
  77. data/lib/stripe_mock/webhook_fixtures/product.created.json +19 -13
  78. data/lib/stripe_mock/webhook_fixtures/product.deleted.json +20 -14
  79. data/lib/stripe_mock/webhook_fixtures/product.updated.json +24 -15
  80. data/lib/stripe_mock/webhook_fixtures/quote.accepted.json +92 -0
  81. data/lib/stripe_mock/webhook_fixtures/quote.canceled.json +92 -0
  82. data/lib/stripe_mock/webhook_fixtures/quote.created.json +92 -0
  83. data/lib/stripe_mock/webhook_fixtures/quote.finalized.json +92 -0
  84. data/lib/stripe_mock/webhook_fixtures/setup_intent.canceled.json +46 -0
  85. data/lib/stripe_mock/webhook_fixtures/setup_intent.created.json +51 -0
  86. data/lib/stripe_mock/webhook_fixtures/setup_intent.setup_failed.json +100 -0
  87. data/lib/stripe_mock/webhook_fixtures/setup_intent.succeeded.json +46 -0
  88. data/lib/stripe_mock/webhook_fixtures/subscription_schedule.canceled.json +119 -0
  89. data/lib/stripe_mock/webhook_fixtures/subscription_schedule.created.json +114 -0
  90. data/lib/stripe_mock/webhook_fixtures/subscription_schedule.released.json +111 -0
  91. data/lib/stripe_mock/webhook_fixtures/subscription_schedule.updated.json +125 -0
  92. data/lib/stripe_mock/webhook_fixtures/tax_rate.created.json +32 -0
  93. data/lib/stripe_mock/webhook_fixtures/tax_rate.updated.json +37 -0
  94. data/lib/stripe_mock.rb +3 -1
  95. data/spec/instance_spec.rb +3 -1
  96. data/spec/integration_examples/completing_checkout_sessions_example.rb +37 -0
  97. data/spec/readme_spec.rb +1 -1
  98. data/spec/shared_stripe_examples/account_examples.rb +9 -1
  99. data/spec/shared_stripe_examples/checkout_session_examples.rb +99 -0
  100. data/spec/shared_stripe_examples/invoice_examples.rb +21 -0
  101. data/spec/shared_stripe_examples/payment_intent_examples.rb +74 -0
  102. data/spec/shared_stripe_examples/payment_method_examples.rb +32 -27
  103. data/spec/shared_stripe_examples/price_examples.rb +42 -2
  104. data/spec/shared_stripe_examples/promotion_code_examples.rb +68 -0
  105. data/spec/shared_stripe_examples/refund_examples.rb +13 -0
  106. data/spec/shared_stripe_examples/setup_intent_examples.rb +17 -0
  107. data/spec/shared_stripe_examples/subscription_examples.rb +213 -2
  108. data/spec/shared_stripe_examples/transfer_examples.rb +10 -1
  109. data/spec/shared_stripe_examples/webhook_event_examples.rb +51 -5
  110. data/spec/support/stripe_examples.rb +3 -1
  111. data/stripe-ruby-mock.gemspec +1 -1
  112. metadata +54 -11
  113. data/.travis.yml +0 -25
  114. data/lib/stripe_mock/request_handlers/checkout.rb +0 -15
  115. data/spec/shared_stripe_examples/checkout_examples.rb +0 -47
@@ -203,6 +203,52 @@ shared_examples 'Webhook Events API' do
203
203
  expect(events.map &:type).to include('invoiceitem.created', 'invoice.created', 'coupon.created')
204
204
  end
205
205
 
206
+ it "retrieves events with a created timestamp" do
207
+ timestamp = Time.now.to_i - 7200
208
+ customer_created_event = StripeMock.mock_webhook_event('customer.created', created: Time.now.to_i - 14_400)
209
+ plan_created_event = StripeMock.mock_webhook_event('plan.created', created: Time.now.to_i - 10_800)
210
+ coupon_created_event = StripeMock.mock_webhook_event('coupon.created', created: timestamp)
211
+ invoice_created_event = StripeMock.mock_webhook_event('invoice.created', created: Time.now.to_i - 3600)
212
+ invoice_item_created_event = StripeMock.mock_webhook_event('invoiceitem.created')
213
+
214
+ events = Stripe::Event.list(created: timestamp)
215
+ expect(events.count).to eq(1)
216
+ expect(events.map &:id).to match_array([coupon_created_event.id])
217
+ expect(events.map &:type).to match_array(['coupon.created'])
218
+
219
+ events = Stripe::Event.list(created: timestamp.to_s)
220
+ expect(events.count).to eq(1)
221
+ expect(events.map &:id).to match_array([coupon_created_event.id])
222
+ expect(events.map &:type).to match_array(['coupon.created'])
223
+ end
224
+
225
+ it "retrieves events with a created filter" do
226
+ timestamp1 = Time.now.to_i - 3600
227
+ timestamp2 = Time.now.to_i - 7200
228
+ timestamp3 = Time.now.to_i - 10_800
229
+ timestamp4 = Time.now.to_i - 14_400
230
+ customer_created_event = StripeMock.mock_webhook_event('customer.created', created: timestamp4)
231
+ plan_created_event = StripeMock.mock_webhook_event('plan.created', created: timestamp3)
232
+ coupon_created_event = StripeMock.mock_webhook_event('coupon.created', created: timestamp2)
233
+ invoice_created_event = StripeMock.mock_webhook_event('invoice.created', created: timestamp1)
234
+ invoice_item_created_event = StripeMock.mock_webhook_event('invoiceitem.created')
235
+
236
+ events = Stripe::Event.list(created: {gte: timestamp2, lte: timestamp1})
237
+ expect(events.count).to eq(2)
238
+ expect(events.map &:id).to match_array([coupon_created_event.id, invoice_created_event.id])
239
+ expect(events.map &:type).to match_array(['coupon.created', 'invoice.created'])
240
+
241
+ events = Stripe::Event.list(created: {gt: timestamp3})
242
+ expect(events.count).to eq(3)
243
+ expect(events.map &:id).to match_array([coupon_created_event.id, invoice_created_event.id, invoice_item_created_event.id])
244
+ expect(events.map &:type).to match_array(['coupon.created', 'invoice.created', 'invoiceitem.created'])
245
+
246
+ events = Stripe::Event.list(created: {lt: timestamp3.to_s})
247
+ expect(events.count).to eq(1)
248
+ expect(events.map &:id).to match_array([customer_created_event.id])
249
+ expect(events.map &:type).to match_array(['customer.created'])
250
+ end
251
+
206
252
  end
207
253
 
208
254
  describe 'Subscription events' do
@@ -211,7 +257,7 @@ shared_examples 'Webhook Events API' do
211
257
  expect(subscription_created_event).to be_a(Stripe::Event)
212
258
  expect(subscription_created_event.id).to_not be_nil
213
259
  expect(subscription_created_event.data.object.items.data.class).to be Array
214
- expect(subscription_created_event.data.object.items.data.length).to be 2
260
+ expect(subscription_created_event.data.object.items.data.length).to be 1
215
261
  expect(subscription_created_event.data.object.items.data.first).to respond_to(:plan)
216
262
  expect(subscription_created_event.data.object.items.data.first.id).to eq('si_00000000000000')
217
263
  end
@@ -221,7 +267,7 @@ shared_examples 'Webhook Events API' do
221
267
  expect(subscription_deleted_event).to be_a(Stripe::Event)
222
268
  expect(subscription_deleted_event.id).to_not be_nil
223
269
  expect(subscription_deleted_event.data.object.items.data.class).to be Array
224
- expect(subscription_deleted_event.data.object.items.data.length).to be 2
270
+ expect(subscription_deleted_event.data.object.items.data.length).to be 1
225
271
  expect(subscription_deleted_event.data.object.items.data.first).to respond_to(:plan)
226
272
  expect(subscription_deleted_event.data.object.items.data.first.id).to eq('si_00000000000000')
227
273
  end
@@ -231,7 +277,7 @@ shared_examples 'Webhook Events API' do
231
277
  expect(subscription_updated_event).to be_a(Stripe::Event)
232
278
  expect(subscription_updated_event.id).to_not be_nil
233
279
  expect(subscription_updated_event.data.object.items.data.class).to be Array
234
- expect(subscription_updated_event.data.object.items.data.length).to be 2
280
+ expect(subscription_updated_event.data.object.items.data.length).to be 1
235
281
  expect(subscription_updated_event.data.object.items.data.first).to respond_to(:plan)
236
282
  expect(subscription_updated_event.data.object.items.data.first.id).to eq('si_00000000000000')
237
283
  end
@@ -253,9 +299,9 @@ shared_examples 'Webhook Events API' do
253
299
  expect(invoice_payment_succeeded).to be_a(Stripe::Event)
254
300
  expect(invoice_payment_succeeded.id).to_not be_nil
255
301
  expect(invoice_payment_succeeded.data.object.lines.data.class).to be Array
256
- expect(invoice_payment_succeeded.data.object.lines.data.length).to be 2
302
+ expect(invoice_payment_succeeded.data.object.lines.data.length).to be 1
257
303
  expect(invoice_payment_succeeded.data.object.lines.data.first).to respond_to(:plan)
258
- expect(invoice_payment_succeeded.data.object.lines.data.first.id).to eq('sub_00000000000000')
304
+ expect(invoice_payment_succeeded.data.object.lines.data.first.id).to eq('il_000000000000000000000000')
259
305
  end
260
306
  end
261
307
  end
@@ -24,6 +24,7 @@ def it_behaves_like_stripe(&block)
24
24
  it_behaves_like 'Plan API', &block
25
25
  it_behaves_like 'Price API', &block
26
26
  it_behaves_like 'Product API', &block
27
+ it_behaves_like 'PromotionCode API', &block
27
28
  it_behaves_like 'Recipient API', &block
28
29
  it_behaves_like 'Refund API', &block
29
30
  it_behaves_like 'Transfer API', &block
@@ -39,10 +40,11 @@ def it_behaves_like_stripe(&block)
39
40
  it_behaves_like 'Country Spec API', &block
40
41
  it_behaves_like 'EphemeralKey API', &block
41
42
  it_behaves_like 'TaxRate API', &block
42
- it_behaves_like 'Checkout API', &block
43
+ it_behaves_like 'Checkout Session API', &block
43
44
 
44
45
  # Integration tests
45
46
  it_behaves_like 'Multiple Customer Cards'
46
47
  it_behaves_like 'Charging with Tokens'
47
48
  it_behaves_like 'Card Error Prep'
49
+ it_behaves_like 'Completing Checkout Sessions'
48
50
  end
@@ -28,5 +28,5 @@ Gem::Specification.new do |gem|
28
28
 
29
29
  gem.add_development_dependency 'rspec', '~> 3.7.0'
30
30
  gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
31
- gem.add_development_dependency 'thin', '~> 1.6.4'
31
+ gem.add_development_dependency 'thin', '~> 1.8.1'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-ruby-mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.rc3
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-16 00:00:00.000000000 Z
11
+ date: 2024-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stripe
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 1.6.4
95
+ version: 1.8.1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 1.6.4
102
+ version: 1.8.1
103
103
  description: A drop-in library to test stripe without hitting their servers
104
104
  email: gilbertbgarza@gmail.com
105
105
  executables:
@@ -108,9 +108,9 @@ extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
110
  - ".env"
111
+ - ".github/workflows/rspec_tests.yml"
111
112
  - ".gitignore"
112
113
  - ".rspec"
113
- - ".travis.yml"
114
114
  - CHANGELOG.md
115
115
  - Gemfile
116
116
  - LICENSE.txt
@@ -148,7 +148,6 @@ files:
148
148
  - lib/stripe_mock/request_handlers/balance_transactions.rb
149
149
  - lib/stripe_mock/request_handlers/cards.rb
150
150
  - lib/stripe_mock/request_handlers/charges.rb
151
- - lib/stripe_mock/request_handlers/checkout.rb
152
151
  - lib/stripe_mock/request_handlers/checkout_session.rb
153
152
  - lib/stripe_mock/request_handlers/country_spec.rb
154
153
  - lib/stripe_mock/request_handlers/coupons.rb
@@ -174,6 +173,7 @@ files:
174
173
  - lib/stripe_mock/request_handlers/plans.rb
175
174
  - lib/stripe_mock/request_handlers/prices.rb
176
175
  - lib/stripe_mock/request_handlers/products.rb
176
+ - lib/stripe_mock/request_handlers/promotion_codes.rb
177
177
  - lib/stripe_mock/request_handlers/recipients.rb
178
178
  - lib/stripe_mock/request_handlers/refunds.rb
179
179
  - lib/stripe_mock/request_handlers/setup_intents.rb
@@ -196,15 +196,20 @@ files:
196
196
  - lib/stripe_mock/webhook_fixtures/account.external_account.updated.json
197
197
  - lib/stripe_mock/webhook_fixtures/account.updated.json
198
198
  - lib/stripe_mock/webhook_fixtures/balance.available.json
199
+ - lib/stripe_mock/webhook_fixtures/charge.captured.json
199
200
  - lib/stripe_mock/webhook_fixtures/charge.dispute.closed.json
200
201
  - lib/stripe_mock/webhook_fixtures/charge.dispute.created.json
201
202
  - lib/stripe_mock/webhook_fixtures/charge.dispute.funds_reinstated.json
202
203
  - lib/stripe_mock/webhook_fixtures/charge.dispute.funds_withdrawn.json
203
204
  - lib/stripe_mock/webhook_fixtures/charge.dispute.updated.json
204
205
  - lib/stripe_mock/webhook_fixtures/charge.failed.json
206
+ - lib/stripe_mock/webhook_fixtures/charge.refund.updated.json
205
207
  - lib/stripe_mock/webhook_fixtures/charge.refunded.json
206
208
  - lib/stripe_mock/webhook_fixtures/charge.succeeded.json
207
209
  - lib/stripe_mock/webhook_fixtures/charge.updated.json
210
+ - lib/stripe_mock/webhook_fixtures/checkout.session.completed.json
211
+ - lib/stripe_mock/webhook_fixtures/checkout.session.completed.payment_mode.json
212
+ - lib/stripe_mock/webhook_fixtures/checkout.session.completed.setup_mode.json
208
213
  - lib/stripe_mock/webhook_fixtures/coupon.created.json
209
214
  - lib/stripe_mock/webhook_fixtures/coupon.deleted.json
210
215
  - lib/stripe_mock/webhook_fixtures/customer.created.json
@@ -221,20 +226,54 @@ files:
221
226
  - lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json
222
227
  - lib/stripe_mock/webhook_fixtures/customer.updated.json
223
228
  - lib/stripe_mock/webhook_fixtures/invoice.created.json
229
+ - lib/stripe_mock/webhook_fixtures/invoice.finalized.json
230
+ - lib/stripe_mock/webhook_fixtures/invoice.paid.json
231
+ - lib/stripe_mock/webhook_fixtures/invoice.payment_action_required.json
224
232
  - lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json
225
233
  - lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json
234
+ - lib/stripe_mock/webhook_fixtures/invoice.upcoming.json
226
235
  - lib/stripe_mock/webhook_fixtures/invoice.updated.json
227
236
  - lib/stripe_mock/webhook_fixtures/invoiceitem.created.json
228
237
  - lib/stripe_mock/webhook_fixtures/invoiceitem.deleted.json
229
238
  - lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json
239
+ - lib/stripe_mock/webhook_fixtures/mandate.updated.json
240
+ - lib/stripe_mock/webhook_fixtures/payment_intent.amount_capturable_updated.json
241
+ - lib/stripe_mock/webhook_fixtures/payment_intent.canceled.json
242
+ - lib/stripe_mock/webhook_fixtures/payment_intent.created.json
230
243
  - lib/stripe_mock/webhook_fixtures/payment_intent.payment_failed.json
244
+ - lib/stripe_mock/webhook_fixtures/payment_intent.processing.json
245
+ - lib/stripe_mock/webhook_fixtures/payment_intent.requires_action.json
231
246
  - lib/stripe_mock/webhook_fixtures/payment_intent.succeeded.json
247
+ - lib/stripe_mock/webhook_fixtures/payment_link.created.json
248
+ - lib/stripe_mock/webhook_fixtures/payment_link.updated.json
249
+ - lib/stripe_mock/webhook_fixtures/payment_method.attached.json
250
+ - lib/stripe_mock/webhook_fixtures/payment_method.detached.json
251
+ - lib/stripe_mock/webhook_fixtures/payout.created.json
252
+ - lib/stripe_mock/webhook_fixtures/payout.paid.json
253
+ - lib/stripe_mock/webhook_fixtures/payout.updated.json
232
254
  - lib/stripe_mock/webhook_fixtures/plan.created.json
233
255
  - lib/stripe_mock/webhook_fixtures/plan.deleted.json
234
256
  - lib/stripe_mock/webhook_fixtures/plan.updated.json
257
+ - lib/stripe_mock/webhook_fixtures/price.created.json
258
+ - lib/stripe_mock/webhook_fixtures/price.deleted.json
259
+ - lib/stripe_mock/webhook_fixtures/price.updated.json
235
260
  - lib/stripe_mock/webhook_fixtures/product.created.json
236
261
  - lib/stripe_mock/webhook_fixtures/product.deleted.json
237
262
  - lib/stripe_mock/webhook_fixtures/product.updated.json
263
+ - lib/stripe_mock/webhook_fixtures/quote.accepted.json
264
+ - lib/stripe_mock/webhook_fixtures/quote.canceled.json
265
+ - lib/stripe_mock/webhook_fixtures/quote.created.json
266
+ - lib/stripe_mock/webhook_fixtures/quote.finalized.json
267
+ - lib/stripe_mock/webhook_fixtures/setup_intent.canceled.json
268
+ - lib/stripe_mock/webhook_fixtures/setup_intent.created.json
269
+ - lib/stripe_mock/webhook_fixtures/setup_intent.setup_failed.json
270
+ - lib/stripe_mock/webhook_fixtures/setup_intent.succeeded.json
271
+ - lib/stripe_mock/webhook_fixtures/subscription_schedule.canceled.json
272
+ - lib/stripe_mock/webhook_fixtures/subscription_schedule.created.json
273
+ - lib/stripe_mock/webhook_fixtures/subscription_schedule.released.json
274
+ - lib/stripe_mock/webhook_fixtures/subscription_schedule.updated.json
275
+ - lib/stripe_mock/webhook_fixtures/tax_rate.created.json
276
+ - lib/stripe_mock/webhook_fixtures/tax_rate.updated.json
238
277
  - lib/stripe_mock/webhook_fixtures/transfer.created.json
239
278
  - lib/stripe_mock/webhook_fixtures/transfer.failed.json
240
279
  - lib/stripe_mock/webhook_fixtures/transfer.paid.json
@@ -247,6 +286,7 @@ files:
247
286
  - spec/fixtures/stripe_webhooks/custom.account.updated.json
248
287
  - spec/instance_spec.rb
249
288
  - spec/integration_examples/charge_token_examples.rb
289
+ - spec/integration_examples/completing_checkout_sessions_example.rb
250
290
  - spec/integration_examples/customer_card_examples.rb
251
291
  - spec/integration_examples/prepare_error_examples.rb
252
292
  - spec/list_spec.rb
@@ -261,7 +301,7 @@ files:
261
301
  - spec/shared_stripe_examples/card_examples.rb
262
302
  - spec/shared_stripe_examples/card_token_examples.rb
263
303
  - spec/shared_stripe_examples/charge_examples.rb
264
- - spec/shared_stripe_examples/checkout_examples.rb
304
+ - spec/shared_stripe_examples/checkout_session_examples.rb
265
305
  - spec/shared_stripe_examples/country_specs_examples.rb
266
306
  - spec/shared_stripe_examples/coupon_examples.rb
267
307
  - spec/shared_stripe_examples/customer_examples.rb
@@ -279,6 +319,7 @@ files:
279
319
  - spec/shared_stripe_examples/plan_examples.rb
280
320
  - spec/shared_stripe_examples/price_examples.rb
281
321
  - spec/shared_stripe_examples/product_examples.rb
322
+ - spec/shared_stripe_examples/promotion_code_examples.rb
282
323
  - spec/shared_stripe_examples/recipient_examples.rb
283
324
  - spec/shared_stripe_examples/refund_examples.rb
284
325
  - spec/shared_stripe_examples/setup_intent_examples.rb
@@ -312,11 +353,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
353
  version: '0'
313
354
  required_rubygems_version: !ruby/object:Gem::Requirement
314
355
  requirements:
315
- - - ">"
356
+ - - ">="
316
357
  - !ruby/object:Gem::Version
317
- version: 1.3.1
358
+ version: '0'
318
359
  requirements: []
319
- rubygems_version: 3.1.2
360
+ rubygems_version: 3.0.3.1
320
361
  signing_key:
321
362
  specification_version: 4
322
363
  summary: TDD with stripe
@@ -328,6 +369,7 @@ test_files:
328
369
  - spec/fixtures/stripe_webhooks/custom.account.updated.json
329
370
  - spec/instance_spec.rb
330
371
  - spec/integration_examples/charge_token_examples.rb
372
+ - spec/integration_examples/completing_checkout_sessions_example.rb
331
373
  - spec/integration_examples/customer_card_examples.rb
332
374
  - spec/integration_examples/prepare_error_examples.rb
333
375
  - spec/list_spec.rb
@@ -342,7 +384,7 @@ test_files:
342
384
  - spec/shared_stripe_examples/card_examples.rb
343
385
  - spec/shared_stripe_examples/card_token_examples.rb
344
386
  - spec/shared_stripe_examples/charge_examples.rb
345
- - spec/shared_stripe_examples/checkout_examples.rb
387
+ - spec/shared_stripe_examples/checkout_session_examples.rb
346
388
  - spec/shared_stripe_examples/country_specs_examples.rb
347
389
  - spec/shared_stripe_examples/coupon_examples.rb
348
390
  - spec/shared_stripe_examples/customer_examples.rb
@@ -360,6 +402,7 @@ test_files:
360
402
  - spec/shared_stripe_examples/plan_examples.rb
361
403
  - spec/shared_stripe_examples/price_examples.rb
362
404
  - spec/shared_stripe_examples/product_examples.rb
405
+ - spec/shared_stripe_examples/promotion_code_examples.rb
363
406
  - spec/shared_stripe_examples/recipient_examples.rb
364
407
  - spec/shared_stripe_examples/refund_examples.rb
365
408
  - spec/shared_stripe_examples/setup_intent_examples.rb
data/.travis.yml DELETED
@@ -1,25 +0,0 @@
1
- sudo: required
2
- language: ruby
3
- rvm:
4
- - 2.4.6
5
- - 2.5.5
6
- - 2.6.3
7
- - 2.7.0
8
- before_install:
9
- - gem install bundler -v '< 2'
10
- before_script:
11
- - "sudo touch /var/log/stripe-mock-server.log"
12
- - "sudo chown travis /var/log/stripe-mock-server.log"
13
- script: "bundle exec rspec && bundle exec rspec -t live"
14
-
15
- env:
16
- global:
17
- - IS_TRAVIS=true STRIPE_TEST_SECRET_KEY_A=sk_test_BsztzqQjzd7lqkgo1LjEG5DF00KzH7tWKF STRIPE_TEST_SECRET_KEY_B=sk_test_rKCEu0x8jzg6cKPqoey8kUPQ00usQO3KYE STRIPE_TEST_SECRET_KEY_C=sk_test_qeaB7R6Ywp8sC9pzd1ZIABH700YLC7nhmZ STRIPE_TEST_SECRET_KEY_D=sk_test_r1NwHkUW7UyoozyP4aEBD6cs00CI5uDiGq
18
-
19
- notifications:
20
- webhooks:
21
- urls:
22
- - https://webhooks.gitter.im/e/44a1f4718ae2efb67eac
23
- on_success: change # options: [always|never|change] default: always
24
- on_failure: always # options: [always|never|change] default: always
25
- on_start: false # default: false
@@ -1,15 +0,0 @@
1
- module StripeMock
2
- module RequestHandlers
3
- module Checkout
4
- def Checkout.included(klass)
5
- klass.add_handler 'post /v1/checkout/sessions', :new_session
6
- end
7
-
8
- def new_session(route, method_url, params, headers)
9
- params[:id] ||= new_id('cs')
10
-
11
- checkout_sessions[params[:id]] = Data.mock_checkout_session(params)
12
- end
13
- end
14
- end
15
- end
@@ -1,47 +0,0 @@
1
- require 'spec_helper'
2
-
3
- shared_examples 'Checkout API' do
4
-
5
- it "creates a stripe checkout session" do
6
- session = Stripe::Checkout::Session.create({
7
- payment_method_types: ['card'],
8
- line_items: [{
9
- name: 'T-shirt',
10
- quantity: 1,
11
- amount: 500,
12
- currency: 'usd',
13
- }],
14
- })
15
- expect(session.id).to match(/^test_cs/)
16
- expect(session.line_items.count).to eq(1)
17
- end
18
-
19
- context 'retrieve a checkout session' do
20
- let(:checkout_session1) { stripe_helper.create_checkout_session }
21
-
22
- it 'ca be retrieved by id' do
23
- checkout_session1
24
-
25
- checkout_session = Stripe::Checkout::Session.retrieve(checkout_session1.id)
26
-
27
- expect(checkout_session.id).to eq(checkout_session1.id)
28
- end
29
-
30
- it "cannot retrieve a checkout session that doesn't exist" do
31
- expect { Stripe::Checkout::Session.retrieve('nope') }.to raise_error {|e|
32
- expect(e).to be_a Stripe::InvalidRequestError
33
- expect(e.param).to eq('checkout_session')
34
- expect(e.http_status).to eq(404)
35
- }
36
- end
37
-
38
- it 'can expand setup_intent' do
39
- setup_intent = Stripe::SetupIntent.create
40
- initial_session = Stripe::Checkout::Session.create(setup_intent: setup_intent.id)
41
-
42
- checkout_session = Stripe::Checkout::Session.retrieve(id: initial_session.id, expand: ['setup_intent'])
43
-
44
- expect(checkout_session.setup_intent).to eq(setup_intent)
45
- end
46
- end
47
- end