stripe 5.28.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (243) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +286 -0
  3. data/Gemfile +5 -3
  4. data/Makefile +13 -0
  5. data/OPENAPI_VERSION +1 -0
  6. data/README.md +43 -5
  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 +45 -2
  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 +11 -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 +49 -11
  20. data/lib/stripe/error_object.rb +2 -3
  21. data/lib/stripe/instrumentation.rb +46 -6
  22. data/lib/stripe/oauth.rb +4 -3
  23. data/lib/stripe/object_types.rb +36 -10
  24. data/lib/stripe/resources/account.rb +39 -17
  25. data/lib/stripe/resources/account_link.rb +4 -0
  26. data/lib/stripe/resources/application_fee_refund.rb +7 -1
  27. data/lib/stripe/resources/apps/secret.rb +40 -0
  28. data/lib/stripe/resources/balance.rb +11 -0
  29. data/lib/stripe/resources/balance_transaction.rb +4 -0
  30. data/lib/stripe/resources/bank_account.rb +7 -0
  31. data/lib/stripe/resources/billing_portal/configuration.rb +15 -0
  32. data/lib/stripe/resources/billing_portal/session.rb +14 -0
  33. data/lib/stripe/resources/capability.rb +5 -1
  34. data/lib/stripe/resources/card.rb +6 -3
  35. data/lib/stripe/resources/cash_balance.rb +23 -0
  36. data/lib/stripe/resources/charge.rb +23 -3
  37. data/lib/stripe/resources/checkout/session.rb +49 -2
  38. data/lib/stripe/resources/country_spec.rb +6 -0
  39. data/lib/stripe/resources/coupon.rb +3 -0
  40. data/lib/stripe/resources/credit_note.rb +27 -9
  41. data/lib/stripe/resources/credit_note_line_item.rb +2 -0
  42. data/lib/stripe/resources/customer.rb +132 -4
  43. data/lib/stripe/resources/customer_balance_transaction.rb +9 -2
  44. data/lib/stripe/resources/customer_cash_balance_transaction.rb +14 -0
  45. data/lib/stripe/resources/discount.rb +5 -0
  46. data/lib/stripe/resources/dispute.rb +17 -3
  47. data/lib/stripe/resources/event.rb +29 -0
  48. data/lib/stripe/resources/exchange_rate.rb +11 -0
  49. data/lib/stripe/resources/file.rb +9 -1
  50. data/lib/stripe/resources/file_link.rb +3 -0
  51. data/lib/stripe/resources/financial_connections/account.rb +67 -0
  52. data/lib/stripe/resources/financial_connections/account_owner.rb +11 -0
  53. data/lib/stripe/resources/financial_connections/account_ownership.rb +11 -0
  54. data/lib/stripe/resources/financial_connections/session.rb +13 -0
  55. data/lib/stripe/resources/funding_instructions.rb +21 -0
  56. data/lib/stripe/resources/identity/verification_report.rb +23 -0
  57. data/lib/stripe/resources/identity/verification_session.rb +61 -0
  58. data/lib/stripe/resources/invoice.rb +105 -17
  59. data/lib/stripe/resources/invoice_item.rb +11 -0
  60. data/lib/stripe/resources/invoice_line_item.rb +1 -0
  61. data/lib/stripe/resources/issuing/authorization.rb +25 -5
  62. data/lib/stripe/resources/issuing/card.rb +78 -8
  63. data/lib/stripe/resources/issuing/cardholder.rb +3 -0
  64. data/lib/stripe/resources/issuing/dispute.rb +13 -3
  65. data/lib/stripe/resources/issuing/transaction.rb +5 -0
  66. data/lib/stripe/resources/line_item.rb +2 -0
  67. data/lib/stripe/resources/login_link.rb +2 -0
  68. data/lib/stripe/resources/mandate.rb +1 -0
  69. data/lib/stripe/resources/payment_intent.rb +103 -6
  70. data/lib/stripe/resources/payment_link.rb +35 -0
  71. data/lib/stripe/resources/payment_method.rb +25 -5
  72. data/lib/stripe/resources/payout.rb +28 -5
  73. data/lib/stripe/resources/person.rb +7 -0
  74. data/lib/stripe/resources/plan.rb +8 -0
  75. data/lib/stripe/resources/price.rb +15 -0
  76. data/lib/stripe/resources/product.rb +17 -0
  77. data/lib/stripe/resources/promotion_code.rb +2 -0
  78. data/lib/stripe/resources/quote.rb +128 -0
  79. data/lib/stripe/resources/radar/early_fraud_warning.rb +4 -0
  80. data/lib/stripe/resources/radar/value_list.rb +3 -0
  81. data/lib/stripe/resources/radar/value_list_item.rb +3 -0
  82. data/lib/stripe/resources/refund.rb +49 -0
  83. data/lib/stripe/resources/reporting/report_run.rb +8 -0
  84. data/lib/stripe/resources/reporting/report_type.rb +8 -1
  85. data/lib/stripe/resources/reversal.rb +16 -2
  86. data/lib/stripe/resources/review.rb +14 -3
  87. data/lib/stripe/resources/setup_attempt.rb +4 -0
  88. data/lib/stripe/resources/setup_intent.rb +60 -5
  89. data/lib/stripe/resources/shipping_rate.rb +14 -0
  90. data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -0
  91. data/lib/stripe/resources/source.rb +26 -6
  92. data/lib/stripe/resources/source_transaction.rb +5 -0
  93. data/lib/stripe/resources/subscription.rb +57 -3
  94. data/lib/stripe/resources/subscription_item.rb +2 -7
  95. data/lib/stripe/resources/subscription_schedule.rb +23 -5
  96. data/lib/stripe/resources/tax/calculation.rb +33 -0
  97. data/lib/stripe/resources/tax/calculation_line_item.rb +10 -0
  98. data/lib/stripe/resources/tax/settings.rb +15 -0
  99. data/lib/stripe/resources/tax/transaction.rb +49 -0
  100. data/lib/stripe/resources/tax/transaction_line_item.rb +10 -0
  101. data/lib/stripe/resources/tax_code.rb +11 -0
  102. data/lib/stripe/resources/tax_id.rb +5 -0
  103. data/lib/stripe/resources/tax_rate.rb +3 -0
  104. data/lib/stripe/resources/terminal/configuration.rb +16 -0
  105. data/lib/stripe/resources/terminal/connection_token.rb +3 -0
  106. data/lib/stripe/resources/terminal/location.rb +3 -0
  107. data/lib/stripe/resources/terminal/reader.rb +119 -0
  108. data/lib/stripe/resources/test_helpers/test_clock.rb +35 -0
  109. data/lib/stripe/resources/token.rb +20 -0
  110. data/lib/stripe/resources/topup.rb +15 -3
  111. data/lib/stripe/resources/transfer.rb +10 -11
  112. data/lib/stripe/resources/treasury/credit_reversal.rb +14 -0
  113. data/lib/stripe/resources/treasury/debit_reversal.rb +14 -0
  114. data/lib/stripe/resources/treasury/financial_account.rb +52 -0
  115. data/lib/stripe/resources/treasury/financial_account_features.rb +12 -0
  116. data/lib/stripe/resources/treasury/inbound_transfer.rb +94 -0
  117. data/lib/stripe/resources/treasury/outbound_payment.rb +96 -0
  118. data/lib/stripe/resources/treasury/outbound_transfer.rb +100 -0
  119. data/lib/stripe/resources/treasury/received_credit.rb +30 -0
  120. data/lib/stripe/resources/treasury/received_debit.rb +30 -0
  121. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  122. data/lib/stripe/resources/treasury/transaction_entry.rb +17 -0
  123. data/lib/stripe/resources/usage_record.rb +5 -0
  124. data/lib/stripe/resources/usage_record_summary.rb +1 -0
  125. data/lib/stripe/resources/webhook_endpoint.rb +7 -0
  126. data/lib/stripe/resources.rb +34 -10
  127. data/lib/stripe/search_result_object.rb +86 -0
  128. data/lib/stripe/stripe_client.rb +267 -121
  129. data/lib/stripe/stripe_configuration.rb +29 -10
  130. data/lib/stripe/stripe_object.rb +25 -2
  131. data/lib/stripe/stripe_response.rb +80 -52
  132. data/lib/stripe/util.rb +100 -9
  133. data/lib/stripe/version.rb +1 -1
  134. data/lib/stripe.rb +27 -23
  135. data/stripe.gemspec +12 -5
  136. metadata +46 -204
  137. data/.editorconfig +0 -10
  138. data/.gitattributes +0 -4
  139. data/.github/ISSUE_TEMPLATE.md +0 -5
  140. data/.gitignore +0 -8
  141. data/.rubocop.yml +0 -80
  142. data/.rubocop_todo.yml +0 -33
  143. data/.travis.yml +0 -38
  144. data/.vscode/extensions.json +0 -7
  145. data/.vscode/settings.json +0 -8
  146. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  147. data/lib/stripe/resources/bitcoin_transaction.rb +0 -15
  148. data/lib/stripe/resources/issuing/card_details.rb +0 -9
  149. data/lib/stripe/resources/order.rb +0 -33
  150. data/lib/stripe/resources/order_return.rb +0 -10
  151. data/lib/stripe/resources/recipient.rb +0 -14
  152. data/lib/stripe/resources/sku.rb +0 -13
  153. data/lib/stripe/resources/three_d_secure.rb +0 -14
  154. data/test/openapi/README.md +0 -9
  155. data/test/stripe/account_link_test.rb +0 -18
  156. data/test/stripe/account_test.rb +0 -412
  157. data/test/stripe/alipay_account_test.rb +0 -37
  158. data/test/stripe/api_operations_test.rb +0 -80
  159. data/test/stripe/api_resource_test.rb +0 -646
  160. data/test/stripe/apple_pay_domain_test.rb +0 -46
  161. data/test/stripe/application_fee_refund_test.rb +0 -37
  162. data/test/stripe/application_fee_test.rb +0 -58
  163. data/test/stripe/balance_test.rb +0 -13
  164. data/test/stripe/balance_transaction_test.rb +0 -20
  165. data/test/stripe/bank_account_test.rb +0 -36
  166. data/test/stripe/billing_portal/session_test.rb +0 -18
  167. data/test/stripe/capability_test.rb +0 -45
  168. data/test/stripe/charge_test.rb +0 -64
  169. data/test/stripe/checkout/session_test.rb +0 -53
  170. data/test/stripe/connection_manager_test.rb +0 -167
  171. data/test/stripe/country_spec_test.rb +0 -20
  172. data/test/stripe/coupon_test.rb +0 -61
  173. data/test/stripe/credit_note_test.rb +0 -90
  174. data/test/stripe/customer_balance_transaction_test.rb +0 -37
  175. data/test/stripe/customer_card_test.rb +0 -48
  176. data/test/stripe/customer_test.rb +0 -226
  177. data/test/stripe/dispute_test.rb +0 -51
  178. data/test/stripe/ephemeral_key_test.rb +0 -93
  179. data/test/stripe/errors_test.rb +0 -53
  180. data/test/stripe/exchange_rate_test.rb +0 -20
  181. data/test/stripe/file_link_test.rb +0 -41
  182. data/test/stripe/file_test.rb +0 -87
  183. data/test/stripe/instrumentation_test.rb +0 -74
  184. data/test/stripe/invoice_item_test.rb +0 -66
  185. data/test/stripe/invoice_line_item_test.rb +0 -8
  186. data/test/stripe/invoice_test.rb +0 -229
  187. data/test/stripe/issuing/authorization_test.rb +0 -72
  188. data/test/stripe/issuing/card_test.rb +0 -74
  189. data/test/stripe/issuing/cardholder_test.rb +0 -53
  190. data/test/stripe/issuing/dispute_test.rb +0 -54
  191. data/test/stripe/issuing/transaction_test.rb +0 -48
  192. data/test/stripe/list_object_test.rb +0 -202
  193. data/test/stripe/login_link_test.rb +0 -37
  194. data/test/stripe/mandate_test.rb +0 -14
  195. data/test/stripe/multipart_encoder_test.rb +0 -130
  196. data/test/stripe/oauth_test.rb +0 -104
  197. data/test/stripe/order_return_test.rb +0 -21
  198. data/test/stripe/order_test.rb +0 -82
  199. data/test/stripe/payment_intent_test.rb +0 -107
  200. data/test/stripe/payment_method_test.rb +0 -84
  201. data/test/stripe/payout_test.rb +0 -72
  202. data/test/stripe/person_test.rb +0 -46
  203. data/test/stripe/plan_test.rb +0 -98
  204. data/test/stripe/price_test.rb +0 -48
  205. data/test/stripe/product_test.rb +0 -58
  206. data/test/stripe/promotion_code_test.rb +0 -42
  207. data/test/stripe/radar/early_fraud_warning_test.rb +0 -22
  208. data/test/stripe/radar/value_list_item_test.rb +0 -48
  209. data/test/stripe/radar/value_list_test.rb +0 -61
  210. data/test/stripe/recipient_test.rb +0 -62
  211. data/test/stripe/refund_test.rb +0 -39
  212. data/test/stripe/reporting/report_run_test.rb +0 -33
  213. data/test/stripe/reporting/report_type_test.rb +0 -22
  214. data/test/stripe/reversal_test.rb +0 -43
  215. data/test/stripe/review_test.rb +0 -27
  216. data/test/stripe/setup_attempt_test.rb +0 -16
  217. data/test/stripe/setup_intent_test.rb +0 -84
  218. data/test/stripe/sigma/scheduled_query_run_test.rb +0 -22
  219. data/test/stripe/sku_test.rb +0 -60
  220. data/test/stripe/source_test.rb +0 -119
  221. data/test/stripe/stripe_client_test.rb +0 -1291
  222. data/test/stripe/stripe_configuration_test.rb +0 -131
  223. data/test/stripe/stripe_object_test.rb +0 -500
  224. data/test/stripe/stripe_response_test.rb +0 -95
  225. data/test/stripe/subscription_item_test.rb +0 -84
  226. data/test/stripe/subscription_schedule_test.rb +0 -82
  227. data/test/stripe/subscription_test.rb +0 -80
  228. data/test/stripe/tax_id_test.rb +0 -31
  229. data/test/stripe/tax_rate_test.rb +0 -43
  230. data/test/stripe/terminal/connection_token_test.rb +0 -16
  231. data/test/stripe/terminal/location_test.rb +0 -68
  232. data/test/stripe/terminal/reader_test.rb +0 -62
  233. data/test/stripe/three_d_secure_test.rb +0 -23
  234. data/test/stripe/topup_test.rb +0 -62
  235. data/test/stripe/transfer_test.rb +0 -88
  236. data/test/stripe/usage_record_summary_test.rb +0 -29
  237. data/test/stripe/util_test.rb +0 -402
  238. data/test/stripe/webhook_endpoint_test.rb +0 -59
  239. data/test/stripe/webhook_test.rb +0 -135
  240. data/test/stripe_mock.rb +0 -78
  241. data/test/stripe_test.rb +0 -132
  242. data/test/test_data.rb +0 -61
  243. data/test/test_helper.rb +0 -77
