stripe 5.38.0 → 15.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (708) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +742 -0
  3. data/CONTRIBUTING.md +25 -0
  4. data/Gemfile +12 -4
  5. data/Makefile +22 -0
  6. data/OPENAPI_VERSION +1 -0
  7. data/README.md +137 -27
  8. data/Rakefile +3 -6
  9. data/VERSION +1 -1
  10. data/examples/README.md +16 -0
  11. data/examples/example_template.rb +36 -0
  12. data/examples/meter_event_stream.rb +57 -0
  13. data/examples/thinevent_webhook_handler.rb +39 -0
  14. data/{bin → exe}/stripe-console +1 -1
  15. data/justfile +43 -0
  16. data/lib/data/ca-certificates.crt +1241 -1937
  17. data/lib/stripe/api_operations/create.rb +6 -2
  18. data/lib/stripe/api_operations/delete.rb +12 -7
  19. data/lib/stripe/api_operations/list.rb +6 -9
  20. data/lib/stripe/api_operations/nested_resource.rb +59 -31
  21. data/lib/stripe/api_operations/request.rb +30 -65
  22. data/lib/stripe/api_operations/save.rb +20 -10
  23. data/lib/stripe/api_operations/search.rb +21 -0
  24. data/lib/stripe/api_operations/singleton_save.rb +90 -0
  25. data/lib/stripe/api_requestor.rb +1136 -0
  26. data/lib/stripe/api_resource.rb +49 -34
  27. data/lib/stripe/api_resource_test_helpers.rb +53 -0
  28. data/lib/stripe/{resources/usage_record.rb → api_version.rb} +2 -2
  29. data/lib/stripe/connection_manager.rb +28 -11
  30. data/lib/stripe/errors.rb +11 -20
  31. data/lib/stripe/event_types.rb +15 -0
  32. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  33. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  34. data/lib/stripe/events/v2_core_event_destination_ping_event.rb +21 -0
  35. data/lib/stripe/instrumentation.rb +37 -15
  36. data/lib/stripe/list_object.rb +5 -3
  37. data/lib/stripe/multipart_encoder.rb +7 -7
  38. data/lib/stripe/oauth.rb +14 -21
  39. data/lib/stripe/object_types.rb +157 -91
  40. data/lib/stripe/request_options.rb +129 -0
  41. data/lib/stripe/request_params.rb +24 -0
  42. data/lib/stripe/resources/account.rb +4854 -30
  43. data/lib/stripe/resources/account_link.rb +66 -0
  44. data/lib/stripe/resources/account_session.rb +868 -0
  45. data/lib/stripe/resources/alipay_account.rb +1 -1
  46. data/lib/stripe/resources/apple_pay_domain.rb +91 -0
  47. data/lib/stripe/resources/application.rb +20 -0
  48. data/lib/stripe/resources/application_fee.rb +96 -2
  49. data/lib/stripe/resources/application_fee_refund.rb +26 -2
  50. data/lib/stripe/resources/apps/secret.rb +196 -0
  51. data/lib/stripe/resources/balance.rb +178 -0
  52. data/lib/stripe/resources/balance_transaction.rb +124 -0
  53. data/lib/stripe/resources/bank_account.rb +137 -6
  54. data/lib/stripe/resources/billing/alert.rb +222 -0
  55. data/lib/stripe/resources/billing/alert_triggered.rb +26 -0
  56. data/lib/stripe/resources/billing/credit_balance_summary.rb +54 -0
  57. data/lib/stripe/resources/billing/credit_balance_transaction.rb +133 -0
  58. data/lib/stripe/resources/billing/credit_grant.rb +307 -0
  59. data/lib/stripe/resources/billing/meter.rb +254 -0
  60. data/lib/stripe/resources/billing/meter_event.rb +61 -0
  61. data/lib/stripe/resources/billing/meter_event_adjustment.rb +69 -0
  62. data/lib/stripe/resources/billing/meter_event_summary.rb +32 -0
  63. data/lib/stripe/resources/billing_portal/configuration.rb +587 -0
  64. data/lib/stripe/resources/billing_portal/session.rb +298 -0
  65. data/lib/stripe/resources/capability.rb +91 -2
  66. data/lib/stripe/resources/card.rb +111 -3
  67. data/lib/stripe/resources/cash_balance.rb +43 -0
  68. data/lib/stripe/resources/charge.rb +1682 -2
  69. data/lib/stripe/resources/checkout/session.rb +3666 -2
  70. data/lib/stripe/resources/climate/order.rb +234 -0
  71. data/lib/stripe/resources/climate/product.rb +74 -0
  72. data/lib/stripe/resources/climate/supplier.rb +71 -0
  73. data/lib/stripe/resources/confirmation_token.rb +1498 -0
  74. data/lib/stripe/resources/connect_collection_transfer.rb +24 -0
  75. data/lib/stripe/resources/country_spec.rb +68 -0
  76. data/lib/stripe/resources/coupon.rb +236 -0
  77. data/lib/stripe/resources/credit_note.rb +709 -9
  78. data/lib/stripe/resources/credit_note_line_item.rb +71 -0
  79. data/lib/stripe/resources/customer.rb +1015 -16
  80. data/lib/stripe/resources/customer_balance_transaction.rb +38 -1
  81. data/lib/stripe/resources/customer_cash_balance_transaction.rb +124 -0
  82. data/lib/stripe/resources/customer_session.rb +188 -0
  83. data/lib/stripe/resources/discount.rb +37 -0
  84. data/lib/stripe/resources/dispute.rb +650 -2
  85. data/lib/stripe/resources/entitlements/active_entitlement.rb +63 -0
  86. data/lib/stripe/resources/entitlements/active_entitlement_summary.rb +23 -0
  87. data/lib/stripe/resources/entitlements/feature.rb +130 -0
  88. data/lib/stripe/resources/ephemeral_key.rb +44 -0
  89. data/lib/stripe/resources/event.rb +130 -0
  90. data/lib/stripe/resources/exchange_rate.rb +58 -0
  91. data/lib/stripe/resources/file.rb +139 -15
  92. data/lib/stripe/resources/file_link.rb +129 -0
  93. data/lib/stripe/resources/financial_connections/account.rb +363 -0
  94. data/lib/stripe/resources/financial_connections/account_owner.rb +31 -0
  95. data/lib/stripe/resources/financial_connections/account_ownership.rb +23 -0
  96. data/lib/stripe/resources/financial_connections/session.rb +121 -0
  97. data/lib/stripe/resources/financial_connections/transaction.rb +118 -0
  98. data/lib/stripe/resources/forwarding/request.rb +208 -0
  99. data/lib/stripe/resources/funding_instructions.rb +332 -0
  100. data/lib/stripe/resources/identity/verification_report.rb +287 -0
  101. data/lib/stripe/resources/identity/verification_session.rb +474 -4
  102. data/lib/stripe/resources/invoice.rb +3525 -17
  103. data/lib/stripe/resources/invoice_item.rb +453 -0
  104. data/lib/stripe/resources/invoice_line_item.rb +372 -1
  105. data/lib/stripe/resources/invoice_payment.rb +112 -0
  106. data/lib/stripe/resources/invoice_rendering_template.rb +120 -0
  107. data/lib/stripe/resources/issuing/authorization.rb +1313 -4
  108. data/lib/stripe/resources/issuing/card.rb +785 -4
  109. data/lib/stripe/resources/issuing/cardholder.rb +684 -0
  110. data/lib/stripe/resources/issuing/dispute.rb +828 -2
  111. data/lib/stripe/resources/issuing/personalization_design.rb +395 -0
  112. data/lib/stripe/resources/issuing/physical_bundle.rb +80 -0
  113. data/lib/stripe/resources/issuing/token.rb +198 -0
  114. data/lib/stripe/resources/issuing/transaction.rb +991 -0
  115. data/lib/stripe/resources/line_item.rb +51 -0
  116. data/lib/stripe/resources/login_link.rb +12 -0
  117. data/lib/stripe/resources/mandate.rb +146 -0
  118. data/lib/stripe/resources/payment_intent.rb +8876 -6
  119. data/lib/stripe/resources/payment_link.rb +1692 -0
  120. data/lib/stripe/resources/payment_method.rb +1570 -4
  121. data/lib/stripe/resources/payment_method_configuration.rb +3189 -0
  122. data/lib/stripe/resources/payment_method_domain.rb +236 -0
  123. data/lib/stripe/resources/payout.rb +271 -4
  124. data/lib/stripe/resources/person.rb +295 -1
  125. data/lib/stripe/resources/plan.rb +352 -0
  126. data/lib/stripe/resources/price.rb +642 -0
  127. data/lib/stripe/resources/product.rb +534 -0
  128. data/lib/stripe/resources/product_feature.rb +25 -0
  129. data/lib/stripe/resources/promotion_code.rb +237 -0
  130. data/lib/stripe/resources/quote.rb +1015 -38
  131. data/lib/stripe/resources/radar/early_fraud_warning.rb +85 -0
  132. data/lib/stripe/resources/radar/value_list.rb +171 -0
  133. data/lib/stripe/resources/radar/value_list_item.rb +131 -0
  134. data/lib/stripe/resources/refund.rb +494 -0
  135. data/lib/stripe/resources/reporting/report_run.rb +172 -0
  136. data/lib/stripe/resources/reporting/report_type.rb +48 -1
  137. data/lib/stripe/resources/reserve_transaction.rb +22 -0
  138. data/lib/stripe/resources/reversal.rb +38 -2
  139. data/lib/stripe/resources/review.rb +122 -2
  140. data/lib/stripe/resources/setup_attempt.rb +380 -0
  141. data/lib/stripe/resources/setup_intent.rb +3432 -4
  142. data/lib/stripe/resources/shipping_rate.rb +287 -0
  143. data/lib/stripe/resources/sigma/scheduled_query_run.rb +62 -0
  144. data/lib/stripe/resources/source.rb +1250 -10
  145. data/lib/stripe/resources/source_mandate_notification.rb +66 -0
  146. data/lib/stripe/resources/source_transaction.rb +93 -0
  147. data/lib/stripe/resources/subscription.rb +1871 -3
  148. data/lib/stripe/resources/subscription_item.rb +399 -10
  149. data/lib/stripe/resources/subscription_schedule.rb +1455 -4
  150. data/lib/stripe/resources/tax/calculation.rb +430 -0
  151. data/lib/stripe/resources/tax/calculation_line_item.rb +71 -0
  152. data/lib/stripe/resources/tax/registration.rb +2667 -0
  153. data/lib/stripe/resources/tax/settings.rb +134 -0
  154. data/lib/stripe/resources/tax/transaction.rb +314 -0
  155. data/lib/stripe/resources/tax/transaction_line_item.rb +44 -0
  156. data/lib/stripe/resources/tax_code.rb +35 -0
  157. data/lib/stripe/resources/tax_deducted_at_source.rb +22 -0
  158. data/lib/stripe/resources/tax_id.rb +144 -11
  159. data/lib/stripe/resources/tax_rate.rb +217 -0
  160. data/lib/stripe/resources/terminal/configuration.rb +1328 -0
  161. data/lib/stripe/resources/terminal/connection_token.rb +34 -0
  162. data/lib/stripe/resources/terminal/location.rb +222 -0
  163. data/lib/stripe/resources/terminal/reader.rb +886 -0
  164. data/lib/stripe/resources/test_helpers/test_clock.rb +156 -0
  165. data/lib/stripe/resources/token.rb +1249 -0
  166. data/lib/stripe/resources/topup.rb +204 -2
  167. data/lib/stripe/resources/transfer.rb +173 -6
  168. data/lib/stripe/resources/treasury/credit_reversal.rb +120 -0
  169. data/lib/stripe/resources/treasury/debit_reversal.rb +131 -0
  170. data/lib/stripe/resources/treasury/financial_account.rb +833 -0
  171. data/lib/stripe/resources/treasury/financial_account_features.rb +204 -0
  172. data/lib/stripe/resources/treasury/inbound_transfer.rb +356 -0
  173. data/lib/stripe/resources/treasury/outbound_payment.rb +638 -0
  174. data/lib/stripe/resources/treasury/outbound_transfer.rb +493 -0
  175. data/lib/stripe/resources/treasury/received_credit.rb +284 -0
  176. data/lib/stripe/resources/treasury/received_debit.rb +243 -0
  177. data/lib/stripe/resources/treasury/transaction.rb +193 -0
  178. data/lib/stripe/resources/treasury/transaction_entry.rb +178 -0
  179. data/lib/stripe/resources/v2/amount.rb +9 -0
  180. data/lib/stripe/resources/v2/billing/meter_event.rb +34 -0
  181. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +36 -0
  182. data/lib/stripe/resources/v2/billing/meter_event_session.rb +29 -0
  183. data/lib/stripe/resources/v2/event.rb +41 -0
  184. data/lib/stripe/resources/v2/event_destination.rb +73 -0
  185. data/lib/stripe/resources/webhook_endpoint.rb +167 -0
  186. data/lib/stripe/resources.rb +70 -12
  187. data/lib/stripe/search_result_object.rb +89 -0
  188. data/lib/stripe/services/account_capability_service.rb +71 -0
  189. data/lib/stripe/services/account_external_account_service.rb +317 -0
  190. data/lib/stripe/services/account_link_service.rb +63 -0
  191. data/lib/stripe/services/account_login_link_service.rb +28 -0
  192. data/lib/stripe/services/account_person_service.rb +1019 -0
  193. data/lib/stripe/services/account_service.rb +4171 -0
  194. data/lib/stripe/services/account_session_service.rb +569 -0
  195. data/lib/stripe/services/apple_pay_domain_service.rb +100 -0
  196. data/lib/stripe/services/application_fee_refund_service.rb +114 -0
  197. data/lib/stripe/services/application_fee_service.rb +92 -0
  198. data/lib/stripe/services/apps/secret_service.rb +168 -0
  199. data/lib/stripe/services/apps_service.rb +13 -0
  200. data/lib/stripe/services/balance_service.rb +21 -0
  201. data/lib/stripe/services/balance_transaction_service.rb +101 -0
  202. data/lib/stripe/services/billing/alert_service.rb +187 -0
  203. data/lib/stripe/services/billing/credit_balance_summary_service.rb +67 -0
  204. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +70 -0
  205. data/lib/stripe/services/billing/credit_grant_service.rb +240 -0
  206. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +45 -0
  207. data/lib/stripe/services/billing/meter_event_service.rb +40 -0
  208. data/lib/stripe/services/billing/meter_event_summary_service.rb +58 -0
  209. data/lib/stripe/services/billing/meter_service.rb +211 -0
  210. data/lib/stripe/services/billing_portal/configuration_service.rb +496 -0
  211. data/lib/stripe/services/billing_portal/session_service.rb +192 -0
  212. data/lib/stripe/services/billing_portal_service.rb +14 -0
  213. data/lib/stripe/services/billing_service.rb +20 -0
  214. data/lib/stripe/services/charge_service.rb +471 -0
  215. data/lib/stripe/services/checkout/session_line_item_service.rb +37 -0
  216. data/lib/stripe/services/checkout/session_service.rb +2495 -0
  217. data/lib/stripe/services/checkout_service.rb +13 -0
  218. data/lib/stripe/services/climate/order_service.rb +170 -0
  219. data/lib/stripe/services/climate/product_service.rb +57 -0
  220. data/lib/stripe/services/climate/supplier_service.rb +57 -0
  221. data/lib/stripe/services/climate_service.rb +15 -0
  222. data/lib/stripe/services/confirmation_token_service.rb +26 -0
  223. data/lib/stripe/services/country_spec_service.rb +55 -0
  224. data/lib/stripe/services/coupon_service.rb +202 -0
  225. data/lib/stripe/services/credit_note_line_item_service.rb +35 -0
  226. data/lib/stripe/services/credit_note_preview_lines_service.rb +169 -0
  227. data/lib/stripe/services/credit_note_service.rb +457 -0
  228. data/lib/stripe/services/customer_balance_transaction_service.rb +113 -0
  229. data/lib/stripe/services/customer_cash_balance_service.rb +57 -0
  230. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +55 -0
  231. data/lib/stripe/services/customer_funding_instructions_service.rb +61 -0
  232. data/lib/stripe/services/customer_payment_method_service.rb +68 -0
  233. data/lib/stripe/services/customer_payment_source_service.rb +255 -0
  234. data/lib/stripe/services/customer_service.rb +664 -0
  235. data/lib/stripe/services/customer_session_service.rb +113 -0
  236. data/lib/stripe/services/customer_tax_id_service.rb +94 -0
  237. data/lib/stripe/services/dispute_service.rb +422 -0
  238. data/lib/stripe/services/entitlements/active_entitlement_service.rb +66 -0
  239. data/lib/stripe/services/entitlements/feature_service.rb +128 -0
  240. data/lib/stripe/services/entitlements_service.rb +14 -0
  241. data/lib/stripe/services/ephemeral_key_service.rb +64 -0
  242. data/lib/stripe/services/event_service.rb +87 -0
  243. data/lib/stripe/services/exchange_rate_service.rb +55 -0
  244. data/lib/stripe/services/file_link_service.rb +132 -0
  245. data/lib/stripe/services/file_service.rb +124 -0
  246. data/lib/stripe/services/financial_connections/account_owner_service.rb +46 -0
  247. data/lib/stripe/services/financial_connections/account_service.rb +177 -0
  248. data/lib/stripe/services/financial_connections/session_service.rb +98 -0
  249. data/lib/stripe/services/financial_connections/transaction_service.rb +100 -0
  250. data/lib/stripe/services/financial_connections_service.rb +15 -0
  251. data/lib/stripe/services/forwarding/request_service.rb +147 -0
  252. data/lib/stripe/services/forwarding_service.rb +13 -0
  253. data/lib/stripe/services/identity/verification_report_service.rb +95 -0
  254. data/lib/stripe/services/identity/verification_session_service.rb +337 -0
  255. data/lib/stripe/services/identity_service.rb +14 -0
  256. data/lib/stripe/services/invoice_item_service.rb +394 -0
  257. data/lib/stripe/services/invoice_line_item_service.rb +252 -0
  258. data/lib/stripe/services/invoice_payment_service.rb +83 -0
  259. data/lib/stripe/services/invoice_rendering_template_service.rb +101 -0
  260. data/lib/stripe/services/invoice_service.rb +2900 -0
  261. data/lib/stripe/services/issuing/authorization_service.rb +169 -0
  262. data/lib/stripe/services/issuing/card_service.rb +507 -0
  263. data/lib/stripe/services/issuing/cardholder_service.rb +577 -0
  264. data/lib/stripe/services/issuing/dispute_service.rb +696 -0
  265. data/lib/stripe/services/issuing/personalization_design_service.rb +245 -0
  266. data/lib/stripe/services/issuing/physical_bundle_service.rb +70 -0
  267. data/lib/stripe/services/issuing/token_service.rb +114 -0
  268. data/lib/stripe/services/issuing/transaction_service.rb +118 -0
  269. data/lib/stripe/services/issuing_service.rb +20 -0
  270. data/lib/stripe/services/mandate_service.rb +26 -0
  271. data/lib/stripe/services/oauth_service.rb +63 -0
  272. data/lib/stripe/services/payment_intent_service.rb +7202 -0
  273. data/lib/stripe/services/payment_link_line_item_service.rb +35 -0
  274. data/lib/stripe/services/payment_link_service.rb +1333 -0
  275. data/lib/stripe/services/payment_method_configuration_service.rb +2306 -0
  276. data/lib/stripe/services/payment_method_domain_service.rb +142 -0
  277. data/lib/stripe/services/payment_method_service.rb +843 -0
  278. data/lib/stripe/services/payout_service.rb +225 -0
  279. data/lib/stripe/services/plan_service.rb +297 -0
  280. data/lib/stripe/services/price_service.rb +545 -0
  281. data/lib/stripe/services/product_feature_service.rb +91 -0
  282. data/lib/stripe/services/product_service.rb +494 -0
  283. data/lib/stripe/services/promotion_code_service.rb +228 -0
  284. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +35 -0
  285. data/lib/stripe/services/quote_line_item_service.rb +35 -0
  286. data/lib/stripe/services/quote_service.rb +703 -0
  287. data/lib/stripe/services/radar/early_fraud_warning_service.rb +93 -0
  288. data/lib/stripe/services/radar/value_list_item_service.rb +130 -0
  289. data/lib/stripe/services/radar/value_list_service.rb +165 -0
  290. data/lib/stripe/services/radar_service.rb +15 -0
  291. data/lib/stripe/services/refund_service.rb +200 -0
  292. data/lib/stripe/services/reporting/report_run_service.rb +147 -0
  293. data/lib/stripe/services/reporting/report_type_service.rb +48 -0
  294. data/lib/stripe/services/reporting_service.rb +14 -0
  295. data/lib/stripe/services/review_service.rb +89 -0
  296. data/lib/stripe/services/setup_attempt_service.rb +68 -0
  297. data/lib/stripe/services/setup_intent_service.rb +3107 -0
  298. data/lib/stripe/services/shipping_rate_service.rb +250 -0
  299. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +57 -0
  300. data/lib/stripe/services/sigma_service.rb +13 -0
  301. data/lib/stripe/services/source_service.rb +665 -0
  302. data/lib/stripe/services/source_transaction_service.rb +35 -0
  303. data/lib/stripe/services/subscription_item_service.rb +372 -0
  304. data/lib/stripe/services/subscription_schedule_service.rb +1224 -0
  305. data/lib/stripe/services/subscription_service.rb +1590 -0
  306. data/lib/stripe/services/tax/calculation_line_item_service.rb +37 -0
  307. data/lib/stripe/services/tax/calculation_service.rb +246 -0
  308. data/lib/stripe/services/tax/registration_service.rb +1774 -0
  309. data/lib/stripe/services/tax/settings_service.rb +104 -0
  310. data/lib/stripe/services/tax/transaction_line_item_service.rb +37 -0
  311. data/lib/stripe/services/tax/transaction_service.rb +159 -0
  312. data/lib/stripe/services/tax_code_service.rb +49 -0
  313. data/lib/stripe/services/tax_id_service.rb +116 -0
  314. data/lib/stripe/services/tax_rate_service.rb +193 -0
  315. data/lib/stripe/services/tax_service.rb +16 -0
  316. data/lib/stripe/services/terminal/configuration_service.rb +1059 -0
  317. data/lib/stripe/services/terminal/connection_token_service.rb +31 -0
  318. data/lib/stripe/services/terminal/location_service.rb +207 -0
  319. data/lib/stripe/services/terminal/reader_service.rb +488 -0
  320. data/lib/stripe/services/terminal_service.rb +16 -0
  321. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +655 -0
  322. data/lib/stripe/services/test_helpers/customer_service.rb +37 -0
  323. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +832 -0
  324. data/lib/stripe/services/test_helpers/issuing/card_service.rb +110 -0
  325. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +84 -0
  326. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +675 -0
  327. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  328. data/lib/stripe/services/test_helpers/refund_service.rb +28 -0
  329. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +108 -0
  330. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  331. data/lib/stripe/services/test_helpers/test_clock_service.rb +119 -0
  332. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +81 -0
  333. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +141 -0
  334. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +141 -0
  335. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +81 -0
  336. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +81 -0
  337. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  338. data/lib/stripe/services/test_helpers_service.rb +19 -0
  339. data/lib/stripe/services/token_service.rb +1224 -0
  340. data/lib/stripe/services/topup_service.rb +191 -0
  341. data/lib/stripe/services/transfer_reversal_service.rb +122 -0
  342. data/lib/stripe/services/transfer_service.rb +166 -0
  343. data/lib/stripe/services/treasury/credit_reversal_service.rb +100 -0
  344. data/lib/stripe/services/treasury/debit_reversal_service.rb +104 -0
  345. data/lib/stripe/services/treasury/financial_account_features_service.rb +196 -0
  346. data/lib/stripe/services/treasury/financial_account_service.rb +554 -0
  347. data/lib/stripe/services/treasury/inbound_transfer_service.rb +140 -0
  348. data/lib/stripe/services/treasury/outbound_payment_service.rb +310 -0
  349. data/lib/stripe/services/treasury/outbound_transfer_service.rb +176 -0
  350. data/lib/stripe/services/treasury/received_credit_service.rb +82 -0
  351. data/lib/stripe/services/treasury/received_debit_service.rb +70 -0
  352. data/lib/stripe/services/treasury/transaction_entry_service.rb +117 -0
  353. data/lib/stripe/services/treasury/transaction_service.rb +125 -0
  354. data/lib/stripe/services/treasury_service.rb +22 -0
  355. data/lib/stripe/services/v1_services.rb +90 -0
  356. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +44 -0
  357. data/lib/stripe/services/v2/billing/meter_event_service.rb +46 -0
  358. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +23 -0
  359. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +56 -0
  360. data/lib/stripe/services/v2/billing_service.rb +18 -0
  361. data/lib/stripe/services/v2/core/event_destination_service.rb +235 -0
  362. data/lib/stripe/services/v2/core/event_service.rb +48 -0
  363. data/lib/stripe/services/v2/core_service.rb +16 -0
  364. data/lib/stripe/services/v2_services.rb +14 -0
  365. data/lib/stripe/services/webhook_endpoint_service.rb +156 -0
  366. data/lib/stripe/services.rb +180 -0
  367. data/lib/stripe/singleton_api_resource.rb +3 -3
  368. data/lib/stripe/stripe_client.rb +56 -1021
  369. data/lib/stripe/stripe_configuration.rb +63 -42
  370. data/lib/stripe/stripe_object.rb +75 -39
  371. data/lib/stripe/stripe_response.rb +1 -3
  372. data/lib/stripe/stripe_service.rb +32 -0
  373. data/lib/stripe/thin_event.rb +37 -0
  374. data/lib/stripe/util.rb +161 -39
  375. data/lib/stripe/v2_list_object.rb +84 -0
  376. data/lib/stripe/version.rb +1 -1
  377. data/lib/stripe/webhook.rb +3 -2
  378. data/lib/stripe.rb +44 -1
  379. data/rbi/stripe/resources/account.rbi +4926 -0
  380. data/rbi/stripe/resources/account_link.rbi +74 -0
  381. data/rbi/stripe/resources/account_session.rbi +1013 -0
  382. data/rbi/stripe/resources/apple_pay_domain.rbi +88 -0
  383. data/rbi/stripe/resources/application.rbi +20 -0
  384. data/rbi/stripe/resources/application_fee.rbi +118 -0
  385. data/rbi/stripe/resources/application_fee_refund.rbi +37 -0
  386. data/rbi/stripe/resources/apps/secret.rbi +195 -0
  387. data/rbi/stripe/resources/balance.rbi +235 -0
  388. data/rbi/stripe/resources/balance_transaction.rbi +147 -0
  389. data/rbi/stripe/resources/bank_account.rbi +127 -0
  390. data/rbi/stripe/resources/billing/alert.rbi +201 -0
  391. data/rbi/stripe/resources/billing/alert_triggered.rbi +28 -0
  392. data/rbi/stripe/resources/billing/credit_balance_summary.rbi +63 -0
  393. data/rbi/stripe/resources/billing/credit_balance_transaction.rbi +147 -0
  394. data/rbi/stripe/resources/billing/credit_grant.rbi +291 -0
  395. data/rbi/stripe/resources/billing/meter.rbi +226 -0
  396. data/rbi/stripe/resources/billing/meter_event.rbi +64 -0
  397. data/rbi/stripe/resources/billing/meter_event_adjustment.rbi +64 -0
  398. data/rbi/stripe/resources/billing/meter_event_summary.rbi +35 -0
  399. data/rbi/stripe/resources/billing_portal/configuration.rbi +645 -0
  400. data/rbi/stripe/resources/billing_portal/session.rbi +345 -0
  401. data/rbi/stripe/resources/capability.rbi +125 -0
  402. data/rbi/stripe/resources/card.rbi +125 -0
  403. data/rbi/stripe/resources/cash_balance.rbi +32 -0
  404. data/rbi/stripe/resources/charge.rbi +2069 -0
  405. data/rbi/stripe/resources/checkout/session.rbi +4004 -0
  406. data/rbi/stripe/resources/climate/order.rbi +245 -0
  407. data/rbi/stripe/resources/climate/product.rbi +75 -0
  408. data/rbi/stripe/resources/climate/supplier.rbi +72 -0
  409. data/rbi/stripe/resources/confirmation_token.rbi +1807 -0
  410. data/rbi/stripe/resources/connect_collection_transfer.rbi +26 -0
  411. data/rbi/stripe/resources/country_spec.rbi +85 -0
  412. data/rbi/stripe/resources/coupon.rbi +250 -0
  413. data/rbi/stripe/resources/credit_note.rbi +752 -0
  414. data/rbi/stripe/resources/credit_note_line_item.rbi +101 -0
  415. data/rbi/stripe/resources/customer.rbi +1005 -0
  416. data/rbi/stripe/resources/customer_balance_transaction.rbi +56 -0
  417. data/rbi/stripe/resources/customer_cash_balance_transaction.rbi +151 -0
  418. data/rbi/stripe/resources/customer_session.rbi +200 -0
  419. data/rbi/stripe/resources/discount.rbi +53 -0
  420. data/rbi/stripe/resources/dispute.rbi +761 -0
  421. data/rbi/stripe/resources/entitlements/active_entitlement.rbi +58 -0
  422. data/rbi/stripe/resources/entitlements/active_entitlement_summary.rbi +23 -0
  423. data/rbi/stripe/resources/entitlements/feature.rbi +117 -0
  424. data/rbi/stripe/resources/ephemeral_key.rbi +44 -0
  425. data/rbi/stripe/resources/event.rbi +149 -0
  426. data/rbi/stripe/resources/exchange_rate.rbi +66 -0
  427. data/rbi/stripe/resources/file.rbi +143 -0
  428. data/rbi/stripe/resources/file_link.rbi +141 -0
  429. data/rbi/stripe/resources/financial_connections/account.rbi +339 -0
  430. data/rbi/stripe/resources/financial_connections/account_owner.rbi +35 -0
  431. data/rbi/stripe/resources/financial_connections/account_ownership.rbi +23 -0
  432. data/rbi/stripe/resources/financial_connections/session.rbi +123 -0
  433. data/rbi/stripe/resources/financial_connections/transaction.rbi +124 -0
  434. data/rbi/stripe/resources/forwarding/request.rbi +216 -0
  435. data/rbi/stripe/resources/funding_instructions.rbi +437 -0
  436. data/rbi/stripe/resources/identity/verification_report.rbi +360 -0
  437. data/rbi/stripe/resources/identity/verification_session.rbi +526 -0
  438. data/rbi/stripe/resources/invoice.rbi +3812 -0
  439. data/rbi/stripe/resources/invoice_item.rbi +473 -0
  440. data/rbi/stripe/resources/invoice_line_item.rbi +432 -0
  441. data/rbi/stripe/resources/invoice_payment.rbi +121 -0
  442. data/rbi/stripe/resources/invoice_rendering_template.rbi +104 -0
  443. data/rbi/stripe/resources/issuing/authorization.rbi +1283 -0
  444. data/rbi/stripe/resources/issuing/card.rbi +741 -0
  445. data/rbi/stripe/resources/issuing/cardholder.rbi +744 -0
  446. data/rbi/stripe/resources/issuing/dispute.rbi +913 -0
  447. data/rbi/stripe/resources/issuing/personalization_design.rbi +338 -0
  448. data/rbi/stripe/resources/issuing/physical_bundle.rbi +79 -0
  449. data/rbi/stripe/resources/issuing/token.rbi +226 -0
  450. data/rbi/stripe/resources/issuing/transaction.rbi +1061 -0
  451. data/rbi/stripe/resources/line_item.rbi +72 -0
  452. data/rbi/stripe/resources/login_link.rbi +19 -0
  453. data/rbi/stripe/resources/mandate.rbi +187 -0
  454. data/rbi/stripe/resources/payment_intent.rbi +9647 -0
  455. data/rbi/stripe/resources/payment_link.rbi +1801 -0
  456. data/rbi/stripe/resources/payment_method.rbi +1761 -0
  457. data/rbi/stripe/resources/payment_method_configuration.rbi +3550 -0
  458. data/rbi/stripe/resources/payment_method_domain.rbi +228 -0
  459. data/rbi/stripe/resources/payout.rbi +300 -0
  460. data/rbi/stripe/resources/person.rbi +401 -0
  461. data/rbi/stripe/resources/plan.rbi +371 -0
  462. data/rbi/stripe/resources/price.rbi +694 -0
  463. data/rbi/stripe/resources/product.rbi +555 -0
  464. data/rbi/stripe/resources/product_feature.rbi +26 -0
  465. data/rbi/stripe/resources/promotion_code.rbi +261 -0
  466. data/rbi/stripe/resources/quote.rbi +1126 -0
  467. data/rbi/stripe/resources/radar/early_fraud_warning.rbi +98 -0
  468. data/rbi/stripe/resources/radar/value_list.rbi +168 -0
  469. data/rbi/stripe/resources/radar/value_list_item.rbi +129 -0
  470. data/rbi/stripe/resources/refund.rbi +523 -0
  471. data/rbi/stripe/resources/reporting/report_run.rbi +191 -0
  472. data/rbi/stripe/resources/reporting/report_type.rbi +57 -0
  473. data/rbi/stripe/resources/reserve_transaction.rbi +23 -0
  474. data/rbi/stripe/resources/reversal.rbi +51 -0
  475. data/rbi/stripe/resources/review.rbi +154 -0
  476. data/rbi/stripe/resources/setup_attempt.rbi +477 -0
  477. data/rbi/stripe/resources/setup_intent.rbi +3655 -0
  478. data/rbi/stripe/resources/shipping_rate.rbi +305 -0
  479. data/rbi/stripe/resources/sigma/scheduled_query_run.rbi +75 -0
  480. data/rbi/stripe/resources/source.rbi +1496 -0
  481. data/rbi/stripe/resources/source_mandate_notification.rbi +77 -0
  482. data/rbi/stripe/resources/source_transaction.rbi +127 -0
  483. data/rbi/stripe/resources/subscription.rbi +2027 -0
  484. data/rbi/stripe/resources/subscription_item.rbi +404 -0
  485. data/rbi/stripe/resources/subscription_schedule.rbi +1623 -0
  486. data/rbi/stripe/resources/tax/calculation.rbi +478 -0
  487. data/rbi/stripe/resources/tax/calculation_line_item.rbi +91 -0
  488. data/rbi/stripe/resources/tax/registration.rbi +2713 -0
  489. data/rbi/stripe/resources/tax/settings.rbi +141 -0
  490. data/rbi/stripe/resources/tax/transaction.rbi +351 -0
  491. data/rbi/stripe/resources/tax/transaction_line_item.rbi +54 -0
  492. data/rbi/stripe/resources/tax_code.rbi +44 -0
  493. data/rbi/stripe/resources/tax_deducted_at_source.rbi +23 -0
  494. data/rbi/stripe/resources/tax_id.rbi +165 -0
  495. data/rbi/stripe/resources/tax_rate.rbi +239 -0
  496. data/rbi/stripe/resources/terminal/configuration.rbi +1386 -0
  497. data/rbi/stripe/resources/terminal/connection_token.rbi +37 -0
  498. data/rbi/stripe/resources/terminal/location.rbi +222 -0
  499. data/rbi/stripe/resources/terminal/reader.rbi +847 -0
  500. data/rbi/stripe/resources/test_helpers/test_clock.rbi +132 -0
  501. data/rbi/stripe/resources/token.rbi +1283 -0
  502. data/rbi/stripe/resources/topup.rbi +222 -0
  503. data/rbi/stripe/resources/transfer.rbi +199 -0
  504. data/rbi/stripe/resources/treasury/credit_reversal.rbi +119 -0
  505. data/rbi/stripe/resources/treasury/debit_reversal.rbi +131 -0
  506. data/rbi/stripe/resources/treasury/financial_account.rbi +865 -0
  507. data/rbi/stripe/resources/treasury/financial_account_features.rbi +260 -0
  508. data/rbi/stripe/resources/treasury/inbound_transfer.rbi +295 -0
  509. data/rbi/stripe/resources/treasury/outbound_payment.rbi +592 -0
  510. data/rbi/stripe/resources/treasury/outbound_transfer.rbi +431 -0
  511. data/rbi/stripe/resources/treasury/received_credit.rbi +302 -0
  512. data/rbi/stripe/resources/treasury/received_debit.rbi +256 -0
  513. data/rbi/stripe/resources/treasury/transaction.rbi +215 -0
  514. data/rbi/stripe/resources/treasury/transaction_entry.rbi +192 -0
  515. data/rbi/stripe/resources/v2/amount.rbi +14 -0
  516. data/rbi/stripe/resources/v2/billing/meter_event.rbi +37 -0
  517. data/rbi/stripe/resources/v2/billing/meter_event_adjustment.rbi +41 -0
  518. data/rbi/stripe/resources/v2/billing/meter_event_session.rbi +31 -0
  519. data/rbi/stripe/resources/v2/event.rbi +48 -0
  520. data/rbi/stripe/resources/v2/event_destination.rbi +91 -0
  521. data/rbi/stripe/resources/webhook_endpoint.rbi +168 -0
  522. data/rbi/stripe/services/account_capability_service.rbi +51 -0
  523. data/rbi/stripe/services/account_external_account_service.rbi +304 -0
  524. data/rbi/stripe/services/account_link_service.rbi +58 -0
  525. data/rbi/stripe/services/account_login_link_service.rbi +22 -0
  526. data/rbi/stripe/services/account_person_service.rbi +1011 -0
  527. data/rbi/stripe/services/account_service.rbi +4213 -0
  528. data/rbi/stripe/services/account_session_service.rbi +646 -0
  529. data/rbi/stripe/services/apple_pay_domain_service.rbi +76 -0
  530. data/rbi/stripe/services/application_fee_refund_service.rbi +93 -0
  531. data/rbi/stripe/services/application_fee_service.rbi +78 -0
  532. data/rbi/stripe/services/apps/secret_service.rbi +151 -0
  533. data/{lib/stripe/resources/usage_record_summary.rb → rbi/stripe/services/apps_service.rbi} +4 -3
  534. data/rbi/stripe/services/balance_service.rbi +21 -0
  535. data/rbi/stripe/services/balance_transaction_service.rbi +93 -0
  536. data/rbi/stripe/services/billing/alert_service.rbi +152 -0
  537. data/rbi/stripe/services/billing/credit_balance_summary_service.rbi +68 -0
  538. data/rbi/stripe/services/billing/credit_balance_transaction_service.rbi +59 -0
  539. data/rbi/stripe/services/billing/credit_grant_service.rbi +211 -0
  540. data/rbi/stripe/services/billing/meter_event_adjustment_service.rbi +42 -0
  541. data/rbi/stripe/services/billing/meter_event_service.rbi +42 -0
  542. data/rbi/stripe/services/billing/meter_event_summary_service.rbi +54 -0
  543. data/rbi/stripe/services/billing/meter_service.rbi +163 -0
  544. data/rbi/stripe/services/billing_portal/configuration_service.rbi +511 -0
  545. data/rbi/stripe/services/billing_portal/session_service.rbi +204 -0
  546. data/rbi/stripe/services/billing_portal_service.rbi +10 -0
  547. data/rbi/stripe/services/billing_service.rbi +15 -0
  548. data/rbi/stripe/services/charge_service.rbi +448 -0
  549. data/rbi/stripe/services/checkout/session_line_item_service.rbi +33 -0
  550. data/rbi/stripe/services/checkout/session_service.rbi +2614 -0
  551. data/rbi/stripe/services/checkout_service.rbi +9 -0
  552. data/rbi/stripe/services/climate/order_service.rbi +142 -0
  553. data/rbi/stripe/services/climate/product_service.rbi +46 -0
  554. data/rbi/stripe/services/climate/supplier_service.rbi +46 -0
  555. data/rbi/stripe/services/climate_service.rbi +11 -0
  556. data/rbi/stripe/services/confirmation_token_service.rbi +20 -0
  557. data/rbi/stripe/services/country_spec_service.rbi +44 -0
  558. data/rbi/stripe/services/coupon_service.rbi +194 -0
  559. data/rbi/stripe/services/credit_note_line_item_service.rbi +31 -0
  560. data/rbi/stripe/services/credit_note_preview_lines_service.rbi +167 -0
  561. data/rbi/stripe/services/credit_note_service.rbi +415 -0
  562. data/rbi/stripe/services/customer_balance_transaction_service.rbi +92 -0
  563. data/rbi/stripe/services/customer_cash_balance_service.rbi +45 -0
  564. data/rbi/stripe/services/customer_cash_balance_transaction_service.rbi +44 -0
  565. data/rbi/stripe/services/customer_funding_instructions_service.rbi +59 -0
  566. data/rbi/stripe/services/customer_payment_method_service.rbi +57 -0
  567. data/rbi/stripe/services/customer_payment_source_service.rbi +232 -0
  568. data/rbi/stripe/services/customer_service.rbi +647 -0
  569. data/rbi/stripe/services/customer_session_service.rbi +116 -0
  570. data/rbi/stripe/services/customer_tax_id_service.rbi +70 -0
  571. data/rbi/stripe/services/dispute_service.rbi +424 -0
  572. data/rbi/stripe/services/entitlements/active_entitlement_service.rbi +55 -0
  573. data/rbi/stripe/services/entitlements/feature_service.rbi +107 -0
  574. data/rbi/stripe/services/entitlements_service.rbi +10 -0
  575. data/rbi/stripe/services/ephemeral_key_service.rbi +53 -0
  576. data/rbi/stripe/services/event_service.rbi +83 -0
  577. data/rbi/stripe/services/exchange_rate_service.rbi +44 -0
  578. data/rbi/stripe/services/file_link_service.rbi +124 -0
  579. data/rbi/stripe/services/file_service.rbi +116 -0
  580. data/rbi/stripe/services/financial_connections/account_owner_service.rbi +42 -0
  581. data/rbi/stripe/services/financial_connections/account_service.rbi +133 -0
  582. data/rbi/stripe/services/financial_connections/session_service.rbi +88 -0
  583. data/rbi/stripe/services/financial_connections/transaction_service.rbi +92 -0
  584. data/rbi/stripe/services/financial_connections_service.rbi +11 -0
  585. data/rbi/stripe/services/forwarding/request_service.rbi +134 -0
  586. data/rbi/stripe/services/forwarding_service.rbi +9 -0
  587. data/rbi/stripe/services/identity/verification_report_service.rbi +87 -0
  588. data/rbi/stripe/services/identity/verification_session_service.rbi +323 -0
  589. data/rbi/stripe/services/identity_service.rbi +10 -0
  590. data/rbi/stripe/services/invoice_item_service.rbi +366 -0
  591. data/rbi/stripe/services/invoice_line_item_service.rbi +259 -0
  592. data/rbi/stripe/services/invoice_payment_service.rbi +71 -0
  593. data/rbi/stripe/services/invoice_rendering_template_service.rbi +82 -0
  594. data/rbi/stripe/services/invoice_service.rbi +2981 -0
  595. data/rbi/stripe/services/issuing/authorization_service.rbi +146 -0
  596. data/rbi/stripe/services/issuing/card_service.rbi +495 -0
  597. data/rbi/stripe/services/issuing/cardholder_service.rbi +587 -0
  598. data/rbi/stripe/services/issuing/dispute_service.rbi +707 -0
  599. data/rbi/stripe/services/issuing/personalization_design_service.rbi +243 -0
  600. data/rbi/stripe/services/issuing/physical_bundle_service.rbi +59 -0
  601. data/rbi/stripe/services/issuing/token_service.rbi +99 -0
  602. data/rbi/stripe/services/issuing/transaction_service.rbi +105 -0
  603. data/rbi/stripe/services/issuing_service.rbi +16 -0
  604. data/rbi/stripe/services/mandate_service.rbi +20 -0
  605. data/rbi/stripe/services/payment_intent_service.rbi +7659 -0
  606. data/rbi/stripe/services/payment_link_line_item_service.rbi +31 -0
  607. data/rbi/stripe/services/payment_link_service.rbi +1352 -0
  608. data/rbi/stripe/services/payment_method_configuration_service.rbi +2487 -0
  609. data/rbi/stripe/services/payment_method_domain_service.rbi +112 -0
  610. data/rbi/stripe/services/payment_method_service.rbi +776 -0
  611. data/rbi/stripe/services/payout_service.rbi +205 -0
  612. data/rbi/stripe/services/plan_service.rbi +282 -0
  613. data/rbi/stripe/services/price_service.rbi +546 -0
  614. data/rbi/stripe/services/product_feature_service.rbi +67 -0
  615. data/rbi/stripe/services/product_service.rbi +477 -0
  616. data/rbi/stripe/services/promotion_code_service.rbi +214 -0
  617. data/rbi/stripe/services/quote_computed_upfront_line_items_service.rbi +31 -0
  618. data/rbi/stripe/services/quote_line_item_service.rbi +31 -0
  619. data/rbi/stripe/services/quote_service.rbi +686 -0
  620. data/rbi/stripe/services/radar/early_fraud_warning_service.rbi +85 -0
  621. data/rbi/stripe/services/radar/value_list_item_service.rbi +109 -0
  622. data/rbi/stripe/services/radar/value_list_service.rbi +141 -0
  623. data/rbi/stripe/services/radar_service.rbi +11 -0
  624. data/rbi/stripe/services/refund_service.rbi +185 -0
  625. data/rbi/stripe/services/reporting/report_run_service.rbi +135 -0
  626. data/rbi/stripe/services/reporting/report_type_service.rbi +35 -0
  627. data/rbi/stripe/services/reporting_service.rbi +10 -0
  628. data/rbi/stripe/services/review_service.rbi +84 -0
  629. data/rbi/stripe/services/setup_attempt_service.rbi +65 -0
  630. data/rbi/stripe/services/setup_intent_service.rbi +3391 -0
  631. data/rbi/stripe/services/shipping_rate_service.rbi +241 -0
  632. data/rbi/stripe/services/sigma/scheduled_query_run_service.rbi +46 -0
  633. data/rbi/stripe/services/sigma_service.rbi +9 -0
  634. data/rbi/stripe/services/source_service.rbi +663 -0
  635. data/rbi/stripe/services/source_transaction_service.rbi +31 -0
  636. data/rbi/stripe/services/subscription_item_service.rbi +350 -0
  637. data/rbi/stripe/services/subscription_schedule_service.rbi +1290 -0
  638. data/rbi/stripe/services/subscription_service.rbi +1648 -0
  639. data/rbi/stripe/services/tax/calculation_line_item_service.rbi +33 -0
  640. data/rbi/stripe/services/tax/calculation_service.rbi +234 -0
  641. data/rbi/stripe/services/tax/registration_service.rbi +1845 -0
  642. data/rbi/stripe/services/tax/settings_service.rbi +93 -0
  643. data/rbi/stripe/services/tax/transaction_line_item_service.rbi +33 -0
  644. data/rbi/stripe/services/tax/transaction_service.rbi +146 -0
  645. data/rbi/stripe/services/tax_code_service.rbi +44 -0
  646. data/rbi/stripe/services/tax_id_service.rbi +110 -0
  647. data/rbi/stripe/services/tax_rate_service.rbi +185 -0
  648. data/rbi/stripe/services/tax_service.rbi +12 -0
  649. data/rbi/stripe/services/terminal/configuration_service.rbi +1118 -0
  650. data/rbi/stripe/services/terminal/connection_token_service.rbi +25 -0
  651. data/rbi/stripe/services/terminal/location_service.rbi +182 -0
  652. data/rbi/stripe/services/terminal/reader_service.rbi +455 -0
  653. data/rbi/stripe/services/terminal_service.rbi +12 -0
  654. data/rbi/stripe/services/test_helpers/confirmation_token_service.rbi +739 -0
  655. data/rbi/stripe/services/test_helpers/customer_service.rbi +33 -0
  656. data/rbi/stripe/services/test_helpers/issuing/authorization_service.rbi +848 -0
  657. data/rbi/stripe/services/test_helpers/issuing/card_service.rbi +76 -0
  658. data/rbi/stripe/services/test_helpers/issuing/personalization_design_service.rbi +69 -0
  659. data/rbi/stripe/services/test_helpers/issuing/transaction_service.rbi +711 -0
  660. data/rbi/stripe/services/test_helpers/issuing_service.rbi +14 -0
  661. data/rbi/stripe/services/test_helpers/refund_service.rbi +22 -0
  662. data/rbi/stripe/services/test_helpers/terminal/reader_service.rbi +93 -0
  663. data/rbi/stripe/services/test_helpers/terminal_service.rbi +11 -0
  664. data/rbi/stripe/services/test_helpers/test_clock_service.rbi +90 -0
  665. data/rbi/stripe/services/test_helpers/treasury/inbound_transfer_service.rbi +64 -0
  666. data/rbi/stripe/services/test_helpers/treasury/outbound_payment_service.rbi +125 -0
  667. data/rbi/stripe/services/test_helpers/treasury/outbound_transfer_service.rbi +125 -0
  668. data/rbi/stripe/services/test_helpers/treasury/received_credit_service.rbi +87 -0
  669. data/rbi/stripe/services/test_helpers/treasury/received_debit_service.rbi +87 -0
  670. data/rbi/stripe/services/test_helpers/treasury_service.rbi +15 -0
  671. data/rbi/stripe/services/test_helpers_service.rbi +15 -0
  672. data/rbi/stripe/services/token_service.rbi +1257 -0
  673. data/rbi/stripe/services/topup_service.rbi +176 -0
  674. data/rbi/stripe/services/transfer_reversal_service.rbi +101 -0
  675. data/rbi/stripe/services/transfer_service.rbi +152 -0
  676. data/rbi/stripe/services/treasury/credit_reversal_service.rbi +84 -0
  677. data/rbi/stripe/services/treasury/debit_reversal_service.rbi +88 -0
  678. data/rbi/stripe/services/treasury/financial_account_features_service.rbi +198 -0
  679. data/rbi/stripe/services/treasury/financial_account_service.rbi +562 -0
  680. data/rbi/stripe/services/treasury/inbound_transfer_service.rbi +117 -0
  681. data/rbi/stripe/services/treasury/outbound_payment_service.rbi +304 -0
  682. data/rbi/stripe/services/treasury/outbound_transfer_service.rbi +157 -0
  683. data/rbi/stripe/services/treasury/received_credit_service.rbi +72 -0
  684. data/rbi/stripe/services/treasury/received_debit_service.rbi +59 -0
  685. data/rbi/stripe/services/treasury/transaction_entry_service.rbi +111 -0
  686. data/rbi/stripe/services/treasury/transaction_service.rbi +122 -0
  687. data/rbi/stripe/services/treasury_service.rbi +18 -0
  688. data/rbi/stripe/services/v1_services.rbi +77 -0
  689. data/rbi/stripe/services/v2/billing/meter_event_adjustment_service.rbi +39 -0
  690. data/rbi/stripe/services/v2/billing/meter_event_service.rbi +42 -0
  691. data/rbi/stripe/services/v2/billing/meter_event_session_service.rbi +18 -0
  692. data/rbi/stripe/services/v2/billing/meter_event_stream_service.rbi +55 -0
  693. data/rbi/stripe/services/v2/billing_service.rbi +14 -0
  694. data/rbi/stripe/services/v2/core/event_destination_service.rbi +192 -0
  695. data/rbi/stripe/services/v2/core/event_service.rbi +36 -0
  696. data/rbi/stripe/services/v2/core_service.rbi +12 -0
  697. data/rbi/stripe/services/v2_services.rbi +10 -0
  698. data/rbi/stripe/services/webhook_endpoint_service.rbi +129 -0
  699. data/stripe.gemspec +10 -7
  700. metadata +599 -18
  701. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  702. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  703. data/lib/stripe/resources/issuing/card_details.rb +0 -9
  704. data/lib/stripe/resources/order.rb +0 -33
  705. data/lib/stripe/resources/order_return.rb +0 -10
  706. data/lib/stripe/resources/recipient.rb +0 -14
  707. data/lib/stripe/resources/sku.rb +0 -13
  708. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -2,25 +2,1003 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # This object represents a customer of your business. Use it to [create recurring charges](https://stripe.com/docs/invoicing/customer), [save payment](https://stripe.com/docs/payments/save-during-payment) and contact information,
