stripe 19.4.0.pre.beta.1 → 19.5.0.pre.beta.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 (124) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stripe/api_requestor.rb +2 -27
  3. data/lib/stripe/api_version.rb +1 -1
  4. data/lib/stripe/error_object.rb +43 -19
  5. data/lib/stripe/params/account_create_params.rb +72 -24
  6. data/lib/stripe/params/account_person_create_params.rb +6 -0
  7. data/lib/stripe/params/account_person_update_params.rb +6 -0
  8. data/lib/stripe/params/account_reject_params.rb +4 -1
  9. data/lib/stripe/params/account_session_create_params.rb +20 -4
  10. data/lib/stripe/params/account_unreject_params.rb +13 -0
  11. data/lib/stripe/params/account_update_params.rb +85 -0
  12. data/lib/stripe/params/billing/alert_create_params.rb +1 -1
  13. data/lib/stripe/params/billing_portal/configuration_create_params.rb +1 -1
  14. data/lib/stripe/params/billing_portal/configuration_update_params.rb +1 -1
  15. data/lib/stripe/params/capital/financing_transaction_list_params.rb +2 -2
  16. data/lib/stripe/params/charge_capture_params.rb +12 -12
  17. data/lib/stripe/params/charge_update_params.rb +12 -12
  18. data/lib/stripe/params/checkout/session_create_params.rb +21 -7
  19. data/lib/stripe/params/customer_create_params.rb +1 -1
  20. data/lib/stripe/params/customer_tax_id_create_params.rb +1 -1
  21. data/lib/stripe/params/financial_connections/session_create_params.rb +9 -1
  22. data/lib/stripe/params/invoice_create_preview_params.rb +7 -3
  23. data/lib/stripe/params/issuing/authorization_capture_params.rb +1 -1
  24. data/lib/stripe/params/issuing/authorization_create_params.rb +1 -1
  25. data/lib/stripe/params/issuing/authorization_finalize_amount_params.rb +1 -1
  26. data/lib/stripe/params/issuing/card_create_params.rb +4 -0
  27. data/lib/stripe/params/issuing/card_update_params.rb +4 -0
  28. data/lib/stripe/params/issuing/cardholder_update_params.rb +4 -0
  29. data/lib/stripe/params/issuing/transaction_create_force_capture_params.rb +1 -1
  30. data/lib/stripe/params/issuing/transaction_create_unlinked_refund_params.rb +1 -1
  31. data/lib/stripe/params/order_create_params.rb +1 -1
  32. data/lib/stripe/params/order_update_params.rb +1 -1
  33. data/lib/stripe/params/payment_intent_capture_params.rb +12 -12
  34. data/lib/stripe/params/payment_intent_confirm_params.rb +41 -16
  35. data/lib/stripe/params/payment_intent_create_params.rb +40 -15
  36. data/lib/stripe/params/payment_intent_update_params.rb +36 -14
  37. data/lib/stripe/params/payment_link_update_params.rb +58 -0
  38. data/lib/stripe/params/payment_record_list_params.rb +35 -0
  39. data/lib/stripe/params/product_catalog/trial_offer_list_params.rb +54 -0
  40. data/lib/stripe/params/product_catalog/trial_offer_retrieve_params.rb +15 -0
  41. data/lib/stripe/params/promotion_code_create_params.rb +1 -1
  42. data/lib/stripe/params/promotion_code_update_params.rb +1 -1
  43. data/lib/stripe/params/quote_create_params.rb +28 -1
  44. data/lib/stripe/params/quote_update_params.rb +28 -1
  45. data/lib/stripe/params/setup_intent_confirm_params.rb +4 -0
  46. data/lib/stripe/params/setup_intent_create_params.rb +4 -0
  47. data/lib/stripe/params/setup_intent_update_params.rb +4 -0
  48. data/lib/stripe/params/shared_payment/issued_token_create_params.rb +5 -1
  49. data/lib/stripe/params/subscription_schedule_create_params.rb +60 -4
  50. data/lib/stripe/params/subscription_schedule_list_params.rb +1 -1
  51. data/lib/stripe/params/subscription_schedule_update_params.rb +61 -5
  52. data/lib/stripe/params/subscription_update_params.rb +1 -1
  53. data/lib/stripe/params/tax/calculation_create_params.rb +2 -2
  54. data/lib/stripe/params/tax/registration_create_params.rb +26 -0
  55. data/lib/stripe/params/tax_id_create_params.rb +1 -1
  56. data/lib/stripe/params/test_helpers/issuing/authorization_capture_params.rb +1 -1
  57. data/lib/stripe/params/test_helpers/issuing/authorization_create_params.rb +1 -1
  58. data/lib/stripe/params/test_helpers/issuing/authorization_finalize_amount_params.rb +1 -1
  59. data/lib/stripe/params/test_helpers/issuing/transaction_create_force_capture_params.rb +1 -1
  60. data/lib/stripe/params/test_helpers/issuing/transaction_create_unlinked_refund_params.rb +1 -1
  61. data/lib/stripe/params/token_create_params.rb +78 -0
  62. data/lib/stripe/params/v2/billing/meter_event_create_params.rb +2 -2
  63. data/lib/stripe/params/v2/billing/meter_event_stream_create_params.rb +2 -2
  64. data/lib/stripe/params/v2/core/account_create_params.rb +43 -0
  65. data/lib/stripe/params/v2/core/account_token_create_params.rb +43 -0
  66. data/lib/stripe/params/v2/core/account_update_params.rb +43 -0
  67. data/lib/stripe/params.rb +8 -0
  68. data/lib/stripe/resources/account.rb +86 -6
  69. data/lib/stripe/resources/account_session.rb +8 -0
  70. data/lib/stripe/resources/balance_transaction.rb +1 -1
  71. data/lib/stripe/resources/bank_account.rb +2 -2
  72. data/lib/stripe/resources/billing_portal/configuration.rb +1 -1
  73. data/lib/stripe/resources/capability.rb +2 -2
  74. data/lib/stripe/resources/capital/financing_transaction.rb +1 -1
  75. data/lib/stripe/resources/charge.rb +3 -3
  76. data/lib/stripe/resources/checkout/session.rb +21 -5
  77. data/lib/stripe/resources/confirmation_token.rb +1 -1
  78. data/lib/stripe/resources/dispute.rb +4 -2
  79. data/lib/stripe/resources/financial_connections/session.rb +26 -0
  80. data/lib/stripe/resources/fx_quote.rb +3 -3
  81. data/lib/stripe/resources/invoice.rb +1 -1
  82. data/lib/stripe/resources/issuing/card.rb +2 -0
  83. data/lib/stripe/resources/issuing/transaction.rb +1 -1
  84. data/lib/stripe/resources/order.rb +1 -1
  85. data/lib/stripe/resources/payment_attempt_record.rb +2 -2
  86. data/lib/stripe/resources/payment_intent.rb +27 -9
  87. data/lib/stripe/resources/payment_method.rb +3 -3
  88. data/lib/stripe/resources/payment_record.rb +9 -2
  89. data/lib/stripe/resources/person.rb +2 -2
  90. data/lib/stripe/resources/product_catalog/trial_offer.rb +11 -0
  91. data/lib/stripe/resources/quote.rb +22 -1
  92. data/lib/stripe/resources/quote_preview_invoice.rb +1 -1
  93. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +46 -2
  94. data/lib/stripe/resources/refund.rb +6 -0
  95. data/lib/stripe/resources/setup_intent.rb +2 -0
  96. data/lib/stripe/resources/shared_payment/granted_token.rb +11 -1131
  97. data/lib/stripe/resources/shared_payment/issued_token.rb +20 -1
  98. data/lib/stripe/resources/subscription_schedule.rb +46 -2
  99. data/lib/stripe/resources/tax/calculation.rb +1 -1
  100. data/lib/stripe/resources/tax/location.rb +2 -0
  101. data/lib/stripe/resources/tax/registration.rb +32 -0
  102. data/lib/stripe/resources/tax/transaction.rb +1 -1
  103. data/lib/stripe/resources/tax_id.rb +1 -1
  104. data/lib/stripe/resources/topup.rb +31 -1
  105. data/lib/stripe/resources/v2/billing/meter_event.rb +2 -2
  106. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +1 -1
  107. data/lib/stripe/resources/v2/core/account.rb +30 -0
  108. data/lib/stripe/resources/v2/iam/activity_log.rb +2 -0
  109. data/lib/stripe/resources/v2/money_management/inbound_transfer.rb +1 -1
  110. data/lib/stripe/resources/v2/money_management/received_credit.rb +1 -1
  111. data/lib/stripe/resources/v2/money_management/received_debit.rb +2 -1
  112. data/lib/stripe/services/account_person_service.rb +1 -1
  113. data/lib/stripe/services/account_service.rb +17 -2
  114. data/lib/stripe/services/dispute_service.rb +1 -1
  115. data/lib/stripe/services/fx_quote_service.rb +1 -1
  116. data/lib/stripe/services/payment_method_service.rb +1 -1
  117. data/lib/stripe/services/payment_record_service.rb +11 -0
  118. data/lib/stripe/services/product_catalog/trial_offer_service.rb +22 -0
  119. data/lib/stripe/services/v2/core/vault/us_bank_account_service.rb +4 -0
  120. data/lib/stripe/telemetry_id.rb +65 -0
  121. data/lib/stripe/version.rb +1 -1
  122. data/lib/stripe.rb +2 -0
  123. data/rbi/stripe.rbi +2079 -1482
  124. metadata +7 -2
