stripe 6.0.0 → 7.0.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -2
  3. data/Makefile +1 -1
  4. data/OPENAPI_VERSION +1 -0
  5. data/README.md +1 -1
  6. data/VERSION +1 -1
  7. data/lib/data/ca-certificates.crt +1241 -1937
  8. data/lib/stripe/api_operations/create.rb +6 -2
  9. data/lib/stripe/api_operations/delete.rb +12 -7
  10. data/lib/stripe/api_operations/list.rb +6 -9
  11. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  12. data/lib/stripe/api_operations/request.rb +10 -0
  13. data/lib/stripe/api_operations/save.rb +6 -3
  14. data/lib/stripe/api_operations/search.rb +6 -9
  15. data/lib/stripe/api_resource.rb +1 -1
  16. data/lib/stripe/api_resource_test_helpers.rb +2 -0
  17. data/lib/stripe/api_version.rb +8 -0
  18. data/lib/stripe/object_types.rb +11 -7
  19. data/lib/stripe/resources/account.rb +28 -8
  20. data/lib/stripe/resources/apps/secret.rb +31 -0
  21. data/lib/stripe/resources/card.rb +1 -3
  22. data/lib/stripe/resources/charge.rb +10 -3
  23. data/lib/stripe/resources/checkout/session.rb +27 -5
  24. data/lib/stripe/resources/credit_note.rb +24 -9
  25. data/lib/stripe/resources/customer.rb +104 -19
  26. data/lib/stripe/resources/dispute.rb +10 -3
  27. data/lib/stripe/resources/financial_connections/account.rb +40 -5
  28. data/lib/stripe/resources/identity/verification_session.rb +20 -5
  29. data/lib/stripe/resources/invoice.rb +64 -17
  30. data/lib/stripe/resources/issuing/authorization.rb +20 -5
  31. data/lib/stripe/resources/issuing/card.rb +78 -9
  32. data/lib/stripe/resources/issuing/dispute.rb +10 -3
  33. data/lib/stripe/resources/order.rb +40 -9
  34. data/lib/stripe/resources/payment_intent.rb +60 -13
  35. data/lib/stripe/resources/payment_link.rb +10 -3
  36. data/lib/stripe/resources/payment_method.rb +20 -5
  37. data/lib/stripe/resources/payout.rb +20 -5
  38. data/lib/stripe/resources/quote.rb +50 -11
  39. data/lib/stripe/resources/refund.rb +19 -5
  40. data/lib/stripe/resources/reporting/report_type.rb +0 -1
  41. data/lib/stripe/resources/review.rb +10 -3
  42. data/lib/stripe/resources/setup_intent.rb +30 -7
  43. data/lib/stripe/resources/source.rb +16 -6
  44. data/lib/stripe/resources/subscription.rb +52 -3
  45. data/lib/stripe/resources/subscription_item.rb +0 -7
  46. data/lib/stripe/resources/subscription_schedule.rb +20 -5
  47. data/lib/stripe/resources/terminal/reader.rb +49 -11
  48. data/lib/stripe/resources/test_helpers/test_clock.rb +10 -3
  49. data/lib/stripe/resources/topup.rb +10 -3
  50. data/lib/stripe/resources/transfer.rb +0 -11
  51. data/lib/stripe/resources/treasury/credit_reversal.rb +13 -0
  52. data/lib/stripe/resources/treasury/debit_reversal.rb +13 -0
  53. data/lib/stripe/resources/treasury/financial_account.rb +50 -0
  54. data/lib/stripe/resources/treasury/inbound_transfer.rb +93 -0
  55. data/lib/stripe/resources/treasury/outbound_payment.rb +93 -0
  56. data/lib/stripe/resources/treasury/outbound_transfer.rb +97 -0
  57. data/lib/stripe/resources/treasury/received_credit.rb +29 -0
  58. data/lib/stripe/resources/treasury/received_debit.rb +29 -0
  59. data/lib/stripe/resources/treasury/transaction.rb +12 -0
  60. data/lib/stripe/resources/treasury/transaction_entry.rb +16 -0
  61. data/lib/stripe/resources.rb +11 -7
  62. data/lib/stripe/util.rb +38 -3
  63. data/lib/stripe/version.rb +1 -1
  64. metadata +16 -8
  65. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  66. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  67. data/lib/stripe/resources/issuing/card_details.rb +0 -10
  68. data/lib/stripe/resources/recipient.rb +0 -14
  69. data/lib/stripe/resources/three_d_secure.rb +0 -14
data/lib/stripe/util.rb CHANGED
@@ -90,7 +90,7 @@ module Stripe
90
90
  opts
91
91
  )
92
92
 
93
- Util.convert_to_stripe_object(resp.data, opts)
93
+ Util.convert_to_stripe_object_with_params(resp.data, params, opts)
94
94
  end
