stripe 10.1.0 → 12.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +215 -21
  3. data/Gemfile +6 -5
  4. data/Makefile +8 -1
  5. data/OPENAPI_VERSION +1 -1
  6. data/README.md +46 -14
  7. data/Rakefile +7 -5
  8. data/VERSION +1 -1
  9. data/{bin → exe}/stripe-console +1 -1
  10. data/lib/stripe/api_operations/nested_resource.rb +22 -2
  11. data/lib/stripe/api_operations/request.rb +22 -18
  12. data/lib/stripe/api_operations/save.rb +7 -9
  13. data/lib/stripe/api_operations/search.rb +5 -0
  14. data/lib/stripe/api_operations/singleton_save.rb +86 -0
  15. data/lib/stripe/api_resource.rb +13 -4
  16. data/lib/stripe/api_resource_test_helpers.rb +7 -3
  17. data/lib/stripe/api_version.rb +1 -1
  18. data/lib/stripe/connection_manager.rb +4 -6
  19. data/lib/stripe/errors.rb +3 -11
  20. data/lib/stripe/instrumentation.rb +5 -21
  21. data/lib/stripe/list_object.rb +3 -0
  22. data/lib/stripe/multipart_encoder.rb +7 -7
  23. data/lib/stripe/oauth.rb +6 -6
  24. data/lib/stripe/object_types.rb +135 -116
  25. data/lib/stripe/resources/account.rb +103 -25
  26. data/lib/stripe/resources/account_link.rb +8 -0
  27. data/lib/stripe/resources/account_session.rb +8 -0
  28. data/lib/stripe/resources/alipay_account.rb +1 -1
  29. data/lib/stripe/resources/apple_pay_domain.rb +43 -0
  30. data/lib/stripe/resources/application_fee.rb +8 -0
  31. data/lib/stripe/resources/application_fee_refund.rb +4 -2
  32. data/lib/stripe/resources/apps/secret.rb +15 -0
  33. data/lib/stripe/resources/balance.rb +3 -0
  34. data/lib/stripe/resources/balance_transaction.rb +15 -0
  35. data/lib/stripe/resources/bank_account.rb +49 -7
  36. data/lib/stripe/resources/billing/alert.rb +87 -0
  37. data/lib/stripe/resources/billing/meter.rb +83 -0
  38. data/lib/stripe/resources/billing/meter_event.rb +27 -0
  39. data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
  40. data/lib/stripe/resources/billing/meter_event_summary.rb +15 -0
  41. data/lib/stripe/resources/billing_portal/configuration.rb +33 -0
  42. data/lib/stripe/resources/billing_portal/session.rb +14 -1
  43. data/lib/stripe/resources/capability.rb +4 -2
  44. data/lib/stripe/resources/card.rb +28 -0
  45. data/lib/stripe/resources/cash_balance.rb +3 -0
  46. data/lib/stripe/resources/charge.rb +39 -1
  47. data/lib/stripe/resources/checkout/session.rb +47 -5
  48. data/lib/stripe/resources/climate/order.rb +67 -0
  49. data/lib/stripe/resources/climate/product.rb +27 -0
  50. data/lib/stripe/resources/climate/supplier.rb +26 -0
  51. data/lib/stripe/resources/confirmation_token.rb +39 -0
  52. data/lib/stripe/resources/country_spec.rb +8 -0
  53. data/lib/stripe/resources/coupon.rb +45 -0
  54. data/lib/stripe/resources/credit_note.rb +47 -7
  55. data/lib/stripe/resources/credit_note_line_item.rb +3 -0
  56. data/lib/stripe/resources/customer.rb +89 -26
  57. data/lib/stripe/resources/customer_balance_transaction.rb +3 -1
  58. data/lib/stripe/resources/customer_cash_balance_transaction.rb +3 -2
  59. data/lib/stripe/resources/customer_session.rb +29 -0
  60. data/lib/stripe/resources/discount.rb +3 -0
  61. data/lib/stripe/resources/dispute.rb +26 -0
  62. data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
  63. data/lib/stripe/resources/entitlements/feature.rb +49 -0
  64. data/lib/stripe/resources/ephemeral_key.rb +23 -0
  65. data/lib/stripe/resources/event.rb +11 -3
  66. data/lib/stripe/resources/exchange_rate.rb +8 -0
  67. data/lib/stripe/resources/file.rb +29 -16
  68. data/lib/stripe/resources/file_link.rb +23 -0
  69. data/lib/stripe/resources/financial_connections/account.rb +66 -7
  70. data/lib/stripe/resources/financial_connections/account_owner.rb +3 -0
  71. data/lib/stripe/resources/financial_connections/account_ownership.rb +3 -0
  72. data/lib/stripe/resources/financial_connections/session.rb +13 -0
  73. data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
  74. data/lib/stripe/resources/forwarding/request.rb +52 -0
  75. data/lib/stripe/resources/funding_instructions.rb +3 -0
  76. data/lib/stripe/resources/identity/verification_report.rb +14 -1
  77. data/lib/stripe/resources/identity/verification_session.rb +90 -4
  78. data/lib/stripe/resources/invoice.rb +170 -17
  79. data/lib/stripe/resources/invoice_item.rb +43 -0
  80. data/lib/stripe/resources/invoice_line_item.rb +21 -0
  81. data/lib/stripe/resources/invoice_rendering_template.rb +63 -0
  82. data/lib/stripe/resources/issuing/authorization.rb +88 -14
  83. data/lib/stripe/resources/issuing/card.rb +50 -16
  84. data/lib/stripe/resources/issuing/cardholder.rb +33 -0
  85. data/lib/stripe/resources/issuing/dispute.rb +35 -0
  86. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  87. data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
  88. data/lib/stripe/resources/issuing/token.rb +18 -0
  89. data/lib/stripe/resources/issuing/transaction.rb +30 -0
  90. data/lib/stripe/resources/line_item.rb +3 -0
  91. data/lib/stripe/resources/login_link.rb +4 -1
  92. data/lib/stripe/resources/mandate.rb +3 -0
  93. data/lib/stripe/resources/payment_intent.rb +190 -25
  94. data/lib/stripe/resources/payment_link.rb +25 -0
  95. data/lib/stripe/resources/payment_method.rb +57 -4
  96. data/lib/stripe/resources/payment_method_configuration.rb +33 -0
  97. data/lib/stripe/resources/payment_method_domain.rb +46 -1
  98. data/lib/stripe/resources/payout.rb +39 -4
  99. data/lib/stripe/resources/person.rb +5 -4
  100. data/lib/stripe/resources/plan.rb +43 -0
  101. data/lib/stripe/resources/price.rb +24 -1
  102. data/lib/stripe/resources/product.rb +47 -1
  103. data/lib/stripe/resources/product_feature.rb +13 -0
  104. data/lib/stripe/resources/promotion_code.rb +23 -0
  105. data/lib/stripe/resources/quote.rb +67 -32
  106. data/lib/stripe/resources/radar/early_fraud_warning.rb +13 -0
  107. data/lib/stripe/resources/radar/value_list.rb +53 -0
  108. data/lib/stripe/resources/radar/value_list_item.rb +43 -0
  109. data/lib/stripe/resources/refund.rb +46 -0
  110. data/lib/stripe/resources/reporting/report_run.rb +23 -0
  111. data/lib/stripe/resources/reporting/report_type.rb +13 -0
  112. data/lib/stripe/resources/reversal.rb +5 -3
  113. data/lib/stripe/resources/review.rb +10 -0
  114. data/lib/stripe/resources/setup_attempt.rb +8 -0
  115. data/lib/stripe/resources/setup_intent.rb +72 -10
  116. data/lib/stripe/resources/shipping_rate.rb +23 -0
  117. data/lib/stripe/resources/sigma/scheduled_query_run.rb +13 -0
  118. data/lib/stripe/resources/source.rb +23 -1
  119. data/lib/stripe/resources/source_transaction.rb +3 -0
  120. data/lib/stripe/resources/subscription.rb +81 -13
  121. data/lib/stripe/resources/subscription_item.rb +54 -1
  122. data/lib/stripe/resources/subscription_schedule.rb +41 -4
  123. data/lib/stripe/resources/tax/calculation.rb +15 -0
  124. data/lib/stripe/resources/tax/calculation_line_item.rb +3 -0
  125. data/lib/stripe/resources/tax/registration.rb +35 -0
  126. data/lib/stripe/resources/tax/settings.rb +4 -2
  127. data/lib/stripe/resources/tax/transaction.rb +15 -8
  128. data/lib/stripe/resources/tax/transaction_line_item.rb +3 -0
  129. data/lib/stripe/resources/tax_code.rb +8 -0
  130. data/lib/stripe/resources/tax_id.rb +30 -12
  131. data/lib/stripe/resources/tax_rate.rb +23 -0
  132. data/lib/stripe/resources/terminal/configuration.rb +53 -0
  133. data/lib/stripe/resources/terminal/connection_token.rb +13 -0
  134. data/lib/stripe/resources/terminal/location.rb +54 -0
  135. data/lib/stripe/resources/terminal/reader.rb +80 -12
  136. data/lib/stripe/resources/test_helpers/test_clock.rb +45 -0
  137. data/lib/stripe/resources/token.rb +10 -1
  138. data/lib/stripe/resources/topup.rb +25 -0
  139. data/lib/stripe/resources/transfer.rb +26 -1
  140. data/lib/stripe/resources/treasury/credit_reversal.rb +23 -0
  141. data/lib/stripe/resources/treasury/debit_reversal.rb +23 -0
  142. data/lib/stripe/resources/treasury/financial_account.rb +42 -5
  143. data/lib/stripe/resources/treasury/financial_account_features.rb +3 -0
  144. data/lib/stripe/resources/treasury/inbound_transfer.rb +47 -11
  145. data/lib/stripe/resources/treasury/outbound_payment.rb +64 -8
  146. data/lib/stripe/resources/treasury/outbound_transfer.rb +64 -8
  147. data/lib/stripe/resources/treasury/received_credit.rb +17 -0
  148. data/lib/stripe/resources/treasury/received_debit.rb +17 -0
  149. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  150. data/lib/stripe/resources/treasury/transaction_entry.rb +13 -0
  151. data/lib/stripe/resources/usage_record.rb +5 -0
  152. data/lib/stripe/resources/usage_record_summary.rb +3 -0
  153. data/lib/stripe/resources/webhook_endpoint.rb +55 -2
  154. data/lib/stripe/resources.rb +18 -0
  155. data/lib/stripe/search_result_object.rb +4 -1
  156. data/lib/stripe/singleton_api_resource.rb +20 -3
  157. data/lib/stripe/stripe_client.rb +61 -63
  158. data/lib/stripe/stripe_configuration.rb +13 -29
  159. data/lib/stripe/stripe_object.rb +23 -21
  160. data/lib/stripe/stripe_response.rb +1 -3
  161. data/lib/stripe/util.rb +13 -15
  162. data/lib/stripe/version.rb +1 -1
  163. data/lib/stripe.rb +26 -0
  164. data/stripe.gemspec +7 -4
  165. metadata +25 -5