@@ -13,6 +13,21 @@ module Stripe
13
13
  end
14
14
 
15
15
  class NextAction < ::Stripe::StripeObject
16
+ class RedirectToUrl < ::Stripe::StripeObject
17
+ # If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion.
18
+ attr_reader :return_url
19
+ # The URL you must redirect your customer to in order to authenticate the payment.
20
+ attr_reader :url
21
+
22
+ def self.inner_class_types
23
+ @inner_class_types = {}
24
+ end
25
+
26
+ def self.field_remappings
27
+ @field_remappings = {}
28
+ end
29
+ end
30
+
16
31
  class UseStripeSdk < ::Stripe::StripeObject
17
32
  # A base64-encoded string used by Stripe.js and the iOS and Android client SDKs to handle the next action. Its content is subject to change.
18
33
  attr_reader :value
@@ -25,13 +40,15 @@ module Stripe
25
40
  @field_remappings = {}
26
41
  end
27
42
  end
43
+ # Contains details for handling the next action by redirecting the customer. Present when `next_action.type` is `redirect_to_url`.
44
+ attr_reader :redirect_to_url
28
45
  # Specifies the type of next action required. Determines which child attribute contains action details.
29
46
  attr_reader :type
30
47
  # Contains details for handling the next action using Stripe.js, iOS, or Android SDKs. Present when `next_action.type` is `use_stripe_sdk`.