@@ -2,6 +2,14 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A `Payout` object is created when you receive funds from Stripe, or when you
6
+ # initiate a payout to either a bank account or debit card of a [connected
7
+ # Stripe account](https://stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts,
8
+ # as well as list all payouts. Payouts are made on [varying
9
+ # schedules](https://stripe.com/docs/connect/manage-payout-schedule), depending on your country and
10
+ # industry.
11
+ #
12
+ # Related guide: [Receiving payouts](https://stripe.com/docs/payouts)
5
13
  class Payout < APIResource
6
14
  extend Stripe::APIOperations::Create
7
15
  extend Stripe::APIOperations::List
@@ -9,13 +17,10 @@ module Stripe
9
17
 
10
18
  OBJECT_NAME = "payout"
11
19
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :reverse, http_verb: :post
14
-
15
20
  def cancel(params = {}, opts = {})
16
21
  request_stripe_object(
17
22
  method: :post,
18
- path: resource_url + "/cancel",
23
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(self["id"]) }),
19
24
  params: params,
20
25
  opts: opts
21
26
  )
@@ -24,7 +29,25 @@ module Stripe
24
29
  def reverse(params = {}, opts = {})
25
30
  request_stripe_object(
26
31
  method: :post,
27
- path: resource_url + "/reverse",
32
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
33
+ params: params,
34
+ opts: opts
35
+ )
36
+ end
37
+
38
+ def self.cancel(payout, params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def self.reverse(payout, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :post,
50
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
28
51
  params: params,
29
52
  opts: opts
30
53
  )
@@ -1,6 +1,13 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
5
+ # This is an object representing a person associated with a Stripe account.
6
+ #
7
+ # A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account.
8
+ # See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform prefilling and account onboarding steps.
9
+ #
10
+ # Related guide: [Handling identity verification with the API](https://stripe.com/docs/connect/identity-verification-api#person-information)
4
11
  class Person < APIResource
5
12
  extend Stripe::APIOperations::List
6
13
  include Stripe::APIOperations::Save
@@ -2,6 +2,14 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.
6
+ #
7
+ # Plans define the base price, currency, and billing cycle for recurring purchases of products.
8
+ # [Products](https://stripe.com/docs/api#products) help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.
9
+ #
10
+ # For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.
11
+ #
12
+ # Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription) and more about [products and prices](https://stripe.com/docs/products-prices/overview).
5
13
  class Plan < APIResource
6
14
  extend Stripe::APIOperations::Create
7
15
  include Stripe::APIOperations::Delete
@@ -2,11 +2,26 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products.
6
+ # [Products](https://stripe.com/docs/api#products) help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.
7
+ #
8
+ # For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.
9
+ #
10
+ # Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription), [create an invoice](https://stripe.com/docs/billing/invoices/create), and more about [products and prices](https://stripe.com/docs/products-prices/overview).
5
11
  class Price < APIResource
6
12
  extend Stripe::APIOperations::Create
7
13
  extend Stripe::APIOperations::List
14
+ extend Stripe::APIOperations::Search
8
15
  include Stripe::APIOperations::Save
9
16
 
10
17
  OBJECT_NAME = "price"
18
+
19
+ def self.search(params = {}, opts = {})
20
+ _search("/v1/prices/search", params, opts)
21
+ end
22
+
23
+ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
24
+ search(params, opts).auto_paging_each(&blk)
25
+ end
11
26
  end
12
27
  end
@@ -2,12 +2,29 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Products describe the specific goods or services you offer to your customers.
6
+ # For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product.
7
+ # They can be used in conjunction with [Prices](https://stripe.com/docs/api#prices) to configure pricing in Payment Links, Checkout, and Subscriptions.
8
+ #
9
+ # Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription),
10
+ # [share a Payment Link](https://stripe.com/docs/payment-links),
11
+ # [accept payments with Checkout](https://stripe.com/docs/payments/accept-a-payment#create-product-prices-upfront),
12
+ # and more about [Products and Prices](https://stripe.com/docs/products-prices/overview)
5
13
  class Product < APIResource
6
14
  extend Stripe::APIOperations::Create
7
15
  include Stripe::APIOperations::Delete
8
16
  extend Stripe::APIOperations::List
17
+ extend Stripe::APIOperations::Search
9
18
  include Stripe::APIOperations::Save
10
19
 
11
20
  OBJECT_NAME = "product"
21
+
22
+ def self.search(params = {}, opts = {})
23
+ _search("/v1/products/search", params, opts)
24
+ end
25
+
26
+ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
27
+ search(params, opts).auto_paging_each(&blk)
28
+ end
12
29
  end
13
30
  end
@@ -2,6 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A Promotion Code represents a customer-redeemable code for a [coupon](https://stripe.com/docs/api#coupons). It can be used to
6
+ # create multiple codes for a single coupon.
5
7
  class PromotionCode < APIResource
6
8
  extend Stripe::APIOperations::Create
7
9
  extend Stripe::APIOperations::List
@@ -0,0 +1,128 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # A Quote is a way to model prices that you'd like to provide to a customer.
6
+ # Once accepted, it will automatically create an invoice, subscription or subscription schedule.
7
+ class Quote < APIResource
8
+ extend Stripe::APIOperations::Create
9
+ extend Stripe::APIOperations::List
10
+ include Stripe::APIOperations::Save
11
+
12
+ OBJECT_NAME = "quote"
13
+
14
+ def accept(params = {}, opts = {})
15
+ request_stripe_object(
16
+ method: :post,
17
+ path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(self["id"]) }),
18
+ params: params,
19
+ opts: opts
20
+ )
21
+ end
22
+
23
+ def cancel(params = {}, opts = {})
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(self["id"]) }),
27
+ params: params,
28
+ opts: opts
29
+ )
30
+ end
31
+
32
+ def finalize_quote(params = {}, opts = {})
33
+ request_stripe_object(
34
+ method: :post,
35
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(self["id"]) }),
36
+ params: params,
37
+ opts: opts
38
+ )
39
+ end
40
+
41
+ def list_computed_upfront_line_items(params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :get,
44
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(self["id"]) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
49
+
50
+ def list_line_items(params = {}, opts = {})
51
+ request_stripe_object(
52
+ method: :get,
53
+ path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(self["id"]) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
58
+
59
+ def pdf(params = {}, opts = {}, &read_body_chunk_block)
60
+ config = opts[:client]&.config || Stripe.config
61
+ opts = { api_base: config.uploads_base }.merge(opts)
62
+ request_stream(
63
+ method: :get,
64
+ path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }),
65
+ params: params,
66
+ opts: opts,
67
+ &read_body_chunk_block
68
+ )
69
+ end
70
+
71
+ def self.accept(quote, params = {}, opts = {})
72
+ request_stripe_object(
73
+ method: :post,
74
+ path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
75
+ params: params,
76
+ opts: opts
77
+ )
78
+ end
79
+
80
+ def self.cancel(quote, params = {}, opts = {})
81
+ request_stripe_object(
82
+ method: :post,
83
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
84
+ params: params,
85
+ opts: opts
86
+ )
87
+ end
88
+
89
+ def self.finalize_quote(quote, params = {}, opts = {})
90
+ request_stripe_object(
91
+ method: :post,
92
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
93
+ params: params,
94
+ opts: opts
95
+ )
96
+ end
97
+
98
+ def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
99
+ request_stripe_object(
100
+ method: :get,
101
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
102
+ params: params,
103
+ opts: opts
104
+ )
105
+ end
106
+
107
+ def self.list_line_items(quote, params = {}, opts = {})
108
+ request_stripe_object(
109
+ method: :get,
110
+ path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }),
111
+ params: params,
112
+ opts: opts
113
+ )
114
+ end
115
+
116
+ def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
117
+ config = opts[:client]&.config || Stripe.config
118
+ opts = { api_base: config.uploads_base }.merge(opts)
119
+ execute_resource_request_stream(
120
+ :get,
121
+ format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(quote) }),
122
+ params,
123
+ opts,
124
+ &read_body_chunk_block
125
+ )
126
+ end
127
+ end
128
+ end
@@ -3,6 +3,10 @@
3
3
 
