stripe 5.41.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +256 -0
  3. data/Gemfile +5 -2
  4. data/Makefile +13 -0
  5. data/OPENAPI_VERSION +1 -0
  6. data/README.md +40 -6
  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 +13 -3
  15. data/lib/stripe/api_operations/search.rb +16 -0
  16. data/lib/stripe/api_resource.rb +3 -18
  17. data/lib/stripe/api_resource_test_helpers.rb +49 -0
  18. data/lib/stripe/api_version.rb +8 -0
  19. data/lib/stripe/connection_manager.rb +22 -1
  20. data/lib/stripe/instrumentation.rb +45 -7
  21. data/lib/stripe/object_types.rb +29 -10
  22. data/lib/stripe/resources/account.rb +36 -9
  23. data/lib/stripe/resources/account_link.rb +4 -0
  24. data/lib/stripe/resources/application_fee_refund.rb +5 -0
  25. data/lib/stripe/resources/apps/secret.rb +40 -0
  26. data/lib/stripe/resources/balance.rb +11 -0
  27. data/lib/stripe/resources/balance_transaction.rb +4 -0
  28. data/lib/stripe/resources/bank_account.rb +7 -0
  29. data/lib/stripe/resources/billing_portal/configuration.rb +1 -0
  30. data/lib/stripe/resources/billing_portal/session.rb +14 -0
  31. data/lib/stripe/resources/capability.rb +3 -0
  32. data/lib/stripe/resources/card.rb +6 -3
  33. data/lib/stripe/resources/cash_balance.rb +23 -0
  34. data/lib/stripe/resources/charge.rb +23 -3
  35. data/lib/stripe/resources/checkout/session.rb +41 -5
  36. data/lib/stripe/resources/country_spec.rb +6 -0
  37. data/lib/stripe/resources/coupon.rb +3 -0
  38. data/lib/stripe/resources/credit_note.rb +27 -9
  39. data/lib/stripe/resources/credit_note_line_item.rb +1 -0
  40. data/lib/stripe/resources/customer.rb +124 -12
  41. data/lib/stripe/resources/customer_balance_transaction.rb +6 -0
  42. data/lib/stripe/resources/customer_cash_balance_transaction.rb +14 -0
  43. data/lib/stripe/resources/discount.rb +4 -0
  44. data/lib/stripe/resources/dispute.rb +17 -3
  45. data/lib/stripe/resources/event.rb +29 -0
  46. data/lib/stripe/resources/exchange_rate.rb +11 -0
  47. data/lib/stripe/resources/file.rb +7 -0
  48. data/lib/stripe/resources/file_link.rb +3 -0
  49. data/lib/stripe/resources/financial_connections/account.rb +67 -0
  50. data/lib/stripe/resources/financial_connections/account_owner.rb +11 -0
  51. data/lib/stripe/resources/financial_connections/account_ownership.rb +11 -0
  52. data/lib/stripe/resources/financial_connections/session.rb +13 -0
  53. data/lib/stripe/resources/funding_instructions.rb +21 -0
  54. data/lib/stripe/resources/identity/verification_report.rb +11 -0
  55. data/lib/stripe/resources/identity/verification_session.rb +31 -5
  56. data/lib/stripe/resources/invoice.rb +105 -17
  57. data/lib/stripe/resources/invoice_item.rb +11 -0
  58. data/lib/stripe/resources/issuing/authorization.rb +25 -5
  59. data/lib/stripe/resources/issuing/card.rb +78 -8
  60. data/lib/stripe/resources/issuing/cardholder.rb +3 -0
  61. data/lib/stripe/resources/issuing/dispute.rb +13 -3
  62. data/lib/stripe/resources/issuing/transaction.rb +5 -0
  63. data/lib/stripe/resources/line_item.rb +1 -0
  64. data/lib/stripe/resources/login_link.rb +1 -0
  65. data/lib/stripe/resources/mandate.rb +1 -0
  66. data/lib/stripe/resources/payment_intent.rb +103 -6
  67. data/lib/stripe/resources/payment_link.rb +35 -0
  68. data/lib/stripe/resources/payment_method.rb +25 -5
  69. data/lib/stripe/resources/payout.rb +28 -5
  70. data/lib/stripe/resources/person.rb +6 -0
  71. data/lib/stripe/resources/plan.rb +8 -0
  72. data/lib/stripe/resources/price.rb +15 -0
  73. data/lib/stripe/resources/product.rb +17 -0
  74. data/lib/stripe/resources/promotion_code.rb +2 -0
  75. data/lib/stripe/resources/quote.rb +58 -35
  76. data/lib/stripe/resources/radar/early_fraud_warning.rb +4 -0
  77. data/lib/stripe/resources/radar/value_list.rb +3 -0
  78. data/lib/stripe/resources/radar/value_list_item.rb +3 -0
  79. data/lib/stripe/resources/refund.rb +49 -0
  80. data/lib/stripe/resources/reporting/report_run.rb +8 -0
  81. data/lib/stripe/resources/reporting/report_type.rb +8 -1
  82. data/lib/stripe/resources/reversal.rb +13 -0
  83. data/lib/stripe/resources/review.rb +14 -3
  84. data/lib/stripe/resources/setup_attempt.rb +4 -0
  85. data/lib/stripe/resources/setup_intent.rb +60 -5
  86. data/lib/stripe/resources/shipping_rate.rb +2 -0
  87. data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -0
  88. data/lib/stripe/resources/source.rb +26 -6
  89. data/lib/stripe/resources/source_transaction.rb +4 -0
  90. data/lib/stripe/resources/subscription.rb +57 -3
  91. data/lib/stripe/resources/subscription_item.rb +2 -7
  92. data/lib/stripe/resources/subscription_schedule.rb +23 -5
  93. data/lib/stripe/resources/tax/calculation.rb +33 -0
  94. data/lib/stripe/resources/tax/calculation_line_item.rb +10 -0
  95. data/lib/stripe/resources/tax/settings.rb +15 -0
  96. data/lib/stripe/resources/tax/transaction.rb +49 -0
  97. data/lib/stripe/resources/tax/transaction_line_item.rb +10 -0
  98. data/lib/stripe/resources/tax_code.rb +1 -0
  99. data/lib/stripe/resources/tax_id.rb +4 -0
  100. data/lib/stripe/resources/tax_rate.rb +3 -0
  101. data/lib/stripe/resources/terminal/configuration.rb +16 -0
  102. data/lib/stripe/resources/terminal/connection_token.rb +3 -0
  103. data/lib/stripe/resources/terminal/location.rb +3 -0
  104. data/lib/stripe/resources/terminal/reader.rb +119 -0
  105. data/lib/stripe/resources/test_helpers/test_clock.rb +35 -0
  106. data/lib/stripe/resources/token.rb +20 -0
  107. data/lib/stripe/resources/topup.rb +15 -3
  108. data/lib/stripe/resources/transfer.rb +10 -11
  109. data/lib/stripe/resources/treasury/credit_reversal.rb +14 -0
  110. data/lib/stripe/resources/treasury/debit_reversal.rb +14 -0
  111. data/lib/stripe/resources/treasury/financial_account.rb +52 -0
  112. data/lib/stripe/resources/treasury/financial_account_features.rb +12 -0
  113. data/lib/stripe/resources/treasury/inbound_transfer.rb +94 -0
  114. data/lib/stripe/resources/treasury/outbound_payment.rb +96 -0
  115. data/lib/stripe/resources/treasury/outbound_transfer.rb +100 -0
  116. data/lib/stripe/resources/treasury/received_credit.rb +30 -0
  117. data/lib/stripe/resources/treasury/received_debit.rb +30 -0
  118. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  119. data/lib/stripe/resources/treasury/transaction_entry.rb +17 -0
  120. data/lib/stripe/resources/usage_record.rb +4 -0
  121. data/lib/stripe/resources/webhook_endpoint.rb +7 -0
  122. data/lib/stripe/resources.rb +27 -10
  123. data/lib/stripe/search_result_object.rb +86 -0
  124. data/lib/stripe/stripe_client.rb +37 -22
  125. data/lib/stripe/stripe_configuration.rb +5 -1
  126. data/lib/stripe/stripe_object.rb +2 -2
  127. data/lib/stripe/util.rb +85 -2
  128. data/lib/stripe/version.rb +1 -1
  129. data/lib/stripe.rb +5 -1
  130. data/stripe.gemspec +3 -3
  131. metadata +39 -14
  132. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  133. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  134. data/lib/stripe/resources/issuing/card_details.rb +0 -10
  135. data/lib/stripe/resources/order.rb +0 -33
  136. data/lib/stripe/resources/order_return.rb +0 -10
  137. data/lib/stripe/resources/recipient.rb +0 -14
  138. data/lib/stripe/resources/sku.rb +0 -13
  139. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -3,6 +3,9 @@
