stripe 5.55.0 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +122 -2
  3. data/Gemfile +1 -0
  4. data/Makefile +1 -1
  5. data/OPENAPI_VERSION +1 -0
  6. data/README.md +37 -3
  7. data/VERSION +1 -1
  8. data/lib/data/ca-certificates.crt +1241 -1937
  9. data/lib/stripe/api_operations/create.rb +6 -2
  10. data/lib/stripe/api_operations/delete.rb +12 -7
  11. data/lib/stripe/api_operations/list.rb +6 -9
  12. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  13. data/lib/stripe/api_operations/request.rb +10 -0
  14. data/lib/stripe/api_operations/save.rb +11 -3
  15. data/lib/stripe/api_operations/search.rb +6 -9
  16. data/lib/stripe/api_resource.rb +1 -1
  17. data/lib/stripe/api_resource_test_helpers.rb +2 -0
  18. data/lib/stripe/api_version.rb +8 -0
  19. data/lib/stripe/instrumentation.rb +45 -7
  20. data/lib/stripe/object_types.rb +12 -10
  21. data/lib/stripe/resources/account.rb +36 -9
  22. data/lib/stripe/resources/account_link.rb +4 -0
  23. data/lib/stripe/resources/application_fee_refund.rb +5 -0
  24. data/lib/stripe/resources/apps/secret.rb +40 -0
  25. data/lib/stripe/resources/balance.rb +11 -0
  26. data/lib/stripe/resources/balance_transaction.rb +4 -0
  27. data/lib/stripe/resources/bank_account.rb +7 -0
  28. data/lib/stripe/resources/billing_portal/configuration.rb +1 -0
  29. data/lib/stripe/resources/billing_portal/session.rb +14 -0
  30. data/lib/stripe/resources/capability.rb +3 -0
  31. data/lib/stripe/resources/card.rb +6 -3
  32. data/lib/stripe/resources/cash_balance.rb +1 -0
  33. data/lib/stripe/resources/charge.rb +15 -3
  34. data/lib/stripe/resources/checkout/session.rb +41 -5
  35. data/lib/stripe/resources/country_spec.rb +6 -0
  36. data/lib/stripe/resources/coupon.rb +3 -0
  37. data/lib/stripe/resources/credit_note.rb +27 -9
  38. data/lib/stripe/resources/customer.rb +109 -19
  39. data/lib/stripe/resources/customer_balance_transaction.rb +6 -0
  40. data/lib/stripe/resources/customer_cash_balance_transaction.rb +14 -0
  41. data/lib/stripe/resources/discount.rb +4 -0
  42. data/lib/stripe/resources/dispute.rb +17 -3
  43. data/lib/stripe/resources/event.rb +29 -0
  44. data/lib/stripe/resources/exchange_rate.rb +11 -0
  45. data/lib/stripe/resources/file.rb +7 -0
  46. data/lib/stripe/resources/file_link.rb +3 -0
  47. data/lib/stripe/resources/financial_connections/account.rb +42 -6
  48. data/lib/stripe/resources/financial_connections/account_ownership.rb +1 -0
  49. data/lib/stripe/resources/financial_connections/session.rb +1 -0
  50. data/lib/stripe/resources/funding_instructions.rb +5 -0
  51. data/lib/stripe/resources/identity/verification_report.rb +11 -0
  52. data/lib/stripe/resources/identity/verification_session.rb +31 -5
  53. data/lib/stripe/resources/invoice.rb +96 -17
  54. data/lib/stripe/resources/invoice_item.rb +11 -0
  55. data/lib/stripe/resources/issuing/authorization.rb +25 -5
  56. data/lib/stripe/resources/issuing/card.rb +78 -8
  57. data/lib/stripe/resources/issuing/cardholder.rb +3 -0
  58. data/lib/stripe/resources/issuing/dispute.rb +13 -3
  59. data/lib/stripe/resources/issuing/transaction.rb +5 -0
  60. data/lib/stripe/resources/line_item.rb +1 -0
  61. data/lib/stripe/resources/mandate.rb +1 -0
  62. data/lib/stripe/resources/payment_intent.rb +71 -13
  63. data/lib/stripe/resources/payment_link.rb +15 -3
  64. data/lib/stripe/resources/payment_method.rb +25 -5
  65. data/lib/stripe/resources/payout.rb +28 -5
  66. data/lib/stripe/resources/person.rb +6 -0
  67. data/lib/stripe/resources/plan.rb +8 -0
  68. data/lib/stripe/resources/price.rb +6 -0
  69. data/lib/stripe/resources/product.rb +8 -0
  70. data/lib/stripe/resources/promotion_code.rb +2 -0
  71. data/lib/stripe/resources/quote.rb +52 -11
  72. data/lib/stripe/resources/radar/early_fraud_warning.rb +4 -0
  73. data/lib/stripe/resources/radar/value_list.rb +3 -0
  74. data/lib/stripe/resources/radar/value_list_item.rb +3 -0
  75. data/lib/stripe/resources/refund.rb +24 -5
  76. data/lib/stripe/resources/reporting/report_run.rb +8 -0
  77. data/lib/stripe/resources/reporting/report_type.rb +8 -1
  78. data/lib/stripe/resources/reversal.rb +13 -0
  79. data/lib/stripe/resources/review.rb +14 -3
  80. data/lib/stripe/resources/setup_attempt.rb +4 -0
  81. data/lib/stripe/resources/setup_intent.rb +52 -7
  82. data/lib/stripe/resources/shipping_rate.rb +3 -0
  83. data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -0
  84. data/lib/stripe/resources/source.rb +26 -6
  85. data/lib/stripe/resources/source_transaction.rb +4 -0
  86. data/lib/stripe/resources/subscription.rb +48 -3
  87. data/lib/stripe/resources/subscription_item.rb +2 -7
  88. data/lib/stripe/resources/subscription_schedule.rb +23 -5
  89. data/lib/stripe/resources/tax_code.rb +1 -0
  90. data/lib/stripe/resources/tax_id.rb +4 -0
  91. data/lib/stripe/resources/tax_rate.rb +3 -0
  92. data/lib/stripe/resources/terminal/configuration.rb +1 -0
  93. data/lib/stripe/resources/terminal/connection_token.rb +3 -0
  94. data/lib/stripe/resources/terminal/location.rb +3 -0
  95. data/lib/stripe/resources/terminal/reader.rb +70 -11
  96. data/lib/stripe/resources/test_helpers/test_clock.rb +13 -3
  97. data/lib/stripe/resources/token.rb +22 -0
  98. data/lib/stripe/resources/topup.rb +15 -3
  99. data/lib/stripe/resources/transfer.rb +10 -11
  100. data/lib/stripe/resources/treasury/credit_reversal.rb +14 -0
  101. data/lib/stripe/resources/treasury/debit_reversal.rb +14 -0
  102. data/lib/stripe/resources/treasury/financial_account.rb +52 -0
  103. data/lib/stripe/resources/treasury/inbound_transfer.rb +94 -0
  104. data/lib/stripe/resources/treasury/outbound_payment.rb +96 -0
  105. data/lib/stripe/resources/treasury/outbound_transfer.rb +100 -0
  106. data/lib/stripe/resources/treasury/received_credit.rb +30 -0
  107. data/lib/stripe/resources/treasury/received_debit.rb +30 -0
  108. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  109. data/lib/stripe/resources/treasury/transaction_entry.rb +17 -0
  110. data/lib/stripe/resources/usage_record.rb +4 -0
  111. data/lib/stripe/resources/webhook_endpoint.rb +7 -0
  112. data/lib/stripe/resources.rb +12 -10
  113. data/lib/stripe/stripe_client.rb +25 -17
  114. data/lib/stripe/stripe_object.rb +2 -2
  115. data/lib/stripe/util.rb +38 -3
  116. data/lib/stripe/version.rb +1 -1
  117. metadata +17 -11
  118. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  119. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  120. data/lib/stripe/resources/issuing/card_details.rb +0 -10
  121. data/lib/stripe/resources/order.rb +0 -33
  122. data/lib/stripe/resources/order_return.rb +0 -10
  123. data/lib/stripe/resources/recipient.rb +0 -14
  124. data/lib/stripe/resources/sku.rb +0 -13
  125. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -4,8 +4,12 @@ module Stripe