4
4
  module Stripe
5
5
  module Radar
6
+ # An early fraud warning indicates that the card issuer has notified us that a
7
+ # charge may be fraudulent.
8
+ #
9
+ # Related guide: [Early fraud warnings](https://stripe.com/docs/disputes/measuring#early-fraud-warnings)
6
10
  class EarlyFraudWarning < APIResource
7
11
  extend Stripe::APIOperations::List
8
12
 
@@ -3,6 +3,9 @@
3
3
 
4
4
  module Stripe
5
5
  module Radar
6
+ # Value lists allow you to group values together which can then be referenced in rules.
7
+ #
8
+ # Related guide: [Default Stripe lists](https://stripe.com/docs/radar/lists#managing-list-items)
6
9
  class ValueList < 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 Radar
6
+ # Value list items allow you to add specific values to a given Radar value list, which can then be used in rules.
7
+ #
8
+ # Related guide: [Managing list items](https://stripe.com/docs/radar/lists#managing-list-items)
6
9
  class ValueListItem < APIResource
7
10
  extend Stripe::APIOperations::Create
8
11
  include Stripe::APIOperations::Delete
@@ -2,11 +2,60 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # `Refund` objects allow you to refund a charge that has previously been created
6
+ # but not yet refunded. Funds will be refunded to the credit or debit card that
7
+ # was originally charged.
8
+ #
9
+ # Related guide: [Refunds](https://stripe.com/docs/refunds)
5
10
  class Refund < APIResource