@@ -15,11 +15,36 @@ module Stripe
15
15
  class Transfer < APIResource
16
16
  extend Stripe::APIOperations::Create
17
17
  extend Stripe::APIOperations::List
18
- include Stripe::APIOperations::Save
19
18
  extend Stripe::APIOperations::NestedResource
19
+ include Stripe::APIOperations::Save
20
20
 
21
21
  OBJECT_NAME = "transfer"
22
+ def self.object_name
23
+ "transfer"
24
+ end
22
25
 
23
26
  nested_resource_class_methods :reversal, operations: %i[create retrieve update list]
27
+
28
+ # 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.
29
+ def self.create(params = {}, opts = {})
30
+ request_stripe_object(method: :post, path: "/v1/transfers", params: params, opts: opts)
31
+ end
32
+
33
+ # 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.
34
+ def self.list(filters = {}, opts = {})
35
+ request_stripe_object(method: :get, path: "/v1/transfers", params: filters, opts: opts)
36
+ end
37
+
38
+ # Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
39
+ #
40
+ # This request accepts only metadata as an argument.
41
+ def self.update(id, params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :post,
44
+ path: format("/v1/transfers/%<id>s", { id: CGI.escape(id) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
24
49
  end
25
50
  end
@@ -9,6 +9,29 @@ module Stripe
9
9
  extend Stripe::APIOperations::List
10
10
 
11
11
  OBJECT_NAME = "treasury.credit_reversal"
12
+ def self.object_name
13
+ "treasury.credit_reversal"
14
+ end
15
+
16
+ # Reverses a ReceivedCredit and creates a CreditReversal object.
17
+ def self.create(params = {}, opts = {})
18
+ request_stripe_object(
19
+ method: :post,
20
+ path: "/v1/treasury/credit_reversals",
21
+ params: params,
22
+ opts: opts
23
+ )
24
+ end
25
+
26
+ # Returns a list of CreditReversals.
27
+ def self.list(filters = {}, opts = {})
28
+ request_stripe_object(
29
+ method: :get,
30
+ path: "/v1/treasury/credit_reversals",
31
+ params: filters,
32
+ opts: opts
33
+ )
34
+ end
12
35
  end
13
36
  end
14
37
  end
@@ -9,6 +9,29 @@ module Stripe
9
9
  extend Stripe::APIOperations::List
10
10
 
11
11
  OBJECT_NAME = "treasury.debit_reversal"
12
+ def self.object_name
13
+ "treasury.debit_reversal"
14
+ end
15
+
16
+ # Reverses a ReceivedDebit and creates a DebitReversal object.
17
+ def self.create(params = {}, opts = {})
18
+ request_stripe_object(
19
+ method: :post,
20
+ path: "/v1/treasury/debit_reversals",
21
+ params: params,
22
+ opts: opts
23
+ )
24
+ end
25
+
26
+ # Returns a list of DebitReversals.
27
+ def self.list(filters = {}, opts = {})
28
+ request_stripe_object(
29
+ method: :get,
30
+ path: "/v1/treasury/debit_reversals",
31
+ params: filters,
32
+ opts: opts
33
+ )
34
+ end
12
35
  end
13
36
  end
14
37
  end
@@ -11,25 +11,41 @@ module Stripe
11
11
  include Stripe::APIOperations::Save
12
12
 
13
13
  OBJECT_NAME = "treasury.financial_account"
14
+ def self.object_name
15
+ "treasury.financial_account"
16
+ end
14
17
 
15
- def retrieve_features(params = {}, opts = {})
18
+ # Creates a new FinancialAccount. For now, each connected account can only have one FinancialAccount.
19
+ def self.create(params = {}, opts = {})
16
20
  request_stripe_object(
17
- method: :get,
18
- path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
21
+ method: :post,
22
+ path: "/v1/treasury/financial_accounts",
19
23
  params: params,
20
24
  opts: opts
21
25
  )
22
26
  end
23
27
 
24
- def update_features(params = {}, opts = {})
28
+ # Returns a list of FinancialAccounts.
29
+ def self.list(filters = {}, opts = {})
25
30
  request_stripe_object(
26
- method: :post,
31
+ method: :get,
32
+ path: "/v1/treasury/financial_accounts",
33
+ params: filters,
34
+ opts: opts
35
+ )
36
+ end
37
+
38
+ # Retrieves Features information associated with the FinancialAccount.
39
+ def retrieve_features(params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :get,
27
42
  path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )
31
46
  end
32
47
 
48
+ # Retrieves Features information associated with the FinancialAccount.
33
49
  def self.retrieve_features(financial_account, params = {}, opts = {})
34
50
  request_stripe_object(
35
51
  method: :get,
@@ -39,6 +55,27 @@ module Stripe
39
55
  )
40
56
  end
41
57
 
58
+ # Updates the details of a FinancialAccount.
59
+ def self.update(id, params = {}, opts = {})
60
+ request_stripe_object(
61
+ method: :post,
62
+ path: format("/v1/treasury/financial_accounts/%<id>s", { id: CGI.escape(id) }),
63
+ params: params,
64
+ opts: opts
65
+ )
66
+ end
67
+
68
+ # Updates the Features associated with a FinancialAccount.
69
+ def update_features(params = {}, opts = {})
70
+ request_stripe_object(
71
+ method: :post,
72
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
73
+ params: params,
74
+ opts: opts
75
+ )
76
+ end
77
+
78
+ # Updates the Features associated with a FinancialAccount.
42
79
  def self.update_features(financial_account, params = {}, opts = {})
43
80
  request_stripe_object(
44
81
  method: :post,
@@ -7,6 +7,9 @@ module Stripe
7
7
  # Stripe or the platform can control Features via the requested field.
8
8
  class FinancialAccountFeatures < APIResource
9
9
  OBJECT_NAME = "treasury.financial_account_features"
10
+ def self.object_name
11
+ "treasury.financial_account_features"
12
+ end
10
13
  end
11
14
  end
12
15
  end
@@ -3,13 +3,19 @@
3
3
 
4
4
  module Stripe
5
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.
6
+ # Use [InboundTransfers](https://docs.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
+ #
8
+ # Related guide: [Moving money with Treasury using InboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers)
7
9
  class InboundTransfer < APIResource
8
10
  extend Stripe::APIOperations::Create
9
11
  extend Stripe::APIOperations::List
10
12
 
11
13
  OBJECT_NAME = "treasury.inbound_transfer"
14
+ def self.object_name
15
+ "treasury.inbound_transfer"
16
+ end
12
17
 
18
+ # Cancels an InboundTransfer.
13
19
  def cancel(params = {}, opts = {})
14
20
  request_stripe_object(
15
21
  method: :post,
@@ -19,6 +25,7 @@ module Stripe
19
25
  )
20
26
  end
21
27
 
28
+ # Cancels an InboundTransfer.
22
29
  def self.cancel(inbound_transfer, params = {}, opts = {})
23
30
  request_stripe_object(
24
31
  method: :post,
@@ -28,13 +35,37 @@ module Stripe
28
35
  )
29
36
  end
30
37
 
38
+ # Creates an InboundTransfer.
39
+ def self.create(params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: "/v1/treasury/inbound_transfers",
43
+ params: params,
44
+ opts: opts
45
+ )
46
+ end
47
+
48
+ # Returns a list of InboundTransfers sent from the specified FinancialAccount.
49
+ def self.list(filters = {}, opts = {})
50
+ request_stripe_object(
51
+ method: :get,
52
+ path: "/v1/treasury/inbound_transfers",
53
+ params: filters,
54
+ opts: opts
55
+ )
56
+ end
57
+
31
58
  def test_helpers
32
59
  TestHelpers.new(self)
33
60
  end
34
61
 
35
62
  class TestHelpers < APIResourceTestHelpers
36
63
  RESOURCE_CLASS = InboundTransfer
64
+ def self.resource_class
65
+ "InboundTransfer"
66
+ end
37
67
 
68
+ # Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
38
69
  def self.fail(id, params = {}, opts = {})
39
70
  request_stripe_object(
40
71
  method: :post,
@@ -44,42 +75,47 @@ module Stripe
44
75
  )
45
76
  end
46
77
 
47
- def self.return_inbound_transfer(id, params = {}, opts = {})
48
- request_stripe_object(
78
+ # Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
79
+ def fail(params = {}, opts = {})
80
+ @resource.request_stripe_object(
49
81
  method: :post,
50
- path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(id) }),
82
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
51
83
  params: params,
52
84
  opts: opts
53
85
  )
54
86
  end
55
87
 
56
- def self.succeed(id, params = {}, opts = {})
88
+ # Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
89
+ def self.return_inbound_transfer(id, params = {}, opts = {})
57
90
  request_stripe_object(
58
91
  method: :post,
59
- path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/succeed", { id: CGI.escape(id) }),
92
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(id) }),
60
93
  params: params,
61
94
  opts: opts
62
95
  )
63
96
  end
64
97
 
65
- def fail(params = {}, opts = {})
98
+ # Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
99
+ def return_inbound_transfer(params = {}, opts = {})
66
100
  @resource.request_stripe_object(
67
101
  method: :post,
68
- path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
102
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
69
103
  params: params,
70
104
  opts: opts
71
105
  )
72
106
  end
73
107
 
74
- def return_inbound_transfer(params = {}, opts = {})
75
- @resource.request_stripe_object(
108
+ # Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
109
+ def self.succeed(id, params = {}, opts = {})
110
+ request_stripe_object(
76
111
  method: :post,
77
- path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
112
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/succeed", { id: CGI.escape(id) }),
78
113
  params: params,
79
114
  opts: opts
80
115
  )
81
116
  end
82
117
 
118
+ # Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
83
119
  def succeed(params = {}, opts = {})
84
120
  @resource.request_stripe_object(
85
121
  method: :post,
@@ -3,15 +3,21 @@
3
3
 
4
4
  module Stripe
5
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).
6
+ # Use [OutboundPayments](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) 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
7
  #
8
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
+ #
10
+ # Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments)
9
11
  class OutboundPayment < APIResource
10
12
  extend Stripe::APIOperations::Create
11
13
  extend Stripe::APIOperations::List
12
14
 
13
15
  OBJECT_NAME = "treasury.outbound_payment"
16
+ def self.object_name
17
+ "treasury.outbound_payment"
18
+ end
14
19
 
20
+ # Cancel an OutboundPayment.
15
21
  def cancel(params = {}, opts = {})
16
22
  request_stripe_object(
17
23
  method: :post,
@@ -21,6 +27,7 @@ module Stripe
21
27
  )
22
28
  end
23
29
 
30
+ # Cancel an OutboundPayment.
24
31
  def self.cancel(id, params = {}, opts = {})
25
32
  request_stripe_object(
26
33
  method: :post,
@@ -30,13 +37,37 @@ module Stripe
30
37
  )
31
38
  end
32
39
 
40
+ # Creates an OutboundPayment.
41
+ def self.create(params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :post,
44
+ path: "/v1/treasury/outbound_payments",
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
49
+
50
+ # Returns a list of OutboundPayments sent from the specified FinancialAccount.
51
+ def self.list(filters = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :get,
54
+ path: "/v1/treasury/outbound_payments",
55
+ params: filters,
56
+ opts: opts
57
+ )
58
+ end
59
+
33
60
  def test_helpers
34
61
  TestHelpers.new(self)
35
62
  end
36
63
 
37
64
  class TestHelpers < APIResourceTestHelpers
38
65
  RESOURCE_CLASS = OutboundPayment
66
+ def self.resource_class
67
+ "OutboundPayment"
68
+ end
39
69
 
70
+ # Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
40
71
  def self.fail(id, params = {}, opts = {})
41
72
  request_stripe_object(
42
73
  method: :post,
@@ -46,6 +77,17 @@ module Stripe
46
77
  )
47
78
  end
48
79
 
80
+ # Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
81
+ def fail(params = {}, opts = {})
82
+ @resource.request_stripe_object(
83
+ method: :post,
84
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
85
+ params: params,
86
+ opts: opts
87
+ )
88
+ end
89
+
90
+ # Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
49
91
  def self.post(id, params = {}, opts = {})
50
92
  request_stripe_object(
51
93
  method: :post,
@@ -55,6 +97,17 @@ module Stripe
55
97
  )
56
98
  end
57
99
 
100
+ # Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
101
+ def post(params = {}, opts = {})
102
+ @resource.request_stripe_object(
103
+ method: :post,
104
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(@resource["id"]) }),
105
+ params: params,
106
+ opts: opts
107
+ )
108
+ end
109
+
110
+ # Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
58
111
  def self.return_outbound_payment(id, params = {}, opts = {})
59
112
  request_stripe_object(
60
113
  method: :post,
@@ -64,28 +117,31 @@ module Stripe
64
117
  )
65
118
  end
66
119
 
67
- def fail(params = {}, opts = {})
120
+ # Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
121
+ def return_outbound_payment(params = {}, opts = {})
68
122
  @resource.request_stripe_object(
69
123
  method: :post,
70
- path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
124
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
71
125
  params: params,
72
126
  opts: opts
73
127
  )
74
128
  end
75
129
 
76
- def post(params = {}, opts = {})
77
- @resource.request_stripe_object(
130
+ # Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
131
+ def self.update(id, params = {}, opts = {})
132
+ request_stripe_object(
78
133
  method: :post,
79
- path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(@resource["id"]) }),
134
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s", { id: CGI.escape(id) }),
80
135
  params: params,
81
136
  opts: opts
82
137
  )