4
4
  module APIOperations
5
5
  module Create
6
6
  def create(params = {}, opts = {})
7
- resp, opts = execute_resource_request(:post, resource_url, params, opts)
8
- Util.convert_to_stripe_object(resp.data, opts)
7
+ request_stripe_object(
8
+ method: :post,
9
+ path: resource_url,
10
+ params: params,
11
+ opts: opts
12
+ )
9
13
  end
10
14
  end
11
15
  end
@@ -18,17 +18,22 @@ module Stripe
18
18
  # api_key to be overwritten. See
19
19
  # {APIOperations::Request.execute_resource_request}.
20
20
  def delete(id, params = {}, opts = {})
21
- resp, opts = execute_resource_request(:delete,
22
- "#{resource_url}/#{id}",
23
- params, opts)
24
- Util.convert_to_stripe_object(resp.data, opts)
21
+ request_stripe_object(
22
+ method: :delete,
23
+ path: "#{resource_url}/#{id}",
24
+ params: params,
25
+ opts: opts
26
+ )
25
27
  end
26
28
  end
27
29
 
28
30
  def delete(params = {}, opts = {})
29
- resp, opts = execute_resource_request(:delete, resource_url,
30
- params, opts)
31
- initialize_from(resp.data, opts)
31
+ request_stripe_object(
32
+ method: :delete,
33
+ path: resource_url,
34
+ params: params,
35
+ opts: opts
36
+ )
32
37
  end