95
95
  end
96
96
 
@@ -104,9 +104,27 @@ module Stripe
104
104
  # ==== Attributes
105
105
  #
106
106
  # * +data+ - Hash of fields and values to be converted into a StripeObject.
107
+ # * +params+ - Params for +StripeObject+ like filters used in search that
108
+ # will be reused on subsequent API calls.
107
109
  # * +opts+ - Options for +StripeObject+ like an API key that will be reused
108
110
  # on subsequent API calls.
109
111
  def self.convert_to_stripe_object(data, opts = {})
112
+ convert_to_stripe_object_with_params(data, {}, opts)
113
+ end
114
+
115
+ # Converts a hash of fields or an array of hashes into a +StripeObject+ or
116
+ # array of +StripeObject+s. These new objects will be created as a concrete
117
+ # type as dictated by their `object` field (e.g. an `object` value of
118
+ # `charge` would create an instance of +Charge+), but if `object` is not
119
+ # present or of an unknown type, the newly created instance will fall back
120
+ # to being a +StripeObject+.
121
+ #
122
+ # ==== Attributes
123
+ #
124
+ # * +data+ - Hash of fields and values to be converted into a StripeObject.
125
+ # * +opts+ - Options for +StripeObject+ like an API key that will be reused
126
+ # on subsequent API calls.
127
+ def self.convert_to_stripe_object_with_params(data, params, opts = {})
110
128
  opts = normalize_opts(opts)
111
129
 
112
130
  case data
@@ -115,8 +133,16 @@ module Stripe
115
133
  when Hash
116
134
  # Try converting to a known object class. If none available, fall back
117
135
  # to generic StripeObject
118
- object_classes.fetch(data[:object], StripeObject)
119
- .construct_from(data, opts)
136
+ obj = object_classes.fetch(data[:object], StripeObject)
137
+ .construct_from(data, opts)
138
+
139
+ # set filters so that we can fetch the same limit, expansions, and
140
+ # predicates when accessing the next and previous pages
141
+ if obj && (obj.is_a?(SearchResultObject) || obj.is_a?(ListObject))
142
+ obj.filters = params.dup
143
+ end
144
+
145
+ obj
120
146
  else
121
147
  data
122
148
  end
@@ -390,6 +416,15 @@ module Stripe
390
416
  # Hopefully val is a string, but protect in case it's not.
391
417
  val = val.to_s
392
418
 
419
+ # Some values returned by the server are encoded in ASCII-8BIT before
420
+ # being parsed as UTF-8 by Marshal. If we don't transform these here, then
421
+ # puts will fail as it tries to render UTF-8 characters as ASCII-8BIT
422
+ # which is not valid.
423
+ if val && val.encoding == Encoding::ASCII_8BIT
424
+ # Dup the string as it is a frozen literal.
425
+ val = val.dup.force_encoding("UTF-8")
426
+ end
427
+
393
428
  if %r{[^\w\-/]} =~ val
394
429
  # If the string contains any special characters, escape any double
395
430
  # quotes it has, remove newlines, and wrap the whole thing in quotes.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "6.0.0"
4
+ VERSION = "7.0.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: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-09 00:00:00.000000000 Z
11
+ date: 2022-08-02 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.
@@ -25,6 +25,7 @@ files:
25
25
  - History.txt
26
26
  - LICENSE
27
27
  - Makefile
28
+ - OPENAPI_VERSION
28
29
  - README.md
29
30
  - Rakefile
30
31
  - VERSION
@@ -40,6 +41,7 @@ files:
40
41
  - lib/stripe/api_operations/search.rb
41
42
  - lib/stripe/api_resource.rb
42
43
  - lib/stripe/api_resource_test_helpers.rb
44
+ - lib/stripe/api_version.rb
43
45
  - lib/stripe/connection_manager.rb
44
46
  - lib/stripe/error_object.rb
45
47
  - lib/stripe/errors.rb
@@ -55,13 +57,12 @@ files:
55
57
  - lib/stripe/resources/apple_pay_domain.rb
56
58
  - lib/stripe/resources/application_fee.rb
57
59
  - lib/stripe/resources/application_fee_refund.rb
60
+ - lib/stripe/resources/apps/secret.rb
58
61
  - lib/stripe/resources/balance.rb
59
62
  - lib/stripe/resources/balance_transaction.rb
60
63
  - lib/stripe/resources/bank_account.rb
61
64
  - lib/stripe/resources/billing_portal/configuration.rb
62
65
  - lib/stripe/resources/billing_portal/session.rb
63
- - lib/stripe/resources/bitcoin_receiver.rb
64
- - lib/stripe/resources/bitcoin_transaction.rb
65
66
  - lib/stripe/resources/capability.rb