31
48
  attr_reader :use_stripe_sdk
32
49
 
33
50
  def self.inner_class_types
34
- @inner_class_types = { use_stripe_sdk: UseStripeSdk }
51
+ @inner_class_types = { redirect_to_url: RedirectToUrl, use_stripe_sdk: UseStripeSdk }
35
52
  end
36
53
 
37
54
  def self.field_remappings
@@ -242,6 +259,8 @@ module Stripe
242
259
  attr_reader :usage_details
243
260
  # Usage limits of the SharedPaymentIssuedToken.
244
261
  attr_reader :usage_limits
262
+ # Set to true when using Stripe.js, iOS, or Android client-side SDKs to handle next actions.
263
+ attr_reader :use_stripe_sdk
245
264
 
246
265
  # Creates a new SharedPaymentIssuedToken object
247
266
  def self.create(params = {}, opts = {})
@@ -107,6 +107,21 @@ module Stripe
107
107
  end
108
108
 
109
109
  class InvoiceSettings < ::Stripe::StripeObject
110
+ class CustomField < ::Stripe::StripeObject
111
+ # The name of the custom field.
112
+ attr_reader :name
113
+ # The value of the custom field.
114
+ attr_reader :value
115
+
116
+ def self.inner_class_types
117
+ @inner_class_types = {}
118
+ end
119
+
120
+ def self.field_remappings
121
+ @field_remappings = {}
122
+ end
123
+ end
124
+
110
125
  class Issuer < ::Stripe::StripeObject
111
126
  # The connected account being referenced when `type` is `account`.
112
127
  attr_reader :account
@@ -123,13 +138,19 @@ module Stripe
123
138
  end
124
139
  # The account tax IDs associated with the subscription schedule. Will be set on invoices generated by the subscription schedule.
125
140
  attr_reader :account_tax_ids
141
+ # A list of up to 4 custom fields to be displayed on the invoice.
142
+ attr_reader :custom_fields
126
143
  # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
127
144
  attr_reader :days_until_due
145
+ # An arbitrary string attached to the object. Often useful for displaying to users.
146
+ attr_reader :description
147
+ # Footer to be displayed on the invoice.
148
+ attr_reader :footer
128
149
  # Attribute for field issuer
129
150
  attr_reader :issuer
130
151
 
131
152
  def self.inner_class_types
132
- @inner_class_types = { issuer: Issuer }
153
+ @inner_class_types = { custom_fields: CustomField, issuer: Issuer }
133
154
  end
134
155
 
135
156
  def self.field_remappings