33
38
 
34
39
  def self.included(base)
@@ -4,15 +4,12 @@ module Stripe
4
4
  module APIOperations
5
5
  module List
6
6
  def list(filters = {}, opts = {})
7
- opts = Util.normalize_opts(opts)
8
-
9
- resp, opts = execute_resource_request(:get, resource_url, filters, opts)
10
- obj = ListObject.construct_from(resp.data, opts)
11
-
12
- # set filters so that we can fetch the same limit, expansions, and
13
- # predicates when accessing the next and previous pages
14
- obj.filters = filters.dup
15
- obj
7
+ request_stripe_object(
8
+ method: :get,
9
+ path: resource_url,
10
+ params: filters,
11
+ opts: opts
12
+ )
16
13
  end
17
14
  end
18
15
  end
@@ -26,46 +26,74 @@ module Stripe
26
26
  end
27
27
 
28
28
  operations.each do |operation|
29
- case operation
30
- when :create
31
- define_singleton_method(:"create_#{resource}") \
29
+ define_operation(
30
+ resource,
31
+ operation,
32
+ resource_url_method,
33
+ resource_plural
34
+ )
35
+ end
36
+ end
37
+
38
+ private def define_operation(
39
+ resource,
40
+ operation,
41
+ resource_url_method,
42
+ resource_plural
43
+ )
44
+ case operation
45
+ when :create
46
+ define_singleton_method(:"create_#{resource}") \
32
47
  do |id, params = {}, opts = {}|
