stripe 12.7.0.pre.beta.1 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +725 -1354
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +4 -3
  5. data/VERSION +1 -1
  6. data/examples/README.md +11 -0
  7. data/examples/meter_event_stream.rb +47 -0
  8. data/examples/new_example.rb +24 -0
  9. data/examples/stripe_webhook_handler.rb +28 -0
  10. data/lib/stripe/api_operations/nested_resource.rb +1 -21
  11. data/lib/stripe/api_operations/request.rb +19 -70
  12. data/lib/stripe/api_operations/save.rb +4 -3
  13. data/lib/stripe/api_operations/singleton_save.rb +5 -2
  14. data/lib/stripe/api_requestor.rb +1131 -0
  15. data/lib/stripe/api_resource.rb +22 -14
  16. data/lib/stripe/api_version.rb +1 -2
  17. data/lib/stripe/connection_manager.rb +1 -1
  18. data/lib/stripe/errors.rb +8 -2
  19. data/lib/stripe/event_types.rb +14 -0
  20. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  21. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  22. data/lib/stripe/list_object.rb +2 -3
  23. data/lib/stripe/oauth.rb +8 -15
  24. data/lib/stripe/object_types.rb +16 -21
  25. data/lib/stripe/request_options.rb +128 -0
  26. data/lib/stripe/resources/billing/credit_balance_summary.rb +14 -0
  27. data/lib/stripe/resources/billing/credit_balance_transaction.rb +26 -0
  28. data/lib/stripe/resources/billing/credit_grant.rb +88 -0
  29. data/lib/stripe/resources/customer.rb +2 -3
  30. data/lib/stripe/resources/file.rb +7 -5
  31. data/lib/stripe/resources/financial_connections/account.rb +0 -3
  32. data/lib/stripe/resources/invoice.rb +0 -81
  33. data/lib/stripe/resources/invoice_rendering_template.rb +2 -0
  34. data/lib/stripe/resources/payment_intent.rb +0 -50
  35. data/lib/stripe/resources/quote.rb +4 -108
  36. data/lib/stripe/resources/source.rb +3 -2
  37. data/lib/stripe/resources/subscription.rb +6 -6
  38. data/lib/stripe/resources/subscription_schedule.rb +0 -20
  39. data/lib/stripe/resources/terminal/reader.rb +0 -60
  40. data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
  41. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
  42. data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
  43. data/lib/stripe/resources/v2/event.rb +13 -0
  44. data/lib/stripe/resources.rb +9 -19
  45. data/lib/stripe/search_result_object.rb +1 -1
  46. data/lib/stripe/services/account_capability_service.rb +39 -0
  47. data/lib/stripe/services/account_external_account_service.rb +68 -0
  48. data/lib/stripe/services/account_link_service.rb +17 -0
  49. data/lib/stripe/services/account_login_link_service.rb +19 -0
  50. data/lib/stripe/services/account_person_service.rb +61 -0
  51. data/lib/stripe/services/account_service.rb +100 -0
  52. data/lib/stripe/services/account_session_service.rb +17 -0
  53. data/lib/stripe/services/apple_pay_domain_service.rb +50 -0
  54. data/lib/stripe/services/application_fee_refund_service.rb +60 -0
  55. data/lib/stripe/services/application_fee_service.rb +35 -0
  56. data/lib/stripe/services/apps/secret_service.rb +52 -0
  57. data/lib/stripe/services/apps_service.rb +13 -0
  58. data/lib/stripe/services/balance_service.rb +12 -0
  59. data/lib/stripe/services/balance_transaction_service.rb +32 -0
  60. data/lib/stripe/services/billing/alert_service.rb +74 -0
  61. data/lib/stripe/services/billing/credit_balance_summary_service.rb +19 -0
  62. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +30 -0
  63. data/lib/stripe/services/billing/credit_grant_service.rb +74 -0
  64. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +19 -0
  65. data/lib/stripe/services/billing/meter_event_service.rb +19 -0
  66. data/lib/stripe/services/billing/meter_event_summary_service.rb +19 -0
  67. data/lib/stripe/services/billing/meter_service.rb +81 -0
  68. data/lib/stripe/services/billing_portal/configuration_service.rb +52 -0
  69. data/lib/stripe/services/billing_portal/session_service.rb +19 -0
  70. data/lib/stripe/services/billing_portal_service.rb +14 -0
  71. data/lib/stripe/services/billing_service.rb +20 -0
  72. data/lib/stripe/services/charge_service.rb +69 -0
  73. data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
  74. data/lib/stripe/services/checkout/session_service.rb +72 -0
  75. data/lib/stripe/services/checkout_service.rb +13 -0
  76. data/lib/stripe/services/climate/order_service.rb +68 -0
  77. data/lib/stripe/services/climate/product_service.rb +30 -0
  78. data/lib/stripe/services/climate/supplier_service.rb +30 -0
  79. data/lib/stripe/services/climate_service.rb +15 -0
  80. data/lib/stripe/services/confirmation_token_service.rb +17 -0
  81. data/lib/stripe/services/country_spec_service.rb +28 -0
  82. data/lib/stripe/services/coupon_service.rb +51 -0
  83. data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
  84. data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
  85. data/lib/stripe/services/credit_note_service.rb +93 -0
  86. data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
  87. data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
  88. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
  89. data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
  90. data/lib/stripe/services/customer_payment_method_service.rb +28 -0
  91. data/lib/stripe/services/customer_payment_source_service.rb +76 -0
  92. data/lib/stripe/services/customer_service.rb +89 -0
  93. data/lib/stripe/services/customer_session_service.rb +17 -0
  94. data/lib/stripe/services/customer_tax_id_service.rb +50 -0
  95. data/lib/stripe/services/dispute_service.rb +48 -0
  96. data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
  97. data/lib/stripe/services/entitlements/feature_service.rb +52 -0
  98. data/lib/stripe/services/entitlements_service.rb +14 -0
  99. data/lib/stripe/services/ephemeral_key_service.rb +28 -0
  100. data/lib/stripe/services/event_service.rb +22 -0
  101. data/lib/stripe/services/exchange_rate_service.rb +28 -0
  102. data/lib/stripe/services/file_link_service.rb +38 -0
  103. data/lib/stripe/services/file_service.rb +35 -0
  104. data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
  105. data/lib/stripe/services/financial_connections/account_service.rb +81 -0
  106. data/lib/stripe/services/financial_connections/session_service.rb +30 -0
  107. data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
  108. data/lib/stripe/services/financial_connections_service.rb +15 -0
  109. data/lib/stripe/services/forwarding/request_service.rb +41 -0
  110. data/lib/stripe/services/forwarding_service.rb +13 -0
  111. data/lib/stripe/services/identity/verification_report_service.rb +30 -0
  112. data/lib/stripe/services/identity/verification_session_service.rb +106 -0
  113. data/lib/stripe/services/identity_service.rb +14 -0
  114. data/lib/stripe/services/invoice_item_service.rb +61 -0
  115. data/lib/stripe/services/invoice_line_item_service.rb +31 -0
  116. data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
  117. data/lib/stripe/services/invoice_service.rb +202 -0
  118. data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
  119. data/lib/stripe/services/issuing/authorization_service.rb +65 -0
  120. data/lib/stripe/services/issuing/card_service.rb +52 -0
  121. data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
  122. data/lib/stripe/services/issuing/dispute_service.rb +63 -0
  123. data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
  124. data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
  125. data/lib/stripe/services/issuing/token_service.rb +41 -0
  126. data/lib/stripe/services/issuing/transaction_service.rb +41 -0
  127. data/lib/stripe/services/issuing_service.rb +20 -0
  128. data/lib/stripe/services/mandate_service.rb +17 -0
  129. data/lib/stripe/services/oauth_service.rb +63 -0
  130. data/lib/stripe/services/payment_intent_service.rb +204 -0
  131. data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
  132. data/lib/stripe/services/payment_link_service.rb +57 -0
  133. data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
  134. data/lib/stripe/services/payment_method_domain_service.rb +66 -0
  135. data/lib/stripe/services/payment_method_service.rb +86 -0
  136. data/lib/stripe/services/payout_service.rb +66 -0
  137. data/lib/stripe/services/plan_service.rb +49 -0
  138. data/lib/stripe/services/price_service.rb +52 -0
  139. data/lib/stripe/services/product_feature_service.rb +50 -0
  140. data/lib/stripe/services/product_service.rb +70 -0
  141. data/lib/stripe/services/promotion_code_service.rb +50 -0
  142. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
  143. data/lib/stripe/services/quote_line_item_service.rb +17 -0
  144. data/lib/stripe/services/quote_service.rb +92 -0
  145. data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
  146. data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
  147. data/lib/stripe/services/radar/value_list_service.rb +63 -0
  148. data/lib/stripe/services/radar_service.rb +15 -0
  149. data/lib/stripe/services/refund_service.rb +63 -0
  150. data/lib/stripe/services/reporting/report_run_service.rb +41 -0
  151. data/lib/stripe/services/reporting/report_type_service.rb +30 -0
  152. data/lib/stripe/services/reporting_service.rb +14 -0
  153. data/lib/stripe/services/review_service.rb +33 -0
  154. data/lib/stripe/services/setup_attempt_service.rb +17 -0
  155. data/lib/stripe/services/setup_intent_service.rb +105 -0
  156. data/lib/stripe/services/shipping_rate_service.rb +50 -0
  157. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
  158. data/lib/stripe/services/sigma_service.rb +13 -0
  159. data/lib/stripe/services/source_service.rb +64 -0
  160. data/lib/stripe/services/source_transaction_service.rb +17 -0
  161. data/lib/stripe/services/subscription_item_service.rb +69 -0
  162. data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
  163. data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
  164. data/lib/stripe/services/subscription_schedule_service.rb +72 -0
  165. data/lib/stripe/services/subscription_service.rb +127 -0
  166. data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
  167. data/lib/stripe/services/tax/calculation_service.rb +37 -0
  168. data/lib/stripe/services/tax/registration_service.rb +54 -0
  169. data/lib/stripe/services/tax/settings_service.rb +30 -0
  170. data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
  171. data/lib/stripe/services/tax/transaction_service.rb +48 -0
  172. data/lib/stripe/services/tax_code_service.rb +22 -0
  173. data/lib/stripe/services/tax_id_service.rb +38 -0
  174. data/lib/stripe/services/tax_rate_service.rb +38 -0
  175. data/lib/stripe/services/tax_service.rb +16 -0
  176. data/lib/stripe/services/terminal/configuration_service.rb +63 -0
  177. data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
  178. data/lib/stripe/services/terminal/location_service.rb +64 -0
  179. data/lib/stripe/services/terminal/reader_service.rb +118 -0
  180. data/lib/stripe/services/terminal_service.rb +16 -0
  181. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
  182. data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
  183. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +76 -0
  184. data/lib/stripe/services/test_helpers/issuing/card_service.rb +54 -0
  185. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
  186. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
  187. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  188. data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
  189. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
  190. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  191. data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
  192. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
  193. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
  194. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
  195. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
  196. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
  197. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  198. data/lib/stripe/services/test_helpers_service.rb +19 -0
  199. data/lib/stripe/services/token_service.rb +23 -0
  200. data/lib/stripe/services/topup_service.rb +49 -0
  201. data/lib/stripe/services/transfer_reversal_service.rb +56 -0
  202. data/lib/stripe/services/transfer_service.rb +47 -0
  203. data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
  204. data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
  205. data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
  206. data/lib/stripe/services/treasury/financial_account_service.rb +59 -0
  207. data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
  208. data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
  209. data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
  210. data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
  211. data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
  212. data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
  213. data/lib/stripe/services/treasury/transaction_service.rb +30 -0
  214. data/lib/stripe/services/treasury_service.rb +22 -0
  215. data/lib/stripe/services/v1_services.rb +89 -0
  216. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
  217. data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
  218. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
  219. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
  220. data/lib/stripe/services/v2/billing_service.rb +18 -0
  221. data/lib/stripe/services/v2/core/event_service.rb +32 -0
  222. data/lib/stripe/services/v2/core_service.rb +15 -0
  223. data/lib/stripe/services/v2_services.rb +14 -0
  224. data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
  225. data/lib/stripe/services.rb +181 -0
  226. data/lib/stripe/singleton_api_resource.rb +1 -18
  227. data/lib/stripe/stripe_client.rb +51 -1067
  228. data/lib/stripe/stripe_configuration.rb +32 -20
  229. data/lib/stripe/stripe_object.rb +37 -18
  230. data/lib/stripe/stripe_service.rb +32 -0
  231. data/lib/stripe/thin_event.rb +17 -0
  232. data/lib/stripe/util.rb +69 -46
  233. data/lib/stripe/v2_list_object.rb +84 -0
  234. data/lib/stripe/version.rb +1 -1
  235. data/lib/stripe/webhook.rb +1 -1
  236. data/lib/stripe.rb +15 -54
  237. metadata +203 -24
  238. data/lib/stripe/request_signing_authenticator.rb +0 -79
  239. data/lib/stripe/resources/account_notice.rb +0 -32
  240. data/lib/stripe/resources/capital/financing_offer.rb +0 -49
  241. data/lib/stripe/resources/capital/financing_summary.rb +0 -15
  242. data/lib/stripe/resources/capital/financing_transaction.rb +0 -27
  243. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +0 -14
  244. data/lib/stripe/resources/financial_connections/institution.rb +0 -26
  245. data/lib/stripe/resources/gift_cards/card.rb +0 -59
  246. data/lib/stripe/resources/gift_cards/transaction.rb +0 -93
  247. data/lib/stripe/resources/invoice_payment.rb +0 -12
  248. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +0 -88
  249. data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +0 -26
  250. data/lib/stripe/resources/margin.rb +0 -37
  251. data/lib/stripe/resources/order.rb +0 -120
  252. data/lib/stripe/resources/quote_phase.rb +0 -32
  253. data/lib/stripe/resources/quote_preview_invoice.rb +0 -43
  254. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +0 -11
  255. data/lib/stripe/resources/tax/association.rb +0 -24
  256. data/lib/stripe/resources/tax/form.rb +0 -49
  257. data/lib/stripe/resources/terminal/reader_collected_data.rb +0 -14