@@ -399,6 +420,21 @@ module Stripe
399
420
  end
400
421
 
401
422
  class InvoiceSettings < ::Stripe::StripeObject
423
+ class CustomField < ::Stripe::StripeObject
424
+ # The name of the custom field.
425
+ attr_reader :name
426
+ # The value of the custom field.
427
+ attr_reader :value
428
+
429
+ def self.inner_class_types
430
+ @inner_class_types = {}
431
+ end
432
+
433
+ def self.field_remappings
434
+ @field_remappings = {}
435
+ end
436
+ end
437
+
402
438
  class Issuer < ::Stripe::StripeObject
403
439
  # The connected account being referenced when `type` is `account`.
404
440
  attr_reader :account
@@ -415,13 +451,19 @@ module Stripe
415
451
  end
416
452
  # The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
417
453
  attr_reader :account_tax_ids
454
+ # A list of up to 4 custom fields to be displayed on the invoice.
455
+ attr_reader :custom_fields
418
456
  # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
419
457
  attr_reader :days_until_due
458
+ # An arbitrary string attached to the object. Often useful for displaying to users.
459
+ attr_reader :description
460
+ # Footer to be displayed on the invoice.
461
+ attr_reader :footer
420
462
  # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
421
463
  attr_reader :issuer
422
464
 
423
465
  def self.inner_class_types
424
- @inner_class_types = { issuer: Issuer }
466
+ @inner_class_types = { custom_fields: CustomField, issuer: Issuer }
425
467
  end
426
468
 
427
469
  def self.field_remappings
@@ -614,6 +656,8 @@ module Stripe
614
656
  attr_reader :start_date
615
657
  # The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
616
658
  attr_reader :transfer_data
659
+ # If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
660
+ attr_reader :trial
617
661
  # Specify behavior of the trial when crossing schedule phase boundaries
618
662
  attr_reader :trial_continuation
619
663
  # When the trial ends within the phase.
@@ -39,7 +39,7 @@ module Stripe
39
39
  end
40
40
 
41
41
  class TaxId < ::Stripe::StripeObject
42
- # The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `pl_nip`, `it_cf`, `fo_vat`, `gi_tin`, `py_ruc`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `li_vat`, `lk_vat`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, `aw_tin`, `az_tin`, `bd_bin`, `bj_ifu`, `et_tin`, `kg_tin`, `la_tin`, `cm_niu`, `cv_nif`, `bf_ifu`, or `unknown`
42
+ # The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `pl_nip`, `it_cf`, `fo_vat`, `gi_tin`, `py_ruc`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `li_vat`, `lk_vat`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, `aw_tin`, `az_tin`, `bd_bin`, `bj_ifu`, `et_tin`, `kg_tin`, `la_tin`, `cm_niu`, `cv_nif`, `bf_ifu`, `ic_nif`, or `unknown`
43
43
  attr_reader :type
44
44
  # The value of the tax ID.
45
45
  attr_reader :value
@@ -41,6 +41,8 @@ module Stripe
41
41
  attr_reader :description
42
42
  # Unique identifier for the object.
43
43
  attr_reader :id
44
+ # If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
45
+ attr_reader :livemode
44
46
  # String representing the object's type. Objects of the same type share the same value.
45
47
  attr_reader :object
46
48
  # The type of tax location to be defined. Currently the only option is `performance`.
@@ -1850,6 +1850,32 @@ module Stripe
1850
1850
  end
1851
1851
  end
1852
1852
 
1853
+ class MassTransitParkingTax < ::Stripe::StripeObject
1854
+ # A [jurisdiction code](https://docs.stripe.com/tax/registering?type=mass_transit_parking_tax#registration-types) representing the local jurisdiction.
1855
+ attr_reader :jurisdiction
1856
+
1857
+ def self.inner_class_types
1858
+ @inner_class_types = {}
1859
+ end
1860
+
1861
+ def self.field_remappings
1862
+ @field_remappings = {}
1863
+ end
1864
+ end
1865
+
1866
+ class ParkingTax < ::Stripe::StripeObject
1867
+ # A [jurisdiction code](https://docs.stripe.com/tax/registering?type=parking_tax#registration-types) representing the local jurisdiction.
1868
+ attr_reader :jurisdiction
1869
+
1870
+ def self.inner_class_types
1871
+ @inner_class_types = {}
1872
+ end
1873
+
1874
+ def self.field_remappings
1875
+ @field_remappings = {}
1876
+ end
1877
+ end
1878
+
1853
1879
  class ResortTax < ::Stripe::StripeObject