33
- url = send(resource_url_method, id)
34
- resp, opts = execute_resource_request(:post, url, params, opts)
35
- Util.convert_to_stripe_object(resp.data, opts)
36
- end
37
- when :retrieve
38
- define_singleton_method(:"retrieve_#{resource}") \
48
+ request_stripe_object(
49
+ method: :post,
50
+ path: send(resource_url_method, id),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+ when :retrieve
56
+ define_singleton_method(:"retrieve_#{resource}") \
39
57
  do |id, nested_id, opts = {}|
40
- url = send(resource_url_method, id, nested_id)
41
- resp, opts = execute_resource_request(:get, url, {}, opts)
42
- Util.convert_to_stripe_object(resp.data, opts)
43
- end
44
- when :update
45
- define_singleton_method(:"update_#{resource}") \
58
+ request_stripe_object(
59
+ method: :get,
60
+ path: send(resource_url_method, id, nested_id),
61
+ params: {},
62
+ opts: opts
63
+ )
64
+ end
65
+ when :update
66
+ define_singleton_method(:"update_#{resource}") \
46
67
  do |id, nested_id, params = {}, opts = {}|
47
- url = send(resource_url_method, id, nested_id)
48
- resp, opts = execute_resource_request(:post, url, params, opts)
49
- Util.convert_to_stripe_object(resp.data, opts)
50
- end
51
- when :delete
52
- define_singleton_method(:"delete_#{resource}") \
68
+ request_stripe_object(
69
+ method: :post,
70
+ path: send(resource_url_method, id, nested_id),
71
+ params: params,
72
+ opts: opts
73
+ )
74
+ end
75
+ when :delete
76
+ define_singleton_method(:"delete_#{resource}") \
53
77
  do |id, nested_id, params = {}, opts = {}|
54
- url = send(resource_url_method, id, nested_id)
55
- resp, opts = execute_resource_request(:delete, url, params,
56
- opts)
57
- Util.convert_to_stripe_object(resp.data, opts)
58
- end
59
- when :list
60
- define_singleton_method(:"list_#{resource_plural}") \
78
+ request_stripe_object(
79
+ method: :delete,
80
+ path: send(resource_url_method, id, nested_id),
81
+ params: params,
82
+ opts: opts
83
+ )
84
+ end
85
+ when :list
86
+ define_singleton_method(:"list_#{resource_plural}") \
61
87
  do |id, params = {}, opts = {}|
62
- url = send(resource_url_method, id)
63
- resp, opts = execute_resource_request(:get, url, params, opts)
64
- Util.convert_to_stripe_object(resp.data, opts)
65
- end
66
- else
67
- raise ArgumentError, "Unknown operation: #{operation.inspect}"
88
+ request_stripe_object(
89
+ method: :get,
90
+ path: send(resource_url_method, id),
91
+ params: params,
92
+ opts: opts
93
+ )
68
94
  end
95
+ else
96
+ raise ArgumentError, "Unknown operation: #{operation.inspect}"
69
97
  end
70
98
  end
71
99
  end
@@ -24,6 +24,11 @@ module Stripe
24
24
  )
25
25
  end
26
26
 
27
+ private def request_stripe_object(method:, path:, params:, opts: {})
28
+ resp, opts = execute_resource_request(method, path, params, opts)
29
+ Util.convert_to_stripe_object_with_params(resp.data, params, opts)
30
+ end
31
+
27
32
  private def execute_resource_request_internal(client_request_method_sym,
28
33
  method, url,
29
34
  params, opts,
@@ -122,6 +127,11 @@ module Stripe
122
127
  )
123
128
  end
124
129
 
130
+ private def request_stripe_object(method:, path:, params:, opts: {})
131
+ resp, opts = execute_resource_request(method, path, params, opts)
132
+ Util.convert_to_stripe_object_with_params(resp.data, params, opts)
133
+ end
134
+
125
135
  # See notes on `alias` above.
126
136
  alias request execute_resource_request
127
137
  end
@@ -24,12 +24,18 @@ module Stripe
24
24
  end
25
25
  end
26
26
 
27
- resp, opts = execute_resource_request(:post, "#{resource_url}/#{id}",
28
- params, opts)
29
- Util.convert_to_stripe_object(resp.data, opts)
27
+ request_stripe_object(
28
+ method: :post,
29
+ path: "#{resource_url}/#{id}",
30
+ params: params,
31
+ opts: opts
32
+ )
30
33
  end
31
34
  end
32
35
 
36
+ # The `save` method is DEPRECATED and will be removed in a future major
37
+ # version of the library. Use the `update` method on the resource instead.
38
+ #
33
39
  # Creates or updates an API resource.
34
40
  #
35
41
  # If the resource doesn't yet have an assigned ID and the resource is one
@@ -65,6 +71,8 @@ module Stripe
65
71
  resp, opts = execute_resource_request(:post, save_url, values, opts)
66
72
  initialize_from(resp.data, opts)
67
73
  end
74
+ extend Gem::Deprecate
75
+ deprecate :save, :update, 2022, 11
68
76
 
69
77
  def self.included(base)
70
78
  # Set `metadata` as additive so that when it's set directly we remember
@@ -4,15 +4,12 @@ module Stripe
4
4
  module APIOperations
5
5
  module Search
6
6
  def _search(search_url, filters = {}, opts = {})
