stripe 4.12.0 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a30c5b27bb9161913905e0ada304efcef00519446eb64cbf2e7c3d0d625a2810
4
- data.tar.gz: d8503b19941c67e68c75b7b4e1c24cae2bd7a4c80a5b91e5c4e81058d23b658d
3
+ metadata.gz: 8fefd607d30d32ab6b4b1a3062c031fec8366abd331c311770136721354b89a4
4
+ data.tar.gz: c537164f6d8871f1508c4a2b82d894eec944169fbf4143c50c274df37f78170e
5
5
  SHA512:
6
- metadata.gz: a3a0ecd3172c802dc16bacab0be7f3d34373ed2230d18e5a89b84814d3705568e6f0ca261fb576492c1ec3ef39132b17a9b9126ba69f3941e45a4b3f851a3f07
7
- data.tar.gz: 7a6d70ebe915abe5774a4f5e55815e43ea24d6db4f4553ce77f18394b93aca8eeae051f9fd557d74bdda4d3e4d77112b821dca22a62c7284fc942392fc797638
6
+ metadata.gz: 1c7ab0496bb4f3359ca20399f7fd2dc72ce62d193ac18083974bf4f164b6204e9a77c01227814023e1ce91b589acfb505849dbe4793e748b25eb15c0183944c4
7
+ data.tar.gz: 3b3bfae890cb4c99a4a9005f9aac45bfd92c270035fab4df4f92b8fe17af3a520475c390cbdab59e9eabde7e76b4a66da816a39d6a0f2502fda0b1f5d1d9125f
@@ -17,7 +17,7 @@ sudo: false
17
17
  env:
18
18
  global:
19
19
  # If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.49.0
20
+ - STRIPE_MOCK_VERSION=0.52.0
21
21
 
22
22
  cache:
