stripe 11.7.0 → 12.1.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: 10d590e76f5c8524bee12dc767dee9b845fa9732aa4eed9621d0c10d05dfef4c
4
- data.tar.gz: 803b1a9728c6322b40cce127b3464e1abff35c2ad515a73ec2b11ae1fe5b0476
3
+ metadata.gz: 9aca4084cfbcc4eec52a2f5b1756be4ac140769e46520bd644967473468898fc
4
+ data.tar.gz: b6b4350bc34d08ba00eb6791e53ec5a570345c86930149032305dd58bce9374c
5
5
  SHA512:
6
- metadata.gz: 9f324debcf2d8d68f425a1fd934d981656f695d8440ca3c4cef5dab5b618d56407e324420b0ceee896f69c21281133d8fe4fb931b9bca34a9fece9fc281b6ef3
7
- data.tar.gz: 6d17556b19ccac9ce7d9a102b6a3d7984b042f98fcaeb3014dd177a232fba50897bbba9b2ddf6addc76fad6a99b607e4f0069c994047e38217f53ee81b61ed7c
6
+ metadata.gz: 5a59e650d1e896c9d3f4c549518a0837f0593f05be7c18373ad51125849edbaec032295742bf79f7727efc568edc26464307b9e285831cdd61e3ef6e9df62e14
7
+ data.tar.gz: 3d0c0ab2d096538c0db2ed09f2ebb263f299fbffa524d0713c7a6026c328fc7647116270f4badcb83ea3264d64a885a78093329f30d3d2bec82bdc07fa05ace3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,43 @@
1
1
  # Changelog