3
3
 
4
4
  module Stripe
5
5
  module Terminal
6
+ # A Connection Token is used by the Stripe Terminal SDK to connect to a reader.
7
+ #
8
+ # Related guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations)
6
9
  class ConnectionToken < APIResource
7
10
  extend Stripe::APIOperations::Create
8
11
 
@@ -3,6 +3,9 @@
3
3
 
4
4
  module Stripe
5
5
  module Terminal
6
+ # A Location represents a grouping of readers.
7
+ #
8
+ # Related guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations)
6
9
  class Location < APIResource
7
10
  extend Stripe::APIOperations::Create
8
11
  include Stripe::APIOperations::Delete
@@ -3,6 +3,9 @@
3
3
 
4
4
  module Stripe
5
5
  module Terminal
6
+ # A Reader represents a physical device for accepting payment details.
7
+ #
8
+ # Related guide: [Connecting to a reader](https://stripe.com/docs/terminal/payments/connect-reader)
6
9
  class Reader < APIResource
7
10
  extend Stripe::APIOperations::Create
8
11
  include Stripe::APIOperations::Delete
@@ -10,6 +13,122 @@ module Stripe
10
13
  include Stripe::APIOperations::Save
11
14
 
12
15
  OBJECT_NAME = "terminal.reader"