7
- opts = Util.normalize_opts(opts)
8
-
9
- resp, opts = execute_resource_request(:get, search_url, filters, opts)
10
- obj = SearchResultObject.construct_from(resp.data, opts)
11
-
12
- # set filters so that we can fetch the same limit and query
13
- # when accessing the next page
14
- obj.filters = filters.dup
15
- obj
7
+ request_stripe_object(
8
+ method: :get,
9
+ path: search_url,
10
+ params: filters,
11
+ opts: opts
12
+ )
16
13
  end
17
14
  end
18
15
  end
@@ -97,7 +97,7 @@ module Stripe
97
97
  if Util.object_name_matches_class?(resp.data[:object], self.class)
98
98
  initialize_from(resp.data, opts)
99
99
  else
100
- Util.convert_to_stripe_object(resp.data, opts)
100
+ Util.convert_to_stripe_object_with_params(resp.data, params, opts)
101
101
  end
102
102
  end
103
103
 
@@ -8,6 +8,8 @@ module Stripe
8
8
  # class MyAPIResource < APIResource
9
9
  # class TestHelpers < APIResourceTestHelpers
10
10
  class APIResourceTestHelpers
11
+ include Stripe::APIOperations::Request
12
+
11
13
  def initialize(resource)
12
14
  @resource = resource
13
15
  end
@@ -0,0 +1,8 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module ApiVersion
6
+ CURRENT = "2022-11-15"
7
+ end
8
+ end
@@ -33,6 +33,10 @@ module Stripe
33
33
  attr_reader :num_retries
34
34
  attr_reader :path
35
35
  attr_reader :request_id
36
+ attr_reader :response_header
37
+ attr_reader :response_body
38
+ attr_reader :request_header
39
+ attr_reader :request_body
36
40
 
37
41
  # Arbitrary user-provided data in the form of a Ruby hash that's passed
38
42
  # from subscribers on `request_begin` to subscribers on `request_end`.
@@ -40,19 +44,53 @@ module Stripe
40
44
  # in `request_end`.
41
45
  attr_reader :user_data
42
46
 
43
- def initialize(duration:, http_status:, method:, num_retries:, path:,
44
- request_id:, user_data: nil)
45
- @duration = duration
46
- @http_status = http_status
47
- @method = method
47
+ def initialize(request_context:, response_context:,
48
+ num_retries:, user_data: nil)
49
+ @duration = request_context.duration
50
+ @http_status = response_context.http_status
51
+ @method = request_context.method
48
52
  @num_retries = num_retries
49
- @path = path
50
- @request_id = request_id
53
+ @path = request_context.path
54
+ @request_id = request_context.request_id
51
55
  @user_data = user_data
56
+ @response_header = response_context.header
57
+ @response_body = response_context.body
58
+ @request_header = request_context.header
59
+ @request_body = request_context.body
52
60
  freeze
53
61
  end
54
62
  end
55
63
 
64
+ class RequestContext
65
+ attr_reader :duration
66
+ attr_reader :method
67
+ attr_reader :path
68
+ attr_reader :request_id
69
+ attr_reader :body
70
+ attr_reader :header
71
+
72
+ def initialize(duration:, context:, header:)
73
+ @duration = duration
74
+ @method = context.method
75
+ @path = context.path
76
+ @request_id = context.request_id
77
+ @body = context.body
78
+ @header = header
79
+ end
80
+ end
81
+
82
+ class ResponseContext
83
+ attr_reader :http_status
84
+ attr_reader :body
85
+ attr_reader :header
86
+
87
+ def initialize(http_status:, response:)
88
+ @http_status = http_status
89
+ @header = response ? response.to_hash : nil
90
+ @body = response ? response.body : nil
91
+ end
92
+ end
93
+
56
94
  # This class was renamed for consistency. This alias is here for backwards
57
95
  # compatibility.
58
96
  RequestEvent = RequestEndEvent
@@ -14,17 +14,15 @@ module Stripe
14
14
  # business objects
15
15
  Account::OBJECT_NAME => Account,
16
16
  AccountLink::OBJECT_NAME => AccountLink,
