stripe 12.7.0.pre.beta.2 → 13.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +725 -1359
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +4 -3
  5. data/VERSION +1 -1
  6. data/examples/README.md +16 -0
  7. data/examples/example_template.rb +36 -0
  8. data/examples/meter_event_stream.rb +57 -0
  9. data/examples/thinevent_webhook_handler.rb +39 -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 -20
  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/payment_intent.rb +0 -50
  34. data/lib/stripe/resources/quote.rb +4 -108
  35. data/lib/stripe/resources/source.rb +3 -2
  36. data/lib/stripe/resources/subscription.rb +6 -6
  37. data/lib/stripe/resources/subscription_schedule.rb +0 -20
  38. data/lib/stripe/resources/terminal/reader.rb +0 -60
  39. data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
  40. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
  41. data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
  42. data/lib/stripe/resources/v2/event.rb +13 -0
  43. data/lib/stripe/resources.rb +9 -18
  44. data/lib/stripe/search_result_object.rb +1 -1
  45. data/lib/stripe/services/account_capability_service.rb +39 -0
  46. data/lib/stripe/services/account_external_account_service.rb +68 -0
  47. data/lib/stripe/services/account_link_service.rb +17 -0
  48. data/lib/stripe/services/account_login_link_service.rb +19 -0
  49. data/lib/stripe/services/account_person_service.rb +61 -0
  50. data/lib/stripe/services/account_service.rb +100 -0
  51. data/lib/stripe/services/account_session_service.rb +17 -0
  52. data/lib/stripe/services/apple_pay_domain_service.rb +50 -0
  53. data/lib/stripe/services/application_fee_refund_service.rb +60 -0
  54. data/lib/stripe/services/application_fee_service.rb +35 -0
  55. data/lib/stripe/services/apps/secret_service.rb +52 -0
  56. data/lib/stripe/services/apps_service.rb +13 -0
  57. data/lib/stripe/services/balance_service.rb +12 -0
  58. data/lib/stripe/services/balance_transaction_service.rb +32 -0
  59. data/lib/stripe/services/billing/alert_service.rb +74 -0
  60. data/lib/stripe/services/billing/credit_balance_summary_service.rb +19 -0
  61. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +30 -0
  62. data/lib/stripe/services/billing/credit_grant_service.rb +74 -0
  63. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +19 -0
  64. data/lib/stripe/services/billing/meter_event_service.rb +19 -0
  65. data/lib/stripe/services/billing/meter_event_summary_service.rb +19 -0
  66. data/lib/stripe/services/billing/meter_service.rb +81 -0
  67. data/lib/stripe/services/billing_portal/configuration_service.rb +52 -0
  68. data/lib/stripe/services/billing_portal/session_service.rb +19 -0
  69. data/lib/stripe/services/billing_portal_service.rb +14 -0
  70. data/lib/stripe/services/billing_service.rb +20 -0
  71. data/lib/stripe/services/charge_service.rb +69 -0
  72. data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
  73. data/lib/stripe/services/checkout/session_service.rb +72 -0
  74. data/lib/stripe/services/checkout_service.rb +13 -0
  75. data/lib/stripe/services/climate/order_service.rb +68 -0
  76. data/lib/stripe/services/climate/product_service.rb +30 -0
  77. data/lib/stripe/services/climate/supplier_service.rb +30 -0
  78. data/lib/stripe/services/climate_service.rb +15 -0
  79. data/lib/stripe/services/confirmation_token_service.rb +17 -0
  80. data/lib/stripe/services/country_spec_service.rb +28 -0
  81. data/lib/stripe/services/coupon_service.rb +51 -0
  82. data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
  83. data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
  84. data/lib/stripe/services/credit_note_service.rb +93 -0
  85. data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
  86. data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
  87. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
  88. data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
  89. data/lib/stripe/services/customer_payment_method_service.rb +28 -0
  90. data/lib/stripe/services/customer_payment_source_service.rb +76 -0
  91. data/lib/stripe/services/customer_service.rb +89 -0
  92. data/lib/stripe/services/customer_session_service.rb +17 -0
  93. data/lib/stripe/services/customer_tax_id_service.rb +50 -0
  94. data/lib/stripe/services/dispute_service.rb +48 -0
  95. data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
  96. data/lib/stripe/services/entitlements/feature_service.rb +52 -0
  97. data/lib/stripe/services/entitlements_service.rb +14 -0
  98. data/lib/stripe/services/ephemeral_key_service.rb +28 -0
  99. data/lib/stripe/services/event_service.rb +22 -0
  100. data/lib/stripe/services/exchange_rate_service.rb +28 -0
  101. data/lib/stripe/services/file_link_service.rb +38 -0
  102. data/lib/stripe/services/file_service.rb +35 -0
  103. data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
  104. data/lib/stripe/services/financial_connections/account_service.rb +81 -0
  105. data/lib/stripe/services/financial_connections/session_service.rb +30 -0
  106. data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
  107. data/lib/stripe/services/financial_connections_service.rb +15 -0
  108. data/lib/stripe/services/forwarding/request_service.rb +41 -0
  109. data/lib/stripe/services/forwarding_service.rb +13 -0
  110. data/lib/stripe/services/identity/verification_report_service.rb +30 -0
  111. data/lib/stripe/services/identity/verification_session_service.rb +106 -0
  112. data/lib/stripe/services/identity_service.rb +14 -0
  113. data/lib/stripe/services/invoice_item_service.rb +61 -0
  114. data/lib/stripe/services/invoice_line_item_service.rb +31 -0
  115. data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
  116. data/lib/stripe/services/invoice_service.rb +202 -0
  117. data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
  118. data/lib/stripe/services/issuing/authorization_service.rb +65 -0
  119. data/lib/stripe/services/issuing/card_service.rb +52 -0
  120. data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
  121. data/lib/stripe/services/issuing/dispute_service.rb +63 -0
  122. data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
  123. data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
  124. data/lib/stripe/services/issuing/token_service.rb +41 -0
  125. data/lib/stripe/services/issuing/transaction_service.rb +41 -0
  126. data/lib/stripe/services/issuing_service.rb +20 -0
  127. data/lib/stripe/services/mandate_service.rb +17 -0
  128. data/lib/stripe/services/oauth_service.rb +63 -0
  129. data/lib/stripe/services/payment_intent_service.rb +204 -0
  130. data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
  131. data/lib/stripe/services/payment_link_service.rb +57 -0
  132. data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
  133. data/lib/stripe/services/payment_method_domain_service.rb +66 -0
  134. data/lib/stripe/services/payment_method_service.rb +86 -0
  135. data/lib/stripe/services/payout_service.rb +66 -0
  136. data/lib/stripe/services/plan_service.rb +49 -0
  137. data/lib/stripe/services/price_service.rb +52 -0
  138. data/lib/stripe/services/product_feature_service.rb +50 -0
  139. data/lib/stripe/services/product_service.rb +70 -0
  140. data/lib/stripe/services/promotion_code_service.rb +50 -0
  141. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
  142. data/lib/stripe/services/quote_line_item_service.rb +17 -0
  143. data/lib/stripe/services/quote_service.rb +92 -0
  144. data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
  145. data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
  146. data/lib/stripe/services/radar/value_list_service.rb +63 -0
  147. data/lib/stripe/services/radar_service.rb +15 -0
  148. data/lib/stripe/services/refund_service.rb +63 -0
  149. data/lib/stripe/services/reporting/report_run_service.rb +41 -0
  150. data/lib/stripe/services/reporting/report_type_service.rb +30 -0
  151. data/lib/stripe/services/reporting_service.rb +14 -0
  152. data/lib/stripe/services/review_service.rb +33 -0
  153. data/lib/stripe/services/setup_attempt_service.rb +17 -0
  154. data/lib/stripe/services/setup_intent_service.rb +105 -0
  155. data/lib/stripe/services/shipping_rate_service.rb +50 -0
  156. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
  157. data/lib/stripe/services/sigma_service.rb +13 -0
  158. data/lib/stripe/services/source_service.rb +64 -0
  159. data/lib/stripe/services/source_transaction_service.rb +17 -0
  160. data/lib/stripe/services/subscription_item_service.rb +69 -0
  161. data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
  162. data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
  163. data/lib/stripe/services/subscription_schedule_service.rb +72 -0
  164. data/lib/stripe/services/subscription_service.rb +127 -0
  165. data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
  166. data/lib/stripe/services/tax/calculation_service.rb +37 -0
  167. data/lib/stripe/services/tax/registration_service.rb +54 -0
  168. data/lib/stripe/services/tax/settings_service.rb +30 -0
  169. data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
  170. data/lib/stripe/services/tax/transaction_service.rb +48 -0
  171. data/lib/stripe/services/tax_code_service.rb +22 -0
  172. data/lib/stripe/services/tax_id_service.rb +38 -0
  173. data/lib/stripe/services/tax_rate_service.rb +38 -0
  174. data/lib/stripe/services/tax_service.rb +16 -0
  175. data/lib/stripe/services/terminal/configuration_service.rb +63 -0
  176. data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
  177. data/lib/stripe/services/terminal/location_service.rb +64 -0
  178. data/lib/stripe/services/terminal/reader_service.rb +118 -0
  179. data/lib/stripe/services/terminal_service.rb +16 -0
  180. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
  181. data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
  182. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +76 -0
  183. data/lib/stripe/services/test_helpers/issuing/card_service.rb +54 -0
  184. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
  185. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
  186. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  187. data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
  188. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
  189. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  190. data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
  191. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
  192. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
  193. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
  194. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
  195. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
  196. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  197. data/lib/stripe/services/test_helpers_service.rb +19 -0
  198. data/lib/stripe/services/token_service.rb +23 -0
  199. data/lib/stripe/services/topup_service.rb +49 -0
  200. data/lib/stripe/services/transfer_reversal_service.rb +56 -0
  201. data/lib/stripe/services/transfer_service.rb +47 -0
  202. data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
  203. data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
  204. data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
  205. data/lib/stripe/services/treasury/financial_account_service.rb +59 -0
  206. data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
  207. data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
  208. data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
  209. data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
  210. data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
  211. data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
  212. data/lib/stripe/services/treasury/transaction_service.rb +30 -0
  213. data/lib/stripe/services/treasury_service.rb +22 -0
  214. data/lib/stripe/services/v1_services.rb +89 -0
  215. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
  216. data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
  217. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
  218. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
  219. data/lib/stripe/services/v2/billing_service.rb +18 -0
  220. data/lib/stripe/services/v2/core/event_service.rb +32 -0
  221. data/lib/stripe/services/v2/core_service.rb +15 -0
  222. data/lib/stripe/services/v2_services.rb +14 -0
  223. data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
  224. data/lib/stripe/services.rb +181 -0
  225. data/lib/stripe/singleton_api_resource.rb +1 -18
  226. data/lib/stripe/stripe_client.rb +51 -1067
  227. data/lib/stripe/stripe_configuration.rb +32 -20
  228. data/lib/stripe/stripe_object.rb +37 -18
  229. data/lib/stripe/stripe_service.rb +32 -0
  230. data/lib/stripe/thin_event.rb +17 -0
  231. data/lib/stripe/util.rb +69 -46
  232. data/lib/stripe/v2_list_object.rb +84 -0
  233. data/lib/stripe/version.rb +1 -1
  234. data/lib/stripe/webhook.rb +1 -1
  235. data/lib/stripe.rb +15 -54
  236. metadata +203 -23
  237. data/lib/stripe/request_signing_authenticator.rb +0 -79
  238. data/lib/stripe/resources/account_notice.rb +0 -32
  239. data/lib/stripe/resources/capital/financing_offer.rb +0 -49
  240. data/lib/stripe/resources/capital/financing_summary.rb +0 -15
  241. data/lib/stripe/resources/capital/financing_transaction.rb +0 -27
  242. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +0 -14
  243. data/lib/stripe/resources/financial_connections/institution.rb +0 -26
  244. data/lib/stripe/resources/gift_cards/card.rb +0 -59
  245. data/lib/stripe/resources/gift_cards/transaction.rb +0 -93
  246. data/lib/stripe/resources/invoice_payment.rb +0 -12
  247. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +0 -88
  248. data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +0 -26
  249. data/lib/stripe/resources/margin.rb +0 -37
  250. data/lib/stripe/resources/order.rb +0 -120
  251. data/lib/stripe/resources/quote_preview_invoice.rb +0 -43
  252. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +0 -11
  253. data/lib/stripe/resources/tax/association.rb +0 -24
  254. data/lib/stripe/resources/tax/form.rb +0 -49
  255. data/lib/stripe/resources/terminal/reader_collected_data.rb +0 -14