1854
1880
  # A [jurisdiction code](https://docs.stripe.com/tax/registering?type=resort_tax#registration-types) representing the local jurisdiction.
1855
1881
  attr_reader :jurisdiction
@@ -1918,6 +1944,10 @@ module Stripe
1918
1944
  attr_reader :local_lease_tax
1919
1945
  # Attribute for field luxury_tax
1920
1946
  attr_reader :luxury_tax
1947
+ # Attribute for field mass_transit_parking_tax
1948
+ attr_reader :mass_transit_parking_tax
1949
+ # Attribute for field parking_tax
1950
+ attr_reader :parking_tax
1921
1951
  # Attribute for field resort_tax
1922
1952
  attr_reader :resort_tax
1923
1953
  # Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
@@ -1939,6 +1969,8 @@ module Stripe
1939
1969
  local_amusement_tax: LocalAmusementTax,
1940
1970
  local_lease_tax: LocalLeaseTax,
1941
1971
  luxury_tax: LuxuryTax,
1972
+ mass_transit_parking_tax: MassTransitParkingTax,
1973
+ parking_tax: ParkingTax,
1942
1974
  resort_tax: ResortTax,
1943
1975
  state_sales_tax: StateSalesTax,
1944
1976
  tourism_tax: TourismTax,
@@ -37,7 +37,7 @@ module Stripe
37
37
  end
38
38
 
39
39
  class TaxId < ::Stripe::StripeObject
40
- # The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `pl_nip`, `it_cf`, `fo_vat`, `gi_tin`, `py_ruc`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `li_vat`, `lk_vat`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, `aw_tin`, `az_tin`, `bd_bin`, `bj_ifu`, `et_tin`, `kg_tin`, `la_tin`, `cm_niu`, `cv_nif`, `bf_ifu`, or `unknown`
40
+ # The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `pl_nip`, `it_cf`, `fo_vat`, `gi_tin`, `py_ruc`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `li_vat`, `lk_vat`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, `aw_tin`, `az_tin`, `bd_bin`, `bj_ifu`, `et_tin`, `kg_tin`, `la_tin`, `cm_niu`, `cv_nif`, `bf_ifu`, `ic_nif`, or `unknown`
41
41
  attr_reader :type
42
42
  # The value of the tax ID.
43
43
  attr_reader :value
@@ -71,7 +71,7 @@ module Stripe
71
71
  attr_reader :object
72
72
  # The account or customer the tax ID belongs to.
73
73
  attr_reader :owner
74
- # 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`, `fo_vat`, `gb_vat`, `ge_vat`, `gi_tin`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `it_cf`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kg_tin`, `kh_tin`, `kr_brn`, `kz_bin`, `la_tin`, `li_uid`, `li_vat`, `lk_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`, `pl_nip`, `py_ruc`, `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`. Note that some legacy tax IDs have type `unknown`
74
+ # 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`, `fo_vat`, `gb_vat`, `ge_vat`, `gi_tin`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `ic_nif`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `it_cf`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kg_tin`, `kh_tin`, `kr_brn`, `kz_bin`, `la_tin`, `li_uid`, `li_vat`, `lk_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`, `pl_nip`, `py_ruc`, `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`. Note that some legacy tax IDs have type `unknown`
75
75
  attr_reader :type
76
76
  # Value of the tax ID.
77
77
  attr_reader :value
@@ -17,6 +17,30 @@ module Stripe
17
17
  "topup"
18
18
  end
19
19
 
20
+ class PaymentMethodOptions < ::Stripe::StripeObject
21
+ class UsBankAccount < ::Stripe::StripeObject
22
+ # The US bank transfer network used for this top-up. The default is `ach`.
23
+ attr_reader :network
24
+
25
+ def self.inner_class_types
26
+ @inner_class_types = {}
27
+ end
28
+
29
+ def self.field_remappings
30
+ @field_remappings = {}
31
+ end
32
+ end
33
+ # If this top-up is to be used with a `us_bank_account` payment method, this sub-hash contains configuration for it.
34
+ attr_reader :us_bank_account
35
+
36
+ def self.inner_class_types
37
+ @inner_class_types = { us_bank_account: UsBankAccount }
38
+ end
39
+
40
+ def self.field_remappings
41
+ @field_remappings = {}
42
+ end
43
+ end
20
44
  # Amount transferred.
21
45
  attr_reader :amount
22
46
  # ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up.
@@ -35,12 +59,18 @@ module Stripe
35
59
  attr_reader :failure_message