16
+
17
+ def cancel_action(params = {}, opts = {})
18
+ request_stripe_object(
19
+ method: :post,
20
+ path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(self["id"]) }),
21
+ params: params,
22
+ opts: opts
23
+ )
24
+ end
25
+
26
+ def process_payment_intent(params = {}, opts = {})
27
+ request_stripe_object(
28
+ method: :post,
29
+ path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(self["id"]) }),
30
+ params: params,
31
+ opts: opts
32
+ )
33
+ end
34
+
35
+ def process_setup_intent(params = {}, opts = {})
36
+ request_stripe_object(
37
+ method: :post,
38
+ path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(self["id"]) }),
39
+ params: params,
40
+ opts: opts
41
+ )
42
+ end
43
+
44
+ def refund_payment(params = {}, opts = {})
45
+ request_stripe_object(
46
+ method: :post,
47
+ path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(self["id"]) }),
48
+ params: params,
49
+ opts: opts
50
+ )
51
+ end
52
+
53
+ def set_reader_display(params = {}, opts = {})
54
+ request_stripe_object(
55
+ method: :post,
56
+ path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(self["id"]) }),
57
+ params: params,
58
+ opts: opts
59
+ )
60
+ end
61
+
62
+ def self.cancel_action(reader, params = {}, opts = {})
63
+ request_stripe_object(
64
+ method: :post,
65
+ path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(reader) }),
66
+ params: params,
67
+ opts: opts
68
+ )
69
+ end
70
+
71
+ def self.process_payment_intent(reader, params = {}, opts = {})
72
+ request_stripe_object(
73
+ method: :post,
74
+ path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(reader) }),
75
+ params: params,
76
+ opts: opts
77
+ )
78
+ end
79
+
80
+ def self.process_setup_intent(reader, params = {}, opts = {})
81
+ request_stripe_object(
82
+ method: :post,
83
+ path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(reader) }),
84
+ params: params,
85
+ opts: opts
86
+ )
87
+ end
88
+
89
+ def self.refund_payment(reader, params = {}, opts = {})
90
+ request_stripe_object(
91
+ method: :post,
92
+ path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(reader) }),
93
+ params: params,
94
+ opts: opts
95
+ )
96
+ end
97
+
98
+ def self.set_reader_display(reader, params = {}, opts = {})
99
+ request_stripe_object(
100
+ method: :post,
101
+ path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(reader) }),
102
+ params: params,
103
+ opts: opts
104
+ )
105
+ end
106
+
107
+ def test_helpers
108
+ TestHelpers.new(self)
109
+ end
110
+
111
+ class TestHelpers < APIResourceTestHelpers
112
+ RESOURCE_CLASS = Reader
113
+
114
+ def self.present_payment_method(reader, params = {}, opts = {})
115
+ request_stripe_object(
116
+ method: :post,
117
+ path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(reader) }),
118
+ params: params,
119
+ opts: opts
120
+ )
121
+ end
122
+
123
+ def present_payment_method(params = {}, opts = {})
124
+ @resource.request_stripe_object(
125
+ method: :post,
126
+ path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(@resource["id"]) }),
127
+ params: params,
128
+ opts: opts
129
+ )
130
+ end
131
+ end
13
132
  end