6
11
  extend Stripe::APIOperations::Create
7
12
  extend Stripe::APIOperations::List
8
13
  include Stripe::APIOperations::Save
9
14
 
10
15
  OBJECT_NAME = "refund"
16
+
17
+ def cancel(params = {}, opts = {})
18
+ request_stripe_object(
19
+ method: :post,
20
+ path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(self["id"]) }),
21
+ params: params,
22
+ opts: opts
23
+ )
24
+ end
25
+
26
+ def self.cancel(refund, params = {}, opts = {})
27
+ request_stripe_object(
28
+ method: :post,
29
+ path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(refund) }),
30
+ params: params,
31
+ opts: opts
32
+ )
33
+ end
34
+
35
+ def test_helpers
36
+ TestHelpers.new(self)
37
+ end
38
+
39
+ class TestHelpers < APIResourceTestHelpers
40
+ RESOURCE_CLASS = Refund
41
+
42
+ def self.expire(refund, params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :post,
45
+ path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(refund) }),
46
+ params: params,
47
+ opts: opts
48
+ )
49
+ end
50
+
51
+ def expire(params = {}, opts = {})
52
+ @resource.request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(@resource["id"]) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
59
+ end
11
60
  end
12
61
  end
@@ -3,6 +3,14 @@
3
3
 