6
+ # and track payments that belong to the same customer.
5
7
  class Customer < APIResource
6
8
  extend Stripe::APIOperations::Create
7
9
  include Stripe::APIOperations::Delete
8
10
  extend Stripe::APIOperations::List
9
- include Stripe::APIOperations::Save
10
11
  extend Stripe::APIOperations::NestedResource
12
+ extend Stripe::APIOperations::Search
13
+ include Stripe::APIOperations::Save
11
14
 
12
15
  OBJECT_NAME = "customer"
16
+ def self.object_name
17
+ "customer"
18
+ end
19
+
20
+ nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list]
21
+ nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list]
22
+ nested_resource_class_methods :source, operations: %i[create retrieve update delete list]
23
+ nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]
24
+
25
+ class Address < Stripe::StripeObject
26
+ # City, district, suburb, town, or village.
27
+ attr_reader :city
28
+ # Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
29
+ attr_reader :country
30
+ # Address line 1 (e.g., street, PO Box, or company name).
31
+ attr_reader :line1
32
+ # Address line 2 (e.g., apartment, suite, unit, or building).
33
+ attr_reader :line2
34
+ # ZIP or postal code.
35
+ attr_reader :postal_code
36
+ # State, county, province, or region.
37
+ attr_reader :state
38
+ end
39
+
40
+ class InvoiceSettings < Stripe::StripeObject
41
+ class CustomField < Stripe::StripeObject
42
+ # The name of the custom field.
43
+ attr_reader :name
44
+ # The value of the custom field.
45
+ attr_reader :value
46
+ end
47
+
48
+ class RenderingOptions < Stripe::StripeObject
49
+ # How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
50
+ attr_reader :amount_tax_display
51
+ # ID of the invoice rendering template to be used for this customer's invoices. If set, the template will be used on all invoices for this customer unless a template is set directly on the invoice.
52
+ attr_reader :template
53
+ end
54
+ # Default custom fields to be displayed on invoices for this customer.
55
+ attr_reader :custom_fields
56
+ # ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices.
57
+ attr_reader :default_payment_method
58
+ # Default footer to be displayed on invoices for this customer.
59
+ attr_reader :footer
60
+ # Default options for invoice PDF rendering for this customer.
61
+ attr_reader :rendering_options
62
+ end
63
+
64
+ class Shipping < Stripe::StripeObject
65
+ class Address < Stripe::StripeObject
66
+ # City, district, suburb, town, or village.
67
+ attr_reader :city
68
+ # Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
69
+ attr_reader :country
70
+ # Address line 1 (e.g., street, PO Box, or company name).
71
+ attr_reader :line1
72
+ # Address line 2 (e.g., apartment, suite, unit, or building).
73
+ attr_reader :line2
74
+ # ZIP or postal code.
75
+ attr_reader :postal_code
76
+ # State, county, province, or region.
77
+ attr_reader :state
78
+ end
79
+ # Attribute for field address
80
+ attr_reader :address
81
+ # The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
82
+ attr_reader :carrier
83
+ # Recipient name.
84
+ attr_reader :name
85
+ # Recipient phone (including extension).
86
+ attr_reader :phone
87
+ # The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.
88
+ attr_reader :tracking_number
89
+ end
90
+
91
+ class Tax < Stripe::StripeObject
92
+ class Location < Stripe::StripeObject
93
+ # The identified tax country of the customer.
94
+ attr_reader :country
95
+ # The data source used to infer the customer's location.
96
+ attr_reader :source
97
+ # The identified tax state, county, province, or region of the customer.
98
+ attr_reader :state
99
+ end
100
+ # Surfaces if automatic tax computation is possible given the current customer location information.
101
+ attr_reader :automatic_tax
102
+ # A recent IP address of the customer used for tax reporting and tax location inference.
103
+ attr_reader :ip_address
104
+ # The identified tax location of the customer.
105
+ attr_reader :location
106
+ end
107
+
108
+ class DeleteParams < Stripe::RequestParams; end
109
+
110
+ class UpdateParams < Stripe::RequestParams
111
+ class Address < Stripe::RequestParams
112
+ # City, district, suburb, town, or village.
113
+ attr_accessor :city
114
+ # A freeform text field for the country. However, in order to activate some tax features, the format should be a two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
115
+ attr_accessor :country
116
+ # Address line 1 (e.g., street, PO Box, or company name).
117
+ attr_accessor :line1
118
+ # Address line 2 (e.g., apartment, suite, unit, or building).
119
+ attr_accessor :line2
120
+ # ZIP or postal code.
121
+ attr_accessor :postal_code
122
+ # State, county, province, or region.
123
+ attr_accessor :state
124
+
125
+ def initialize(
126
+ city: nil,
127
+ country: nil,
128
+ line1: nil,
129
+ line2: nil,
130
+ postal_code: nil,
131
+ state: nil
132
+ )
133
+ @city = city
134
+ @country = country
135
+ @line1 = line1
136
+ @line2 = line2
137
+ @postal_code = postal_code
138
+ @state = state
139
+ end
140
+ end
141
+
142
+ class CashBalance < Stripe::RequestParams
143
+ class Settings < Stripe::RequestParams
144
+ # Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
145
+ attr_accessor :reconciliation_mode
146
+
147
+ def initialize(reconciliation_mode: nil)
148
+ @reconciliation_mode = reconciliation_mode
149
+ end
150
+ end
151
+ # Settings controlling the behavior of the customer's cash balance,
152
+ # such as reconciliation of funds received.
153
+ attr_accessor :settings
154
+
155
+ def initialize(settings: nil)
156
+ @settings = settings
157
+ end
158
+ end
159
+
160
+ class InvoiceSettings < Stripe::RequestParams
161
+ class CustomField < Stripe::RequestParams
162
+ # The name of the custom field. This may be up to 40 characters.
163
+ attr_accessor :name
164
+ # The value of the custom field. This may be up to 140 characters.
165
+ attr_accessor :value
166
+
167
+ def initialize(name: nil, value: nil)
168
+ @name = name
169
+ @value = value
170
+ end
171
+ end
172
+
173
+ class RenderingOptions < Stripe::RequestParams
174
+ # How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
175
+ attr_accessor :amount_tax_display
176
+ # ID of the invoice rendering template to use for future invoices.
177
+ attr_accessor :template
178
+
179
+ def initialize(amount_tax_display: nil, template: nil)
180
+ @amount_tax_display = amount_tax_display
181
+ @template = template
182
+ end
183
+ end
184
+ # The list of up to 4 default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields.
185
+ attr_accessor :custom_fields
186
+ # ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices.
187
+ attr_accessor :default_payment_method
188
+ # Default footer to be displayed on invoices for this customer.
189
+ attr_accessor :footer
190
+ # Default options for invoice PDF rendering for this customer.
191
+ attr_accessor :rendering_options
192
+
193
+ def initialize(
194
+ custom_fields: nil,
195
+ default_payment_method: nil,
196
+ footer: nil,
197
+ rendering_options: nil
198
+ )
199
+ @custom_fields = custom_fields
200
+ @default_payment_method = default_payment_method
201
+ @footer = footer
202
+ @rendering_options = rendering_options
203
+ end
204
+ end
205
+
206
+ class Shipping < Stripe::RequestParams
207
+ class Address < Stripe::RequestParams
208
+ # City, district, suburb, town, or village.
209
+ attr_accessor :city
210
+ # A freeform text field for the country. However, in order to activate some tax features, the format should be a two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
211
+ attr_accessor :country
212
+ # Address line 1 (e.g., street, PO Box, or company name).
213
+ attr_accessor :line1
214
+ # Address line 2 (e.g., apartment, suite, unit, or building).
215
+ attr_accessor :line2
216
+ # ZIP or postal code.
217
+ attr_accessor :postal_code
218
+ # State, county, province, or region.
219
+ attr_accessor :state
220
+
221
+ def initialize(
222
+ city: nil,
223
+ country: nil,
224
+ line1: nil,
225
+ line2: nil,
226
+ postal_code: nil,
227
+ state: nil
228
+ )
229
+ @city = city
230
+ @country = country
231
+ @line1 = line1
232
+ @line2 = line2
233
+ @postal_code = postal_code
234
+ @state = state
235
+ end
236
+ end
237
+ # Customer shipping address.
238
+ attr_accessor :address
239
+ # Customer name.
240
+ attr_accessor :name
241
+ # Customer phone (including extension).
242
+ attr_accessor :phone
243
+
244
+ def initialize(address: nil, name: nil, phone: nil)
245
+ @address = address
246
+ @name = name
247
+ @phone = phone
248
+ end
249
+ end
250
+
251
+ class Tax < Stripe::RequestParams
252
+ # A recent IP address of the customer used for tax reporting and tax location inference. Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
253
+ attr_accessor :ip_address
254
+ # A flag that indicates when Stripe should validate the customer tax location. Defaults to `auto`.
255
+ attr_accessor :validate_location
256
+
257
+ def initialize(ip_address: nil, validate_location: nil)
258
+ @ip_address = ip_address
259
+ @validate_location = validate_location
260
+ end
261
+ end
262
+ # The customer's address.
263
+ attr_accessor :address
264
+ # An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
265
+ attr_accessor :balance
266
+ # Balance information and default balance settings for this customer.
267
+ attr_accessor :cash_balance
268
+ # If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) parameter.
269
+ #
270
+ # Provide the ID of a payment source already attached to this customer to make it this customer's default payment source.
271
+ #
272
+ # If you want to add a new payment source and make it the default, see the [source](https://stripe.com/docs/api/customers/update#update_customer-source) property.
273
+ attr_accessor :default_source
274
+ # An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard.
275
+ attr_accessor :description
276
+ # Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to *512 characters*.
277
+ attr_accessor :email
278
+ # Specifies which fields in the response should be expanded.
279
+ attr_accessor :expand
280
+ # The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.
281
+ attr_accessor :invoice_prefix
282
+ # Default invoice settings for this customer.
283
+ attr_accessor :invoice_settings
284
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
285
+ attr_accessor :metadata
286
+ # The customer's full name or business name.
287
+ attr_accessor :name
288
+ # The sequence to be used on the customer's next invoice. Defaults to 1.
289
+ attr_accessor :next_invoice_sequence
290
+ # The customer's phone number.
291
+ attr_accessor :phone
292
+ # Customer's preferred languages, ordered by preference.
293
+ attr_accessor :preferred_locales
294
+ # The customer's shipping information. Appears on invoices emailed to this customer.
295
+ attr_accessor :shipping
296
+ # Attribute for param field source
297
+ attr_accessor :source
298
+ # Tax details about the customer.
299
+ attr_accessor :tax
300
+ # The customer's tax exemption. One of `none`, `exempt`, or `reverse`.
301
+ attr_accessor :tax_exempt
302
+ # Attribute for param field validate
303
+ attr_accessor :validate
304
+
305
+ def initialize(
306
+ address: nil,
307
+ balance: nil,
308
+ cash_balance: nil,
309
+ default_source: nil,
310
+ description: nil,
311
+ email: nil,
312
+ expand: nil,
313
+ invoice_prefix: nil,
314
+ invoice_settings: nil,
315
+ metadata: nil,
316
+ name: nil,
317
+ next_invoice_sequence: nil,
318
+ phone: nil,
319
+ preferred_locales: nil,
320
+ shipping: nil,
321
+ source: nil,
322
+ tax: nil,
323
+ tax_exempt: nil,
324
+ validate: nil
325
+ )
326
+ @address = address
327
+ @balance = balance
328
+ @cash_balance = cash_balance
329
+ @default_source = default_source
330
+ @description = description
331
+ @email = email
332
+ @expand = expand
333
+ @invoice_prefix = invoice_prefix
334
+ @invoice_settings = invoice_settings
335
+ @metadata = metadata
336
+ @name = name
337
+ @next_invoice_sequence = next_invoice_sequence
338
+ @phone = phone
339
+ @preferred_locales = preferred_locales
340
+ @shipping = shipping
341
+ @source = source
342
+ @tax = tax
343
+ @tax_exempt = tax_exempt
344
+ @validate = validate
345
+ end
346
+ end
347
+
348
+ class DeleteDiscountParams < Stripe::RequestParams; end
349
+
350
+ class ListParams < Stripe::RequestParams
351
+ class Created < Stripe::RequestParams
352
+ # Minimum value to filter by (exclusive)
353
+ attr_accessor :gt
354
+ # Minimum value to filter by (inclusive)
355
+ attr_accessor :gte
356
+ # Maximum value to filter by (exclusive)
357
+ attr_accessor :lt
358
+ # Maximum value to filter by (inclusive)
359
+ attr_accessor :lte
360
+
361
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
362
+ @gt = gt
363
+ @gte = gte
364
+ @lt = lt
365
+ @lte = lte
366
+ end
367
+ end
368
+ # Only return customers that were created during the given date interval.
369
+ attr_accessor :created
370
+ # A case-sensitive filter on the list based on the customer's `email` field. The value must be a string.
371
+ attr_accessor :email
372
+ # A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
373
+ attr_accessor :ending_before
374
+ # Specifies which fields in the response should be expanded.
375
+ attr_accessor :expand
376
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
377
+ attr_accessor :limit
378
+ # A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
379
+ attr_accessor :starting_after
380
+ # Provides a list of customers that are associated with the specified test clock. The response will not include customers with test clocks if this parameter is not set.
381
+ attr_accessor :test_clock
382
+
383
+ def initialize(
384
+ created: nil,
385
+ email: nil,
386
+ ending_before: nil,
387
+ expand: nil,
388
+ limit: nil,
389
+ starting_after: nil,
390
+ test_clock: nil
391
+ )
392
+ @created = created
393
+ @email = email
394
+ @ending_before = ending_before
395
+ @expand = expand
396
+ @limit = limit
397
+ @starting_after = starting_after
398
+ @test_clock = test_clock
399
+ end
400
+ end
401
+
402
+ class CreateParams < Stripe::RequestParams
403
+ class Address < Stripe::RequestParams
404
+ # City, district, suburb, town, or village.
405
+ attr_accessor :city
406
+ # A freeform text field for the country. However, in order to activate some tax features, the format should be a two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
407
+ attr_accessor :country
408
+ # Address line 1 (e.g., street, PO Box, or company name).
409
+ attr_accessor :line1
410
+ # Address line 2 (e.g., apartment, suite, unit, or building).
411
+ attr_accessor :line2
412
+ # ZIP or postal code.
413
+ attr_accessor :postal_code
414
+ # State, county, province, or region.
415
+ attr_accessor :state
416
+
417
+ def initialize(
418
+ city: nil,
419
+ country: nil,
420
+ line1: nil,
421
+ line2: nil,
422
+ postal_code: nil,
423
+ state: nil
424
+ )
425
+ @city = city
426
+ @country = country
427
+ @line1 = line1
428
+ @line2 = line2
429
+ @postal_code = postal_code
430
+ @state = state
431
+ end
432
+ end
433
+
434
+ class CashBalance < Stripe::RequestParams
435
+ class Settings < Stripe::RequestParams
436
+ # Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
437
+ attr_accessor :reconciliation_mode
438
+
439
+ def initialize(reconciliation_mode: nil)
440
+ @reconciliation_mode = reconciliation_mode
441
+ end
442
+ end
443
+ # Settings controlling the behavior of the customer's cash balance,
444
+ # such as reconciliation of funds received.
445
+ attr_accessor :settings
446
+
447
+ def initialize(settings: nil)
448
+ @settings = settings
449
+ end
450
+ end
451
+
452
+ class InvoiceSettings < Stripe::RequestParams
453
+ class CustomField < Stripe::RequestParams
454
+ # The name of the custom field. This may be up to 40 characters.
455
+ attr_accessor :name
456
+ # The value of the custom field. This may be up to 140 characters.
457
+ attr_accessor :value
458
+
459
+ def initialize(name: nil, value: nil)
460
+ @name = name
461
+ @value = value
462
+ end
463
+ end
464
+
465
+ class RenderingOptions < Stripe::RequestParams
466
+ # How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
467
+ attr_accessor :amount_tax_display
468
+ # ID of the invoice rendering template to use for future invoices.
469
+ attr_accessor :template
470
+
471
+ def initialize(amount_tax_display: nil, template: nil)
472
+ @amount_tax_display = amount_tax_display
473
+ @template = template
474
+ end
475
+ end
476
+ # The list of up to 4 default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields.
477
+ attr_accessor :custom_fields
478
+ # ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices.
479
+ attr_accessor :default_payment_method
480
+ # Default footer to be displayed on invoices for this customer.
481
+ attr_accessor :footer
482
+ # Default options for invoice PDF rendering for this customer.
483
+ attr_accessor :rendering_options
484
+
485
+ def initialize(
486
+ custom_fields: nil,
487
+ default_payment_method: nil,
488
+ footer: nil,
489
+ rendering_options: nil
490
+ )
491
+ @custom_fields = custom_fields
492
+ @default_payment_method = default_payment_method
493
+ @footer = footer
494
+ @rendering_options = rendering_options
495
+ end
496
+ end
497
+
498
+ class Shipping < Stripe::RequestParams
499
+ class Address < Stripe::RequestParams
500
+ # City, district, suburb, town, or village.
501
+ attr_accessor :city
502
+ # A freeform text field for the country. However, in order to activate some tax features, the format should be a two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
503
+ attr_accessor :country
504
+ # Address line 1 (e.g., street, PO Box, or company name).
505
+ attr_accessor :line1
506
+ # Address line 2 (e.g., apartment, suite, unit, or building).
507
+ attr_accessor :line2
508
+ # ZIP or postal code.
509
+ attr_accessor :postal_code
510
+ # State, county, province, or region.
511
+ attr_accessor :state
512
+
513
+ def initialize(
514
+ city: nil,
515
+ country: nil,
516
+ line1: nil,
517
+ line2: nil,
518
+ postal_code: nil,
519
+ state: nil
520
+ )
521
+ @city = city
522
+ @country = country
523
+ @line1 = line1
524
+ @line2 = line2
525
+ @postal_code = postal_code
526
+ @state = state
527
+ end
528
+ end
529
+ # Customer shipping address.
530
+ attr_accessor :address
531
+ # Customer name.
532
+ attr_accessor :name
533
+ # Customer phone (including extension).
534
+ attr_accessor :phone
535
+
536
+ def initialize(address: nil, name: nil, phone: nil)
537
+ @address = address
538
+ @name = name
539
+ @phone = phone
540
+ end
541
+ end
542
+
543
+ class Tax < Stripe::RequestParams
544
+ # A recent IP address of the customer used for tax reporting and tax location inference. Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
545
+ attr_accessor :ip_address
546
+ # A flag that indicates when Stripe should validate the customer tax location. Defaults to `deferred`.
547
+ attr_accessor :validate_location
548
+
549
+ def initialize(ip_address: nil, validate_location: nil)
550
+ @ip_address = ip_address
551
+ @validate_location = validate_location
552
+ end
553
+ end
554
+
555
+ class TaxIdDatum < Stripe::RequestParams
556
+ # Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `aw_tin`, `az_tin`, `ba_tin`, `bb_tin`, `bd_bin`, `bf_ifu`, `bg_uic`, `bh_vat`, `bj_ifu`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cm_niu`, `cn_tin`, `co_nit`, `cr_tin`, `cv_nif`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `et_tin`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kg_tin`, `kh_tin`, `kr_brn`, `kz_bin`, `la_tin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`
557
+ attr_accessor :type
558
+ # Value of the tax ID.
559
+ attr_accessor :value
560
+
561
+ def initialize(type: nil, value: nil)
562
+ @type = type
563
+ @value = value
564
+ end
565
+ end
566
+ # The customer's address.
567
+ attr_accessor :address
568
+ # An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
569
+ attr_accessor :balance
570
+ # Balance information and default balance settings for this customer.
571
+ attr_accessor :cash_balance
572
+ # An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard.
573
+ attr_accessor :description
574
+ # Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to *512 characters*.
575
+ attr_accessor :email
576
+ # Specifies which fields in the response should be expanded.
577
+ attr_accessor :expand
578
+ # The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.
579
+ attr_accessor :invoice_prefix
580
+ # Default invoice settings for this customer.
581
+ attr_accessor :invoice_settings
582
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
583
+ attr_accessor :metadata
584
+ # The customer's full name or business name.
585
+ attr_accessor :name
586
+ # The sequence to be used on the customer's next invoice. Defaults to 1.
587
+ attr_accessor :next_invoice_sequence
588
+ # Attribute for param field payment_method
589
+ attr_accessor :payment_method
590
+ # The customer's phone number.
591
+ attr_accessor :phone
592
+ # Customer's preferred languages, ordered by preference.
593
+ attr_accessor :preferred_locales
594
+ # The customer's shipping information. Appears on invoices emailed to this customer.
595
+ attr_accessor :shipping
596
+ # Attribute for param field source
597
+ attr_accessor :source
598
+ # Tax details about the customer.
599
+ attr_accessor :tax
600
+ # The customer's tax exemption. One of `none`, `exempt`, or `reverse`.
601
+ attr_accessor :tax_exempt
602
+ # The customer's tax IDs.
603
+ attr_accessor :tax_id_data
604
+ # ID of the test clock to attach to the customer.
605
+ attr_accessor :test_clock
606
+ # Attribute for param field validate
607
+ attr_accessor :validate
608
+
609
+ def initialize(
610
+ address: nil,
611
+ balance: nil,
612
+ cash_balance: nil,
613
+ description: nil,
614
+ email: nil,
615
+ expand: nil,
616
+ invoice_prefix: nil,
617
+ invoice_settings: nil,
618
+ metadata: nil,
619
+ name: nil,
620
+ next_invoice_sequence: nil,
621
+ payment_method: nil,
622
+ phone: nil,
623
+ preferred_locales: nil,
624
+ shipping: nil,
625
+ source: nil,
626
+ tax: nil,
627
+ tax_exempt: nil,
628
+ tax_id_data: nil,
629
+ test_clock: nil,
630
+ validate: nil
631
+ )
632
+ @address = address
633
+ @balance = balance
634
+ @cash_balance = cash_balance
635
+ @description = description
636
+ @email = email
637
+ @expand = expand
638
+ @invoice_prefix = invoice_prefix
639
+ @invoice_settings = invoice_settings
640
+ @metadata = metadata
641
+ @name = name
642
+ @next_invoice_sequence = next_invoice_sequence
643
+ @payment_method = payment_method
644
+ @phone = phone
645
+ @preferred_locales = preferred_locales
646
+ @shipping = shipping
647
+ @source = source
648
+ @tax = tax
649
+ @tax_exempt = tax_exempt
650
+ @tax_id_data = tax_id_data
651
+ @test_clock = test_clock
652
+ @validate = validate
653
+ end
654
+ end
655
+
656
+ class ListPaymentMethodsParams < Stripe::RequestParams
657
+ # This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
658
+ attr_accessor :allow_redisplay
659
+ # A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
660
+ attr_accessor :ending_before
661
+ # Specifies which fields in the response should be expanded.
662
+ attr_accessor :expand
663
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
664
+ attr_accessor :limit
665
+ # A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
666
+ attr_accessor :starting_after
667
+ # An optional filter on the list, based on the object `type` field. Without the filter, the list includes all current and future payment method types. If your integration expects only one type of payment method in the response, make sure to provide a type value in the request.
668
+ attr_accessor :type
669
+
670
+ def initialize(
671
+ allow_redisplay: nil,
672
+ ending_before: nil,
673
+ expand: nil,
674
+ limit: nil,
675
+ starting_after: nil,
676
+ type: nil
677
+ )
678
+ @allow_redisplay = allow_redisplay
679
+ @ending_before = ending_before
680
+ @expand = expand
681
+ @limit = limit
682
+ @starting_after = starting_after
683
+ @type = type
684
+ end
685
+ end
13
686
 