36
60
  # Unique identifier for the object.
37
61
  attr_reader :id
62
+ # Indicates whether the top-up was initiated by Stripe or by the user.
63
+ attr_reader :initiated_by
38
64
  # If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
39
65
  attr_reader :livemode
40
66
  # Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
41
67
  attr_reader :metadata
42
68
  # String representing the object's type. Objects of the same type share the same value.
43
69
  attr_reader :object
70
+ # The ID of a PaymentMethod representing the payment method used for the top-up. A PaymentMethod of type `us_bank_account` can be used.
71
+ attr_reader :payment_method
72
+ # Payment-method-specific configuration for this top-up.
73
+ attr_reader :payment_method_options
44
74
  # The source field is deprecated. It might not always be present in the API response.
45
75
  attr_reader :source
46
76
  # Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter.
@@ -91,7 +121,7 @@ module Stripe
91
121
  end
92
122
 
93
123
  def self.inner_class_types
94
- @inner_class_types = {}
124
+ @inner_class_types = { payment_method_options: PaymentMethodOptions }
95
125
  end
96
126
 
97
127
  def self.field_remappings
@@ -15,13 +15,13 @@ module Stripe
15
15
  attr_reader :created
16
16
  # The name of the meter event. Corresponds with the `event_name` field on a meter.
17
17
  attr_reader :event_name
18
- # A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We’ll enforce uniqueness within a rolling 24 hour period.
18
+ # A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We'll enforce uniqueness within a rolling 24 hour period.
19
19
  attr_reader :identifier
20
20
  # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
21
21
  attr_reader :livemode
22
22
  # String representing the object's type. Objects of the same type share the same value of the object field.
23
23
  attr_reader :object
24
- # The payload of the event. This must contain the fields corresponding to a meter’s
24
+ # The payload of the event. This must contain the fields corresponding to a meter's
25
25
  # `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and
26
26
  # `value_settings.event_payload_key` (default is `value`). Read more about
27
27
  # the [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides)..
@@ -35,7 +35,7 @@ module Stripe
35
35
  attr_reader :livemode
36
36
  # String representing the object's type. Objects of the same type share the same value of the object field.
37
37
  attr_reader :object
38
- # Open Enum. The meter event adjustment’s status.
38
+ # Open Enum. The meter event adjustment's status.
39
39
  attr_reader :status
40
40
  # Open Enum. Specifies the type of cancellation. Currently supports canceling a single event.
41
41
  attr_reader :type
@@ -3317,6 +3317,33 @@ module Stripe
3317
3317
  end
3318
3318
 
3319
3319
  class BusinessDetails < ::Stripe::StripeObject
3320
+ class AdditionalAddress < ::Stripe::StripeObject
3321
+ # City, district, suburb, town, or village.
3322
+ attr_reader :city
3323
+ # Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
3324
+ attr_reader :country
3325
+ # Address line 1 (e.g., street, PO Box, or company name).
3326
+ attr_reader :line1
3327
+ # Address line 2 (e.g., apartment, suite, unit, or building).
3328
+ attr_reader :line2
3329
+ # ZIP or postal code.
3330
+ attr_reader :postal_code
3331
+ # Purpose of additional address.
3332
+ attr_reader :purpose
3333
+ # State, county, province, or region.
3334
+ attr_reader :state
3335
+ # Town or district.
3336
+ attr_reader :town
3337
+
3338
+ def self.inner_class_types
3339
+ @inner_class_types = {}
3340
+ end
3341
+
3342
+ def self.field_remappings
3343
+ @field_remappings = {}
3344
+ end
3345
+ end
3346
+
3320
3347
  class Address < ::Stripe::StripeObject
3321
3348
  # City, district, suburb, town, or village.
3322
3349
  attr_reader :city
@@ -3738,6 +3765,8 @@ module Stripe
3738
3765
  @field_remappings = {}
3739
3766
  end
3740
3767
  end
3768
+ # Additional addresses associated with the business.
3769
+ attr_reader :additional_addresses
3741
3770
  # The company’s primary address.
3742
3771
  attr_reader :address
3743
3772
  # The business gross annual revenue for its preceding fiscal year.
@@ -3765,6 +3794,7 @@ module Stripe
3765
3794
 
3766
3795
  def self.inner_class_types