4
4
  module Stripe
5
5
  module Reporting
6
+ # The Report Run object represents an instance of a report type generated with
7
+ # specific run parameters. Once the object is created, Stripe begins processing the report.
8
+ # When the report has finished running, it will give you a reference to a file
9
+ # where you can retrieve your results. For an overview, see
10
+ # [API Access to Reports](https://stripe.com/docs/reporting/statements/api).
11
+ #
12
+ # Note that certain report types can only be run based on your live-mode data (not test-mode
13
+ # data), and will error when queried without a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).
6
14
  class ReportRun < APIResource
7
15
  extend Stripe::APIOperations::Create
8
16
  extend Stripe::APIOperations::List
@@ -3,8 +3,15 @@
3
3
 
4
4
  module Stripe
5
5
  module Reporting
6
+ # The Report Type resource corresponds to a particular type of report, such as
7
+ # the "Activity summary" or "Itemized payouts" reports. These objects are
8
+ # identified by an ID belonging to a set of enumerated values. See
9
+ # [API Access to Reports documentation](https://stripe.com/docs/reporting/statements/api)
10
+ # for those Report Type IDs, along with required and optional parameters.
11
+ #
12
+ # Note that certain report types can only be run based on your live-mode data (not test-mode
13
+ # data), and will error when queried without a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).
6
14
  class ReportType < APIResource