14
- nested_resource_class_methods :balance_transaction,
15
- operations: %i[create retrieve update list]
16
- nested_resource_class_methods :tax_id,
17
- operations: %i[create retrieve delete list]
687
+ class RetrievePaymentMethodParams < Stripe::RequestParams
688
+ # Specifies which fields in the response should be expanded.
689
+ attr_accessor :expand
18
690
 
19
- custom_method :delete_discount, http_verb: :delete, http_path: "discount"
691
+ def initialize(expand: nil)
692
+ @expand = expand
693
+ end
694
+ end
695
+
696
+ class SearchParams < Stripe::RequestParams
697
+ # Specifies which fields in the response should be expanded.
698
+ attr_accessor :expand
699
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
700
+ attr_accessor :limit
701
+ # A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
702
+ attr_accessor :page
703
+ # The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for customers](https://stripe.com/docs/search#query-fields-for-customers).
704
+ attr_accessor :query
705
+
706
+ def initialize(expand: nil, limit: nil, page: nil, query: nil)
707
+ @expand = expand
708
+ @limit = limit
709
+ @page = page
710
+ @query = query
711
+ end
712
+ end
713
+
714
+ class CreateFundingInstructionsParams < Stripe::RequestParams
715
+ class BankTransfer < Stripe::RequestParams
716
+ class EuBankTransfer < Stripe::RequestParams
717
+ # The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
718
+ attr_accessor :country
719
+
720
+ def initialize(country: nil)
721
+ @country = country
722
+ end
723
+ end
724
+ # Configuration for eu_bank_transfer funding type.
725
+ attr_accessor :eu_bank_transfer
726
+ # List of address types that should be returned in the financial_addresses response. If not specified, all valid types will be returned.
727
+ #
728
+ # Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
729
+ attr_accessor :requested_address_types
730
+ # The type of the `bank_transfer`
731
+ attr_accessor :type
732
+
733
+ def initialize(eu_bank_transfer: nil, requested_address_types: nil, type: nil)
734
+ @eu_bank_transfer = eu_bank_transfer
735
+ @requested_address_types = requested_address_types
736
+ @type = type
737
+ end
738
+ end
739
+ # Additional parameters for `bank_transfer` funding types
740
+ attr_accessor :bank_transfer
741
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
742
+ attr_accessor :currency
743
+ # Specifies which fields in the response should be expanded.
744
+ attr_accessor :expand
745
+ # The `funding_type` to get the instructions for.
746
+ attr_accessor :funding_type
747
+
748
+ def initialize(bank_transfer: nil, currency: nil, expand: nil, funding_type: nil)
749
+ @bank_transfer = bank_transfer
750
+ @currency = currency
751
+ @expand = expand
752
+ @funding_type = funding_type
753
+ end
754
+ end
755
+
756
+ class RetrieveParams < Stripe::RequestParams
757
+ # Specifies which fields in the response should be expanded.
758
+ attr_accessor :expand
759
+
760
+ def initialize(expand: nil)
761
+ @expand = expand
762
+ end
763
+ end
764
+
765
+ class FundCashBalanceParams < Stripe::RequestParams
766
+ # Amount to be used for this test cash balance transaction. A positive integer representing how much to fund in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to fund $1.00 or 100 to fund ¥100, a zero-decimal currency).
767
+ attr_accessor :amount
768
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
769
+ attr_accessor :currency
770
+ # Specifies which fields in the response should be expanded.
771
+ attr_accessor :expand
772
+ # A description of the test funding. This simulates free-text references supplied by customers when making bank transfers to their cash balance. You can use this to test how Stripe's [reconciliation algorithm](https://stripe.com/docs/payments/customer-balance/reconciliation) applies to different user inputs.
773
+ attr_accessor :reference
774
+
775
+ def initialize(amount: nil, currency: nil, expand: nil, reference: nil)
776
+ @amount = amount
777
+ @currency = currency
778
+ @expand = expand
779
+ @reference = reference
780
+ end
781
+ end
782
+ # The customer's address.
783
+ attr_reader :address
784
+ # The current balance, if any, that's stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that's added to their next invoice. The balance only considers amounts that Stripe hasn't successfully applied to any invoice. It doesn't reflect unpaid invoices. This balance is only taken into account after invoices finalize.
785
+ attr_reader :balance
786
+ # The current funds being held by Stripe on behalf of the customer. You can apply these funds towards payment intents when the source is "cash_balance". The `settings[reconciliation_mode]` field describes if these funds apply to these payment intents manually or automatically.
787
+ attr_reader :cash_balance
788
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
789
+ attr_reader :created
790
+ # Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) the customer can be charged in for recurring billing purposes.
791
+ attr_reader :currency
792
+ # ID of the default payment source for the customer.
793
+ #
794
+ # If you use payment methods created through the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead.
795
+ attr_reader :default_source
796
+ # Tracks the most recent state change on any invoice belonging to the customer. Paying an invoice or marking it uncollectible via the API will set this field to false. An automatic payment failure or passing the `invoice.due_date` will set this field to `true`.
797
+ #
798
+ # If an invoice becomes uncollectible by [dunning](https://stripe.com/docs/billing/automatic-collection), `delinquent` doesn't reset to `false`.
799
+ #
800
+ # If you care whether the customer has paid their most recent subscription invoice, use `subscription.status` instead. Paying or marking uncollectible any customer invoice regardless of whether it is the latest invoice for a subscription will always set this field to `false`.
801
+ attr_reader :delinquent
802
+ # An arbitrary string attached to the object. Often useful for displaying to users.
803
+ attr_reader :description
804
+ # Describes the current discount active on the customer, if there is one.
805
+ attr_reader :discount
806
+ # The customer's email address.
807
+ attr_reader :email
808
+ # Unique identifier for the object.
809
+ attr_reader :id
810
+ # The current multi-currency balances, if any, that's stored on the customer. If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency. If negative, the customer has an amount owed that's added to their next invoice denominated in that currency. These balances don't apply to unpaid invoices. They solely track amounts that Stripe hasn't successfully applied to any invoice. Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.
811
+ attr_reader :invoice_credit_balance
812
+ # The prefix for the customer used to generate unique invoice numbers.
813
+ attr_reader :invoice_prefix
814
+ # Attribute for field invoice_settings
815
+ attr_reader :invoice_settings
816
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
817
+ attr_reader :livemode
818
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
819
+ attr_reader :metadata
820
+ # The customer's full name or business name.
821
+ attr_reader :name
822
+ # The suffix of the customer's next invoice number (for example, 0001). When the account uses account level sequencing, this parameter is ignored in API requests and the field omitted in API responses.
823
+ attr_reader :next_invoice_sequence
824
+ # String representing the object's type. Objects of the same type share the same value.
825
+ attr_reader :object
826
+ # The customer's phone number.
827
+ attr_reader :phone
828
+ # The customer's preferred locales (languages), ordered by preference.
829
+ attr_reader :preferred_locales
830
+ # Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
831
+ attr_reader :shipping
832
+ # The customer's payment sources, if any.
833
+ attr_reader :sources
834
+ # The customer's current subscriptions, if any.
835
+ attr_reader :subscriptions
836
+ # Attribute for field tax
837
+ attr_reader :tax
838
+ # Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`. When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**.
839
+ attr_reader :tax_exempt
840
+ # The customer's tax IDs.
841
+ attr_reader :tax_ids
842
+ # ID of the test clock that this customer belongs to.
843
+ attr_reader :test_clock
844
+ # Always true for a deleted object
845
+ attr_reader :deleted
846
+
847
+ # Creates a new customer object.
848
+ def self.create(params = {}, opts = {})
849
+ request_stripe_object(method: :post, path: "/v1/customers", params: params, opts: opts)
850
+ end
851
+
852
+ # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
853
+ # funding instructions will be created. If funding instructions have already been created for a given customer, the same
854
+ # funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
855
+ def create_funding_instructions(params = {}, opts = {})
856
+ request_stripe_object(
857
+ method: :post,
858
+ path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(self["id"]) }),
859
+ params: params,
860
+ opts: opts
861
+ )
862
+ end
863
+
864
+ # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
865
+ # funding instructions will be created. If funding instructions have already been created for a given customer, the same
866
+ # funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
867
+ def self.create_funding_instructions(customer, params = {}, opts = {})
868
+ request_stripe_object(
869
+ method: :post,
870
+ path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
871
+ params: params,
872
+ opts: opts
873
+ )
874
+ end
875
+
876
+ # Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
877
+ def self.delete(customer, params = {}, opts = {})
878
+ request_stripe_object(
879
+ method: :delete,
880
+ path: format("/v1/customers/%<customer>s", { customer: CGI.escape(customer) }),
881
+ params: params,
882
+ opts: opts
883
+ )
884
+ end
885
+
886
+ # Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
887
+ def delete(params = {}, opts = {})
888
+ request_stripe_object(
889
+ method: :delete,
890
+ path: format("/v1/customers/%<customer>s", { customer: CGI.escape(self["id"]) }),
891
+ params: params,
892
+ opts: opts
893
+ )
894
+ end
895
+
896
+ # Removes the currently applied discount on a customer.
897
+ def delete_discount(params = {}, opts = {})
898
+ request_stripe_object(
899
+ method: :delete,
900
+ path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
901
+ params: params,
902
+ opts: opts
903
+ )
904
+ end
905
+
906
+ # Removes the currently applied discount on a customer.
907
+ def self.delete_discount(customer, params = {}, opts = {})
908
+ request_stripe_object(
909
+ method: :delete,
910
+ path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(customer) }),
911
+ params: params,
912
+ opts: opts
913
+ )
914
+ end
915
+
916
+ # Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
917
+ def self.list(params = {}, opts = {})
918
+ request_stripe_object(method: :get, path: "/v1/customers", params: params, opts: opts)
919
+ end
920
+
921
+ # Returns a list of PaymentMethods for a given Customer
922
+ def list_payment_methods(params = {}, opts = {})
923
+ request_stripe_object(
924
+ method: :get,
925
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
926
+ params: params,
927
+ opts: opts
928
+ )
929
+ end
930
+
931
+ # Returns a list of PaymentMethods for a given Customer
932
+ def self.list_payment_methods(customer, params = {}, opts = {})
933
+ request_stripe_object(
934
+ method: :get,
935
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
936
+ params: params,
937
+ opts: opts
938
+ )
939
+ end
940
+
941
+ # Retrieves a customer's cash balance.
942
+ def self.retrieve_cash_balance(customer, params = {}, opts = {})
943
+ request_stripe_object(
944
+ method: :get,
945
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
946
+ params: params,
947
+ opts: opts
948
+ )
949
+ end
950
+
951
+ # Retrieves a PaymentMethod object for a given Customer.
952
+ def retrieve_payment_method(payment_method, params = {}, opts = {})
953
+ request_stripe_object(
954
+ method: :get,
955
+ path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
956
+ params: params,
957
+ opts: opts
958
+ )
959
+ end
960
+
961
+ # Retrieves a PaymentMethod object for a given Customer.
962
+ def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
963
+ request_stripe_object(
964
+ method: :get,
965
+ path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
966
+ params: params,
967
+ opts: opts
968
+ )
969
+ end
970
+
971
+ def self.search(params = {}, opts = {})
972
+ request_stripe_object(method: :get, path: "/v1/customers/search", params: params, opts: opts)
973
+ end
974
+
975
+ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
976
+ search(params, opts).auto_paging_each(&blk)
977
+ end
978
+
979
+ # Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the source parameter, that becomes the customer's active source (e.g., a card) to be used for all charges in the future. When you update a customer to a new valid card source by passing the source parameter: for each of the customer's current subscriptions, if the subscription bills automatically and is in the past_due state, then the latest open invoice for the subscription with automatic collection enabled will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Changing the default_source for a customer will not trigger this behavior.
980
+ #
981
+ # This request accepts mostly the same arguments as the customer creation call.
982
+ def self.update(customer, params = {}, opts = {})
983
+ request_stripe_object(
984
+ method: :post,
985
+ path: format("/v1/customers/%<customer>s", { customer: CGI.escape(customer) }),
986
+ params: params,
987
+ opts: opts
988
+ )
989
+ end
990
+
991
+ # Changes the settings on a customer's cash balance.
992
+ def self.update_cash_balance(customer, params = {}, opts = {})
993
+ request_stripe_object(
994
+ method: :post,
995
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
996
+ params: params,
997
+ opts: opts
998
+ )
999
+ end
20
1000
 