14
133
  end
15
134
  end
@@ -0,0 +1,35 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module TestHelpers
6
+ # A test clock enables deterministic control over objects in testmode. With a test clock, you can create
7
+ # objects at a frozen time in the past or future, and advance to a specific future time to observe webhooks and state changes. After the clock advances,
8
+ # you can either validate the current state of your scenario (and test your assumptions), change the current state of your scenario (and test more complex scenarios), or keep advancing forward in time.
9
+ class TestClock < APIResource
10
+ extend Stripe::APIOperations::Create
11
+ include Stripe::APIOperations::Delete
12
+ extend Stripe::APIOperations::List
13
+
14
+ OBJECT_NAME = "test_helpers.test_clock"
15
+
16
+ def advance(params = {}, opts = {})
17
+ request_stripe_object(
18
+ method: :post,
19
+ path: format("/v1/test_helpers/test_clocks/%<test_clock>s/advance", { test_clock: CGI.escape(self["id"]) }),
20
+ params: params,
21
+ opts: opts
22
+ )
23
+ end
24
+
25
+ def self.advance(test_clock, params = {}, opts = {})
26
+ request_stripe_object(
27
+ method: :post,
28
+ path: format("/v1/test_helpers/test_clocks/%<test_clock>s/advance", { test_clock: CGI.escape(test_clock) }),
29
+ params: params,
30
+ opts: opts
31
+ )
32
+ end
33
+ end
34
+ end
35
+ end
@@ -2,6 +2,26 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Tokenization is the process Stripe uses to collect sensitive card or bank
6
+ # account details, or personally identifiable information (PII), directly from
7
+ # your customers in a secure manner. A token representing this information is
8
+ # returned to your server to use. You should use our
9
+ # [recommended payments integrations](https://stripe.com/docs/payments) to perform this process
10
+ # client-side. This ensures that no sensitive card data touches your server,
11
+ # and allows your integration to operate in a PCI-compliant way.
12
+ #
13
+ # If you cannot use client-side tokenization, you can also create tokens using
14
+ # the API with either your publishable or secret API key. Keep in mind that if
15
+ # your integration uses this method, you are responsible for any PCI compliance
16
+ # that may be required, and you must keep your secret API key safe. Unlike with
17
+ # client-side tokenization, your customer's information is not sent directly to
18
+ # Stripe, so we cannot determine how it is handled or stored.
19
+ #
20
+ # Tokens cannot be stored or used more than once. To store card or bank account
21
+ # information for later use, you can create [Customer](https://stripe.com/docs/api#customers)
22
+ # objects or [Custom accounts](https://stripe.com/docs/api#external_accounts). Note that
23
+ # [Radar](https://stripe.com/docs/radar), our integrated solution for automatic fraud protection,
24
+ # performs best with integrations that use client-side tokenization.
5
25
  class Token < APIResource
