stripe 12.7.0.pre.beta.2 → 13.1.0.pre.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -9
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +4 -3
  5. data/VERSION +1 -1
  6. data/examples/README.md +11 -0
  7. data/examples/meter_event_stream.rb +47 -0
  8. data/examples/new_example.rb +24 -0
  9. data/examples/stripe_webhook_handler.rb +28 -0
  10. data/lib/stripe/api_operations/nested_resource.rb +1 -21
  11. data/lib/stripe/api_operations/request.rb +19 -70
  12. data/lib/stripe/api_operations/save.rb +4 -3
  13. data/lib/stripe/api_operations/singleton_save.rb +5 -2
  14. data/lib/stripe/api_requestor.rb +1131 -0
  15. data/lib/stripe/api_resource.rb +22 -14
  16. data/lib/stripe/api_version.rb +1 -2
  17. data/lib/stripe/connection_manager.rb +1 -1
  18. data/lib/stripe/errors.rb +8 -2
  19. data/lib/stripe/event_types.rb +14 -0
  20. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  21. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  22. data/lib/stripe/list_object.rb +2 -3
  23. data/lib/stripe/oauth.rb +8 -15
  24. data/lib/stripe/object_types.rb +16 -1
  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/billing/meter.rb +2 -0
  30. data/lib/stripe/resources/customer.rb +2 -3
  31. data/lib/stripe/resources/file.rb +7 -5
  32. data/lib/stripe/resources/issuing/card.rb +20 -0
  33. data/lib/stripe/resources/quote.rb +4 -4
  34. data/lib/stripe/resources/source.rb +3 -2
  35. data/lib/stripe/resources/subscription.rb +6 -6
  36. data/lib/stripe/resources/tax/form.rb +4 -4
  37. data/lib/stripe/resources/usage_record_summary.rb +1 -0
  38. data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
  39. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
  40. data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
  41. data/lib/stripe/resources/v2/event.rb +13 -0
  42. data/lib/stripe/resources.rb +9 -0
  43. data/lib/stripe/search_result_object.rb +1 -1
  44. data/lib/stripe/services/account_capability_service.rb +39 -0
  45. data/lib/stripe/services/account_external_account_service.rb +68 -0
  46. data/lib/stripe/services/account_link_service.rb +17 -0
  47. data/lib/stripe/services/account_login_link_service.rb +19 -0
  48. data/lib/stripe/services/account_notice_service.rb +39 -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/capital/financing_offer_service.rb +42 -0
  72. data/lib/stripe/services/capital/financing_summary_service.rb +19 -0
  73. data/lib/stripe/services/capital/financing_transaction_service.rb +31 -0
  74. data/lib/stripe/services/capital_service.rb +15 -0
  75. data/lib/stripe/services/charge_service.rb +69 -0
  76. data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
  77. data/lib/stripe/services/checkout/session_service.rb +72 -0
  78. data/lib/stripe/services/checkout_service.rb +13 -0
  79. data/lib/stripe/services/climate/order_service.rb +68 -0
  80. data/lib/stripe/services/climate/product_service.rb +30 -0
  81. data/lib/stripe/services/climate/supplier_service.rb +30 -0
  82. data/lib/stripe/services/climate_service.rb +15 -0
  83. data/lib/stripe/services/confirmation_token_service.rb +17 -0
  84. data/lib/stripe/services/country_spec_service.rb +28 -0
  85. data/lib/stripe/services/coupon_service.rb +51 -0
  86. data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
  87. data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
  88. data/lib/stripe/services/credit_note_service.rb +93 -0
  89. data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
  90. data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
  91. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
  92. data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
  93. data/lib/stripe/services/customer_payment_method_service.rb +28 -0
  94. data/lib/stripe/services/customer_payment_source_service.rb +76 -0
  95. data/lib/stripe/services/customer_service.rb +89 -0
  96. data/lib/stripe/services/customer_session_service.rb +17 -0
  97. data/lib/stripe/services/customer_tax_id_service.rb +50 -0
  98. data/lib/stripe/services/dispute_service.rb +48 -0
  99. data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
  100. data/lib/stripe/services/entitlements/feature_service.rb +52 -0
  101. data/lib/stripe/services/entitlements_service.rb +14 -0
  102. data/lib/stripe/services/ephemeral_key_service.rb +28 -0
  103. data/lib/stripe/services/event_service.rb +22 -0
  104. data/lib/stripe/services/exchange_rate_service.rb +28 -0
  105. data/lib/stripe/services/file_link_service.rb +38 -0
  106. data/lib/stripe/services/file_service.rb +35 -0
  107. data/lib/stripe/services/financial_connections/account_inferred_balance_service.rb +19 -0
  108. data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
  109. data/lib/stripe/services/financial_connections/account_service.rb +83 -0
  110. data/lib/stripe/services/financial_connections/institution_service.rb +30 -0
  111. data/lib/stripe/services/financial_connections/session_service.rb +30 -0
  112. data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
  113. data/lib/stripe/services/financial_connections_service.rb +16 -0
  114. data/lib/stripe/services/forwarding/request_service.rb +41 -0
  115. data/lib/stripe/services/forwarding_service.rb +13 -0
  116. data/lib/stripe/services/gift_cards/card_service.rb +63 -0
  117. data/lib/stripe/services/gift_cards/transaction_service.rb +74 -0
  118. data/lib/stripe/services/gift_cards_service.rb +14 -0
  119. data/lib/stripe/services/identity/verification_report_service.rb +30 -0
  120. data/lib/stripe/services/identity/verification_session_service.rb +106 -0
  121. data/lib/stripe/services/identity_service.rb +14 -0
  122. data/lib/stripe/services/invoice_item_service.rb +61 -0
  123. data/lib/stripe/services/invoice_line_item_service.rb +31 -0
  124. data/lib/stripe/services/invoice_payment_service.rb +28 -0
  125. data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
  126. data/lib/stripe/services/invoice_service.rb +245 -0
  127. data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
  128. data/lib/stripe/services/issuing/authorization_service.rb +65 -0
  129. data/lib/stripe/services/issuing/card_service.rb +52 -0
  130. data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
  131. data/lib/stripe/services/issuing/credit_underwriting_record_service.rb +74 -0
  132. data/lib/stripe/services/issuing/dispute_service.rb +63 -0
  133. data/lib/stripe/services/issuing/dispute_settlement_detail_service.rb +30 -0
  134. data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
  135. data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
  136. data/lib/stripe/services/issuing/token_service.rb +41 -0
  137. data/lib/stripe/services/issuing/transaction_service.rb +41 -0
  138. data/lib/stripe/services/issuing_service.rb +23 -0
  139. data/lib/stripe/services/mandate_service.rb +17 -0
  140. data/lib/stripe/services/margin_service.rb +50 -0
  141. data/lib/stripe/services/oauth_service.rb +63 -0
  142. data/lib/stripe/services/order_line_item_service.rb +17 -0
  143. data/lib/stripe/services/order_service.rb +78 -0
  144. data/lib/stripe/services/payment_intent_service.rb +230 -0
  145. data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
  146. data/lib/stripe/services/payment_link_service.rb +57 -0
  147. data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
  148. data/lib/stripe/services/payment_method_domain_service.rb +66 -0
  149. data/lib/stripe/services/payment_method_service.rb +86 -0
  150. data/lib/stripe/services/payout_service.rb +66 -0
  151. data/lib/stripe/services/plan_service.rb +49 -0
  152. data/lib/stripe/services/price_service.rb +52 -0
  153. data/lib/stripe/services/product_feature_service.rb +50 -0
  154. data/lib/stripe/services/product_service.rb +70 -0
  155. data/lib/stripe/services/promotion_code_service.rb +50 -0
  156. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
  157. data/lib/stripe/services/quote_line_item_service.rb +17 -0
  158. data/lib/stripe/services/quote_line_service.rb +17 -0
  159. data/lib/stripe/services/quote_preview_invoice_service.rb +17 -0
  160. data/lib/stripe/services/quote_preview_subscription_schedule_service.rb +17 -0
  161. data/lib/stripe/services/quote_service.rb +140 -0
  162. data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
  163. data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
  164. data/lib/stripe/services/radar/value_list_service.rb +63 -0
  165. data/lib/stripe/services/radar_service.rb +15 -0
  166. data/lib/stripe/services/refund_service.rb +63 -0
  167. data/lib/stripe/services/reporting/report_run_service.rb +41 -0
  168. data/lib/stripe/services/reporting/report_type_service.rb +30 -0
  169. data/lib/stripe/services/reporting_service.rb +14 -0
  170. data/lib/stripe/services/review_service.rb +33 -0
  171. data/lib/stripe/services/setup_attempt_service.rb +17 -0
  172. data/lib/stripe/services/setup_intent_service.rb +105 -0
  173. data/lib/stripe/services/shipping_rate_service.rb +50 -0
  174. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
  175. data/lib/stripe/services/sigma_service.rb +13 -0
  176. data/lib/stripe/services/source_service.rb +64 -0
  177. data/lib/stripe/services/source_transaction_service.rb +17 -0
  178. data/lib/stripe/services/subscription_item_service.rb +69 -0
  179. data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
  180. data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
  181. data/lib/stripe/services/subscription_schedule_service.rb +83 -0
  182. data/lib/stripe/services/subscription_service.rb +127 -0
  183. data/lib/stripe/services/tax/association_service.rb +19 -0
  184. data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
  185. data/lib/stripe/services/tax/calculation_service.rb +37 -0
  186. data/lib/stripe/services/tax/form_service.rb +37 -0
  187. data/lib/stripe/services/tax/registration_service.rb +54 -0
  188. data/lib/stripe/services/tax/settings_service.rb +30 -0
  189. data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
  190. data/lib/stripe/services/tax/transaction_service.rb +48 -0
  191. data/lib/stripe/services/tax_code_service.rb +22 -0
  192. data/lib/stripe/services/tax_id_service.rb +38 -0
  193. data/lib/stripe/services/tax_rate_service.rb +38 -0
  194. data/lib/stripe/services/tax_service.rb +18 -0
  195. data/lib/stripe/services/terminal/configuration_service.rb +63 -0
  196. data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
  197. data/lib/stripe/services/terminal/location_service.rb +64 -0
  198. data/lib/stripe/services/terminal/reader_collected_data_service.rb +19 -0
  199. data/lib/stripe/services/terminal/reader_service.rb +151 -0
  200. data/lib/stripe/services/terminal_service.rb +17 -0
  201. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
  202. data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
  203. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +76 -0
  204. data/lib/stripe/services/test_helpers/issuing/card_service.rb +65 -0
  205. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
  206. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
  207. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  208. data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
  209. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
  210. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  211. data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
  212. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
  213. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
  214. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
  215. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
  216. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
  217. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  218. data/lib/stripe/services/test_helpers_service.rb +19 -0
  219. data/lib/stripe/services/token_service.rb +23 -0
  220. data/lib/stripe/services/topup_service.rb +49 -0
  221. data/lib/stripe/services/transfer_reversal_service.rb +56 -0
  222. data/lib/stripe/services/transfer_service.rb +47 -0
  223. data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
  224. data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
  225. data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
  226. data/lib/stripe/services/treasury/financial_account_service.rb +59 -0
  227. data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
  228. data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
  229. data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
  230. data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
  231. data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
  232. data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
  233. data/lib/stripe/services/treasury/transaction_service.rb +30 -0
  234. data/lib/stripe/services/treasury_service.rb +22 -0
  235. data/lib/stripe/services/v1_services.rb +94 -0
  236. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
  237. data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
  238. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
  239. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
  240. data/lib/stripe/services/v2/billing_service.rb +18 -0
  241. data/lib/stripe/services/v2/core/event_service.rb +32 -0
  242. data/lib/stripe/services/v2/core_service.rb +15 -0
  243. data/lib/stripe/services/v2_services.rb +14 -0
  244. data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
  245. data/lib/stripe/services.rb +203 -0
  246. data/lib/stripe/singleton_api_resource.rb +1 -18
  247. data/lib/stripe/stripe_client.rb +51 -1067
  248. data/lib/stripe/stripe_configuration.rb +33 -19
  249. data/lib/stripe/stripe_object.rb +37 -18
  250. data/lib/stripe/stripe_service.rb +32 -0
  251. data/lib/stripe/thin_event.rb +17 -0
  252. data/lib/stripe/util.rb +68 -39
  253. data/lib/stripe/v2_list_object.rb +84 -0
  254. data/lib/stripe/version.rb +1 -1
  255. data/lib/stripe/webhook.rb +1 -1
  256. data/lib/stripe.rb +33 -27
  257. metadata +223 -2