66
67
  - lib/stripe/resources/card.rb
67
68
  - lib/stripe/resources/cash_balance.rb
@@ -92,7 +93,6 @@ files:
92
93
  - lib/stripe/resources/invoice_line_item.rb
93
94
  - lib/stripe/resources/issuing/authorization.rb
94
95
  - lib/stripe/resources/issuing/card.rb
95
- - lib/stripe/resources/issuing/card_details.rb
96
96
  - lib/stripe/resources/issuing/cardholder.rb
97
97
  - lib/stripe/resources/issuing/dispute.rb
98
98
  - lib/stripe/resources/issuing/transaction.rb
@@ -113,7 +113,6 @@ files:
113
113
  - lib/stripe/resources/radar/early_fraud_warning.rb
114
114
  - lib/stripe/resources/radar/value_list.rb
115
115
  - lib/stripe/resources/radar/value_list_item.rb
116
- - lib/stripe/resources/recipient.rb
117
116
  - lib/stripe/resources/recipient_transfer.rb
118
117
  - lib/stripe/resources/refund.rb
119
118
  - lib/stripe/resources/reporting/report_run.rb
@@ -138,10 +137,19 @@ files:
138
137
  - lib/stripe/resources/terminal/location.rb
139
138
  - lib/stripe/resources/terminal/reader.rb
140
139
  - lib/stripe/resources/test_helpers/test_clock.rb
141
- - lib/stripe/resources/three_d_secure.rb
142
140
  - lib/stripe/resources/token.rb
143
141
  - lib/stripe/resources/topup.rb
144
142
  - lib/stripe/resources/transfer.rb
143
+ - lib/stripe/resources/treasury/credit_reversal.rb
144
+ - lib/stripe/resources/treasury/debit_reversal.rb
145
+ - lib/stripe/resources/treasury/financial_account.rb
146
+ - lib/stripe/resources/treasury/inbound_transfer.rb
147
+ - lib/stripe/resources/treasury/outbound_payment.rb
148
+ - lib/stripe/resources/treasury/outbound_transfer.rb
149
+ - lib/stripe/resources/treasury/received_credit.rb
150
+ - lib/stripe/resources/treasury/received_debit.rb
151
+ - lib/stripe/resources/treasury/transaction.rb
152
+ - lib/stripe/resources/treasury/transaction_entry.rb
145
153
  - lib/stripe/resources/usage_record.rb
146
154
  - lib/stripe/resources/usage_record_summary.rb
147
155
  - lib/stripe/resources/webhook_endpoint.rb
@@ -180,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
188
  - !ruby/object:Gem::Version
181
189
  version: '0'
182
190
  requirements: []
183
- rubygems_version: 3.1.2
191
+ rubygems_version: 3.3.7
184
192
  signing_key:
185
193
  specification_version: 4
186
194
  summary: Ruby bindings for the Stripe API
@@ -1,24 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- # Directly creating or retrieving BitcoinReceivers is deprecated. Please use
6
- # the Sources API instead: https://stripe.com/docs/sources/bitcoin
7
- class BitcoinReceiver < APIResource
8
- extend Stripe::APIOperations::List
9
-
10
- OBJECT_NAME = "bitcoin_receiver"
11
-
12
- def self.resource_url
13
- "/v1/bitcoin/receivers"
14
- end
15
-
16
- def resource_url
17
- if respond_to?(:customer) && !customer.nil? && customer != ""
18
- "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
19
- else
20
- "#{self.class.resource_url}/#{CGI.escape(id)}"
21
- end
22
- end
23
- end
24
- end
@@ -1,16 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- # Directly retrieving BitcoinTransactions is deprecated. Please use
6
- # the Sources API instead: https://stripe.com/docs/sources/bitcoin
7
- class BitcoinTransaction < APIResource
8
- extend Stripe::APIOperations::List
9
-
10
- OBJECT_NAME = "bitcoin_transaction"
11
-
12
- def self.resource_url
13
- "/v1/bitcoin/transactions"
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- module Issuing
6
- class CardDetails < StripeObject
7
- OBJECT_NAME = "issuing.card_details"
8
- end
9
- end
10
- end
@@ -1,14 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- # Recipients objects are deprecated. Please use Stripe Connect instead.
6
- class Recipient < APIResource
7
- extend Stripe::APIOperations::Create
8
- include Stripe::APIOperations::Delete
9
- extend Stripe::APIOperations::List
10
- include Stripe::APIOperations::Save
11
-
12
- OBJECT_NAME = "recipient"
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- class ThreeDSecure < APIResource
6
- extend Stripe::APIOperations::Create
7
-
8
- OBJECT_NAME = "three_d_secure"
9
-
10
- def self.resource_url
11
- "/v1/3d_secure"
12
- end
13
- end
14
- end