83
138
  end
84
139
 
85
- def return_outbound_payment(params = {}, opts = {})
140
+ # Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
141
+ def update(params = {}, opts = {})
86
142
  @resource.request_stripe_object(
87
143
  method: :post,
88
- path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
144
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s", { id: CGI.escape(@resource["id"]) }),
89
145
  params: params,
90
146
  opts: opts
91
147
  )
@@ -3,15 +3,21 @@
3
3
 
4
4
  module Stripe
5
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.
6
+ # Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) 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
7
  #
8
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
+ #
10
+ # Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers)
9
11
  class OutboundTransfer < APIResource
10
12
  extend Stripe::APIOperations::Create
11
13
  extend Stripe::APIOperations::List
12
14
 
13
15
  OBJECT_NAME = "treasury.outbound_transfer"
16
+ def self.object_name
17
+ "treasury.outbound_transfer"
18
+ end
14
19
 
20
+ # An OutboundTransfer can be canceled if the funds have not yet been paid out.
15
21
  def cancel(params = {}, opts = {})
16
22
  request_stripe_object(
17
23
  method: :post,
@@ -21,6 +27,7 @@ module Stripe
21
27
  )
22
28
  end
23
29
 
30
+ # An OutboundTransfer can be canceled if the funds have not yet been paid out.
24
31
  def self.cancel(outbound_transfer, params = {}, opts = {})