3767
3796
  @inner_class_types = {
3797
+ additional_addresses: AdditionalAddress,
3768
3798
  address: Address,
3769
3799
  annual_revenue: AnnualRevenue,
3770
3800
  documents: Documents,
@@ -129,6 +129,8 @@ module Stripe
129
129
  attr_reader :new_roles
130
130
  # Roles the user had before the change.
131
131
  attr_reader :old_roles
132
+ # Source of the role change.
133
+ attr_reader :source
132
134
  # Email address of the user whose roles were changed.
133
135
  attr_reader :user_email
134
136
 
@@ -165,7 +165,7 @@ module Stripe
165
165
  attr_reader :receipt_url
166
166
  # A nested object containing information about the destination of the InboundTransfer.
167
167
  attr_reader :to
168
- # A list of history objects, representing changes in the state of the InboundTransfer.
168
+ # A list of history objects, representing changes in the state of the InboundTransfer. The most recent entry's type indicates the current status of the InboundTransfer.
169
169
  attr_reader :transfer_history
170
170
 
171
171
  def self.inner_class_types
@@ -19,7 +19,7 @@ module Stripe
19
19
  # The ID of the outbound transfer object that originated the ReceivedCredit.
20
20
  attr_reader :outbound_transfer
21
21
  # The ID of the payout object that originated the ReceivedCredit.
22
- attr_reader :payout_v1
22
+ attr_reader :payout
23
23
  # The ID of the v1 transfer object that originated the ReceivedCredit.
24
24
  attr_reader :transfer
25
25
  # Open Enum. The type of Stripe Money Movement that originated the ReceivedCredit.
@@ -34,7 +34,8 @@ module Stripe
34
34
  attr_reader :payment_method_type
35
35
  # The statement descriptor set by the originator of the debit.
36
36
  attr_reader :statement_descriptor
37
- # The payment method used to originate the debit.
37
+ # Object containing details of the US Bank Account that originated the debit.
38
+ # Present when the debit was originated via ACH.
38
39
  attr_reader :us_bank_account
39
40
 
40
41
  def self.inner_class_types
@@ -14,7 +14,7 @@ module Stripe
14
14
  )
15
15
  end
16
16
 
17
- # Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
17
+ # Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the representative. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
18
18
  def delete(account, person, params = {}, opts = {})