23
23
  directories:
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.13.0 - 2019-04-16
4
+ * [#766](https://github.com/stripe/stripe-ruby/pull/766) Relax constraints on objects that we'll accept as a file (now they just need to respond to `#read`)
5
+
3
6
  ## 4.12.0 - 2019-04-02
4
7
  * [#752](https://github.com/stripe/stripe-ruby/pull/752) Add `.delete` class method on deletable API resources
5
8
  * [#754](https://github.com/stripe/stripe-ruby/pull/754) Add class methods for all custom API requests (e.g. `Charge.capture`)
data/README.md CHANGED
@@ -35,7 +35,7 @@ If you want to build the gem from source:
35
35
 
36
36
  ### Requirements
37
37
 
38
- * Ruby 2.0+.
38
+ * Ruby 2.1+.
39
39
 
40
40
  ### Bundler
41
41
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.12.0
1
+ 4.13.0
@@ -20,7 +20,11 @@ module Stripe
20
20
  # rest-client would accept a vanilla `File` for upload, but Faraday does
21
21
  # not. Support the old API by wrapping a `File`-like object with an
22
22
  # `UploadIO` object if we're given one.
23
- if params[:file] && params[:file].respond_to?(:path) && params[:file].respond_to?(:read)
23
+ if params[:file] && !params[:file].is_a?(String)
24
+ unless params[:file].respond_to?(:read)
25
+ raise ArgumentError, "file must respond to `#read`"
26
+ end
27
+
24
28
  params[:file] = Faraday::UploadIO.new(params[:file], nil)
25
29
  end
26
30
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "4.12.0".freeze
4
+ VERSION = "4.13.0".freeze
5
5
  end
@@ -265,5 +265,130 @@ module Stripe
265
265
  assert_equal(expected, obj.serialize_params)
266
266
  end
267
267
  end
268
+
269
+ context "#create_external_account" do
270
+ should "create an external account" do
271
+ external_account = Stripe::Account.create_external_account(
272
+ "acct_123",
273
+ external_account: "btok_123"
274
+ )
275
+ assert_requested :post, "#{Stripe.api_base}/v1/accounts/acct_123/external_accounts"
276
+ assert external_account.is_a?(Stripe::BankAccount)
277
+ end
278
+ end
279
+
280
+ context "#retrieve_external_account" do
281
+ should "retrieve an external account" do
282
+ external_account = Stripe::Account.retrieve_external_account(
283
+ "acct_123",
284
+ "ba_123"
285
+ )
286
+ assert_requested :get, "#{Stripe.api_base}/v1/accounts/acct_123/external_accounts/ba_123"
287
+ assert external_account.is_a?(Stripe::BankAccount)
288
+ end
289
+ end
290
+
291
+ context "#update_external_account" do
292
+ should "update an external account" do
293
+ external_account = Stripe::Account.update_external_account(
294
+ "acct_123",
295
+ "ba_123",
296
+ metadata: { foo: "bar" }
297
+ )
298
+ assert_requested :post, "#{Stripe.api_base}/v1/accounts/acct_123/external_accounts/ba_123"
299
+ assert external_account.is_a?(Stripe::BankAccount)
300
+ end
301
+ end
302
+
303
+ context "#delete_external_account" do
304
+ should "delete an external_account" do
305
+ external_account = Stripe::Account.delete_external_account(
306
+ "acct_123",
307
+ "ba_123"
308
+ )
309
+ assert_requested :delete, "#{Stripe.api_base}/v1/accounts/acct_123/external_accounts/ba_123"
310
+ assert external_account.deleted
311
+ assert_equal "ba_123", external_account.id
312
+ end
313
+ end
314
+
315
+ context "#list_external_accounts" do
316
+ should "list the account's external accounts" do
317
+ external_accounts = Stripe::Account.list_external_accounts(
318
+ "acct_123"
319
+ )
320
+ assert_requested :get, "#{Stripe.api_base}/v1/accounts/acct_123/external_accounts"
321
+ assert external_accounts.is_a?(Stripe::ListObject)
322
+ assert external_accounts.data.is_a?(Array)
323
+ end
324
+ end
325
+
326
+ context "#create_login_link" do
327
+ should "create a login link" do
328
+ login_link = Stripe::Account.create_login_link(
329
+ "acct_123"
330
+ )
331
+ assert_requested :post, "#{Stripe.api_base}/v1/accounts/acct_123/login_links"
332
+ assert login_link.is_a?(Stripe::LoginLink)
333
+ end
334
+ end
335
+
336
+ context "#create_person" do
337
+ should "create a person" do
338
+ person = Stripe::Account.create_person(
339
+ "acct_123",
340
+ first_name: "John",
341
+ last_name: "Doe"
342
+ )
343
+ assert_requested :post, "#{Stripe.api_base}/v1/accounts/acct_123/persons"
344
+ assert person.is_a?(Stripe::Person)
345
+ end
346
+ end
347
+
348
+ context "#retrieve_person" do
349
+ should "retrieve a person" do
350
+ person = Stripe::Account.retrieve_person(
351
+ "acct_123",
352
+ "person_123"
353
+ )
354
+ assert_requested :get, "#{Stripe.api_base}/v1/accounts/acct_123/persons/person_123"
355
+ assert person.is_a?(Stripe::Person)
356
+ end
357
+ end
358
+
359
+ context "#update_person" do
360
+ should "update a person" do
361
+ person = Stripe::Account.update_person(
362
+ "acct_123",
363
+ "person_123",
364
+ first_name: "John"
365
+ )
366
+ assert_requested :post, "#{Stripe.api_base}/v1/accounts/acct_123/persons/person_123"
367
+ assert person.is_a?(Stripe::Person)
368
+ end
369
+ end
370
+
371
+ context "#delete_person" do
372
+ should "delete an person" do
373
+ person = Stripe::Account.delete_person(
374
+ "acct_123",
375
+ "person_123"
376
+ )
377
+ assert_requested :delete, "#{Stripe.api_base}/v1/accounts/acct_123/persons/person_123"
378
+ assert person.deleted
379
+ assert_equal "person_123", person.id
380
+ end
381
+ end
382
+
383
+ context "#list_persons" do
384
+ should "list the account's external accounts" do
385
+ persons = Stripe::Account.list_persons(
386
+ "acct_123"
387
+ )
388
+ assert_requested :get, "#{Stripe.api_base}/v1/accounts/acct_123/persons"
389
+ assert persons.is_a?(Stripe::ListObject)
390
+ assert persons.data.is_a?(Array)
391
+ end
392
+ end
268
393
  end
269
394
  end
@@ -10,5 +10,49 @@ module Stripe
10
10
  assert fees.data.is_a?(Array)
11
11
  assert fees.data[0].is_a?(Stripe::ApplicationFee)
12
12
  end
13
+
14
+ context "#create_refund" do
15
+ should "create a refund" do
16
+ refund = Stripe::ApplicationFee.create_refund(
17
+ "fee_123"
18
+ )
19
+ assert_requested :post, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds"
20
+ assert refund.is_a?(Stripe::ApplicationFeeRefund)
21
+ end
22
+ end
23
+
24
+ context "#retrieve_refund" do
25
+ should "retrieve a refund" do
26
+ refund = Stripe::ApplicationFee.retrieve_refund(
27
+ "fee_123",
28
+ "fr_123"
29
+ )
30
+ assert_requested :get, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds/fr_123"
31
+ assert refund.is_a?(Stripe::ApplicationFeeRefund)
32
+ end
33
+ end
34
+
35
+ context "#update_refund" do
36
+ should "update a refund" do
37
+ refund = Stripe::ApplicationFee.update_refund(
38
+ "fee_123",
39
+ "fr_123",
40
+ metadata: { foo: "bar" }
41
+ )
42
+ assert_requested :post, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds/fr_123"
43
+ assert refund.is_a?(Stripe::ApplicationFeeRefund)
44
+ end
45
+ end
46
+
47
+ context "#list_refunds" do
48
+ should "list the application fee's refuns" do
49
+ refunds = Stripe::ApplicationFee.list_refunds(
50
+ "fee_123"
51
+ )
52
+ assert_requested :get, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds"
53
+ assert refunds.is_a?(Stripe::ListObject)
54
+ assert refunds.data.is_a?(Array)
55
+ end
56
+ end
13
57
  end
14
58
  end
@@ -113,6 +113,57 @@ module Stripe
113
113
  assert discount.is_a?(Stripe::Discount)
114
114
  end
115
115
  end
116
+ context "#create_source" do
117
+ should "create a source" do
118
+ Stripe::Customer.create_source(
119
+ "cus_123",
120
+ source: "tok_123"
121
+ )
122
+ assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/sources"
123
+ end
124
+ end
125
+
126
+ context "#retrieve_source" do
127
+ should "retrieve a source" do
128
+ Stripe::Customer.retrieve_source(
129
+ "cus_123",
130
+ "ba_123"
131
+ )
132
+ assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_123/sources/ba_123"
133
+ end
134
+ end
135
+
136
+ context "#update_source" do
137
+ should "update a source" do
138
+ Stripe::Customer.update_source(
139
+ "cus_123",
140
+ "ba_123",
141
+ metadata: { foo: "bar" }
142
+ )
143
+ assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/sources/ba_123"
144
+ end
145
+ end
146
+
147
+ context "#delete_source" do
148
+ should "delete a source" do
149
+ Stripe::Customer.delete_source(
150
+ "cus_123",
151
+ "ba_123"
152
+ )
153
+ assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_123/sources/ba_123"
154
+ end
155
+ end
156
+
157
+ context "#list_sources" do
158
+ should "list the customer's sources" do
159
+ sources = Stripe::Customer.list_sources(
160
+ "cus_123"
161
+ )
162
+ assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_123/sources"
163
+ assert sources.is_a?(Stripe::ListObject)
164
+ assert sources.data.is_a?(Array)
165
+ end
166
+ end
116
167
 
117
168
  context "source field" do
118
169
  should "allow setting source with token" do
@@ -31,7 +31,8 @@ module Stripe
31
31
  should "be creatable with a File" do
32
32
  file = Stripe::File.create(
33
33
  purpose: "dispute_evidence",
34
- file: ::File.new(__FILE__)
34
+ file: ::File.new(__FILE__),
35
+ file_link_data: { create: true }
35
36
  )
36
37
  assert_requested :post, "#{Stripe.uploads_base}/v1/files"
37
38
  assert file.is_a?(Stripe::File)
@@ -44,7 +45,8 @@ module Stripe
44
45
 
45
46
  file = Stripe::File.create(
46
47
  purpose: "dispute_evidence",
47
- file: tempfile
48
+ file: tempfile,
49
+ file_link_data: { create: true }
48
50
  )
49
51
  assert_requested :post, "#{Stripe.uploads_base}/v1/files"
50
52
  assert file.is_a?(Stripe::File)
@@ -53,11 +55,33 @@ module Stripe
53
55
  should "be creatable with Faraday::UploadIO" do
54
56
  file = Stripe::File.create(
55
57
  purpose: "dispute_evidence",
56
- file: Faraday::UploadIO.new(::File.new(__FILE__), nil)
58
+ file: Faraday::UploadIO.new(::File.new(__FILE__), nil),
59
+ file_link_data: { create: true }
57
60
  )
58
61
  assert_requested :post, "#{Stripe.uploads_base}/v1/files"
59
62
  assert file.is_a?(Stripe::File)
60
63
  end
64
+
65
+ should "be creatable with a string" do
66
+ file = Stripe::File.create(
67
+ purpose: "dispute_evidence",
68
+ file: "my-file-contents",
69
+ file_link_data: { create: true }
70
+ )
71
+ assert_requested :post, "#{Stripe.uploads_base}/v1/files"
72
+ assert file.is_a?(Stripe::File)
73
+ end
74
+
75
+ should "raise given a file object that doesn't respond to #read" do
76
+ e = assert_raises(ArgumentError) do
77
+ Stripe::File.create(
78
+ purpose: "dispute_evidence",
79
+ file: Object.new,
80
+ file_link_data: { create: true }
81
+ )
82
+ end
83
+ assert_equal "file must respond to `#read`", e.message
84
+ end
61
85
  end
62
86
 
63
87
  should "be deserializable when `object=file`" do
@@ -34,7 +34,8 @@ module Stripe
34
34
  should "be creatable with a File" do
35
35
  file = Stripe::FileUpload.create(
36
36
  purpose: "dispute_evidence",
37
- file: ::File.new(__FILE__)
37
+ file: ::File.new(__FILE__),
38
+ file_link_data: { create: true }
38
39
  )
39
40
  assert_requested :post, "#{Stripe.uploads_base}/v1/files"
40
41
  assert file.is_a?(Stripe::FileUpload)
@@ -47,7 +48,8 @@ module Stripe
47
48
 
48
49
  file = Stripe::FileUpload.create(
49
50
  purpose: "dispute_evidence",
50
- file: tempfile
51
+ file: tempfile,
52
+ file_link_data: { create: true }
51
53
  )
52
54
  assert_requested :post, "#{Stripe.uploads_base}/v1/files"
53
55
  assert file.is_a?(Stripe::FileUpload)
@@ -56,7 +58,8 @@ module Stripe
56
58
  should "be creatable with Faraday::UploadIO" do
57
59
  file = Stripe::FileUpload.create(
58
60
  purpose: "dispute_evidence",
59
- file: Faraday::UploadIO.new(::File.new(__FILE__), nil)
61
+ file: Faraday::UploadIO.new(::File.new(__FILE__), nil),
62
+ file_link_data: { create: true }
60
63
  )
61
64
  assert_requested :post, "#{Stripe.uploads_base}/v1/files"
62
65
  assert file.is_a?(Stripe::FileUpload)
@@ -38,8 +38,6 @@ module Stripe
38
38
  assert invoice.is_a?(Stripe::Invoice)
39
39
  end
40
40
 
41
- should "be deletable" do
42
- end
43
41
  context "#delete" do
44
42
  should "be deletable" do
45
43
  invoice = Stripe::Invoice.retrieve("in_123")
@@ -21,7 +21,7 @@ module Stripe
21
21
  plan = Stripe::Plan.create(
22
22
  amount: 5000,
23
23
  interval: "month",
24
- name: "Sapphire elite",
24
+ nickname: "Sapphire elite",
25
25
  currency: "usd"
26
26
  )
27
27
  assert_requested :post, "#{Stripe.api_base}/v1/plans"
@@ -32,7 +32,7 @@ module Stripe
32
32
  plan = Stripe::Plan.create(
33
33
  amount: 5000,
34
34
  interval: "month",
35
- name: "Sapphire elite",
35
+ nickname: "Sapphire elite",
36
36
  currency: "usd",
37
37
  usage_type: "metered"
38
38
  )
@@ -43,7 +43,7 @@ module Stripe
43
43
  should "be creatable with tiered configuration" do
44
44
  plan = Stripe::Plan.create(
45
45
  interval: "month",
46
- name: "Sapphire elite",
46
+ nickname: "Sapphire elite",
47
47
  currency: "usd",
48
48
  billing_scheme: "tiered",
49
49
  tiers_mode: "volume",
@@ -56,7 +56,7 @@ module Stripe
56
56
  should "be creatable with transform_usage" do
57
57
  plan = Stripe::Plan.create(
58
58
  interval: "month",
59
- name: "Sapphire elite",
59
+ nickname: "Sapphire elite",
60
60
  currency: "usd",
61
61
  amount: 5000,
62
62
  transform_usage: { round: "up", divide_by: 50 }
@@ -89,5 +89,28 @@ module Stripe
89
89
  assert revisions.data[0].is_a?(Stripe::SubscriptionScheduleRevision)
90
90
  end
91
91
  end
92
+
93
+ context "#retrieve_revision" do
94
+ should "retrieve a subscription schedule revision" do
95
+ revision = Stripe::SubscriptionSchedule.retrieve_revision(
96
+ "sub_sched_123",
97
+ "sub_sched_rev_123"
98
+ )
99
+ assert_requested :get, "#{Stripe.api_base}/v1/subscription_schedules/sub_sched_123/revisions/sub_sched_rev_123"
100
+ assert revision.is_a?(Stripe::SubscriptionScheduleRevision)
101
+ end
102
+ end
103
+
104
+ context "#list_revisions" do
105
+ should "list a subscription schedule's revisions" do
106
+ revisions = Stripe::SubscriptionSchedule.list_revisions(
107
+ "sub_sched_123"
108
+ )
109
+ assert_requested :get, "#{Stripe.api_base}/v1/subscription_schedules/sub_sched_123/revisions"
110
+ assert revisions.is_a?(Stripe::ListObject)
111
+ assert revisions.data.is_a?(Array)
112
+ assert revisions.data[0].is_a?(Stripe::SubscriptionScheduleRevision)
113
+ end
114
+ end
92
115
  end
93
116
  end
@@ -39,5 +39,50 @@ module Stripe
39
39
  assert_requested :post, "#{Stripe.api_base}/v1/transfers/tr_123"
40
40
  assert transfer.is_a?(Stripe::Transfer)
41
41
  end
42
+
43
+ context "#create_reversal" do
44
+ should "create a reversal" do
45
+ reversal = Stripe::Transfer.create_reversal(
46
+ "tr_123",
47
+ amount: 100
48
+ )
49
+ assert_requested :post, "#{Stripe.api_base}/v1/transfers/tr_123/reversals"
50
+ assert reversal.is_a?(Stripe::Reversal)
51
+ end
52
+ end
53
+
54
+ context "#retrieve_reversal" do
55
+ should "retrieve a reversal" do
56
+ reversal = Stripe::Transfer.retrieve_reversal(
57
+ "tr_123",
58
+ "trr_123"
59
+ )
60
+ assert_requested :get, "#{Stripe.api_base}/v1/transfers/tr_123/reversals/trr_123"
61
+ assert reversal.is_a?(Stripe::Reversal)
62
+ end
63
+ end
64
+
65
+ context "#update_reversal" do
66
+ should "update a reversal" do
67
+ reversal = Stripe::Transfer.update_reversal(
68
+ "tr_123",
69
+ "trr_123",
70
+ metadata: { foo: "bar" }
71
+ )
72
+ assert_requested :post, "#{Stripe.api_base}/v1/transfers/tr_123/reversals/trr_123"
73
+ assert reversal.is_a?(Stripe::Reversal)
74
+ end
75
+ end
76
+
77
+ context "#list_reversals" do
78
+ should "list the transfer's reversals" do
79
+ reversals = Stripe::Transfer.list_reversals(
80
+ "tr_123"
81
+ )
82
+ assert_requested :get, "#{Stripe.api_base}/v1/transfers/tr_123/reversals"
83
+ assert reversals.is_a?(Stripe::ListObject)
84
+ assert reversals.data.is_a?(Array)
85
+ end
86
+ end
42
87
  end
43
88
  end
@@ -17,7 +17,7 @@ require ::File.expand_path("../test_data", __FILE__)
17
17
  require ::File.expand_path("../stripe_mock", __FILE__)
18
18
 
19
19
  # If changing this number, please also change it in `.travis.yml`.
20
- MOCK_MINIMUM_VERSION = "0.49.0".freeze
20
+ MOCK_MINIMUM_VERSION = "0.52.0".freeze
21
21
  MOCK_PORT = Stripe::StripeMock.start
22
22
 
23
23
  # Disable all real network connections except those that are outgoing to
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.0
4
+ version: 4.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-02 00:00:00.000000000 Z
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -153,17 +153,13 @@ files:
153
153
  - stripe.gemspec
154
154
  - test/api_stub_helpers.rb
155
155
  - test/openapi/README.md
156
- - test/stripe/account_external_accounts_operations_test.rb
157
156
  - test/stripe/account_link_test.rb
158
- - test/stripe/account_login_links_operations_test.rb
159
- - test/stripe/account_persons_operations_test.rb
160
157
  - test/stripe/account_test.rb
161
158
  - test/stripe/alipay_account_test.rb
162
159
  - test/stripe/api_operations_test.rb
163
160
  - test/stripe/api_resource_test.rb
164
161
  - test/stripe/apple_pay_domain_test.rb
165
162
  - test/stripe/application_fee_refund_test.rb
166
- - test/stripe/application_fee_refunds_operations_test.rb
167
163
  - test/stripe/application_fee_test.rb
168
164
  - test/stripe/balance_test.rb
169
165
  - test/stripe/bank_account_test.rb
@@ -172,7 +168,6 @@ files:
172
168
  - test/stripe/country_spec_test.rb
173
169
  - test/stripe/coupon_test.rb
174
170
  - test/stripe/customer_card_test.rb
175
- - test/stripe/customer_sources_operations_test.rb
176
171
  - test/stripe/customer_test.rb
177
172
  - test/stripe/dispute_test.rb
178
173
  - test/stripe/ephemeral_key_test.rb
@@ -218,7 +213,6 @@ files:
218
213
  - test/stripe/stripe_response_test.rb
219
214
  - test/stripe/subscription_item_test.rb
220
215
  - test/stripe/subscription_schedule_revision_test.rb
221
- - test/stripe/subscription_schedule_revisions_operations_test.rb
222
216
  - test/stripe/subscription_schedule_test.rb
223
217
  - test/stripe/subscription_test.rb
224
218
  - test/stripe/terminal/connection_token_test.rb
@@ -226,7 +220,6 @@ files:
226
220
  - test/stripe/terminal/reader_test.rb
227
221
  - test/stripe/three_d_secure_test.rb
228
222
  - test/stripe/topup_test.rb
229
- - test/stripe/transfer_reversals_operations_test.rb
230
223
  - test/stripe/transfer_test.rb
231
224
  - test/stripe/usage_record_summary_test.rb
232
225
  - test/stripe/usage_record_test.rb
@@ -263,17 +256,13 @@ summary: Ruby bindings for the Stripe API
263
256
  test_files:
264
257
  - test/api_stub_helpers.rb
265
258
  - test/openapi/README.md
266
- - test/stripe/account_external_accounts_operations_test.rb
267
259
  - test/stripe/account_link_test.rb
268
- - test/stripe/account_login_links_operations_test.rb
269
- - test/stripe/account_persons_operations_test.rb
270
260
  - test/stripe/account_test.rb
271
261
  - test/stripe/alipay_account_test.rb
272
262
  - test/stripe/api_operations_test.rb
273
263
  - test/stripe/api_resource_test.rb
274
264
  - test/stripe/apple_pay_domain_test.rb
275
265
  - test/stripe/application_fee_refund_test.rb
276
- - test/stripe/application_fee_refunds_operations_test.rb
277
266
  - test/stripe/application_fee_test.rb
278
267
  - test/stripe/balance_test.rb
279
268
  - test/stripe/bank_account_test.rb
@@ -282,7 +271,6 @@ test_files:
282
271
  - test/stripe/country_spec_test.rb
283
272
  - test/stripe/coupon_test.rb
284
273
  - test/stripe/customer_card_test.rb
285
- - test/stripe/customer_sources_operations_test.rb
286
274
  - test/stripe/customer_test.rb
287
275
  - test/stripe/dispute_test.rb
288
276
  - test/stripe/ephemeral_key_test.rb
@@ -328,7 +316,6 @@ test_files:
328
316
  - test/stripe/stripe_response_test.rb
329
317
  - test/stripe/subscription_item_test.rb
330
318
  - test/stripe/subscription_schedule_revision_test.rb
331
- - test/stripe/subscription_schedule_revisions_operations_test.rb
332
319
  - test/stripe/subscription_schedule_test.rb
333
320
  - test/stripe/subscription_test.rb
334
321
  - test/stripe/terminal/connection_token_test.rb
@@ -336,7 +323,6 @@ test_files:
336
323
  - test/stripe/terminal/reader_test.rb
337
324
  - test/stripe/three_d_secure_test.rb
338
325
  - test/stripe/topup_test.rb
339
- - test/stripe/transfer_reversals_operations_test.rb
340
326
  - test/stripe/transfer_test.rb
341
327
  - test/stripe/usage_record_summary_test.rb
342
328
  - test/stripe/usage_record_test.rb
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class AccountExternalAccountsOperationsTest < Test::Unit::TestCase
7
- setup do
8
- @account_id = "acct_123"
9
- @external_account_id = "ba_123"
10
- end
11
-
12
- context "#create_external_account" do
13
- should "create an external account" do
14
- external_account = Stripe::Account.create_external_account(
15
- @account_id,
16
- external_account: "btok_123"
17
- )
18
- assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts"
19
- assert external_account.is_a?(Stripe::BankAccount)
20
- end
21
- end
22
-
23
- context "#retrieve_external_account" do
24
- should "retrieve an external account" do
25
- external_account = Stripe::Account.retrieve_external_account(
26
- @account_id,
27
- @external_account_id
28
- )
29
- assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts/#{@external_account_id}"
30
- assert external_account.is_a?(Stripe::BankAccount)
31
- end
32
- end
33
-
34
- context "#update_external_account" do
35
- should "update an external account" do
36
- external_account = Stripe::Account.update_external_account(
37
- @account_id,
38
- @external_account_id,
39
- metadata: { foo: "bar" }
40
- )
41
- assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts/#{@external_account_id}"
42
- assert external_account.is_a?(Stripe::BankAccount)
43
- end
44
- end
45
-
46
- context "#delete_external_account" do
47
- should "delete an external_account" do
48
- external_account = Stripe::Account.delete_external_account(
49
- @account_id,
50
- @external_account_id
51
- )
52
- assert_requested :delete, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts/#{@external_account_id}"
53
- assert external_account.deleted
54
- assert_equal @external_account_id, external_account.id
55
- end
56
- end
57
-
58
- context "#list_external_accounts" do
59
- should "list the account's external accounts" do
60
- external_accounts = Stripe::Account.list_external_accounts(
61
- @account_id
62
- )
63
- assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts"
64
- assert external_accounts.is_a?(Stripe::ListObject)
65
- assert external_accounts.data.is_a?(Array)
66
- end
67
- end
68
- end
69
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class AccountLoginLinksOperationsTest < Test::Unit::TestCase
7
- setup do
8
- @account_id = "acct_123"
9
- end
10
-
11
- context "#create_login_link" do
12
- should "create a login link" do
13
- login_link = Stripe::Account.create_login_link(
14
- @account_id
15
- )
16
- assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/login_links"
17
- assert login_link.is_a?(Stripe::LoginLink)
18
- end
19
- end
20
- end
21
- end
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class AccountPersonsOperationsTest < Test::Unit::TestCase
7
- setup do
8
- @account_id = "acct_123"
9
- @person_id = "person_123"
10
- end
11
-
12
- context "#create_person" do
13
- should "create a person" do
14
- person = Stripe::Account.create_person(
15
- @account_id,
16
- first_name: "John",
17
- last_name: "Doe"
18
- )
19
- assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons"
20
- assert person.is_a?(Stripe::Person)
21
- end
22
- end
23
-
24
- context "#retrieve_person" do
25
- should "retrieve a person" do
26
- person = Stripe::Account.retrieve_person(
27
- @account_id,
28
- @person_id
29
- )
30
- assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons/#{@person_id}"
31
- assert person.is_a?(Stripe::Person)
32
- end
33
- end
34
-
35
- context "#update_person" do
36
- should "update a person" do
37
- person = Stripe::Account.update_person(
38
- @account_id,
39
- @person_id,
40
- first_name: "John"
41
- )
42
- assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons/#{@person_id}"
43
- assert person.is_a?(Stripe::Person)
44
- end
45
- end
46
-
47
- context "#delete_person" do
48
- should "delete an person" do
49
- person = Stripe::Account.delete_person(
50
- @account_id,
51
- @person_id
52
- )
53
- assert_requested :delete, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons/#{@person_id}"
54
- assert person.deleted
55
- assert_equal @person_id, person.id
56
- end
57
- end
58
-
59
- context "#list_persons" do
60
- should "list the account's external accounts" do
61
- persons = Stripe::Account.list_persons(
62
- @account_id
63
- )
64
- assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons"
65
- assert persons.is_a?(Stripe::ListObject)
66
- assert persons.data.is_a?(Array)
67
- end
68
- end
69
- end
70
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class ApplicationFeeRefundsOperationsTest < Test::Unit::TestCase
7
- setup do
8
- @application_fee_id = "fee_123"
9
- @refund_id = "fr_123"
10
- end
11
-
12
- context "#create_refund" do
13
- should "create a refund" do
14
- refund = Stripe::ApplicationFee.create_refund(
15
- @application_fee_id
16
- )
17
- assert_requested :post, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds"
18
- assert refund.is_a?(Stripe::ApplicationFeeRefund)
19
- end
20
- end
21
-
22
- context "#retrieve_refund" do
23
- should "retrieve a refund" do
24
- refund = Stripe::ApplicationFee.retrieve_refund(
25
- @application_fee_id,
26
- @refund_id
27
- )
28
- assert_requested :get, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds/#{@refund_id}"
29
- assert refund.is_a?(Stripe::ApplicationFeeRefund)
30
- end
31
- end
32
-
33
- context "#update_refund" do
34
- should "update a refund" do
35
- refund = Stripe::ApplicationFee.update_refund(
36
- @application_fee_id,
37
- @refund_id,
38
- metadata: { foo: "bar" }
39
- )
40
- assert_requested :post, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds/#{@refund_id}"
41
- assert refund.is_a?(Stripe::ApplicationFeeRefund)
42
- end
43
- end
44
-
45
- context "#list_refunds" do
46
- should "list the application fee's refuns" do
47
- refunds = Stripe::ApplicationFee.list_refunds(
48
- @application_fee_id
49
- )
50
- assert_requested :get, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds"
51
- assert refunds.is_a?(Stripe::ListObject)
52
- assert refunds.data.is_a?(Array)
53
- end
54
- end
55
- end
56
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class CustomerSourcesOperationsTest < Test::Unit::TestCase
7
- setup do
8
- @customer_id = "cus_123"
9
- @source_id = "ba_123"
10
- end
11
-
12
- context "#create_source" do
13
- should "create a source" do
14
- Stripe::Customer.create_source(
15
- @customer_id,
16
- source: "tok_123"
17
- )
18
- assert_requested :post, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources"
19
- end
20
- end
21
-
22
- context "#retrieve_source" do
23
- should "retrieve a source" do
24
- Stripe::Customer.retrieve_source(
25
- @customer_id,
26
- @source_id
27
- )
28
- assert_requested :get, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources/#{@source_id}"
29
- end
30
- end
31
-
32
- context "#update_source" do
33
- should "update a source" do
34
- Stripe::Customer.update_source(
35
- @customer_id,
36
- @source_id,
37
- metadata: { foo: "bar" }
38
- )
39
- assert_requested :post, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources/#{@source_id}"
40
- end
41
- end
42
-
43
- context "#delete_source" do
44
- should "delete a source" do
45
- Stripe::Customer.delete_source(
46
- @customer_id,
47
- @source_id
48
- )
49
- assert_requested :delete, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources/#{@source_id}"
50
- end
51
- end
52
-
53
- context "#list_sources" do
54
- should "list the customer's sources" do
55
- sources = Stripe::Customer.list_sources(
56
- @customer_id
57
- )
58
- assert_requested :get, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources"
59
- assert sources.is_a?(Stripe::ListObject)
60
- assert sources.data.is_a?(Array)
61
- end
62
- end
63
- end
64
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class SubscriptionScheduleRevisionsOperationsTest < Test::Unit::TestCase
7
- setup do
8
- @schedule_id = "sub_sched_123"
9
- @revision_id = "sub_sched_rev_123"
10
- end
11
-
12
- context "#retrieve_revision" do
13
- should "retrieve a subscription schedule revision" do
14
- revision = Stripe::SubscriptionSchedule.retrieve_revision(
15
- @schedule_id,
16
- @revision_id
17
- )
18
- assert_requested :get, "#{Stripe.api_base}/v1/subscription_schedules/#{@schedule_id}/revisions/#{@revision_id}"
19
- assert revision.is_a?(Stripe::SubscriptionScheduleRevision)
20
- end
21
- end
22
-
23
- context "#list_revisions" do
24
- should "list a subscription schedule's revisions" do
25
- revisions = Stripe::SubscriptionSchedule.list_revisions(
26
- @schedule_id
27
- )
28
- assert_requested :get, "#{Stripe.api_base}/v1/subscription_schedules/#{@schedule_id}/revisions"
29
- assert revisions.is_a?(Stripe::ListObject)
30
- assert revisions.data.is_a?(Array)
31
- assert revisions.data[0].is_a?(Stripe::SubscriptionScheduleRevision)
32
- end
33
- end
34
- end
35
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class TransferReversalsOperationsTest < Test::Unit::TestCase
7
- setup do
8
- @transfer_id = "tr_123"
9
- @reversal_id = "trr_123"
10
- end
11
-
12
- context "#create_reversal" do
13
- should "create a reversal" do
14
- reversal = Stripe::Transfer.create_reversal(
15
- @transfer_id,
16
- amount: 100
17
- )
18
- assert_requested :post, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals"
19
- assert reversal.is_a?(Stripe::Reversal)
20
- end
21
- end
22
-
23
- context "#retrieve_reversal" do
24
- should "retrieve a reversal" do
25
- reversal = Stripe::Transfer.retrieve_reversal(
26
- @transfer_id,
27
- @reversal_id
28
- )
29
- assert_requested :get, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals/#{@reversal_id}"
30
- assert reversal.is_a?(Stripe::Reversal)
31
- end
32
- end
33
-
34
- context "#update_reversal" do
35
- should "update a reversal" do
36
- reversal = Stripe::Transfer.update_reversal(
37
- @transfer_id,
38
- @reversal_id,
39
- metadata: { foo: "bar" }
40
- )
41
- assert_requested :post, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals/#{@reversal_id}"
42
- assert reversal.is_a?(Stripe::Reversal)
43
- end
44
- end
45
-
46
- context "#list_reversals" do
47
- should "list the transfer's reversals" do
48
- reversals = Stripe::Transfer.list_reversals(
49
- @transfer_id
50
- )
51
- assert_requested :get, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals"
52
- assert reversals.is_a?(Stripe::ListObject)
53
- assert reversals.data.is_a?(Array)
54
- end
55
- end
56
- end
57
- end