25
32
  request_stripe_object(
26
33
  method: :post,
@@ -30,13 +37,37 @@ module Stripe
30
37
  )
31
38
  end
32
39
 
40
+ # Creates an OutboundTransfer.
41
+ def self.create(params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :post,
44
+ path: "/v1/treasury/outbound_transfers",
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
49
+
50
+ # Returns a list of OutboundTransfers sent from the specified FinancialAccount.
51
+ def self.list(filters = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :get,
54
+ path: "/v1/treasury/outbound_transfers",
55
+ params: filters,
56
+ opts: opts
57
+ )
58
+ end
59
+
33
60
  def test_helpers
34
61
  TestHelpers.new(self)
35
62
  end
36
63
 
37
64
  class TestHelpers < APIResourceTestHelpers
38
65
  RESOURCE_CLASS = OutboundTransfer
66
+ def self.resource_class
67
+ "OutboundTransfer"
68
+ end
39
69
 
70
+ # Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
40
71
  def self.fail(outbound_transfer, params = {}, opts = {})
41
72
  request_stripe_object(
42
73
  method: :post,
@@ -46,6 +77,17 @@ module Stripe
46
77
  )
47
78
  end
48
79
 
80
+ # Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
81
+ def fail(params = {}, opts = {})
82
+ @resource.request_stripe_object(
83
+ method: :post,
84
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/fail", { outbound_transfer: CGI.escape(@resource["id"]) }),
85
+ params: params,
86
+ opts: opts
87
+ )
88
+ end
89
+
90
+ # Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
49
91
  def self.post(outbound_transfer, params = {}, opts = {})
50
92
  request_stripe_object(
51
93
  method: :post,
@@ -55,6 +97,17 @@ module Stripe
55
97
  )
56
98
  end
57
99
 
100
+ # Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
101
+ def post(params = {}, opts = {})
102
+ @resource.request_stripe_object(
103
+ method: :post,
104
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/post", { outbound_transfer: CGI.escape(@resource["id"]) }),
105
+ params: params,
106
+ opts: opts
107
+ )
108
+ end
109
+
110
+ # Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
58
111
  def self.return_outbound_transfer(outbound_transfer, params = {}, opts = {})
59
112
  request_stripe_object(
60
113
  method: :post,
@@ -64,28 +117,31 @@ module Stripe
64
117
  )
65
118
  end
66
119
 
67
- def fail(params = {}, opts = {})
120
+ # Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
121
+ def return_outbound_transfer(params = {}, opts = {})
68
122
  @resource.request_stripe_object(
69
123
  method: :post,
70
- path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/fail", { outbound_transfer: CGI.escape(@resource["id"]) }),
124
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/return", { outbound_transfer: CGI.escape(@resource["id"]) }),
71
125
  params: params,
72
126
  opts: opts
73
127
  )
74
128
  end
75
129
 
76
- def post(params = {}, opts = {})
77
- @resource.request_stripe_object(
130
+ # Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
131
+ def self.update(outbound_transfer, params = {}, opts = {})
132
+ request_stripe_object(
78
133
  method: :post,
79
- path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/post", { outbound_transfer: CGI.escape(@resource["id"]) }),
134
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(outbound_transfer) }),
80
135
  params: params,
81
136
  opts: opts
82
137
  )