7
- extend Stripe::APIOperations::Create
8
15
  extend Stripe::APIOperations::List
9
16
 
10
17
  OBJECT_NAME = "reporting.report_type"
@@ -1,6 +1,20 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
5
+ # [Stripe Connect](https://stripe.com/docs/connect) platforms can reverse transfers made to a
6
+ # connected account, either entirely or partially, and can also specify whether
7
+ # to refund any related application fees. Transfer reversals add to the
8
+ # platform's balance and subtract from the destination account's balance.
9
+ #
10
+ # Reversing a transfer that was made for a [destination
11
+ # charge](https://stripe.com/docs/connect/destination-charges) is allowed only up to the amount of
12
+ # the charge. It is possible to reverse a
13
+ # [transfer_group](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options)
14
+ # transfer only if the destination account has enough balance to cover the
15
+ # reversal.
16
+ #
17
+ # Related guide: [Reversing transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#reversing-transfers)
4
18
  class Reversal < APIResource
5
19
  extend Stripe::APIOperations::List
6
20
  include Stripe::APIOperations::Save
@@ -22,8 +36,8 @@ module Stripe
22
36
  def self.retrieve(_id, _opts = {})
23
37
  raise NotImplementedError,
24
38
  "Reversals cannot be retrieved without a transfer ID. Retrieve " \