2
+ ## 12.1.0 - 2024-07-05
3
+ * [#1425](https://github.com/stripe/stripe-ruby/pull/1425) Update generated code
4
+ * Add support for `add_lines`, `remove_lines`, and `update_lines` methods on resource `Invoice`
5
+ * [#1420](https://github.com/stripe/stripe-ruby/pull/1420) Update static methods for delete/list on BankAccount/Card to throw NotImplementedError
6
+ * The below methods have been throwing `InvalidRequestError` because the urls used to make the requests have been buggy. Updating them to throw `NotImplementedError` instead just like their counterparts for update & retrieve because they cannot be implemented without the parent id.
7
+
8
+ Methods affected | Use these instead in the context of payment method | Use these in the context of external accounts
9
+ ------ | ------ | ----
10
+ Stripe:: BankAccount.delete | Stripe::Customer.delete_source | Stripe::Account.delete_external_account
11
+ Stripe:: BankAccount.list | Stripe::Customer.list_sources | Stripe::Customer.list_external_accounts
12
+ Stripe:: Card.delete | Stripe::Customer.delete_source | Stripe::Account.delete_external_account
13
+ Stripe:: Card.list | Stripe::Customer.list_sources | Stripe::Customer.list_external_accounts
14
+ * [#1427](https://github.com/stripe/stripe-ruby/pull/1427) Regenerate rbis
15
+ * [#1426](https://github.com/stripe/stripe-ruby/pull/1426) Remove coveralls and re-added JRuby
16
+
17
+ ## 12.0.0 - 2024-06-24
18
+ * [#1418](https://github.com/stripe/stripe-ruby/pull/1418) Add missing static method for verify on BankAccount
19
+ * [#1419](https://github.com/stripe/stripe-ruby/pull/1419)
20
+
21
+ This release changes the pinned API version to 2024-06-20. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-06-20) and carefully review the API changes before upgrading.
22
+
23
+ ### ⚠️ Breaking changes
24
+
25
+ * Singleton `retrieve` method now requires `params` to be passed as the first argument. Existing calls to singleton `retrieve` method with only `opts` argument will have to be updated to account for the addition of `params` argument.
26
+ ```ruby
27
+ params = { expand: ["available"] }
28
+ opts = { stripe_account: "acct_123" }
29
+
30
+ # ❌ No longer works
31
+ Stripe::Balance.retrieve(opts)
32
+
33
+ # ✅ Correct way to call retrieve method
34
+ Stripe::Balance.retrieve(params, opts)
35
+ ```
36
+
37
+ ### Additions
38
+
39
+ * Add support for `finalize_amount` test helper method on resource `Issuing.Authorization`
40
+
2
41
  ## 11.7.0 - 2024-06-13
3
42
  * [#1415](https://github.com/stripe/stripe-ruby/pull/1415) Deprecate StripeClient#request
4
43
  * Add deprecation warning for `StripeClient#request`. This helper method will be removed in a future major version. To access response objects, use the `last_response` property on the returned resource instead. Refer to [Accessing a response object](https://github.com/stripe/stripe-ruby?tab=readme-ov-file#accessing-a-response-object) in the README for usage details.
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ source "https://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  group :development do
8
- gem "coveralls_reborn", "~> 0.25.0" if RUBY_VERSION >= "3.1"
9
8
  gem "mocha", "~> 1.16.0"
10
9
  gem "rack", ">= 2.0.6"
11
10
  gem "rake"
data/OPENAPI_VERSION CHANGED
@@ -1 +1 @@
1
- v1011
1
+ v1111
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/stripe.svg)](https://badge.fury.io/rb/stripe)
4
4
  [![Build Status](https://github.com/stripe/stripe-ruby/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-ruby/actions?query=branch%3Amaster)
5
- [![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-ruby?branch=master)
6
5
 
7
6
  The Stripe Ruby library provides convenient access to the Stripe API from
8
7
  applications written in the Ruby language. It includes a pre-defined set of
data/VERSION CHANGED
@@ -1 +1 @@
1
- 11.7.0
1
+ 12.1.0
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Stripe
5
5
  module ApiVersion
6
- CURRENT = "2024-04-10"
6
+ CURRENT = "2024-06-20"
7
7
  end
8
8
  end
@@ -5,8 +5,7 @@ module Stripe
5
5
  # These bank accounts are payment methods on `Customer` objects.
6
6
  #
7
7
  # On the other hand [External Accounts](https://stripe.com/api#external_accounts) are transfer
8
- # destinations on `Account` objects for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
9
- # is `application`, which includes [Custom accounts](https://stripe.com/connect/custom-accounts).
8
+ # destinations on `Account` objects for connected accounts.
10
9
  # They can be bank accounts or debit cards as well, and are documented in the links above.
11
10
  #
12
11
  # Related guide: [Bank debits and transfers](https://stripe.com/payments/bank-debits-transfers)
@@ -21,8 +20,21 @@ module Stripe
21
20
  end
22
21
 
23
22
  def verify(params = {}, opts = {})
24
- resp, opts = execute_resource_request(:post, resource_url + "/verify", params, opts)
25
- initialize_from(resp.data, opts)
23
+ request_stripe_object(
24
+ method: :post,
25
+ path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ def self.verify(customer, id, params = {}, opts = {})
32
+ request_stripe_object(
33
+ method: :post,
34
+ path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
35
+ params: params,
36
+ opts: opts
37
+ )
26
38
  end
27
39
 
28
40
  def resource_url
@@ -52,12 +64,12 @@ module Stripe
52
64
  end
53
65
 
54
66
  def self.delete(id, params = {}, opts = {})
55
- request_stripe_object(
56
- method: :delete,
57
- path: "#{resource_url}/#{id}",
58
- params: params,
59
- opts: opts
60
- )
67
+ raise NotImplementedError,
68
+ "Bank accounts cannot be deleted without a customer ID or an " \
69
+ "account ID. Delete a bank account using " \
70
+ "`Customer.delete_source('customer_id', 'bank_account_id')` " \
71
+ "or `Account.delete_external_account('account_id', " \
72
+ "'bank_account_id')`"
61
73
  end
62
74
 
63
75
  def delete(params = {}, opts = {})
@@ -70,12 +82,11 @@ module Stripe
70
82
  end
71
83
 
72
84
  def self.list(filters = {}, opts = {})
73
- request_stripe_object(
74
- method: :delete,
75
- path: resource_url.to_s,
76
- params: filters,
77
- opts: opts
78
- )
85
+ raise NotImplementedError,
86
+ "Bank accounts cannot be listed without a customer ID or an " \
87
+ "account ID. List bank accounts using " \
88
+ "`Customer.list_sources('customer_id')` " \
89
+ "or `Account.list_external_accounts('account_id')`"
79
90
  end
80
91
  end
81
92
  end
@@ -42,12 +42,11 @@ module Stripe
42
42
  end
43
43
 
44
44
  def self.delete(id, params = {}, opts = {})
45
- request_stripe_object(
46
- method: :delete,
47
- path: "#{resource_url}/#{id}",
48
- params: params,
49
- opts: opts
50
- )
45
+ raise NotImplementedError,
46
+ "Card cannot be deleted without a customer ID or an account " \
47
+ "ID. Delete a card using `Customer.delete_source(" \
48
+ "'customer_id', 'card_id')` or " \
49
+ "`Account.delete_external_account('account_id', 'card_id')`"
51
50
  end
52
51
 
53
52
  def delete(params = {}, opts = {})
@@ -60,12 +59,11 @@ module Stripe
60
59
  end
61
60
 
62
61
  def self.list(filters = {}, opts = {})
63
- request_stripe_object(
64
- method: :delete,
65
- path: resource_url.to_s,
66
- params: filters,
67
- opts: opts
68
- )
62
+ raise NotImplementedError,
63
+ "Cards cannot be listed without a customer ID or an account " \
64
+ "ID. List cards using `Customer.list_sources(" \
65
+ "'customer_id')` or " \
66
+ "`Account.list_external_accounts('account_id')`"
69
67
  end
70
68
  end
71
69
  end
@@ -15,7 +15,7 @@ module Stripe
15
15
  "climate.order"
16
16
  end
17
17
 
18
- # Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the
18
+ # Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
19
19
  # reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
20
20
  # might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
21
21
  # provides 90 days advance notice and refunds the amount_total.
@@ -28,7 +28,7 @@ module Stripe
28
28
  )
29
29
  end
30
30
 
31
- # Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the
31
+ # Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
32
32
  # reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
33
33
  # might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
34
34
  # provides 90 days advance notice and refunds the amount_total.
@@ -2,8 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
- # A customer session allows you to grant client access to Stripe's frontend SDKs (like StripeJs)
6
- # control over a customer.
5
+ # A Customer Session allows you to grant Stripe's frontend SDKs (like Stripe.js) client-side access
6
+ # control over a Customer.
7
7
  class CustomerSession < APIResource
8
8
  extend Stripe::APIOperations::Create
9
9
 
@@ -12,7 +12,7 @@ module Stripe
12
12
  "customer_session"
13
13
  end
14
14
 
15
- # Creates a customer session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
15
+ # Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
16
16
  def self.create(params = {}, opts = {})
17
17
  request_stripe_object(
18
18
  method: :post,
@@ -49,6 +49,26 @@ module Stripe
49
49
 
50
50
  nested_resource_class_methods :line, operations: %i[list]
51
51
 
52
+ # Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
53
+ def add_lines(params = {}, opts = {})
54
+ request_stripe_object(
55
+ method: :post,
56
+ path: format("/v1/invoices/%<invoice>s/add_lines", { invoice: CGI.escape(self["id"]) }),
57
+ params: params,
58
+ opts: opts
59
+ )
60
+ end
61
+
62
+ # Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
63
+ def self.add_lines(invoice, params = {}, opts = {})
64
+ request_stripe_object(
65
+ method: :post,
66
+ path: format("/v1/invoices/%<invoice>s/add_lines", { invoice: CGI.escape(invoice) }),
67
+ params: params,
68
+ opts: opts
69
+ )
70
+ end
71
+
52
72
  # This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
53
73
  def self.create(params = {}, opts = {})
54
74
  request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
@@ -165,6 +185,26 @@ module Stripe
165
185
  )
166
186
  end
167
187
 
188
+ # Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
189
+ def remove_lines(params = {}, opts = {})
190
+ request_stripe_object(
191
+ method: :post,
192
+ path: format("/v1/invoices/%<invoice>s/remove_lines", { invoice: CGI.escape(self["id"]) }),
193
+ params: params,
194
+ opts: opts
195
+ )
196
+ end
197
+
198
+ # Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
199
+ def self.remove_lines(invoice, params = {}, opts = {})
200
+ request_stripe_object(
201
+ method: :post,
202
+ path: format("/v1/invoices/%<invoice>s/remove_lines", { invoice: CGI.escape(invoice) }),
203
+ params: params,
204
+ opts: opts
205
+ )
206
+ end
207
+
168
208
  def self.search(params = {}, opts = {})
169
209
  request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts)
170
210
  end
@@ -223,6 +263,26 @@ module Stripe
223
263
  )
224
264
  end
225
265
 
266
+ # Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
267
+ def update_lines(params = {}, opts = {})
268
+ request_stripe_object(
269
+ method: :post,
270
+ path: format("/v1/invoices/%<invoice>s/update_lines", { invoice: CGI.escape(self["id"]) }),
271
+ params: params,
272
+ opts: opts
273
+ )
274
+ end
275
+
276
+ # Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
277
+ def self.update_lines(invoice, params = {}, opts = {})
278
+ request_stripe_object(
279
+ method: :post,
280
+ path: format("/v1/invoices/%<invoice>s/update_lines", { invoice: CGI.escape(invoice) }),
281
+ params: params,
282
+ opts: opts
283
+ )
284
+ end
285
+
226
286
  # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
227
287
  #
228
288
  # Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you're doing business in. You might need to [issue another invoice or <a href="#create_credit_note">credit note](https://stripe.com/docs/api#create_invoice) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.
@@ -152,6 +152,26 @@ module Stripe
152
152
  )
153
153
  end
154
154
 
155
+ # Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
156
+ def self.finalize_amount(authorization, params = {}, opts = {})
157
+ request_stripe_object(
158
+ method: :post,
159
+ path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/finalize_amount", { authorization: CGI.escape(authorization) }),
160
+ params: params,
161
+ opts: opts
162
+ )
163
+ end
164
+
165
+ # Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
166
+ def finalize_amount(params = {}, opts = {})
167
+ @resource.request_stripe_object(
168
+ method: :post,
169
+ path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/finalize_amount", { authorization: CGI.escape(@resource["id"]) }),
170
+ params: params,
171
+ opts: opts
172
+ )
173
+ end
174
+
155
175
  # Increment a test-mode Authorization.
156
176
  def self.increment(authorization, params = {}, opts = {})
157
177
  request_stripe_object(
@@ -35,7 +35,7 @@ module Stripe
35
35
 
36
36
  # You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
37
37
  #
38
- # After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
38
+ # After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. You can't cancel the SetupIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
39
39
  def cancel(params = {}, opts = {})
40
40
  request_stripe_object(
41
41
  method: :post,
@@ -47,7 +47,7 @@ module Stripe
47
47
 
48
48
  # You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
49
49
  #
50
- # After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
50
+ # After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. You can't cancel the SetupIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
51
51
  def self.cancel(intent, params = {}, opts = {})
52
52
  request_stripe_object(
53
53
  method: :post,
@@ -14,7 +14,7 @@ module Stripe
14
14
  "tax.calculation"
15
15
  end
16
16
 
17
- # Calculates tax based on input and returns a Tax Calculation object.
17
+ # Calculates tax based on the input and returns a Tax Calculation object.
18
18
  def self.create(params = {}, opts = {})
19
19
  request_stripe_object(
20
20
  method: :post,
@@ -24,7 +24,7 @@ module Stripe
24
24
  )
25
25
  end
26
26
 
27
- # Retrieves the line items of a persisted tax calculation as a collection.
27
+ # Retrieves the line items of a tax calculation as a collection, if the calculation hasn't expired.
28
28
  def list_line_items(params = {}, opts = {})
29
29
  request_stripe_object(
30
30
  method: :get,
@@ -34,7 +34,7 @@ module Stripe
34
34
  )
35
35
  end
36
36
 
37
- # Retrieves the line items of a persisted tax calculation as a collection.
37
+ # Retrieves the line items of a tax calculation as a collection, if the calculation hasn't expired.
38
38
  def self.list_line_items(calculation, params = {}, opts = {})
39
39
  request_stripe_object(
40
40
  method: :get,
@@ -12,7 +12,7 @@ module Stripe
12
12
  "tax.transaction"
13
13
  end
14
14
 
15
- # Creates a Tax Transaction from a calculation.
15
+ # Creates a Tax Transaction from a calculation, if that calculation hasn't expired. Calculations expire after 90 days.
16
16
  def self.create_from_calculation(params = {}, opts = {})
17
17
  request_stripe_object(
18
18
  method: :post,
@@ -366,7 +366,7 @@ module Stripe
366
366
  # garbage in `Thread.current`.
367
367
  attr_accessor :last_responses
368
368
 
369
- # A map of connection mangers for the thread. Normally shared between
369
+ # A map of connection managers for the thread. Normally shared between
370
370
  # all `StripeClient` objects on a particular thread, and created so as to
371
371
  # minimize the number of open connections that an application needs.
372
372
  def default_connection_managers
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "11.7.0"
4
+ VERSION = "12.1.0"
5
5
  end
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: 11.7.0
4
+ version: 12.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-14 00:00:00.000000000 Z
11
+ date: 2024-07-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
14
14
  for details.