83
138
  end
84
139
 
85
- def return_outbound_transfer(params = {}, opts = {})
140
+ # Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
141
+ def update(params = {}, opts = {})
86
142
  @resource.request_stripe_object(
87
143
  method: :post,
88
- path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/return", { outbound_transfer: CGI.escape(@resource["id"]) }),
144
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(@resource["id"]) }),
89
145
  params: params,
90
146
  opts: opts
91
147
  )
@@ -8,6 +8,19 @@ module Stripe
8
8
  extend Stripe::APIOperations::List
9
9
 
10
10
  OBJECT_NAME = "treasury.received_credit"
11
+ def self.object_name
12
+ "treasury.received_credit"
13
+ end
14
+
15
+ # Returns a list of ReceivedCredits.
16
+ def self.list(filters = {}, opts = {})
17
+ request_stripe_object(
18
+ method: :get,
19
+ path: "/v1/treasury/received_credits",
20
+ params: filters,
21
+ opts: opts
22
+ )
23
+ end
11
24
 
12
25
  def test_helpers
13
26
  TestHelpers.new(self)
@@ -15,7 +28,11 @@ module Stripe
15
28
 
16
29
  class TestHelpers < APIResourceTestHelpers
17
30
  RESOURCE_CLASS = ReceivedCredit