@@ -0,0 +1,54 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module TestHelpers
6
+ module Treasury
7
+ class OutboundTransferService < StripeService
8
+ # Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
9
+ def fail(outbound_transfer, params = {}, opts = {})
10
+ request(
11
+ method: :post,
12
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/fail", { outbound_transfer: CGI.escape(outbound_transfer) }),
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+
19
+ # Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
20
+ def post(outbound_transfer, params = {}, opts = {})
21
+ request(
22
+ method: :post,
23
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/post", { outbound_transfer: CGI.escape(outbound_transfer) }),
24
+ params: params,
25
+ opts: opts,
26
+ base_address: :api
27
+ )
28
+ end
29
+
30
+ # Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
31
+ def return_outbound_transfer(outbound_transfer, params = {}, opts = {})
32
+ request(
33
+ method: :post,
34
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/return", { outbound_transfer: CGI.escape(outbound_transfer) }),
35
+ params: params,
36
+ opts: opts,
37
+ base_address: :api
38
+ )
39
+ end
40
+
41
+ # Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
42
+ def update(outbound_transfer, params = {}, opts = {})
43
+ request(
44
+ method: :post,
45
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(outbound_transfer) }),
46
+ params: params,
47
+ opts: opts,
48
+ base_address: :api
49
+ )
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,21 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module TestHelpers
6
+ module Treasury
7
+ class ReceivedCreditService < StripeService
8
+ # Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. In live mode, you can't directly create ReceivedCredits initiated by third parties.
9
+ def create(params = {}, opts = {})
10
+ request(
11
+ method: :post,
12
+ path: "/v1/test_helpers/treasury/received_credits",
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module TestHelpers
6
+ module Treasury
7
+ class ReceivedDebitService < StripeService
8
+ # Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. In live mode, you can't directly create ReceivedDebits initiated by third parties.
9
+ def create(params = {}, opts = {})
10
+ request(
11
+ method: :post,
12
+ path: "/v1/test_helpers/treasury/received_debits",
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module TestHelpers
6
+ class TreasuryService < StripeService
7
+ attr_reader :inbound_transfers, :outbound_payments, :outbound_transfers, :received_credits, :received_debits
8
+
9
+ def initialize(requestor)
10
+ super(requestor)
11
+ @inbound_transfers = Stripe::TestHelpers::Treasury::InboundTransferService.new(@requestor)
12
+ @outbound_payments = Stripe::TestHelpers::Treasury::OutboundPaymentService.new(@requestor)
13
+ @outbound_transfers = Stripe::TestHelpers::Treasury::OutboundTransferService.new(@requestor)
14
+ @received_credits = Stripe::TestHelpers::Treasury::ReceivedCreditService.new(@requestor)
15
+ @received_debits = Stripe::TestHelpers::Treasury::ReceivedDebitService.new(@requestor)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class TestHelpersService < StripeService
6
+ attr_reader :confirmation_tokens, :customers, :issuing, :refunds, :terminal, :test_clocks, :treasury
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @confirmation_tokens = Stripe::TestHelpers::ConfirmationTokenService.new(@requestor)
11
+ @customers = Stripe::TestHelpers::CustomerService.new(@requestor)
12
+ @issuing = Stripe::TestHelpers::IssuingService.new(@requestor)
13
+ @refunds = Stripe::TestHelpers::RefundService.new(@requestor)
14
+ @terminal = Stripe::TestHelpers::TerminalService.new(@requestor)
15
+ @test_clocks = Stripe::TestHelpers::TestClockService.new(@requestor)
16
+ @treasury = Stripe::TestHelpers::TreasuryService.new(@requestor)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class TokenService < StripeService
6
+ # Creates a single-use token that represents a bank account's details.
7
+ # You can use this token with any API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a [connected account](https://stripe.com/docs/api#accounts) where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is application, which includes Custom accounts.
8
+ def create(params = {}, opts = {})
9
+ request(method: :post, path: "/v1/tokens", params: params, opts: opts, base_address: :api)
10
+ end
11
+
12
+ # Retrieves the token with the given ID.
13
+ def retrieve(token, params = {}, opts = {})
14
+ request(
15
+ method: :get,
16
+ path: format("/v1/tokens/%<token>s", { token: CGI.escape(token) }),
17
+ params: params,
18
+ opts: opts,
19
+ base_address: :api
20
+ )
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,49 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class TopupService < StripeService
6
+ # Cancels a top-up. Only pending top-ups can be canceled.
7
+ def cancel(topup, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(topup) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Top up the balance of an account
18
+ def create(params = {}, opts = {})
19
+ request(method: :post, path: "/v1/topups", params: params, opts: opts, base_address: :api)
20
+ end
21
+
22
+ # Returns a list of top-ups.
23
+ def list(params = {}, opts = {})
24
+ request(method: :get, path: "/v1/topups", params: params, opts: opts, base_address: :api)
25
+ end
26
+
27
+ # Retrieves the details of a top-up that has previously been created. Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information.
28
+ def retrieve(topup, params = {}, opts = {})
29
+ request(
30
+ method: :get,
31
+ path: format("/v1/topups/%<topup>s", { topup: CGI.escape(topup) }),
32
+ params: params,
33
+ opts: opts,
34
+ base_address: :api
35
+ )
36
+ end
37
+
38
+ # Updates the metadata of a top-up. Other top-up details are not editable by design.
39
+ def update(topup, params = {}, opts = {})
40
+ request(
41
+ method: :post,
42
+ path: format("/v1/topups/%<topup>s", { topup: CGI.escape(topup) }),
43
+ params: params,
44
+ opts: opts,
45
+ base_address: :api
46
+ )
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,56 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class TransferReversalService < StripeService
6
+ # When you create a new reversal, you must specify a transfer to create it on.
7
+ #
8
+ # When reversing transfers, you can optionally reverse part of the transfer. You can do so as many times as you wish until the entire transfer has been reversed.
9
+ #
10
+ # Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, or when trying to reverse more money than is left on a transfer.
11
+ def create(id, params = {}, opts = {})
12
+ request(
13
+ method: :post,
14
+ path: format("/v1/transfers/%<id>s/reversals", { id: CGI.escape(id) }),
15
+ params: params,
16
+ opts: opts,
17
+ base_address: :api
18
+ )
19
+ end
20
+
21
+ # You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals.
22
+ def list(id, params = {}, opts = {})
23
+ request(
24
+ method: :get,
25
+ path: format("/v1/transfers/%<id>s/reversals", { id: CGI.escape(id) }),
26
+ params: params,
27
+ opts: opts,
28
+ base_address: :api
29
+ )
30
+ end
31
+
32
+ # By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer.
33
+ def retrieve(transfer, id, params = {}, opts = {})
34
+ request(
35
+ method: :get,
36
+ path: format("/v1/transfers/%<transfer>s/reversals/%<id>s", { transfer: CGI.escape(transfer), id: CGI.escape(id) }),
37
+ params: params,
38
+ opts: opts,
39
+ base_address: :api
40
+ )
41
+ end
42
+
43
+ # Updates the specified reversal by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
44
+ #
45
+ # This request only accepts metadata and description as arguments.
46
+ def update(transfer, id, params = {}, opts = {})
47
+ request(
48
+ method: :post,
49
+ path: format("/v1/transfers/%<transfer>s/reversals/%<id>s", { transfer: CGI.escape(transfer), id: CGI.escape(id) }),
50
+ params: params,
51
+ opts: opts,
52
+ base_address: :api
53
+ )
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,47 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class TransferService < StripeService
6
+ attr_reader :reversals
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @reversals = Stripe::TransferReversalService.new(@requestor)
11
+ end
12
+
13
+ # To send funds from your Stripe account to a connected account, you create a new transfer object. Your [Stripe balance](https://stripe.com/docs/api#balance) must be able to cover the transfer amount, or you'll receive an “Insufficient Funds” error.
14
+ def create(params = {}, opts = {})
15
+ request(method: :post, path: "/v1/transfers", params: params, opts: opts, base_address: :api)
16
+ end
17
+
18
+ # Returns a list of existing transfers sent to connected accounts. The transfers are returned in sorted order, with the most recently created transfers appearing first.
19
+ def list(params = {}, opts = {})
20
+ request(method: :get, path: "/v1/transfers", params: params, opts: opts, base_address: :api)
21
+ end
22
+
23
+ # Retrieves the details of an existing transfer. Supply the unique transfer ID from either a transfer creation request or the transfer list, and Stripe will return the corresponding transfer information.
24
+ def retrieve(transfer, params = {}, opts = {})
25
+ request(
26
+ method: :get,
27
+ path: format("/v1/transfers/%<transfer>s", { transfer: CGI.escape(transfer) }),
28
+ params: params,
29
+ opts: opts,
30
+ base_address: :api
31
+ )
32
+ end
33
+
34
+ # Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
35
+ #
36
+ # This request accepts only metadata as an argument.
37
+ def update(transfer, params = {}, opts = {})
38
+ request(
39
+ method: :post,
40
+ path: format("/v1/transfers/%<transfer>s", { transfer: CGI.escape(transfer) }),
41
+ params: params,
42
+ opts: opts,
43
+ base_address: :api
44
+ )
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,41 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ class CreditReversalService < StripeService
7
+ # Reverses a ReceivedCredit and creates a CreditReversal object.
8
+ def create(params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: "/v1/treasury/credit_reversals",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Returns a list of CreditReversals.
19
+ def list(params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: "/v1/treasury/credit_reversals",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list
30
+ def retrieve(credit_reversal, params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: format("/v1/treasury/credit_reversals/%<credit_reversal>s", { credit_reversal: CGI.escape(credit_reversal) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ class DebitReversalService < StripeService
7
+ # Reverses a ReceivedDebit and creates a DebitReversal object.
8
+ def create(params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: "/v1/treasury/debit_reversals",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Returns a list of DebitReversals.
19
+ def list(params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: "/v1/treasury/debit_reversals",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Retrieves a DebitReversal object.
30
+ def retrieve(debit_reversal, params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: format("/v1/treasury/debit_reversals/%<debit_reversal>s", { debit_reversal: CGI.escape(debit_reversal) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,30 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ class FinancialAccountFeaturesService < StripeService
7
+ # Retrieves Features information associated with the FinancialAccount.
8
+ def retrieve(financial_account, params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Updates the Features associated with a FinancialAccount.
19
+ def update(financial_account, params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,59 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ class FinancialAccountService < StripeService
7
+ attr_reader :features
8
+
9
+ def initialize(requestor)
10
+ super(requestor)
11
+ @features = Stripe::Treasury::FinancialAccountFeaturesService.new(@requestor)
12
+ end
13
+
14
+ # Creates a new FinancialAccount. For now, each connected account can only have one FinancialAccount.
15
+ def create(params = {}, opts = {})
16
+ request(
17
+ method: :post,
18
+ path: "/v1/treasury/financial_accounts",
19
+ params: params,
20
+ opts: opts,
21
+ base_address: :api
22
+ )
23
+ end
24
+
25
+ # Returns a list of FinancialAccounts.
26
+ def list(params = {}, opts = {})
27
+ request(
28
+ method: :get,
29
+ path: "/v1/treasury/financial_accounts",
30
+ params: params,
31
+ opts: opts,
32
+ base_address: :api
33
+ )
34
+ end
35
+
36
+ # Retrieves the details of a FinancialAccount.
37
+ def retrieve(financial_account, params = {}, opts = {})
38
+ request(
39
+ method: :get,
40
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s", { financial_account: CGI.escape(financial_account) }),
41
+ params: params,
42
+ opts: opts,
43
+ base_address: :api
44
+ )
45
+ end
46
+
47
+ # Updates the details of a FinancialAccount.
48
+ def update(financial_account, params = {}, opts = {})
49
+ request(
50
+ method: :post,
51
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s", { financial_account: CGI.escape(financial_account) }),
52
+ params: params,
53
+ opts: opts,
54
+ base_address: :api
55
+ )
56
+ end
57
+ end
58
+ end
59
+ 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
+ class InboundTransferService < StripeService
7
+ # Cancels an InboundTransfer.
8
+ def cancel(inbound_transfer, params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: format("/v1/treasury/inbound_transfers/%<inbound_transfer>s/cancel", { inbound_transfer: CGI.escape(inbound_transfer) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Creates an InboundTransfer.
19
+ def create(params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: "/v1/treasury/inbound_transfers",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Returns a list of InboundTransfers sent from the specified FinancialAccount.
30
+ def list(params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: "/v1/treasury/inbound_transfers",
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Retrieves the details of an existing InboundTransfer.
41
+ def retrieve(id, params = {}, opts = {})
42
+ request(
43
+ method: :get,
44
+ path: format("/v1/treasury/inbound_transfers/%<id>s", { id: CGI.escape(id) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+ end
51
+ end
52
+ 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
+ class OutboundPaymentService < StripeService
7
+ # Cancel an OutboundPayment.
8
+ def cancel(id, params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: format("/v1/treasury/outbound_payments/%<id>s/cancel", { id: CGI.escape(id) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Creates an OutboundPayment.
19
+ def create(params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: "/v1/treasury/outbound_payments",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Returns a list of OutboundPayments sent from the specified FinancialAccount.
30
+ def list(params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: "/v1/treasury/outbound_payments",
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list.
41
+ def retrieve(id, params = {}, opts = {})
42
+ request(
43
+ method: :get,
44
+ path: format("/v1/treasury/outbound_payments/%<id>s", { id: CGI.escape(id) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+ end
51
+ end
52
+ 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
+ class OutboundTransferService < StripeService
7
+ # An OutboundTransfer can be canceled if the funds have not yet been paid out.
8
+ def cancel(outbound_transfer, params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: format("/v1/treasury/outbound_transfers/%<outbound_transfer>s/cancel", { outbound_transfer: CGI.escape(outbound_transfer) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Creates an OutboundTransfer.
19
+ def create(params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: "/v1/treasury/outbound_transfers",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Returns a list of OutboundTransfers sent from the specified FinancialAccount.
30
+ def list(params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: "/v1/treasury/outbound_transfers",
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
41
+ def retrieve(outbound_transfer, params = {}, opts = {})
42
+ request(
43
+ method: :get,
44
+ path: format("/v1/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(outbound_transfer) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,30 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Treasury
6
+ class ReceivedCreditService < StripeService
7
+ # Returns a list of ReceivedCredits.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/treasury/received_credits",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
19
+ def retrieve(id, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/treasury/received_credits/%<id>s", { id: CGI.escape(id) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end