@@ -0,0 +1,63 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Radar
6
+ class ValueListService < StripeService
7
+ # Creates a new ValueList object, which can then be referenced in rules.
8
+ def create(params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: "/v1/radar/value_lists",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
19
+ def delete(value_list, params = {}, opts = {})
20
+ request(
21
+ method: :delete,
22
+ path: format("/v1/radar/value_lists/%<value_list>s", { value_list: CGI.escape(value_list) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Returns a list of ValueList objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
30
+ def list(params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: "/v1/radar/value_lists",
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Retrieves a ValueList object.
41
+ def retrieve(value_list, params = {}, opts = {})
42
+ request(
43
+ method: :get,
44
+ path: format("/v1/radar/value_lists/%<value_list>s", { value_list: CGI.escape(value_list) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+
51
+ # Updates a ValueList object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Note that item_type is immutable.
52
+ def update(value_list, params = {}, opts = {})
53
+ request(
54
+ method: :post,
55
+ path: format("/v1/radar/value_lists/%<value_list>s", { value_list: CGI.escape(value_list) }),
56
+ params: params,
57
+ opts: opts,
58
+ base_address: :api
59
+ )
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class RadarService < StripeService
6
+ attr_reader :early_fraud_warnings, :value_lists, :value_list_items
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @early_fraud_warnings = Stripe::Radar::EarlyFraudWarningService.new(@requestor)
11
+ @value_lists = Stripe::Radar::ValueListService.new(@requestor)
12
+ @value_list_items = Stripe::Radar::ValueListItemService.new(@requestor)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,63 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class RefundService < StripeService
6
+ # Cancels a refund with a status of requires_action.
7
+ #
8
+ # You can't cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.
9
+ def cancel(refund, params = {}, opts = {})
10
+ request(
11
+ method: :post,
12
+ path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(refund) }),
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+
19
+ # When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.
20
+ #
21
+ # Creating a new refund will refund a charge that has previously been created but not yet refunded.
22
+ # Funds will be refunded to the credit or debit card that was originally charged.
23
+ #
24
+ # You can optionally refund only part of a charge.
25
+ # You can do so multiple times, until the entire charge has been refunded.
26
+ #
27
+ # Once entirely refunded, a charge can't be refunded again.
28
+ # This method will raise an error when called on an already-refunded charge,
29
+ # or when trying to refund more money than is left on a charge.
30
+ def create(params = {}, opts = {})
31
+ request(method: :post, path: "/v1/refunds", params: params, opts: opts, base_address: :api)
32
+ end
33
+
34
+ # Returns a list of all refunds you created. We return the refunds in sorted order, with the most recent refunds appearing first. The 10 most recent refunds are always available by default on the Charge object.
35
+ def list(params = {}, opts = {})
36
+ request(method: :get, path: "/v1/refunds", params: params, opts: opts, base_address: :api)
37
+ end
38
+
39
+ # Retrieves the details of an existing refund.
40
+ def retrieve(refund, params = {}, opts = {})
41
+ request(
42
+ method: :get,
43
+ path: format("/v1/refunds/%<refund>s", { refund: CGI.escape(refund) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+
50
+ # Updates the refund that you specify by setting the values of the passed parameters. Any parameters that you don't provide remain unchanged.
51
+ #
52
+ # This request only accepts metadata as an argument.
53
+ def update(refund, params = {}, opts = {})
54
+ request(
55
+ method: :post,
56
+ path: format("/v1/refunds/%<refund>s", { refund: CGI.escape(refund) }),
57
+ params: params,
58
+ opts: opts,
59
+ base_address: :api
60
+ )
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,41 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Reporting
6
+ class ReportRunService < StripeService
7
+ # Creates a new object and begin running the report. (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).)
8
+ def create(params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: "/v1/reporting/report_runs",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Returns a list of Report Runs, with the most recent appearing first.
19
+ def list(params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: "/v1/reporting/report_runs",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Retrieves the details of an existing Report Run.
30
+ def retrieve(report_run, params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: format("/v1/reporting/report_runs/%<report_run>s", { report_run: CGI.escape(report_run) }),
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 Reporting
6
+ class ReportTypeService < StripeService
7
+ # Returns a full list of Report Types.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/reporting/report_types",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves the details of a Report Type. (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).)
19
+ def retrieve(report_type, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/reporting/report_types/%<report_type>s", { report_type: CGI.escape(report_type) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class ReportingService < StripeService
6
+ attr_reader :report_runs, :report_types
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @report_runs = Stripe::Reporting::ReportRunService.new(@requestor)
11
+ @report_types = Stripe::Reporting::ReportTypeService.new(@requestor)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class ReviewService < StripeService
6
+ # Approves a Review object, closing it and removing it from the list of reviews.
7
+ def approve(review, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/reviews/%<review>s/approve", { review: CGI.escape(review) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Returns a list of Review objects that have open set to true. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
18
+ def list(params = {}, opts = {})
19
+ request(method: :get, path: "/v1/reviews", params: params, opts: opts, base_address: :api)
20
+ end
21
+
22
+ # Retrieves a Review object.
23
+ def retrieve(review, params = {}, opts = {})
24
+ request(
25
+ method: :get,
26
+ path: format("/v1/reviews/%<review>s", { review: CGI.escape(review) }),
27
+ params: params,
28
+ opts: opts,
29
+ base_address: :api
30
+ )
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SetupAttemptService < StripeService
6
+ # Returns a list of SetupAttempts that associate with a provided SetupIntent.
7
+ def list(params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: "/v1/setup_attempts",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,105 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SetupIntentService < StripeService
6
+ # You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
7
+ #
8
+ # After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. You can't cancel the SetupIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
9
+ def cancel(intent, params = {}, opts = {})
10
+ request(
11
+ method: :post,
12
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+
19
+ # Confirm that your customer intends to set up the current or
20
+ # provided payment method. For example, you would confirm a SetupIntent
21
+ # when a customer hits the “Save” button on a payment method management
22
+ # page on your website.
23
+ #
24
+ # If the selected payment method does not require any additional
25
+ # steps from the customer, the SetupIntent will transition to the
26
+ # succeeded status.
27
+ #
28
+ # Otherwise, it will transition to the requires_action status and
29
+ # suggest additional actions via next_action. If setup fails,
30
+ # the SetupIntent will transition to the
31
+ # requires_payment_method status or the canceled status if the
32
+ # confirmation limit is reached.
33
+ def confirm(intent, params = {}, opts = {})
34
+ request(
35
+ method: :post,
36
+ path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
37
+ params: params,
38
+ opts: opts,
39
+ base_address: :api
40
+ )
41
+ end
42
+
43
+ # Creates a SetupIntent object.
44
+ #
45
+ # After you create the SetupIntent, attach a payment method and [confirm](https://stripe.com/docs/api/setup_intents/confirm)
46
+ # it to collect any required permissions to charge the payment method later.
47
+ def create(params = {}, opts = {})
48
+ request(
49
+ method: :post,
50
+ path: "/v1/setup_intents",
51
+ params: params,
52
+ opts: opts,
53
+ base_address: :api
54
+ )
55
+ end
56
+
57
+ # Returns a list of SetupIntents.
58
+ def list(params = {}, opts = {})
59
+ request(
60
+ method: :get,
61
+ path: "/v1/setup_intents",
62
+ params: params,
63
+ opts: opts,
64
+ base_address: :api
65
+ )
66
+ end
67
+
68
+ # Retrieves the details of a SetupIntent that has previously been created.
69
+ #
70
+ # Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string.
71
+ #
72
+ # When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the [SetupIntent](https://stripe.com/docs/api#setup_intent_object) object reference for more details.
73
+ def retrieve(intent, params = {}, opts = {})
74
+ request(
75
+ method: :get,
76
+ path: format("/v1/setup_intents/%<intent>s", { intent: CGI.escape(intent) }),
77
+ params: params,
78
+ opts: opts,
79
+ base_address: :api
80
+ )
81
+ end
82
+
83
+ # Updates a SetupIntent object.
84
+ def update(intent, params = {}, opts = {})
85
+ request(
86
+ method: :post,
87
+ path: format("/v1/setup_intents/%<intent>s", { intent: CGI.escape(intent) }),
88
+ params: params,
89
+ opts: opts,
90
+ base_address: :api
91
+ )
92
+ end
93
+
94
+ # Verifies microdeposits on a SetupIntent object.
95
+ def verify_microdeposits(intent, params = {}, opts = {})
96
+ request(
97
+ method: :post,
98
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
99
+ params: params,
100
+ opts: opts,
101
+ base_address: :api
102
+ )
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,50 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class ShippingRateService < StripeService
6
+ # Creates a new shipping rate object.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/shipping_rates",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Returns a list of your shipping rates.
18
+ def list(params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: "/v1/shipping_rates",
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Returns the shipping rate object with the given ID.
29
+ def retrieve(shipping_rate_token, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/shipping_rates/%<shipping_rate_token>s", { shipping_rate_token: CGI.escape(shipping_rate_token) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Updates an existing shipping rate object.
40
+ def update(shipping_rate_token, params = {}, opts = {})
41
+ request(
42
+ method: :post,
43
+ path: format("/v1/shipping_rates/%<shipping_rate_token>s", { shipping_rate_token: CGI.escape(shipping_rate_token) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,30 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Sigma
6
+ class ScheduledQueryRunService < StripeService
7
+ # Returns a list of scheduled query runs.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/sigma/scheduled_query_runs",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves the details of an scheduled query run.
19
+ def retrieve(scheduled_query_run, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/sigma/scheduled_query_runs/%<scheduled_query_run>s", { scheduled_query_run: CGI.escape(scheduled_query_run) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SigmaService < StripeService
6
+ attr_reader :scheduled_query_runs
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @scheduled_query_runs = Stripe::Sigma::ScheduledQueryRunService.new(@requestor)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,64 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SourceService < StripeService
6
+ attr_reader :transactions
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @transactions = Stripe::SourceTransactionService.new(@requestor)
11
+ end
12
+
13
+ # Creates a new source object.
14
+ def create(params = {}, opts = {})
15
+ request(method: :post, path: "/v1/sources", params: params, opts: opts, base_address: :api)
16
+ end
17
+
18
+ # Delete a specified source for a given customer.
19
+ def detach(customer, id, params = {}, opts = {})
20
+ request(
21
+ method: :delete,
22
+ path: format("/v1/customers/%<customer>s/sources/%<id>s", { customer: CGI.escape(customer), id: CGI.escape(id) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
30
+ def retrieve(source, params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: format("/v1/sources/%<source>s", { source: CGI.escape(source) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
41
+ #
42
+ # This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
43
+ def update(source, params = {}, opts = {})
44
+ request(
45
+ method: :post,
46
+ path: format("/v1/sources/%<source>s", { source: CGI.escape(source) }),
47
+ params: params,
48
+ opts: opts,
49
+ base_address: :api
50
+ )
51
+ end
52
+
53
+ # Verify a given source.
54
+ def verify(source, params = {}, opts = {})
55
+ request(
56
+ method: :post,
57
+ path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(source) }),
58
+ params: params,
59
+ opts: opts,
60
+ base_address: :api
61
+ )
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SourceTransactionService < StripeService
6
+ # List source transactions for a given source.
7
+ def list(source, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/sources/%<source>s/source_transactions", { source: CGI.escape(source) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,69 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SubscriptionItemService < StripeService
6
+ attr_reader :usage_records, :usage_record_summaries
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @usage_records = Stripe::SubscriptionItemUsageRecordService.new(@requestor)
11
+ @usage_record_summaries = Stripe::SubscriptionItemUsageRecordSummaryService.new(@requestor)
12
+ end
13
+
14
+ # Adds a new item to an existing subscription. No existing items will be changed or replaced.
15
+ def create(params = {}, opts = {})
16
+ request(
17
+ method: :post,
18
+ path: "/v1/subscription_items",
19
+ params: params,
20
+ opts: opts,
21
+ base_address: :api
22
+ )
23
+ end
24
+
25
+ # Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
26
+ def delete(item, params = {}, opts = {})
27
+ request(
28
+ method: :delete,
29
+ path: format("/v1/subscription_items/%<item>s", { item: CGI.escape(item) }),
30
+ params: params,
31
+ opts: opts,
32
+ base_address: :api
33
+ )
34
+ end
35
+
36
+ # Returns a list of your subscription items for a given subscription.
37
+ def list(params = {}, opts = {})
38
+ request(
39
+ method: :get,
40
+ path: "/v1/subscription_items",
41
+ params: params,
42
+ opts: opts,
43
+ base_address: :api
44
+ )
45
+ end
46
+
47
+ # Retrieves the subscription item with the given ID.
48
+ def retrieve(item, params = {}, opts = {})
49
+ request(
50
+ method: :get,
51
+ path: format("/v1/subscription_items/%<item>s", { item: CGI.escape(item) }),
52
+ params: params,
53
+ opts: opts,
54
+ base_address: :api
55
+ )
56
+ end
57
+
58
+ # Updates the plan or quantity of an item on a current subscription.
59
+ def update(item, params = {}, opts = {})
60
+ request(
61
+ method: :post,
62
+ path: format("/v1/subscription_items/%<item>s", { item: CGI.escape(item) }),
63
+ params: params,
64
+ opts: opts,
65
+ base_address: :api
66
+ )
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SubscriptionItemUsageRecordService < StripeService
6
+ # Creates a usage record for a specified subscription item and date, and fills it with a quantity.
7
+ #
8
+ # Usage records provide quantity information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the [metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing) plan, Stripe helps you send accurate invoices to your customers.
9
+ #
10
+ # The default calculation for usage is to add up all the quantity values of the usage records within a billing period. You can change this default behavior with the billing plan's aggregate_usage [parameter](https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage). When there is more than one usage record with the same timestamp, Stripe adds the quantity values together. In most cases, this is the desired resolution, however, you can change this behavior with the action parameter.
11
+ #
12
+ # The default pricing model for metered billing is [per-unit pricing. For finer granularity, you can configure metered billing to have a <a href="https://stripe.com/docs/billing/subscriptions/tiers">tiered pricing](https://stripe.com/docs/api/plans/object#plan_object-billing_scheme) model.
13
+ def create(subscription_item, params = {}, opts = {})
14
+ request(
15
+ method: :post,
16
+ path: format("/v1/subscription_items/%<subscription_item>s/usage_records", { subscription_item: CGI.escape(subscription_item) }),
17
+ params: params,
18
+ opts: opts,
19
+ base_address: :api
20
+ )
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SubscriptionItemUsageRecordSummaryService < StripeService
6
+ # For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that's been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).
7
+ #
8
+ # The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn't ended yet. Since new usage records can still be added, the returned summary information for the subscription item's ID should be seen as unstable until the subscription billing period ends.
9
+ def list(subscription_item, params = {}, opts = {})
10
+ request(
11
+ method: :get,
12
+ path: format("/v1/subscription_items/%<subscription_item>s/usage_record_summaries", { subscription_item: CGI.escape(subscription_item) }),
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+ end
19
+ end