6
26
  extend Stripe::APIOperations::Create
7
27
 
@@ -2,6 +2,11 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # To top up your Stripe balance, you create a top-up object. You can retrieve
6
+ # individual top-ups, as well as list all top-ups. Top-ups are identified by a
7
+ # unique, random ID.
8
+ #
9
+ # Related guide: [Topping up your platform account](https://stripe.com/docs/connect/top-ups)
5
10
  class Topup < APIResource
6
11
  extend Stripe::APIOperations::Create
7
12
  extend Stripe::APIOperations::List
@@ -9,12 +14,19 @@ module Stripe
9
14
 
10
15
  OBJECT_NAME = "topup"
11
16
 
12
- custom_method :cancel, http_verb: :post
13
-
14
17
  def cancel(params = {}, opts = {})
15
18
  request_stripe_object(
16
19
  method: :post,
17
- path: resource_url + "/cancel",
20
+ path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(self["id"]) }),
21
+ params: params,
22
+ opts: opts
23
+ )
24
+ end
25
+
26
+ def self.cancel(topup, params = {}, opts = {})
27
+ request_stripe_object(
28
+ method: :post,
29
+ path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(topup) }),
18
30
  params: params,
19
31
  opts: opts
20
32
  )
@@ -2,6 +2,16 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A `Transfer` object is created when you move funds between Stripe accounts as
6
+ # part of Connect.
7
+ #
8
+ # Before April 6, 2017, transfers also represented movement of funds from a
9
+ # Stripe account to a card or bank account. This behavior has since been split
10
+ # out into a [Payout](https://stripe.com/docs/api#payout_object) object, with corresponding payout endpoints. For more
11
+ # information, read about the
12
+ # [transfer/payout split](https://stripe.com/docs/transfer-payout-split).
13
+ #
14
+ # Related guide: [Creating separate charges and transfers](https://stripe.com/docs/connect/separate-charges-and-transfers)
5
15
  class Transfer < APIResource
6
16
  extend Stripe::APIOperations::Create
7
17
  extend Stripe::APIOperations::List
@@ -10,18 +20,7 @@ module Stripe
10
20
 
11
21
  OBJECT_NAME = "transfer"
12
22
 
13
- custom_method :cancel, http_verb: :post
14
-
15
23
  nested_resource_class_methods :reversal,
16
24
  operations: %i[create retrieve update list]
17
-
18
- def cancel(params = {}, opts = {})
19
- request_stripe_object(
20
- method: :post,
21
- path: resource_url + "/cancel",
22
- params: params,
23
- opts: opts
24
- )
25
- end
26
25
  end