17
- AlipayAccount::OBJECT_NAME => AlipayAccount,
18
17
  ApplePayDomain::OBJECT_NAME => ApplePayDomain,
19
18
  ApplicationFee::OBJECT_NAME => ApplicationFee,
20
19
  ApplicationFeeRefund::OBJECT_NAME => ApplicationFeeRefund,
20
+ Apps::Secret::OBJECT_NAME => Apps::Secret,
21
21
  Balance::OBJECT_NAME => Balance,
22
22
  BalanceTransaction::OBJECT_NAME => BalanceTransaction,
23
23
  BankAccount::OBJECT_NAME => BankAccount,
24
24
  BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
25
25
  BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
26
- BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
27
- BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
28
26
  Capability::OBJECT_NAME => Capability,
29
27
  Card::OBJECT_NAME => Card,
30
28
  CashBalance::OBJECT_NAME => CashBalance,
@@ -36,6 +34,7 @@ module Stripe
36
34
  CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
37
35
  Customer::OBJECT_NAME => Customer,
38
36
  CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
37
+ CustomerCashBalanceTransaction::OBJECT_NAME => CustomerCashBalanceTransaction,
39
38
  Discount::OBJECT_NAME => Discount,
40
39
  Dispute::OBJECT_NAME => Dispute,
41
40
  EphemeralKey::OBJECT_NAME => EphemeralKey,
@@ -57,15 +56,12 @@ module Stripe
57
56
  InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
58
57
  Issuing::Authorization::OBJECT_NAME => Issuing::Authorization,
59
58
  Issuing::Card::OBJECT_NAME => Issuing::Card,
60
- Issuing::CardDetails::OBJECT_NAME => Issuing::CardDetails,
61
59
  Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
62
60
  Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
63
61
  Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
64
62
  LineItem::OBJECT_NAME => LineItem,
65
63
  LoginLink::OBJECT_NAME => LoginLink,
66
64
  Mandate::OBJECT_NAME => Mandate,
67
- Order::OBJECT_NAME => Order,
68
- OrderReturn::OBJECT_NAME => OrderReturn,
69
65
  PaymentIntent::OBJECT_NAME => PaymentIntent,
70
66
  PaymentLink::OBJECT_NAME => PaymentLink,
71
67
  PaymentMethod::OBJECT_NAME => PaymentMethod,
@@ -79,8 +75,6 @@ module Stripe
79
75
  Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
80
76
  Radar::ValueList::OBJECT_NAME => Radar::ValueList,
81
77
  Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
82
- Recipient::OBJECT_NAME => Recipient,
83
- RecipientTransfer::OBJECT_NAME => RecipientTransfer,
84
78
  Refund::OBJECT_NAME => Refund,
85
79
  Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun,
86
80
  Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
@@ -90,7 +84,6 @@ module Stripe
90
84
  SetupIntent::OBJECT_NAME => SetupIntent,
91
85
  ShippingRate::OBJECT_NAME => ShippingRate,
92
86
  Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
93
- SKU::OBJECT_NAME => SKU,
94
87
  Source::OBJECT_NAME => Source,
95
88
  SourceTransaction::OBJECT_NAME => SourceTransaction,
96
89
  Subscription::OBJECT_NAME => Subscription,
@@ -104,10 +97,19 @@ module Stripe
104
97
  Terminal::Location::OBJECT_NAME => Terminal::Location,
105
98
  Terminal::Reader::OBJECT_NAME => Terminal::Reader,
106
99
  TestHelpers::TestClock::OBJECT_NAME => TestHelpers::TestClock,
107
- ThreeDSecure::OBJECT_NAME => ThreeDSecure,
108
100
  Token::OBJECT_NAME => Token,
109
101
  Topup::OBJECT_NAME => Topup,
110
102
  Transfer::OBJECT_NAME => Transfer,