21
1001
  save_nested_resource :source
22
- nested_resource_class_methods :source,
23
- operations: %i[create retrieve update delete list]
24
1002
 
25
1003
  # The API request for deleting a card or bank account and for detaching a
26
1004
  # source object are the same.
@@ -28,14 +1006,35 @@ module Stripe
28
1006
  alias detach_source delete_source
29
1007
  end
30
1008
 
31
- # Deletes a discount associated with the customer.
32
- #
33
- # Returns the deleted discount. The customer object is not updated,
34
- # so you must call `refresh` on it to get a new version with the
35
- # discount removed.
36
- def delete_discount
37
- resp, opts = execute_resource_request(:delete, resource_url + "/discount")
38
- Util.convert_to_stripe_object(resp.data, opts)
1009
+ def test_helpers
1010
+ TestHelpers.new(self)
1011
+ end
1012
+
1013
+ class TestHelpers < APIResourceTestHelpers
1014
+ RESOURCE_CLASS = Customer
1015
+ def self.resource_class
1016
+ "Customer"
1017
+ end
1018
+
1019
+ # Create an incoming testmode bank transfer
1020
+ def self.fund_cash_balance(customer, params = {}, opts = {})
1021
+ request_stripe_object(
1022
+ method: :post,
1023
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(customer) }),
1024
+ params: params,
1025
+ opts: opts
1026
+ )
1027
+ end
1028
+
1029
+ # Create an incoming testmode bank transfer
1030
+ def fund_cash_balance(params = {}, opts = {})
1031
+ @resource.request_stripe_object(
1032
+ method: :post,
1033
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(@resource["id"]) }),
1034
+ params: params,
1035
+ opts: opts
1036
+ )
1037
+ end
39
1038
  end
40
1039
  end
41
1040
  end