@@ -0,0 +1,52 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Issuing
6
+ class PersonalizationDesignService < StripeService
7
+ # Creates a personalization design object.
8
+ def create(params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: "/v1/issuing/personalization_designs",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Returns a list of personalization design objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
19
+ def list(params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: "/v1/issuing/personalization_designs",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Retrieves a personalization design object.
30
+ def retrieve(personalization_design, params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: format("/v1/issuing/personalization_designs/%<personalization_design>s", { personalization_design: CGI.escape(personalization_design) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Updates a card personalization object.
41
+ def update(personalization_design, params = {}, opts = {})
42
+ request(
43
+ method: :post,
44
+ path: format("/v1/issuing/personalization_designs/%<personalization_design>s", { personalization_design: CGI.escape(personalization_design) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,30 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Issuing
6
+ class PhysicalBundleService < StripeService
7
+ # Returns a list of physical bundle objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/issuing/physical_bundles",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves a physical bundle object.
19
+ def retrieve(physical_bundle, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/issuing/physical_bundles/%<physical_bundle>s", { physical_bundle: CGI.escape(physical_bundle) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,41 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Issuing
6
+ class TokenService < StripeService
7
+ # Lists all Issuing Token objects for a given card.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/issuing/tokens",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves an Issuing Token object.
19
+ def retrieve(token, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/issuing/tokens/%<token>s", { token: CGI.escape(token) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Attempts to update the specified Issuing Token object to the status specified.
30
+ def update(token, params = {}, opts = {})
31
+ request(
32
+ method: :post,
33
+ path: format("/v1/issuing/tokens/%<token>s", { token: CGI.escape(token) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Issuing
6
+ class TransactionService < StripeService
7
+ # Returns a list of Issuing Transaction objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/issuing/transactions",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves an Issuing Transaction object.
19
+ def retrieve(transaction, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/issuing/transactions/%<transaction>s", { transaction: CGI.escape(transaction) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Updates the specified Issuing Transaction object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
30
+ def update(transaction, params = {}, opts = {})
31
+ request(
32
+ method: :post,
33
+ path: format("/v1/issuing/transactions/%<transaction>s", { transaction: CGI.escape(transaction) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class IssuingService < StripeService
6
+ attr_reader :authorizations, :cards, :cardholders, :credit_underwriting_records, :disputes, :dispute_settlement_details, :personalization_designs, :physical_bundles, :tokens, :transactions
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @authorizations = Stripe::Issuing::AuthorizationService.new(@requestor)
11
+ @cards = Stripe::Issuing::CardService.new(@requestor)
12
+ @cardholders = Stripe::Issuing::CardholderService.new(@requestor)
13
+ @credit_underwriting_records = Stripe::Issuing::CreditUnderwritingRecordService
14
+ .new(@requestor)
15
+ @disputes = Stripe::Issuing::DisputeService.new(@requestor)
16
+ @dispute_settlement_details = Stripe::Issuing::DisputeSettlementDetailService.new(@requestor)
17
+ @personalization_designs = Stripe::Issuing::PersonalizationDesignService.new(@requestor)
18
+ @physical_bundles = Stripe::Issuing::PhysicalBundleService.new(@requestor)
19
+ @tokens = Stripe::Issuing::TokenService.new(@requestor)
20
+ @transactions = Stripe::Issuing::TransactionService.new(@requestor)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class MandateService < StripeService
6
+ # Retrieves a Mandate object.
7
+ def retrieve(mandate, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/mandates/%<mandate>s", { mandate: CGI.escape(mandate) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,50 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class MarginService < StripeService
6
+ # Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount. A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/billing/margins",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Retrieve a list of your margins.
18
+ def list(params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: "/v1/billing/margins",
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Retrieve a margin object with the given ID.
29
+ def retrieve(margin, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Update the specified margin object. Certain fields of the margin object are not editable.
40
+ def update(margin, params = {}, opts = {})
41
+ request(
42
+ method: :post,
43
+ path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ class OAuthService < StripeService
5
+ def authorize_url(params = {}, opts = {})
6
+ path = if opts[:express]
7
+ "/express/oauth/authorize"
8
+ else
9
+ "/oauth/authorize"
10
+ end
11
+
12
+ params[:client_id] = client_id(params)
13
+
14
+ params[:response_type] = "code" if params.include?(:response_type)
15
+
16
+ query = Util.encode_parameters(params, :v1)
17
+
18
+ connect_api_base = @requestor.config.base_addresses[:connect]
19
+ raise ArgumentError, "connect_api_base cannot be empty" if connect_api_base.nil? || connect_api_base.empty?
20
+
21
+ "#{connect_api_base}#{path}?#{query}"
22
+ end
23
+
24
+ def token(params = {}, opts = {})
25
+ opts = Util.normalize_opts(opts)
26
+ opts[:api_key] = params[:client_secret] if params[:client_secret]
27
+
28
+ request(
29
+ method: :post,
30
+ path: "/oauth/token",
31
+ params: params,
32
+ opts: opts,
33
+ base_address: :connect
34
+ )
35
+ end
36
+
37
+ def deauthorize(params = {}, opts = {})
38
+ params[:client_id] = client_id(params)
39
+
40
+ request(
41
+ method: :post,
42
+ path: "/oauth/deauthorize",
43
+ params: params,
44
+ opts: opts,
45
+ base_address: :connect
46
+ )
47
+ end
48
+
49
+ private def client_id(params = {})
50
+ return params[:client_id] if params.include?(:client_id)
51
+
52
+ return @requestor.config.client_id if !@requestor.config.client_id.nil? && !@requestor.config.client_id.empty?
53
+
54
+ raise AuthenticationError, "No client_id provided. (HINT: set your client_id when configuring " \
55
+ "your StripeClient: \"Stripe::StripeClient.new(..., client_id: <CLIENT_ID>)\"). " \
56
+ "You can find your client_ids in your Stripe dashboard at " \
57
+ "https://dashboard.stripe.com/account/applications/settings, " \
58
+ "after registering your account as a platform. See " \
59
+ "https://stripe.com/docs/connect/standalone-accounts for details, " \
60
+ "or email support@stripe.com if you have any questions." \
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class OrderLineItemService < StripeService
6
+ # When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
7
+ def list(id, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(id) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,78 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class OrderService < StripeService
6
+ attr_reader :line_items
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @line_items = Stripe::OrderLineItemService.new(@requestor)
11
+ end
12
+
13
+ # Cancels the order as well as the payment intent if one is attached.
14
+ def cancel(id, params = {}, opts = {})
15
+ request(
16
+ method: :post,
17
+ path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(id) }),
18
+ params: params,
19
+ opts: opts,
20
+ base_address: :api
21
+ )
22
+ end
23
+
24
+ # Creates a new open order object.
25
+ def create(params = {}, opts = {})
26
+ request(method: :post, path: "/v1/orders", params: params, opts: opts, base_address: :api)
27
+ end
28
+
29
+ # Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
30
+ def list(params = {}, opts = {})
31
+ request(method: :get, path: "/v1/orders", params: params, opts: opts, base_address: :api)
32
+ end
33
+
34
+ # Reopens a submitted order.
35
+ def reopen(id, params = {}, opts = {})
36
+ request(
37
+ method: :post,
38
+ path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(id) }),
39
+ params: params,
40
+ opts: opts,
41
+ base_address: :api
42
+ )
43
+ end
44
+
45
+ # Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.
46
+ def retrieve(id, params = {}, opts = {})
47
+ request(
48
+ method: :get,
49
+ path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }),
50
+ params: params,
51
+ opts: opts,
52
+ base_address: :api
53
+ )
54
+ end
55
+
56
+ # Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the [reopen](https://stripe.com/docs/api#reopen_order) method is called.
57
+ def submit(id, params = {}, opts = {})
58
+ request(
59
+ method: :post,
60
+ path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }),
61
+ params: params,
62
+ opts: opts,
63
+ base_address: :api
64
+ )
65
+ end
66
+
67
+ # Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
68
+ def update(id, params = {}, opts = {})
69
+ request(
70
+ method: :post,
71
+ path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }),
72
+ params: params,
73
+ opts: opts,
74
+ base_address: :api
75
+ )
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,230 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PaymentIntentService < StripeService
6
+ # Manually reconcile the remaining amount for a customer_balance PaymentIntent.
7
+ def apply_customer_balance(intent, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
18
+ #
19
+ # After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
20
+ #
21
+ # You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
22
+ def cancel(intent, params = {}, opts = {})
23
+ request(
24
+ method: :post,
25
+ path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
26
+ params: params,
27
+ opts: opts,
28
+ base_address: :api
29
+ )
30
+ end
31
+
32
+ # Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
33
+ #
34
+ # Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
35
+ #
36
+ # Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
37
+ def capture(intent, params = {}, opts = {})
38
+ request(
39
+ method: :post,
40
+ path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
41
+ params: params,
42
+ opts: opts,
43
+ base_address: :api
44
+ )
45
+ end
46
+
47
+ # Confirm that your customer intends to pay with current or provided
48
+ # payment method. Upon confirmation, the PaymentIntent will attempt to initiate
49
+ # a payment.
50
+ # If the selected payment method requires additional authentication steps, the
51
+ # PaymentIntent will transition to the requires_action status and
52
+ # suggest additional actions via next_action. If payment fails,
53
+ # the PaymentIntent transitions to the requires_payment_method status or the
54
+ # canceled status if the confirmation limit is reached. If
55
+ # payment succeeds, the PaymentIntent will transition to the succeeded
56
+ # status (or requires_capture, if capture_method is set to manual).
57
+ # If the confirmation_method is automatic, payment may be attempted
58
+ # using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
59
+ # and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
60
+ # After next_actions are handled by the client, no additional
61
+ # confirmation is required to complete the payment.
62
+ # If the confirmation_method is manual, all payment attempts must be
63
+ # initiated using a secret key.
64
+ # If any actions are required for the payment, the PaymentIntent will
65
+ # return to the requires_confirmation state
66
+ # after those actions are completed. Your server needs to then
67
+ # explicitly re-confirm the PaymentIntent to initiate the next payment
68
+ # attempt.
69
+ # There is a variable upper limit on how many times a PaymentIntent can be confirmed.
70
+ # After this limit is reached, any further calls to this endpoint will
71
+ # transition the PaymentIntent to the canceled state.
72
+ def confirm(intent, params = {}, opts = {})
73
+ request(
74
+ method: :post,
75
+ path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
76
+ params: params,
77
+ opts: opts,
78
+ base_address: :api
79
+ )
80
+ end
81
+
82
+ # Creates a PaymentIntent object.
83
+ #
84
+ # After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm)
85
+ # to continue the payment. Learn more about <a href="/docs/payments/payment-intents">the available payment flows
86
+ # with the Payment Intents API.
87
+ #
88
+ # When you use confirm=true during creation, it's equivalent to creating
89
+ # and confirming the PaymentIntent in the same call. You can use any parameters
90
+ # available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply
91
+ # confirm=true.
92
+ def create(params = {}, opts = {})
93
+ request(
94
+ method: :post,
95
+ path: "/v1/payment_intents",
96
+ params: params,
97
+ opts: opts,
98
+ base_address: :api
99
+ )
100
+ end
101
+
102
+ # Perform a decremental authorization on an eligible
103
+ # [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
104
+ # PaymentIntent's status must be requires_capture and
105
+ # [decremental_authorization.status](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization)
106
+ # must be available.
107
+ #
108
+ # Decremental authorizations decrease the authorized amount on your customer's card
109
+ # to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
110
+ #
111
+ # After decrement, the PaymentIntent object
112
+ # returns with the updated
113
+ # [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
114
+ # The PaymentIntent will now be capturable up to the new authorized amount.
115
+ #
116
+ # Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines.
117
+ # After it's fully captured, a PaymentIntent can no longer be decremented.
118
+ def decrement_authorization(intent, params = {}, opts = {})
119
+ request(
120
+ method: :post,
121
+ path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(intent) }),
122
+ params: params,
123
+ opts: opts,
124
+ base_address: :api
125
+ )
126
+ end
127
+
128
+ # Perform an incremental authorization on an eligible
129
+ # [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
130
+ # PaymentIntent's status must be requires_capture and
131
+ # [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
132
+ # must be true.
133
+ #
134
+ # Incremental authorizations attempt to increase the authorized amount on
135
+ # your customer's card to the new, higher amount provided. Similar to the
136
+ # initial authorization, incremental authorizations can be declined. A
137
+ # single PaymentIntent can call this endpoint multiple times to further
138
+ # increase the authorized amount.
139
+ #
140
+ # If the incremental authorization succeeds, the PaymentIntent object
141
+ # returns with the updated
142
+ # [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
143
+ # If the incremental authorization fails, a
144
+ # [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
145
+ # fields on the PaymentIntent or Charge update. The PaymentIntent
146
+ # object remains capturable for the previously authorized amount.
147
+ #
148
+ # Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
149
+ # After it's captured, a PaymentIntent can no longer be incremented.
150
+ #
151
+ # Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
152
+ def increment_authorization(intent, params = {}, opts = {})
153
+ request(
154
+ method: :post,
155
+ path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
156
+ params: params,
157
+ opts: opts,
158
+ base_address: :api
159
+ )
160
+ end
161
+
162
+ # Returns a list of PaymentIntents.
163
+ def list(params = {}, opts = {})
164
+ request(
165
+ method: :get,
166
+ path: "/v1/payment_intents",
167
+ params: params,
168
+ opts: opts,
169
+ base_address: :api
170
+ )
171
+ end
172
+
173
+ # Retrieves the details of a PaymentIntent that has previously been created.
174
+ #
175
+ # You can retrieve a PaymentIntent client-side using a publishable key when the client_secret is in the query string.
176
+ #
177
+ # If you retrieve a PaymentIntent with a publishable key, it only returns a subset of properties. Refer to the [payment intent](https://stripe.com/docs/api#payment_intent_object) object reference for more details.
178
+ def retrieve(intent, params = {}, opts = {})
179
+ request(
180
+ method: :get,
181
+ path: format("/v1/payment_intents/%<intent>s", { intent: CGI.escape(intent) }),
182
+ params: params,
183
+ opts: opts,
184
+ base_address: :api
185
+ )
186
+ end
187
+
188
+ # Search for PaymentIntents you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
189
+ # Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
190
+ # conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
191
+ # to an hour behind during outages. Search functionality is not available to merchants in India.
192
+ def search(params = {}, opts = {})
193
+ request(
194
+ method: :get,
195
+ path: "/v1/payment_intents/search",
196
+ params: params,
197
+ opts: opts,
198
+ base_address: :api
199
+ )
200
+ end
201
+
202
+ # Updates properties on a PaymentIntent object without confirming.
203
+ #
204
+ # Depending on which properties you update, you might need to confirm the
205
+ # PaymentIntent again. For example, updating the payment_method
206
+ # always requires you to confirm the PaymentIntent again. If you prefer to
207
+ # update and confirm at the same time, we recommend updating properties through
208
+ # the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead.
209
+ def update(intent, params = {}, opts = {})
210
+ request(
211
+ method: :post,
212
+ path: format("/v1/payment_intents/%<intent>s", { intent: CGI.escape(intent) }),
213
+ params: params,
214
+ opts: opts,
215
+ base_address: :api
216
+ )
217
+ end
218
+
219
+ # Verifies microdeposits on a PaymentIntent object.
220
+ def verify_microdeposits(intent, params = {}, opts = {})
221
+ request(
222
+ method: :post,
223
+ path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
224
+ params: params,
225
+ opts: opts,
226
+ base_address: :api
227
+ )
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PaymentLinkLineItemService < StripeService
6
+ # When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
7
+ def list(payment_link, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end