stripe-ruby-mock 3.1.0.rc3 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec_tests.yml +38 -0
- data/.rspec +2 -1
- data/CHANGELOG.md +36 -0
- data/Gemfile +0 -5
- data/README.md +6 -4
- data/lib/stripe_mock/api/client.rb +1 -1
- data/lib/stripe_mock/api/webhooks.rb +65 -26
- data/lib/stripe_mock/data.rb +80 -11
- data/lib/stripe_mock/instance.rb +7 -3
- data/lib/stripe_mock/request_handlers/accounts.rb +17 -6
- data/lib/stripe_mock/request_handlers/charges.rb +25 -1
- data/lib/stripe_mock/request_handlers/checkout_session.rb +158 -1
- data/lib/stripe_mock/request_handlers/customers.rb +12 -1
- data/lib/stripe_mock/request_handlers/events.rb +30 -3
- data/lib/stripe_mock/request_handlers/helpers/coupon_helpers.rb +1 -0
- data/lib/stripe_mock/request_handlers/helpers/search_helpers.rb +67 -0
- data/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb +28 -9
- data/lib/stripe_mock/request_handlers/invoices.rb +16 -2
- data/lib/stripe_mock/request_handlers/payment_intents.rb +23 -3
- data/lib/stripe_mock/request_handlers/payment_methods.rb +5 -1
- data/lib/stripe_mock/request_handlers/prices.rb +31 -4
- data/lib/stripe_mock/request_handlers/products.rb +14 -5
- data/lib/stripe_mock/request_handlers/promotion_codes.rb +43 -0
- data/lib/stripe_mock/request_handlers/refunds.rb +13 -2
- data/lib/stripe_mock/request_handlers/setup_intents.rb +16 -9
- data/lib/stripe_mock/request_handlers/subscriptions.rb +103 -5
- data/lib/stripe_mock/request_handlers/transfers.rb +12 -1
- data/lib/stripe_mock/request_handlers/validators/param_validators.rb +5 -4
- data/lib/stripe_mock/test_strategies/base.rb +51 -24
- data/lib/stripe_mock/version.rb +1 -1
- data/lib/stripe_mock/webhook_fixtures/account.updated.json +1 -1
- data/lib/stripe_mock/webhook_fixtures/balance.available.json +26 -20
- data/lib/stripe_mock/webhook_fixtures/charge.captured.json +143 -0
- data/lib/stripe_mock/webhook_fixtures/charge.dispute.created.json +63 -16
- data/lib/stripe_mock/webhook_fixtures/charge.failed.json +49 -120
- data/lib/stripe_mock/webhook_fixtures/charge.refund.updated.json +35 -0
- data/lib/stripe_mock/webhook_fixtures/charge.refunded.json +145 -50
- data/lib/stripe_mock/webhook_fixtures/charge.succeeded.json +114 -43
- data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.json +79 -0
- data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.payment_mode.json +53 -0
- data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.setup_mode.json +45 -0
- data/lib/stripe_mock/webhook_fixtures/customer.created.json +37 -46
- data/lib/stripe_mock/webhook_fixtures/customer.deleted.json +36 -32
- data/lib/stripe_mock/webhook_fixtures/customer.source.created.json +31 -22
- data/lib/stripe_mock/webhook_fixtures/customer.source.updated.json +36 -25
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.created.json +135 -47
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.deleted.json +134 -45
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json +135 -56
- data/lib/stripe_mock/webhook_fixtures/customer.updated.json +38 -47
- data/lib/stripe_mock/webhook_fixtures/invoice.created.json +176 -49
- data/lib/stripe_mock/webhook_fixtures/invoice.finalized.json +171 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.paid.json +171 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_action_required.json +171 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json +149 -83
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json +149 -90
- data/lib/stripe_mock/webhook_fixtures/invoice.upcoming.json +70 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.updated.json +178 -50
- data/lib/stripe_mock/webhook_fixtures/invoiceitem.created.json +87 -13
- data/lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json +88 -14
- data/lib/stripe_mock/webhook_fixtures/mandate.updated.json +34 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.amount_capturable_updated.json +170 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.canceled.json +73 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.created.json +86 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.payment_failed.json +118 -79
- data/lib/stripe_mock/webhook_fixtures/payment_intent.processing.json +162 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.requires_action.json +191 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.succeeded.json +85 -53
- data/lib/stripe_mock/webhook_fixtures/payment_link.created.json +47 -0
- data/lib/stripe_mock/webhook_fixtures/payment_link.updated.json +50 -0
- data/lib/stripe_mock/webhook_fixtures/payment_method.attached.json +63 -0
- data/lib/stripe_mock/webhook_fixtures/payment_method.detached.json +62 -0
- data/lib/stripe_mock/webhook_fixtures/payout.created.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/payout.paid.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/payout.updated.json +46 -0
- data/lib/stripe_mock/webhook_fixtures/plan.created.json +30 -13
- data/lib/stripe_mock/webhook_fixtures/plan.deleted.json +30 -13
- data/lib/stripe_mock/webhook_fixtures/plan.updated.json +34 -14
- data/lib/stripe_mock/webhook_fixtures/price.created.json +42 -0
- data/lib/stripe_mock/webhook_fixtures/price.deleted.json +42 -0
- data/lib/stripe_mock/webhook_fixtures/price.updated.json +48 -0
- data/lib/stripe_mock/webhook_fixtures/product.created.json +19 -13
- data/lib/stripe_mock/webhook_fixtures/product.deleted.json +20 -14
- data/lib/stripe_mock/webhook_fixtures/product.updated.json +24 -15
- data/lib/stripe_mock/webhook_fixtures/quote.accepted.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/quote.canceled.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/quote.created.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/quote.finalized.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.canceled.json +46 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.created.json +51 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.setup_failed.json +100 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.succeeded.json +46 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.canceled.json +119 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.created.json +114 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.released.json +111 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.updated.json +125 -0
- data/lib/stripe_mock/webhook_fixtures/tax_rate.created.json +32 -0
- data/lib/stripe_mock/webhook_fixtures/tax_rate.updated.json +37 -0
- data/lib/stripe_mock.rb +4 -1
- data/spec/instance_spec.rb +3 -1
- data/spec/integration_examples/completing_checkout_sessions_example.rb +37 -0
- data/spec/readme_spec.rb +1 -1
- data/spec/shared_stripe_examples/account_examples.rb +9 -1
- data/spec/shared_stripe_examples/bank_token_examples.rb +5 -7
- data/spec/shared_stripe_examples/charge_examples.rb +97 -0
- data/spec/shared_stripe_examples/checkout_session_examples.rb +99 -0
- data/spec/shared_stripe_examples/customer_examples.rb +56 -0
- data/spec/shared_stripe_examples/invoice_examples.rb +107 -1
- data/spec/shared_stripe_examples/payment_intent_examples.rb +136 -0
- data/spec/shared_stripe_examples/payment_method_examples.rb +32 -27
- data/spec/shared_stripe_examples/price_examples.rb +111 -2
- data/spec/shared_stripe_examples/product_examples.rb +68 -0
- data/spec/shared_stripe_examples/promotion_code_examples.rb +68 -0
- data/spec/shared_stripe_examples/refund_examples.rb +13 -0
- data/spec/shared_stripe_examples/setup_intent_examples.rb +17 -0
- data/spec/shared_stripe_examples/subscription_examples.rb +276 -6
- data/spec/shared_stripe_examples/transfer_examples.rb +10 -1
- data/spec/shared_stripe_examples/webhook_event_examples.rb +51 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/support/stripe_examples.rb +3 -1
- data/stripe-ruby-mock.gemspec +3 -4
- metadata +59 -29
- data/.travis.yml +0 -25
- data/lib/stripe_mock/request_handlers/checkout.rb +0 -15
- data/spec/shared_stripe_examples/checkout_examples.rb +0 -47
data/stripe-ruby-mock.gemspec
CHANGED
@@ -22,11 +22,10 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
23
23
|
gem.require_paths = ['lib']
|
24
24
|
|
25
|
-
gem.add_dependency 'stripe', '> 5', '<
|
25
|
+
gem.add_dependency 'stripe', '> 5', '< 12'
|
26
26
|
gem.add_dependency 'multi_json', '~> 1.0'
|
27
27
|
gem.add_dependency 'dante', '>= 0.2.0'
|
28
28
|
|
29
|
-
gem.add_development_dependency 'rspec', '~> 3.
|
30
|
-
gem.add_development_dependency '
|
31
|
-
gem.add_development_dependency 'thin', '~> 1.6.4'
|
29
|
+
gem.add_development_dependency 'rspec', '~> 3.13.0'
|
30
|
+
gem.add_development_dependency 'thin', '~> 1.8.1'
|
32
31
|
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:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gilbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stripe
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '12'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '12'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: multi_json
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,42 +64,28 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 3.
|
67
|
+
version: 3.13.0
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 3.
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rubygems-tasks
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0.2'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0.2'
|
74
|
+
version: 3.13.0
|
89
75
|
- !ruby/object:Gem::Dependency
|
90
76
|
name: thin
|
91
77
|
requirement: !ruby/object:Gem::Requirement
|
92
78
|
requirements:
|
93
79
|
- - "~>"
|
94
80
|
- !ruby/object:Gem::Version
|
95
|
-
version: 1.
|
81
|
+
version: 1.8.1
|
96
82
|
type: :development
|
97
83
|
prerelease: false
|
98
84
|
version_requirements: !ruby/object:Gem::Requirement
|
99
85
|
requirements:
|
100
86
|
- - "~>"
|
101
87
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
88
|
+
version: 1.8.1
|
103
89
|
description: A drop-in library to test stripe without hitting their servers
|
104
90
|
email: gilbertbgarza@gmail.com
|
105
91
|
executables:
|
@@ -108,9 +94,9 @@ extensions: []
|
|
108
94
|
extra_rdoc_files: []
|
109
95
|
files:
|
110
96
|
- ".env"
|
97
|
+
- ".github/workflows/rspec_tests.yml"
|
111
98
|
- ".gitignore"
|
112
99
|
- ".rspec"
|
113
|
-
- ".travis.yml"
|
114
100
|
- CHANGELOG.md
|
115
101
|
- Gemfile
|
116
102
|
- LICENSE.txt
|
@@ -148,7 +134,6 @@ files:
|
|
148
134
|
- lib/stripe_mock/request_handlers/balance_transactions.rb
|
149
135
|
- lib/stripe_mock/request_handlers/cards.rb
|
150
136
|
- lib/stripe_mock/request_handlers/charges.rb
|
151
|
-
- lib/stripe_mock/request_handlers/checkout.rb
|
152
137
|
- lib/stripe_mock/request_handlers/checkout_session.rb
|
153
138
|
- lib/stripe_mock/request_handlers/country_spec.rb
|
154
139
|
- lib/stripe_mock/request_handlers/coupons.rb
|
@@ -163,6 +148,7 @@ files:
|
|
163
148
|
- lib/stripe_mock/request_handlers/helpers/charge_helpers.rb
|
164
149
|
- lib/stripe_mock/request_handlers/helpers/coupon_helpers.rb
|
165
150
|
- lib/stripe_mock/request_handlers/helpers/external_account_helpers.rb
|
151
|
+
- lib/stripe_mock/request_handlers/helpers/search_helpers.rb
|
166
152
|
- lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb
|
167
153
|
- lib/stripe_mock/request_handlers/helpers/token_helpers.rb
|
168
154
|
- lib/stripe_mock/request_handlers/invoice_items.rb
|
@@ -174,6 +160,7 @@ files:
|
|
174
160
|
- lib/stripe_mock/request_handlers/plans.rb
|
175
161
|
- lib/stripe_mock/request_handlers/prices.rb
|
176
162
|
- lib/stripe_mock/request_handlers/products.rb
|
163
|
+
- lib/stripe_mock/request_handlers/promotion_codes.rb
|
177
164
|
- lib/stripe_mock/request_handlers/recipients.rb
|
178
165
|
- lib/stripe_mock/request_handlers/refunds.rb
|
179
166
|
- lib/stripe_mock/request_handlers/setup_intents.rb
|
@@ -196,15 +183,20 @@ files:
|
|
196
183
|
- lib/stripe_mock/webhook_fixtures/account.external_account.updated.json
|
197
184
|
- lib/stripe_mock/webhook_fixtures/account.updated.json
|
198
185
|
- lib/stripe_mock/webhook_fixtures/balance.available.json
|
186
|
+
- lib/stripe_mock/webhook_fixtures/charge.captured.json
|
199
187
|
- lib/stripe_mock/webhook_fixtures/charge.dispute.closed.json
|
200
188
|
- lib/stripe_mock/webhook_fixtures/charge.dispute.created.json
|
201
189
|
- lib/stripe_mock/webhook_fixtures/charge.dispute.funds_reinstated.json
|
202
190
|
- lib/stripe_mock/webhook_fixtures/charge.dispute.funds_withdrawn.json
|
203
191
|
- lib/stripe_mock/webhook_fixtures/charge.dispute.updated.json
|
204
192
|
- lib/stripe_mock/webhook_fixtures/charge.failed.json
|
193
|
+
- lib/stripe_mock/webhook_fixtures/charge.refund.updated.json
|
205
194
|
- lib/stripe_mock/webhook_fixtures/charge.refunded.json
|
206
195
|
- lib/stripe_mock/webhook_fixtures/charge.succeeded.json
|
207
196
|
- lib/stripe_mock/webhook_fixtures/charge.updated.json
|
197
|
+
- lib/stripe_mock/webhook_fixtures/checkout.session.completed.json
|
198
|
+
- lib/stripe_mock/webhook_fixtures/checkout.session.completed.payment_mode.json
|
199
|
+
- lib/stripe_mock/webhook_fixtures/checkout.session.completed.setup_mode.json
|
208
200
|
- lib/stripe_mock/webhook_fixtures/coupon.created.json
|
209
201
|
- lib/stripe_mock/webhook_fixtures/coupon.deleted.json
|
210
202
|
- lib/stripe_mock/webhook_fixtures/customer.created.json
|
@@ -221,20 +213,54 @@ files:
|
|
221
213
|
- lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json
|
222
214
|
- lib/stripe_mock/webhook_fixtures/customer.updated.json
|
223
215
|
- lib/stripe_mock/webhook_fixtures/invoice.created.json
|
216
|
+
- lib/stripe_mock/webhook_fixtures/invoice.finalized.json
|
217
|
+
- lib/stripe_mock/webhook_fixtures/invoice.paid.json
|
218
|
+
- lib/stripe_mock/webhook_fixtures/invoice.payment_action_required.json
|
224
219
|
- lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json
|
225
220
|
- lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json
|
221
|
+
- lib/stripe_mock/webhook_fixtures/invoice.upcoming.json
|
226
222
|
- lib/stripe_mock/webhook_fixtures/invoice.updated.json
|
227
223
|
- lib/stripe_mock/webhook_fixtures/invoiceitem.created.json
|
228
224
|
- lib/stripe_mock/webhook_fixtures/invoiceitem.deleted.json
|
229
225
|
- lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json
|
226
|
+
- lib/stripe_mock/webhook_fixtures/mandate.updated.json
|
227
|
+
- lib/stripe_mock/webhook_fixtures/payment_intent.amount_capturable_updated.json
|
228
|
+
- lib/stripe_mock/webhook_fixtures/payment_intent.canceled.json
|
229
|
+
- lib/stripe_mock/webhook_fixtures/payment_intent.created.json
|
230
230
|
- lib/stripe_mock/webhook_fixtures/payment_intent.payment_failed.json
|
231
|
+
- lib/stripe_mock/webhook_fixtures/payment_intent.processing.json
|
232
|
+
- lib/stripe_mock/webhook_fixtures/payment_intent.requires_action.json
|
231
233
|
- lib/stripe_mock/webhook_fixtures/payment_intent.succeeded.json
|
234
|
+
- lib/stripe_mock/webhook_fixtures/payment_link.created.json
|
235
|
+
- lib/stripe_mock/webhook_fixtures/payment_link.updated.json
|
236
|
+
- lib/stripe_mock/webhook_fixtures/payment_method.attached.json
|
237
|
+
- lib/stripe_mock/webhook_fixtures/payment_method.detached.json
|
238
|
+
- lib/stripe_mock/webhook_fixtures/payout.created.json
|
239
|
+
- lib/stripe_mock/webhook_fixtures/payout.paid.json
|
240
|
+
- lib/stripe_mock/webhook_fixtures/payout.updated.json
|
232
241
|
- lib/stripe_mock/webhook_fixtures/plan.created.json
|
233
242
|
- lib/stripe_mock/webhook_fixtures/plan.deleted.json
|
234
243
|
- lib/stripe_mock/webhook_fixtures/plan.updated.json
|
244
|
+
- lib/stripe_mock/webhook_fixtures/price.created.json
|
245
|
+
- lib/stripe_mock/webhook_fixtures/price.deleted.json
|
246
|
+
- lib/stripe_mock/webhook_fixtures/price.updated.json
|
235
247
|
- lib/stripe_mock/webhook_fixtures/product.created.json
|
236
248
|
- lib/stripe_mock/webhook_fixtures/product.deleted.json
|
237
249
|
- lib/stripe_mock/webhook_fixtures/product.updated.json
|
250
|
+
- lib/stripe_mock/webhook_fixtures/quote.accepted.json
|
251
|
+
- lib/stripe_mock/webhook_fixtures/quote.canceled.json
|
252
|
+
- lib/stripe_mock/webhook_fixtures/quote.created.json
|
253
|
+
- lib/stripe_mock/webhook_fixtures/quote.finalized.json
|
254
|
+
- lib/stripe_mock/webhook_fixtures/setup_intent.canceled.json
|
255
|
+
- lib/stripe_mock/webhook_fixtures/setup_intent.created.json
|
256
|
+
- lib/stripe_mock/webhook_fixtures/setup_intent.setup_failed.json
|
257
|
+
- lib/stripe_mock/webhook_fixtures/setup_intent.succeeded.json
|
258
|
+
- lib/stripe_mock/webhook_fixtures/subscription_schedule.canceled.json
|
259
|
+
- lib/stripe_mock/webhook_fixtures/subscription_schedule.created.json
|
260
|
+
- lib/stripe_mock/webhook_fixtures/subscription_schedule.released.json
|
261
|
+
- lib/stripe_mock/webhook_fixtures/subscription_schedule.updated.json
|
262
|
+
- lib/stripe_mock/webhook_fixtures/tax_rate.created.json
|
263
|
+
- lib/stripe_mock/webhook_fixtures/tax_rate.updated.json
|
238
264
|
- lib/stripe_mock/webhook_fixtures/transfer.created.json
|
239
265
|
- lib/stripe_mock/webhook_fixtures/transfer.failed.json
|
240
266
|
- lib/stripe_mock/webhook_fixtures/transfer.paid.json
|
@@ -247,6 +273,7 @@ files:
|
|
247
273
|
- spec/fixtures/stripe_webhooks/custom.account.updated.json
|
248
274
|
- spec/instance_spec.rb
|
249
275
|
- spec/integration_examples/charge_token_examples.rb
|
276
|
+
- spec/integration_examples/completing_checkout_sessions_example.rb
|
250
277
|
- spec/integration_examples/customer_card_examples.rb
|
251
278
|
- spec/integration_examples/prepare_error_examples.rb
|
252
279
|
- spec/list_spec.rb
|
@@ -261,7 +288,7 @@ files:
|
|
261
288
|
- spec/shared_stripe_examples/card_examples.rb
|
262
289
|
- spec/shared_stripe_examples/card_token_examples.rb
|
263
290
|
- spec/shared_stripe_examples/charge_examples.rb
|
264
|
-
- spec/shared_stripe_examples/
|
291
|
+
- spec/shared_stripe_examples/checkout_session_examples.rb
|
265
292
|
- spec/shared_stripe_examples/country_specs_examples.rb
|
266
293
|
- spec/shared_stripe_examples/coupon_examples.rb
|
267
294
|
- spec/shared_stripe_examples/customer_examples.rb
|
@@ -279,6 +306,7 @@ files:
|
|
279
306
|
- spec/shared_stripe_examples/plan_examples.rb
|
280
307
|
- spec/shared_stripe_examples/price_examples.rb
|
281
308
|
- spec/shared_stripe_examples/product_examples.rb
|
309
|
+
- spec/shared_stripe_examples/promotion_code_examples.rb
|
282
310
|
- spec/shared_stripe_examples/recipient_examples.rb
|
283
311
|
- spec/shared_stripe_examples/refund_examples.rb
|
284
312
|
- spec/shared_stripe_examples/setup_intent_examples.rb
|
@@ -312,11 +340,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
312
340
|
version: '0'
|
313
341
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
314
342
|
requirements:
|
315
|
-
- - "
|
343
|
+
- - ">="
|
316
344
|
- !ruby/object:Gem::Version
|
317
|
-
version:
|
345
|
+
version: '0'
|
318
346
|
requirements: []
|
319
|
-
rubygems_version: 3.
|
347
|
+
rubygems_version: 3.4.19
|
320
348
|
signing_key:
|
321
349
|
specification_version: 4
|
322
350
|
summary: TDD with stripe
|
@@ -328,6 +356,7 @@ test_files:
|
|
328
356
|
- spec/fixtures/stripe_webhooks/custom.account.updated.json
|
329
357
|
- spec/instance_spec.rb
|
330
358
|
- spec/integration_examples/charge_token_examples.rb
|
359
|
+
- spec/integration_examples/completing_checkout_sessions_example.rb
|
331
360
|
- spec/integration_examples/customer_card_examples.rb
|
332
361
|
- spec/integration_examples/prepare_error_examples.rb
|
333
362
|
- spec/list_spec.rb
|
@@ -342,7 +371,7 @@ test_files:
|
|
342
371
|
- spec/shared_stripe_examples/card_examples.rb
|
343
372
|
- spec/shared_stripe_examples/card_token_examples.rb
|
344
373
|
- spec/shared_stripe_examples/charge_examples.rb
|
345
|
-
- spec/shared_stripe_examples/
|
374
|
+
- spec/shared_stripe_examples/checkout_session_examples.rb
|
346
375
|
- spec/shared_stripe_examples/country_specs_examples.rb
|
347
376
|
- spec/shared_stripe_examples/coupon_examples.rb
|
348
377
|
- spec/shared_stripe_examples/customer_examples.rb
|
@@ -360,6 +389,7 @@ test_files:
|
|
360
389
|
- spec/shared_stripe_examples/plan_examples.rb
|
361
390
|
- spec/shared_stripe_examples/price_examples.rb
|
362
391
|
- spec/shared_stripe_examples/product_examples.rb
|
392
|
+
- spec/shared_stripe_examples/promotion_code_examples.rb
|
363
393
|
- spec/shared_stripe_examples/recipient_examples.rb
|
364
394
|
- spec/shared_stripe_examples/refund_examples.rb
|
365
395
|
- 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
|