103
+ Treasury::CreditReversal::OBJECT_NAME => Treasury::CreditReversal,
104
+ Treasury::DebitReversal::OBJECT_NAME => Treasury::DebitReversal,
105
+ Treasury::FinancialAccount::OBJECT_NAME => Treasury::FinancialAccount,
106
+ Treasury::InboundTransfer::OBJECT_NAME => Treasury::InboundTransfer,
107
+ Treasury::OutboundPayment::OBJECT_NAME => Treasury::OutboundPayment,
108
+ Treasury::OutboundTransfer::OBJECT_NAME => Treasury::OutboundTransfer,
109
+ Treasury::ReceivedCredit::OBJECT_NAME => Treasury::ReceivedCredit,
110
+ Treasury::ReceivedDebit::OBJECT_NAME => Treasury::ReceivedDebit,
111
+ Treasury::Transaction::OBJECT_NAME => Treasury::Transaction,
112
+ Treasury::TransactionEntry::OBJECT_NAME => Treasury::TransactionEntry,
111
113
  UsageRecord::OBJECT_NAME => UsageRecord,
112
114
  UsageRecordSummary::OBJECT_NAME => UsageRecordSummary,
113
115
  WebhookEndpoint::OBJECT_NAME => WebhookEndpoint,
@@ -2,6 +2,14 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # This is an object representing a Stripe account. You can retrieve it to see
6
+ # properties on the account like its current requirements or if the account is
7
+ # enabled to make live charges or receive payouts.
8
+ #
9
+ # For Custom accounts, the properties below are always returned. For other accounts, some properties are returned until that
10
+ # account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links)
11
+ # for a Standard or Express account, some parameters are no longer returned. These are marked as **Custom Only** or **Custom and Express**
12
+ # below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts).
5
13
  class Account < APIResource
6
14
  extend Gem::Deprecate
7
15
  extend Stripe::APIOperations::Create
@@ -12,18 +20,43 @@ module Stripe
12
20
 
13
21
  OBJECT_NAME = "account"
14
22
 
15
- custom_method :reject, http_verb: :post
16
-
17
23
  nested_resource_class_methods :capability,
18
24
  operations: %i[retrieve update list],
19
25
  resource_plural: "capabilities"
20
26
  nested_resource_class_methods :person,
21
27
  operations: %i[create retrieve update delete list]
22
28
 
29
+ def persons(params = {}, opts = {})
30
+ request_stripe_object(
31
+ method: :get,
32
+ path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(self["id"]) }),
33
+ params: params,
34
+ opts: opts
35
+ )
36
+ end
37
+
23
38
  def reject(params = {}, opts = {})
24
39
  request_stripe_object(
25
40
  method: :post,
26
- path: resource_url + "/reject",
41
+ path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(self["id"]) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def self.persons(account, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :get,
50
+ path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def self.reject(account, params = {}, opts = {})
57
+ request_stripe_object(
58
+ method: :post,
59
+ path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(account) }),
27
60
  params: params,
28
61
  opts: opts
29
62
  )
@@ -33,7 +66,6 @@ module Stripe
33
66
 
34
67
  nested_resource_class_methods :external_account,
35
68
  operations: %i[create retrieve update delete list]
36
-
37
69
  nested_resource_class_methods :login_link, operations: %i[create]
38
70
 
39
71
  def resource_url
@@ -60,11 +92,6 @@ module Stripe
60
92
  super(id, opts)
61
93
  end
62
94
 
63
- def persons(params = {}, opts = {})
64
- resp, opts = execute_resource_request(:get, resource_url + "/persons", params, opts)
65
- Util.convert_to_stripe_object(resp.data, opts)
66
- end
67
-
68
95
  # We are not adding a helper for capabilities here as the Account object
69
96
  # already has a capabilities property which is a hash and not the sub-list
70
97
  # of capabilities.
@@ -2,6 +2,10 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Account Links are the means by which a Connect platform grants a connected account permission to access
6
+ # Stripe-hosted applications, such as Connect Onboarding.
7
+ #
8
+ # Related guide: [Connect Onboarding](https://stripe.com/docs/connect/connect-onboarding).
5
9
  class AccountLink < APIResource
6
10
  extend Stripe::APIOperations::Create
7
11
 
@@ -2,6 +2,11 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # `Application Fee Refund` objects allow you to refund an application fee that
6
+ # has previously been created but not yet refunded. Funds will be refunded to
7
+ # the Stripe account from which the fee was originally collected.
8
+ #
9
+ # Related guide: [Refunding Application Fees](https://stripe.com/docs/connect/destination-charges#refunding-app-fee).
5
10
  class ApplicationFeeRefund < APIResource