25
- "a reversal using `Transfer.retrieve_reversal('transfer_id', " \
26
- "'reversal_id')`"
39
+ "a reversal using `Transfer.retrieve_reversal('transfer_id', " \
40
+ "'reversal_id'`"
27
41
  end
28
42
  end
29
43
  end
@@ -2,17 +2,28 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Reviews can be used to supplement automated fraud detection with human expertise.
6
+ #
7
+ # Learn more about [Radar](https://stripe.com/radar) and reviewing payments
8
+ # [here](https://stripe.com/docs/radar/reviews).
5
9
  class Review < APIResource
6
10
  extend Stripe::APIOperations::List
7
11
 
8
12
  OBJECT_NAME = "review"
9
13
 
10
- custom_method :approve, http_verb: :post
11
-
12
14
  def approve(params = {}, opts = {})
13
15
  request_stripe_object(
14
16
  method: :post,
15
- path: resource_url + "/approve",
17
+ path: format("/v1/reviews/%<review>s/approve", { review: CGI.escape(self["id"]) }),
18
+ params: params,
19
+ opts: opts
20
+ )
21
+ end
22
+
23
+ def self.approve(review, params = {}, opts = {})
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: format("/v1/reviews/%<review>s/approve", { review: CGI.escape(review) }),
16
27
  params: params,
17
28
  opts: opts
18
29
  )
@@ -2,6 +2,10 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A SetupAttempt describes one attempted confirmation of a SetupIntent,
6
+ # whether that confirmation was successful or unsuccessful. You can use
7
+ # SetupAttempts to inspect details of a specific attempt at setting up a
8
+ # payment method using a SetupIntent.
5
9
  class SetupAttempt < APIResource
6
10
  extend Stripe::APIOperations::List
7
11
 
@@ -2,6 +2,28 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments.
6
+ # For example, you could use a SetupIntent to set up and save your customer's card without immediately collecting a payment.
7
+ # Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow.
8
+ #
9
+ # Create a SetupIntent as soon as you're ready to collect your customer's payment credentials.
10
+ # Do not maintain long-lived, unconfirmed SetupIntents as they may no longer be valid.
11
+ # The SetupIntent then transitions through multiple [statuses](https://stripe.com/docs/payments/intents#intent-statuses) as it guides
12
+ # you through the setup process.
13
+ #
14
+ # Successful SetupIntents result in payment credentials that are optimized for future payments.
15
+ # For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) may need to be run through
16
+ # [Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication) at the time of payment method collection
17
+ # in order to streamline later [off-session payments](https://stripe.com/docs/payments/setup-intents).
18
+ # If the SetupIntent is used with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer), upon success,
19
+ # it will automatically attach the resulting payment method to that Customer.
20
+ # We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on
21
+ # PaymentIntents to save payment methods in order to prevent saving invalid or unoptimized payment methods.
22
+ #
23
+ # By using SetupIntents, you ensure that your customers experience the minimum set of required friction,
24
+ # even as regulations change over time.
25
+ #
26
+ # Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents)
5
27
  class SetupIntent < APIResource
6
28
  extend Stripe::APIOperations::Create
7
29
  extend Stripe::APIOperations::List
@@ -9,13 +31,10 @@ module Stripe
9
31
 
10
32
  OBJECT_NAME = "setup_intent"
11
33
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :confirm, http_verb: :post
14
-
15
34
  def cancel(params = {}, opts = {})