31
+ def self.resource_class
32
+ "ReceivedCredit"
33
+ end
18
34
 
35
+ # 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.
19
36
  def self.create(params = {}, opts = {})
20
37
  request_stripe_object(
21
38
  method: :post,
@@ -8,6 +8,19 @@ module Stripe
8
8
  extend Stripe::APIOperations::List
9
9
 
10
10
  OBJECT_NAME = "treasury.received_debit"
11
+ def self.object_name
12
+ "treasury.received_debit"
13
+ end
14
+
15
+ # Returns a list of ReceivedDebits.
16
+ def self.list(filters = {}, opts = {})
17
+ request_stripe_object(
18
+ method: :get,
19
+ path: "/v1/treasury/received_debits",
20
+ params: filters,
21
+ opts: opts
22
+ )
23
+ end
11
24
 
12
25
  def test_helpers
13
26
  TestHelpers.new(self)
@@ -15,7 +28,11 @@ module Stripe
15
28
 
16
29
  class TestHelpers < APIResourceTestHelpers
17
30
  RESOURCE_CLASS = ReceivedDebit
31
+ def self.resource_class
32
+ "ReceivedDebit"
33
+ end
18
34
 
35
+ # 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.
19
36
  def self.create(params = {}, opts = {})
20
37
  request_stripe_object(
21
38
  method: :post,