6
11
  extend Stripe::APIOperations::List
7
12
  include Stripe::APIOperations::Save
@@ -0,0 +1,40 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Apps
6
+ # Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by UI Extensions and app backends.
7
+ #
8
+ # The primary resource in Secret Store is a `secret`. Other apps can't view secrets created by an app. Additionally, secrets are scoped to provide further permission control.
9
+ #
10
+ # All Dashboard users and the app backend share `account` scoped secrets. Use the `account` scope for secrets that don't change per-user, like a third-party API key.
11
+ #
12
+ # A `user` scoped secret is accessible by the app backend and one specific Dashboard user. Use the `user` scope for per-user secrets like per-user OAuth tokens, where different users might have different permissions.
13
+ #
14
+ # Related guide: [Store data between page reloads](https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects).
15
+ class Secret < APIResource
16
+ extend Stripe::APIOperations::Create
17
+ extend Stripe::APIOperations::List
18
+
19
+ OBJECT_NAME = "apps.secret"
20
+
21
+ def self.delete_where(params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: "/v1/apps/secrets/delete",
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.find(params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :get,
33
+ path: "/v1/apps/secrets/find",
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
@@ -2,6 +2,17 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # This is an object representing your Stripe balance. You can retrieve it to see
6
+ # the balance currently on your Stripe account.
7
+ #
8
+ # You can also retrieve the balance history, which contains a list of
9
+ # [transactions](https://stripe.com/docs/reporting/balance-transaction-types) that contributed to the balance
10
+ # (charges, payouts, and so forth).
11
+ #
12
+ # The available and pending amounts for each currency are broken down further by
13
+ # payment source types.
14
+ #
15
+ # Related guide: [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances).
5
16
  class Balance < SingletonAPIResource
6
17
  OBJECT_NAME = "balance"
7
18
  end
@@ -2,6 +2,10 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Balance transactions represent funds moving through your Stripe account.
6
+ # They're created for every type of transaction that comes into or flows out of your Stripe account balance.
7
+ #
8
+ # Related guide: [Balance Transaction Types](https://stripe.com/docs/reports/balance-transaction-types).
5
9
  class BalanceTransaction < APIResource
6
10
  extend Stripe::APIOperations::List
7
11
 
@@ -2,6 +2,13 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # These bank accounts are payment methods on `Customer` objects.
6
+ #
7
+ # On the other hand [External Accounts](https://stripe.com/docs/api#external_accounts) are transfer
8
+ # destinations on `Account` objects for [Custom accounts](https://stripe.com/docs/connect/custom-accounts).
9
+ # They can be bank accounts or debit cards as well, and are documented in the links above.
10
+ #
11
+ # Related guide: [Bank Debits and Transfers](https://stripe.com/docs/payments/bank-debits-transfers).
5
12
  class BankAccount < APIResource
6
13
  include Stripe::APIOperations::Delete
7
14
  extend Stripe::APIOperations::List
@@ -3,6 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  module BillingPortal
6
+ # A portal configuration describes the functionality and behavior of a portal session.
6
7
  class Configuration < APIResource
7
8
  extend Stripe::APIOperations::Create
8
9
  extend Stripe::APIOperations::List
@@ -3,6 +3,20 @@
3
3
 
4
4
  module Stripe
5
5
  module BillingPortal
6
+ # The Billing customer portal is a Stripe-hosted UI for subscription and
7
+ # billing management.
8
+ #
9
+ # A portal configuration describes the functionality and features that you
10
+ # want to provide to your customers through the portal.
11
+ #
12
+ # A portal session describes the instantiation of the customer portal for
13
+ # a particular customer. By visiting the session's URL, the customer
14
+ # can manage their subscriptions and billing details. For security reasons,
15
+ # sessions are short-lived and will expire if the customer does not visit the URL.
16
+ # Create sessions on-demand when customers intend to manage their subscriptions
17
+ # and billing details.
18
+ #
19
+ # Learn more in the [integration guide](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal).
6
20
  class Session < APIResource
7
21
  extend Stripe::APIOperations::Create
8
22