16
35
  request_stripe_object(
17
36
  method: :post,
18
- path: resource_url + "/cancel",
37
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
19
38
  params: params,
20
39
  opts: opts
21
40
  )
@@ -24,7 +43,43 @@ module Stripe
24
43
  def confirm(params = {}, opts = {})
25
44
  request_stripe_object(
26
45
  method: :post,
27
- path: resource_url + "/confirm",
46
+ path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
47
+ params: params,
48
+ opts: opts
49
+ )
50
+ end
51
+
52
+ def verify_microdeposits(params = {}, opts = {})
53
+ request_stripe_object(
54
+ method: :post,
55
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
56
+ params: params,
57
+ opts: opts
58
+ )
59
+ end
60
+
61
+ def self.cancel(intent, params = {}, opts = {})
62
+ request_stripe_object(
63
+ method: :post,
64
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
65
+ params: params,
66
+ opts: opts
67
+ )
68
+ end
69
+
70
+ def self.confirm(intent, params = {}, opts = {})
71
+ request_stripe_object(
72
+ method: :post,
73
+ path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
74
+ params: params,
75
+ opts: opts
76
+ )
77
+ end
78
+
79
+ def self.verify_microdeposits(intent, params = {}, opts = {})
80
+ request_stripe_object(
81
+ method: :post,
82
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
28
83
  params: params,
29
84
  opts: opts
30
85
  )
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # Shipping rates describe the price of shipping presented to your customers and
6
+ # applied to a purchase. For more information, see [Charge for shipping](https://stripe.com/docs/payments/during-payment/charge-shipping).
7
+ class ShippingRate < APIResource
8
+ extend Stripe::APIOperations::Create
9
+ extend Stripe::APIOperations::List
10
+ include Stripe::APIOperations::Save
11
+
12
+ OBJECT_NAME = "shipping_rate"
13
+ end
14
+ end
@@ -3,6 +3,10 @@
3
3
 
4
4
  module Stripe
5
5
  module Sigma
6
+ # If you have [scheduled a Sigma query](https://stripe.com/docs/sigma/scheduled-queries), you'll
7
+ # receive a `sigma.scheduled_query_run.created` webhook each time the query
8
+ # runs. The webhook contains a `ScheduledQueryRun` object, which you can use to
9
+ # retrieve the query results.
6
10
  class ScheduledQueryRun < APIResource
7
11
  extend Stripe::APIOperations::List
8
12
 
@@ -2,6 +2,16 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # `Source` objects allow you to accept a variety of payment methods. They
6
+ # represent a customer's payment instrument, and can be used with the Stripe API
7
+ # just like a `Card` object: once chargeable, they can be charged, or can be
8
+ # attached to customers.
9
+ #
10
+ # Stripe doesn't recommend using the deprecated [Sources API](https://stripe.com/docs/api/sources).
11
+ # We recommend that you adopt the [PaymentMethods API](https://stripe.com/docs/api/payment_methods).
12
+ # This newer API provides access to our latest features and payment method types.
13
+ #
14
+ # Related guides: [Sources API](https://stripe.com/docs/sources) and [Sources & Customers](https://stripe.com/docs/sources/customers).
5
15
  class Source < APIResource
6
16
  extend Stripe::APIOperations::Create
7
17
  include Stripe::APIOperations::Save
@@ -9,15 +19,22 @@ module Stripe
9
19
 
10
20
  OBJECT_NAME = "source"
11
21
 
12
- custom_method :verify, http_verb: :post
13
-
14
22
  nested_resource_class_methods :source_transaction,
15
23
  operations: %i[retrieve list]
16
24
 
17
25
  def verify(params = {}, opts = {})
18
26
  request_stripe_object(
19
27
  method: :post,
20
- path: resource_url + "/verify",
28
+ path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(self["id"]) }),
29
+ params: params,
30
+ opts: opts
31
+ )
32
+ end
33
+
34
+ def self.verify(source, params = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :post,
37
+ path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(source) }),
21
38
  params: params,
22
39
  opts: opts
23
40
  )
@@ -37,9 +54,12 @@ module Stripe
37
54
  end
38
55
 
39
56
  def source_transactions(params = {}, opts = {})
40
- resp, opts = execute_resource_request(:get, resource_url + "/source_transactions", params,
41
- opts)
42
- Util.convert_to_stripe_object(resp.data, opts)
57
+ request_stripe_object(
58
+ method: :get,
59
+ path: resource_url + "/source_transactions",
60
+ params: params,
61
+ opts: opts
62
+ )
43
63
  end
44
64
  extend Gem::Deprecate
45
65
  deprecate :source_transactions, :"Source.list_source_transactions", 2020, 1