27
26
  end
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ # You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal.
7
+ class CreditReversal < APIResource
8
+ extend Stripe::APIOperations::Create
9
+ extend Stripe::APIOperations::List
10
+
11
+ OBJECT_NAME = "treasury.credit_reversal"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ # You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal.
7
+ class DebitReversal < APIResource
8
+ extend Stripe::APIOperations::Create
9
+ extend Stripe::APIOperations::List
10
+
11
+ OBJECT_NAME = "treasury.debit_reversal"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,52 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ # Stripe Treasury provides users with a container for money called a FinancialAccount that is separate from their Payments balance.
7
+ # FinancialAccounts serve as the source and destination of Treasury's money movement APIs.
8
+ class FinancialAccount < APIResource
9
+ extend Stripe::APIOperations::Create
10
+ extend Stripe::APIOperations::List
11
+ include Stripe::APIOperations::Save
12
+
13
+ OBJECT_NAME = "treasury.financial_account"
14
+
15
+ def retrieve_features(params = {}, opts = {})
16
+ request_stripe_object(
17
+ method: :get,
18
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
19
+ params: params,
20
+ opts: opts
21
+ )
22
+ end
23
+
24
+ def update_features(params = {}, opts = {})
25
+ request_stripe_object(
26
+ method: :post,
27
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
28
+ params: params,
29
+ opts: opts
30
+ )
31
+ end
32
+
33
+ def self.retrieve_features(financial_account, params = {}, opts = {})
34
+ request_stripe_object(
35
+ method: :get,
36
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
37
+ params: params,
38
+ opts: opts
39
+ )
40
+ end
41
+
42
+ def self.update_features(financial_account, params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :post,
45
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
46
+ params: params,
47
+ opts: opts
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,12 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ # Encodes whether a FinancialAccount has access to a particular Feature, with a `status` enum and associated `status_details`.
7
+ # Stripe or the platform can control Features via the requested field.
8
+ class FinancialAccountFeatures < APIResource
9
+ OBJECT_NAME = "treasury.financial_account_features"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,94 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ # Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit.
7
+ class InboundTransfer < APIResource
8
+ extend Stripe::APIOperations::Create
9
+ extend Stripe::APIOperations::List
10
+
11
+ OBJECT_NAME = "treasury.inbound_transfer"
12
+
13
+ def cancel(params = {}, opts = {})
14
+ request_stripe_object(
15
+ method: :post,
16
+ path: format("/v1/treasury/inbound_transfers/%<inbound_transfer>s/cancel", { inbound_transfer: CGI.escape(self["id"]) }),
17
+ params: params,
18
+ opts: opts
19
+ )
20
+ end
21
+
22
+ def self.cancel(inbound_transfer, params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :post,
25
+ path: format("/v1/treasury/inbound_transfers/%<inbound_transfer>s/cancel", { inbound_transfer: CGI.escape(inbound_transfer) }),
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ def test_helpers
32
+ TestHelpers.new(self)
33
+ end
34
+
35
+ class TestHelpers < APIResourceTestHelpers
36
+ RESOURCE_CLASS = InboundTransfer
37
+
38
+ def self.fail(id, params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/fail", { id: CGI.escape(id) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def self.return_inbound_transfer(id, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :post,
50
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(id) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def self.succeed(id, params = {}, opts = {})
57
+ request_stripe_object(
58
+ method: :post,
59
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/succeed", { id: CGI.escape(id) }),
60
+ params: params,
61
+ opts: opts
62
+ )
63
+ end
64
+
65
+ def fail(params = {}, opts = {})
66
+ @resource.request_stripe_object(
67
+ method: :post,
68
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
69
+ params: params,
70
+ opts: opts
71
+ )
72
+ end
73
+
74
+ def return_inbound_transfer(params = {}, opts = {})
75
+ @resource.request_stripe_object(
76
+ method: :post,
77
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
78
+ params: params,
79
+ opts: opts
80
+ )
81
+ end
82
+
83
+ def succeed(params = {}, opts = {})
84
+ @resource.request_stripe_object(
85
+ method: :post,
86
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/succeed", { id: CGI.escape(@resource["id"]) }),
87
+ params: params,
88
+ opts: opts
89
+ )
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,96 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ # Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
7
+ #
8
+ # Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
9
+ class OutboundPayment < APIResource
10
+ extend Stripe::APIOperations::Create
11
+ extend Stripe::APIOperations::List
12
+
13
+ OBJECT_NAME = "treasury.outbound_payment"
14
+
15
+ def cancel(params = {}, opts = {})
16
+ request_stripe_object(
17
+ method: :post,
18
+ path: format("/v1/treasury/outbound_payments/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
19
+ params: params,
20
+ opts: opts
21
+ )
22
+ end
23
+
24
+ def self.cancel(id, params = {}, opts = {})
25
+ request_stripe_object(
26
+ method: :post,
27
+ path: format("/v1/treasury/outbound_payments/%<id>s/cancel", { id: CGI.escape(id) }),
28
+ params: params,
29
+ opts: opts
30
+ )
31
+ end
32
+
33
+ def test_helpers
34
+ TestHelpers.new(self)
35
+ end
36
+
37
+ class TestHelpers < APIResourceTestHelpers
38
+ RESOURCE_CLASS = OutboundPayment
39
+
40
+ def self.fail(id, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(id) }),
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ def self.post(id, params = {}, opts = {})
50
+ request_stripe_object(
51
+ method: :post,
52
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(id) }),
53
+ params: params,
54
+ opts: opts
55
+ )
56
+ end
57
+
58
+ def self.return_outbound_payment(id, params = {}, opts = {})
59
+ request_stripe_object(
60
+ method: :post,
61
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(id) }),
62
+ params: params,
63
+ opts: opts
64
+ )
65
+ end
66
+
67
+ def fail(params = {}, opts = {})
68
+ @resource.request_stripe_object(
69
+ method: :post,
70
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
71
+ params: params,
72
+ opts: opts
73
+ )
74
+ end
75
+
76
+ def post(params = {}, opts = {})
77
+ @resource.request_stripe_object(
78
+ method: :post,
79
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(@resource["id"]) }),
80
+ params: params,
81
+ opts: opts
82
+ )
83
+ end
84
+
85
+ def return_outbound_payment(params = {}, opts = {})
86
+ @resource.request_stripe_object(
87
+ method: :post,
88
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
89
+ params: params,
90
+ opts: opts
91
+ )
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,100 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ # Use OutboundTransfers to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account.
7
+ #
8
+ # Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects.
9
+ class OutboundTransfer < APIResource
10
+ extend Stripe::APIOperations::Create
11
+ extend Stripe::APIOperations::List
12
+
13
+ OBJECT_NAME = "treasury.outbound_transfer"
14
+
15
+ def cancel(params = {}, opts = {})
16
+ request_stripe_object(
17
+ method: :post,
18
+ path: format("/v1/treasury/outbound_transfers/%<outbound_transfer>s/cancel", { outbound_transfer: CGI.escape(self["id"]) }),
19
+ params: params,
20
+ opts: opts
21
+ )
22
+ end
23
+
24
+ def self.cancel(outbound_transfer, params = {}, opts = {})
25
+ request_stripe_object(
26
+ method: :post,
27
+ path: format("/v1/treasury/outbound_transfers/%<outbound_transfer>s/cancel", { outbound_transfer: CGI.escape(outbound_transfer) }),
28
+ params: params,
29
+ opts: opts
30
+ )
31
+ end
32
+
33
+ def test_helpers
34
+ TestHelpers.new(self)
35
+ end
36
+
37
+ class TestHelpers < APIResourceTestHelpers
38
+ RESOURCE_CLASS = OutboundTransfer
39
+
40
+ def self.fail(outbound_transfer, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/fail", { outbound_transfer: CGI.escape(outbound_transfer) }),
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ def self.post(outbound_transfer, params = {}, opts = {})
50
+ request_stripe_object(
51
+ method: :post,
52
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/post", { outbound_transfer: CGI.escape(outbound_transfer) }),
53
+ params: params,
54
+ opts: opts
55
+ )
56
+ end
57
+
58
+ def self.return_outbound_transfer(
59
+ outbound_transfer,
60
+ params = {},
61
+ opts = {}
62
+ )
63
+ request_stripe_object(
64
+ method: :post,
65
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/return", { outbound_transfer: CGI.escape(outbound_transfer) }),
66
+ params: params,
67
+ opts: opts
68
+ )
69
+ end
70
+
71
+ def fail(params = {}, opts = {})
72
+ @resource.request_stripe_object(
73
+ method: :post,
74
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/fail", { outbound_transfer: CGI.escape(@resource["id"]) }),
75
+ params: params,
76
+ opts: opts
77
+ )
78
+ end
79
+
80
+ def post(params = {}, opts = {})
81
+ @resource.request_stripe_object(
82
+ method: :post,
83
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/post", { outbound_transfer: CGI.escape(@resource["id"]) }),
84
+ params: params,
85
+ opts: opts
86
+ )
87
+ end
88
+
89
+ def return_outbound_transfer(params = {}, opts = {})
90
+ @resource.request_stripe_object(
91
+ method: :post,
92
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/return", { outbound_transfer: CGI.escape(@resource["id"]) }),
93
+ params: params,
94
+ opts: opts
95
+ )
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end