19
19
  request(
20
20
  method: :delete,
@@ -16,7 +16,7 @@ module Stripe
16
16
  # With [Connect](https://docs.stripe.com/docs/connect), you can create Stripe accounts for your users.
17
17
  # To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
18
18
  #
19
- # If you've already collected information for your connected accounts, you [can prefill that information](https://docs.stripe.com/docs/connect/best-practices#onboarding) when
19
+ # If you've already collected information for your connected accounts, you [can prefill that information](https://docs.stripe.com/connect/marketplace/tasks/create#prefill-account-information) when
20
20
  # creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
21
21
  # You can prefill any information on the account.
22
22
  def create(params = {}, opts = {})
@@ -47,7 +47,7 @@ module Stripe
47
47
 
48
48
  # With [Connect](https://docs.stripe.com/connect), you can reject accounts that you have flagged as suspicious.
49
49
  #
50
- # Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
50
+ # Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected.
51
51
  def reject(account, params = {}, opts = {})
52
52
  request(
53
53
  method: :post,
@@ -89,6 +89,21 @@ module Stripe
89
89
  JSON.generate(request_body)
90
90
  end
91
91
 
92
+ # With Connect, you can unreject accounts that you have previously rejected.
93
+ #
94
+ # Only accounts that were rejected by your platform can be unrejected. This API cannot be used to unreject accounts that were rejected by Stripe.
95
+ #
96
+ # Unreject will only enable charges and/or payouts if there are no other restrictions other than those placed by a previous rejection. If you have separately paused charges and/or payouts outside of rejection, those pauses will remain in place after unrejection.
97
+ def unreject(account, params = {}, opts = {})
98
+ request(
99
+ method: :post,
100
+ path: format("/v1/accounts/%<account>s/unreject", { account: CGI.escape(account) }),
101
+ params: params,
102
+ opts: opts,
103
+ base_address: :api
104
+ )
105
+ end
106
+
92
107
  # Updates a [connected account](https://docs.stripe.com/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
93
108
  # left unchanged.
94
109
  #
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  class DisputeService < StripeService
6
- # Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost.
6
+ # Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute (accepting it), acknowledging it as lost.
7
7
  #
8
8
  # The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible.
9
9
  def close(dispute, params = {}, opts = {})
@@ -8,7 +8,7 @@ module Stripe
8
8
  request(method: :post, path: "/v1/fx_quotes", params: params, opts: opts, base_address: :api)
9
9
  end
10
10
 
11
- # Returns a list of FX quotes that have been issued. The FX quotes are returned in sorted order, with the most recent FX quotes appearing first.
11
+ # Returns a list of active FX quotes. The FX quotes are returned in sorted order, with the most recent FX quotes appearing first.
12
12
  def list(params = {}, opts = {})
13
13
  request(method: :get, path: "/v1/fx_quotes", params: params, opts: opts, base_address: :api)
14
14
  end
@@ -39,7 +39,7 @@ module Stripe
39
39
  )
40
40
  end
41
41
 
42
- # Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
42
+ # Detaches a PaymentMethod object from a Customer. Detachment is permanent and irreversible — once detached, a PaymentMethod can no longer be used for payments or re-attached to a Customer.
43
43
  def detach(payment_method, params = {}, opts = {})
44
44
  request(
45
45
  method: :post,
@@ -3,6 +3,17 @@
3
3
 
4
4
  module Stripe
5
5
  class PaymentRecordService < StripeService
6
+ # List all the Payment Records for a given merchant.
7
+ def list(params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: "/v1/payment_records",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
6
17
  # Report a new Payment Record. You may report a Payment Record as it is
7
18
  # initialized and later report updates through the other report_* methods, or report Payment
8
19
  # Records in a terminal state directly, through this method.
@@ -14,6 +14,28 @@ module Stripe
14
14
  base_address: :api
15
15
  )
16
16
  end
17
+
18
+ # Returns a list of trial offers.
19
+ def list(params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: "/v1/product_catalog/trial_offers",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Retrieves the trial offer with the given ID.
30
+ def retrieve(id, params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: format("/v1/product_catalog/trial_offers/%<id>s", { id: CGI.escape(id) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
17
39
  end
18
40
  end
19
41
  end
@@ -23,6 +23,8 @@ module Stripe
23
23
  end
24
24
 
25
25
  # Confirm microdeposits amounts or descriptor code that you have received from the Send Microdeposits request. Once you correctly confirm this, this US Bank Account will be verified and eligible to transfer funds with.
26
+ #
27
+ # ** raises ControlledByAlternateResourceError
26
28
  def confirm_microdeposits(id, params = {}, opts = {})
27
29
  request(
28
30
  method: :post,
@@ -71,6 +73,8 @@ module Stripe
71
73
  end
72
74
 
73
75
  # Send microdeposits in order to verify your US Bank Account so it is eligible to transfer funds. This will start the verification process and you must Confirm Microdeposits to successfully verify your US Bank Account.
76
+ #
77
+ # ** raises ControlledByAlternateResourceError
74
78
  def send_microdeposits(id, params = {}, opts = {})
75
79
  request(
76
80
  method: :post,
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ module TelemetryId
5
+ @cached_id = nil
6
+ @loaded = false
7
+
8
+ def self.config_dir
9
+ if Gem.win_platform?
10
+ appdata = ENV.fetch("APPDATA", nil)
11
+ return nil unless appdata && !appdata.empty?
12
+
13
+ ::File.join(appdata, "Stripe")
14
+ else
15
+ xdg = ENV.fetch("XDG_CONFIG_HOME", nil)
16
+ if xdg && !xdg.empty?
17
+ ::File.join(xdg, "stripe")
18
+ else
19
+ ::File.expand_path("~/.config/stripe")
20
+ end
21
+ end
22
+ rescue ArgumentError
23
+ nil
24
+ end
25
+
26
+ def self.get
27
+ return @cached_id if @loaded
28
+
29
+ dir = config_dir
30
+ return nil unless dir
31
+
32
+ file_path = ::File.join(dir, "telemetry_id")
33
+
34
+ begin
35
+ content = ::File.read(file_path).strip
36
+ unless content.empty?
37
+ @cached_id = content
38
+ return @cached_id
39
+ end
40
+ rescue SystemCallError
41
+ # File doesn't exist or can't be read
42
+ end
43
+
44
+ new_id = SecureRandom.hex(16)
45
+
46
+ begin
47
+ ::FileUtils.mkdir_p(dir)
48
+ ::File.write(file_path, new_id)
49
+ rescue SystemCallError
50
+ return nil
51
+ end
52
+
53
+ @cached_id = new_id
54
+ @cached_id
55
+ ensure
56
+ @loaded = true
57
+ end
58
+
59
+ # For testing only
60
+ def self.reset!
61
+ @cached_id = nil
62
+ @loaded = false
63
+ end
64
+ end
65
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "19.4.0-beta.1"
4
+ VERSION = "19.5.0-beta.1"
5
5
  end