stripe 13.0.2 → 13.1.0.pre.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1370 -654
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +1 -1
  5. data/VERSION +1 -1
  6. data/examples/README.md +2 -7
  7. data/examples/meter_event_stream.rb +0 -10
  8. data/examples/new_example.rb +24 -0
  9. data/examples/{thinevent_webhook_handler.rb → stripe_webhook_handler.rb} +0 -11
  10. data/lib/stripe/api_resource.rb +1 -0
  11. data/lib/stripe/object_types.rb +19 -0
  12. data/lib/stripe/request_signing_authenticator.rb +79 -0
  13. data/lib/stripe/resources/account_notice.rb +32 -0
  14. data/lib/stripe/resources/billing/meter.rb +2 -0
  15. data/lib/stripe/resources/capital/financing_offer.rb +49 -0
  16. data/lib/stripe/resources/capital/financing_summary.rb +15 -0
  17. data/lib/stripe/resources/capital/financing_transaction.rb +27 -0
  18. data/lib/stripe/resources/financial_connections/account.rb +3 -0
  19. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +14 -0
  20. data/lib/stripe/resources/financial_connections/institution.rb +26 -0
  21. data/lib/stripe/resources/gift_cards/card.rb +59 -0
  22. data/lib/stripe/resources/gift_cards/transaction.rb +93 -0
  23. data/lib/stripe/resources/invoice.rb +81 -0
  24. data/lib/stripe/resources/invoice_payment.rb +12 -0
  25. data/lib/stripe/resources/issuing/card.rb +20 -0
  26. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +88 -0
  27. data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +26 -0
  28. data/lib/stripe/resources/margin.rb +37 -0
  29. data/lib/stripe/resources/order.rb +120 -0
  30. data/lib/stripe/resources/payment_intent.rb +50 -0
  31. data/lib/stripe/resources/quote.rb +104 -0
  32. data/lib/stripe/resources/quote_preview_invoice.rb +43 -0
  33. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +11 -0
  34. data/lib/stripe/resources/subscription_schedule.rb +20 -0
  35. data/lib/stripe/resources/tax/association.rb +24 -0
  36. data/lib/stripe/resources/tax/form.rb +49 -0
  37. data/lib/stripe/resources/terminal/reader.rb +60 -0
  38. data/lib/stripe/resources/terminal/reader_collected_data.rb +14 -0
  39. data/lib/stripe/resources/usage_record_summary.rb +1 -0
  40. data/lib/stripe/resources/v2/billing/meter_event.rb +2 -2
  41. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +2 -2
  42. data/lib/stripe/resources/v2/billing/meter_event_session.rb +2 -2
  43. data/lib/stripe/resources.rb +18 -0
  44. data/lib/stripe/services/account_notice_service.rb +39 -0
  45. data/lib/stripe/services/capital/financing_offer_service.rb +42 -0
  46. data/lib/stripe/services/capital/financing_summary_service.rb +19 -0
  47. data/lib/stripe/services/capital/financing_transaction_service.rb +31 -0
  48. data/lib/stripe/services/capital_service.rb +15 -0
  49. data/lib/stripe/services/financial_connections/account_inferred_balance_service.rb +19 -0
  50. data/lib/stripe/services/financial_connections/account_service.rb +3 -1
  51. data/lib/stripe/services/financial_connections/institution_service.rb +30 -0
  52. data/lib/stripe/services/financial_connections_service.rb +2 -1
  53. data/lib/stripe/services/gift_cards/card_service.rb +63 -0
  54. data/lib/stripe/services/gift_cards/transaction_service.rb +74 -0
  55. data/lib/stripe/services/gift_cards_service.rb +14 -0
  56. data/lib/stripe/services/invoice_payment_service.rb +28 -0
  57. data/lib/stripe/services/invoice_service.rb +44 -1
  58. data/lib/stripe/services/issuing/credit_underwriting_record_service.rb +74 -0
  59. data/lib/stripe/services/issuing/dispute_settlement_detail_service.rb +30 -0
  60. data/lib/stripe/services/issuing_service.rb +4 -1
  61. data/lib/stripe/services/margin_service.rb +50 -0
  62. data/lib/stripe/services/order_line_item_service.rb +17 -0
  63. data/lib/stripe/services/order_service.rb +78 -0
  64. data/lib/stripe/services/payment_intent_service.rb +26 -0
  65. data/lib/stripe/services/quote_line_service.rb +17 -0
  66. data/lib/stripe/services/quote_preview_invoice_service.rb +17 -0
  67. data/lib/stripe/services/quote_preview_subscription_schedule_service.rb +17 -0
  68. data/lib/stripe/services/quote_service.rb +49 -1
  69. data/lib/stripe/services/subscription_schedule_service.rb +11 -0
  70. data/lib/stripe/services/tax/association_service.rb +19 -0
  71. data/lib/stripe/services/tax/form_service.rb +37 -0
  72. data/lib/stripe/services/tax_service.rb +3 -1
  73. data/lib/stripe/services/terminal/reader_collected_data_service.rb +19 -0
  74. data/lib/stripe/services/terminal/reader_service.rb +33 -0
  75. data/lib/stripe/services/terminal_service.rb +2 -1
  76. data/lib/stripe/services/test_helpers/issuing/card_service.rb +11 -0
  77. data/lib/stripe/services/v1_services.rb +6 -1
  78. data/lib/stripe/services.rb +22 -0
  79. data/lib/stripe/stripe_configuration.rb +3 -1
  80. data/lib/stripe/util.rb +7 -1
  81. data/lib/stripe/version.rb +1 -1
  82. data/lib/stripe.rb +45 -0
  83. metadata +47 -6
  84. data/examples/example_template.rb +0 -36
@@ -0,0 +1,37 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ class FormService < StripeService
7
+ # Returns a list of tax forms which were previously created. The tax forms are returned in sorted order, with the oldest tax forms appearing first.
8
+ def list(params = {}, opts = {})
9
+ request(method: :get, path: "/v1/tax/forms", params: params, opts: opts, base_address: :api)
10
+ end
11
+
12
+ # Download the PDF for a tax form.
13
+ def pdf(id, params = {}, opts = {}, &read_body_chunk_block)
14
+ opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
15
+ request_stream(
16
+ method: :get,
17
+ path: format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(id) }),
18
+ params: params,
19
+ opts: opts,
20
+ base_address: :files,
21
+ &read_body_chunk_block
22
+ )
23
+ end
24
+
25
+ # Retrieves the details of a tax form that has previously been created. Supply the unique tax form ID that was returned from your previous request, and Stripe will return the corresponding tax form information.
26
+ def retrieve(id, params = {}, opts = {})
27
+ request(
28
+ method: :get,
29
+ path: format("/v1/tax/forms/%<id>s", { id: CGI.escape(id) }),
30
+ params: params,
31
+ opts: opts,
32
+ base_address: :api
33
+ )
34
+ end
35
+ end
36
+ end
37
+ end
@@ -3,11 +3,13 @@
3
3
 
4
4
  module Stripe
5
5
  class TaxService < StripeService
6
- attr_reader :calculations, :registrations, :settings, :transactions
6
+ attr_reader :associations, :calculations, :forms, :registrations, :settings, :transactions
7
7
 
8
8
  def initialize(requestor)
9
9
  super(requestor)
10
+ @associations = Stripe::Tax::AssociationService.new(@requestor)
10
11
  @calculations = Stripe::Tax::CalculationService.new(@requestor)
12
+ @forms = Stripe::Tax::FormService.new(@requestor)
11
13
  @registrations = Stripe::Tax::RegistrationService.new(@requestor)
12
14
  @settings = Stripe::Tax::SettingsService.new(@requestor)
13
15
  @transactions = Stripe::Tax::TransactionService.new(@requestor)
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Terminal
6
+ class ReaderCollectedDataService < StripeService
7
+ # Retrieve data collected using Reader hardware.
8
+ def retrieve(reader_collected_data, params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: format("/v1/terminal/reader_collected_data/%<reader_collected_data>s", { reader_collected_data: CGI.escape(reader_collected_data) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+ end
18
+ end
19
+ end
@@ -15,6 +15,39 @@ module Stripe
15
15
  )
16
16
  end
17
17
 
18
+ # Initiates an input collection flow on a Reader.
19
+ def collect_inputs(reader, params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(reader) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
30
+ def collect_payment_method(reader, params = {}, opts = {})
31
+ request(
32
+ method: :post,
33
+ path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(reader) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Finalizes a payment on a Reader.
41
+ def confirm_payment_intent(reader, params = {}, opts = {})
42
+ request(
43
+ method: :post,
44
+ path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(reader) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+
18
51
  # Creates a new Reader object.
19
52
  def create(params = {}, opts = {})
20
53
  request(
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  class TerminalService < StripeService
6
- attr_reader :configurations, :connection_tokens, :locations, :readers
6
+ attr_reader :configurations, :connection_tokens, :locations, :readers, :reader_collected_data
7
7
 
8
8
  def initialize(requestor)
9
9
  super(requestor)
@@ -11,6 +11,7 @@ module Stripe
11
11
  @connection_tokens = Stripe::Terminal::ConnectionTokenService.new(@requestor)
12
12
  @locations = Stripe::Terminal::LocationService.new(@requestor)
13
13
  @readers = Stripe::Terminal::ReaderService.new(@requestor)
14
+ @reader_collected_data = Stripe::Terminal::ReaderCollectedDataService.new(@requestor)
14
15
  end
15
16
  end
16
17
  end
@@ -48,6 +48,17 @@ module Stripe
48
48
  base_address: :api
49
49
  )
50
50
  end
51
+
52
+ # Updates the shipping status of the specified Issuing Card object to submitted. This method is only available with Stripe Version ‘2024-09-30.acacia' or above.
53
+ def submit_card(card, params = {}, opts = {})
54
+ request(
55
+ method: :post,
56
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/submit", { card: CGI.escape(card) }),
57
+ params: params,
58
+ opts: opts,
59
+ base_address: :api
60
+ )
61
+ end
51
62
  end
52
63
  end
53
64
  end
@@ -4,7 +4,7 @@ module Stripe
4
4
  class V1Services < StripeService
5
5
  # v1 accessors: The beginning of the section generated from our OpenAPI spec
6
6
  attr_reader :accounts
7
- attr_reader :account_links, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_transactions, :billing, :billing_portal, :charges, :checkout, :climate, :confirmation_tokens, :test_helpers, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :files, :file_links, :financial_connections, :forwarding, :identity, :invoices, :invoice_rendering_templates, :invoice_items, :issuing, :mandates, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payouts, :plans, :prices, :products, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :sigma, :setup_attempts, :setup_intents, :shipping_rates, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :tokens, :topups, :transfers, :treasury, :webhook_endpoints
7
+ attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_transactions, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :test_helpers, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :files, :file_links, :financial_connections, :forwarding, :gift_cards, :identity, :invoices, :invoice_rendering_templates, :invoice_items, :issuing, :mandates, :margins, :orders, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payouts, :plans, :prices, :products, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :sigma, :setup_attempts, :setup_intents, :shipping_rates, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :tokens, :topups, :transfers, :treasury, :webhook_endpoints
8
8
  # v1 accessors: The end of the section generated from our OpenAPI spec
9
9
 
10
10
  # OAuthService is manually maintained, as it has special behaviors
@@ -15,6 +15,7 @@ module Stripe
15
15
  # v1 services: The beginning of the section generated from our OpenAPI spec
16
16
  @accounts = Stripe::AccountService.new(@requestor)
17
17
  @account_links = Stripe::AccountLinkService.new(@requestor)
18
+ @account_notices = Stripe::AccountNoticeService.new(@requestor)
18
19
  @account_sessions = Stripe::AccountSessionService.new(@requestor)
19
20
  @apple_pay_domains = Stripe::ApplePayDomainService.new(@requestor)
20
21
  @application_fees = Stripe::ApplicationFeeService.new(@requestor)
@@ -23,6 +24,7 @@ module Stripe
23
24
  @balance_transactions = Stripe::BalanceTransactionService.new(@requestor)
24
25
  @billing = Stripe::BillingService.new(@requestor)
25
26
  @billing_portal = Stripe::BillingPortalService.new(@requestor)
27
+ @capital = Stripe::CapitalService.new(@requestor)
26
28
  @charges = Stripe::ChargeService.new(@requestor)
27
29
  @checkout = Stripe::CheckoutService.new(@requestor)
28
30
  @climate = Stripe::ClimateService.new(@requestor)
@@ -42,12 +44,15 @@ module Stripe
42
44
  @file_links = Stripe::FileLinkService.new(@requestor)
43
45
  @financial_connections = Stripe::FinancialConnectionsService.new(@requestor)
44
46
  @forwarding = Stripe::ForwardingService.new(@requestor)
47
+ @gift_cards = Stripe::GiftCardsService.new(@requestor)
45
48
  @identity = Stripe::IdentityService.new(@requestor)
46
49
  @invoices = Stripe::InvoiceService.new(@requestor)
47
50
  @invoice_rendering_templates = Stripe::InvoiceRenderingTemplateService.new(@requestor)
48
51
  @invoice_items = Stripe::InvoiceItemService.new(@requestor)
49
52
  @issuing = Stripe::IssuingService.new(@requestor)
50
53
  @mandates = Stripe::MandateService.new(@requestor)
54
+ @margins = Stripe::MarginService.new(@requestor)
55
+ @orders = Stripe::OrderService.new(@requestor)
51
56
  @payment_intents = Stripe::PaymentIntentService.new(@requestor)
52
57
  @payment_links = Stripe::PaymentLinkService.new(@requestor)
53
58
  @payment_methods = Stripe::PaymentMethodService.new(@requestor)
@@ -5,6 +5,7 @@ require "stripe/services/account_capability_service"
5
5
  require "stripe/services/account_external_account_service"
6
6
  require "stripe/services/account_link_service"
7
7
  require "stripe/services/account_login_link_service"
8
+ require "stripe/services/account_notice_service"
8
9
  require "stripe/services/account_person_service"
9
10
  require "stripe/services/account_service"
10
11
  require "stripe/services/account_session_service"
@@ -27,6 +28,10 @@ require "stripe/services/billing_portal/configuration_service"
27
28
  require "stripe/services/billing_portal/session_service"
28
29
  require "stripe/services/billing_portal_service"
29
30
  require "stripe/services/billing_service"
31
+ require "stripe/services/capital/financing_offer_service"
32
+ require "stripe/services/capital/financing_summary_service"
33
+ require "stripe/services/capital/financing_transaction_service"
34
+ require "stripe/services/capital_service"
30
35
  require "stripe/services/charge_service"
31
36
  require "stripe/services/checkout/session_line_item_service"
32
37
  require "stripe/services/checkout/session_service"
@@ -59,31 +64,42 @@ require "stripe/services/event_service"
59
64
  require "stripe/services/exchange_rate_service"
60
65
  require "stripe/services/file_link_service"
61
66
  require "stripe/services/file_service"
67
+ require "stripe/services/financial_connections/account_inferred_balance_service"
62
68
  require "stripe/services/financial_connections/account_owner_service"
63
69
  require "stripe/services/financial_connections/account_service"
70
+ require "stripe/services/financial_connections/institution_service"
64
71
  require "stripe/services/financial_connections/session_service"
65
72
  require "stripe/services/financial_connections/transaction_service"
66
73
  require "stripe/services/financial_connections_service"
67
74
  require "stripe/services/forwarding/request_service"
68
75
  require "stripe/services/forwarding_service"
76
+ require "stripe/services/gift_cards/card_service"
77
+ require "stripe/services/gift_cards/transaction_service"
78
+ require "stripe/services/gift_cards_service"
69
79
  require "stripe/services/identity/verification_report_service"
70
80
  require "stripe/services/identity/verification_session_service"
71
81
  require "stripe/services/identity_service"
72
82
  require "stripe/services/invoice_item_service"
73
83
  require "stripe/services/invoice_line_item_service"
84
+ require "stripe/services/invoice_payment_service"
74
85
  require "stripe/services/invoice_rendering_template_service"
75
86
  require "stripe/services/invoice_service"
76
87
  require "stripe/services/invoice_upcoming_lines_service"
77
88
  require "stripe/services/issuing/authorization_service"
78
89
  require "stripe/services/issuing/card_service"
79
90
  require "stripe/services/issuing/cardholder_service"
91
+ require "stripe/services/issuing/credit_underwriting_record_service"
80
92
  require "stripe/services/issuing/dispute_service"
93
+ require "stripe/services/issuing/dispute_settlement_detail_service"
81
94
  require "stripe/services/issuing/personalization_design_service"
82
95
  require "stripe/services/issuing/physical_bundle_service"
83
96
  require "stripe/services/issuing/token_service"
84
97
  require "stripe/services/issuing/transaction_service"
85
98
  require "stripe/services/issuing_service"
86
99
  require "stripe/services/mandate_service"
100
+ require "stripe/services/margin_service"
101
+ require "stripe/services/order_line_item_service"
102
+ require "stripe/services/order_service"
87
103
  require "stripe/services/payment_intent_service"
88
104
  require "stripe/services/payment_link_line_item_service"
89
105
  require "stripe/services/payment_link_service"
@@ -98,6 +114,9 @@ require "stripe/services/product_service"
98
114
  require "stripe/services/promotion_code_service"
99
115
  require "stripe/services/quote_computed_upfront_line_items_service"
100
116
  require "stripe/services/quote_line_item_service"
117
+ require "stripe/services/quote_line_service"
118
+ require "stripe/services/quote_preview_invoice_service"
119
+ require "stripe/services/quote_preview_subscription_schedule_service"
101
120
  require "stripe/services/quote_service"
102
121
  require "stripe/services/radar/early_fraud_warning_service"
103
122
  require "stripe/services/radar/value_list_item_service"
@@ -120,8 +139,10 @@ require "stripe/services/subscription_item_usage_record_service"
120
139
  require "stripe/services/subscription_item_usage_record_summary_service"
121
140
  require "stripe/services/subscription_schedule_service"
122
141
  require "stripe/services/subscription_service"
142
+ require "stripe/services/tax/association_service"
123
143
  require "stripe/services/tax/calculation_line_item_service"
124
144
  require "stripe/services/tax/calculation_service"
145
+ require "stripe/services/tax/form_service"
125
146
  require "stripe/services/tax/registration_service"
126
147
  require "stripe/services/tax/settings_service"
127
148
  require "stripe/services/tax/transaction_line_item_service"
@@ -133,6 +154,7 @@ require "stripe/services/tax_service"
133
154
  require "stripe/services/terminal/configuration_service"
134
155
  require "stripe/services/terminal/connection_token_service"
135
156
  require "stripe/services/terminal/location_service"
157
+ require "stripe/services/terminal/reader_collected_data_service"
136
158
  require "stripe/services/terminal/reader_service"
137
159
  require "stripe/services/terminal_service"
138
160
  require "stripe/services/test_helpers/confirmation_token_service"
@@ -25,7 +25,8 @@ module Stripe
25
25
  # If `.logger` is set, the value of `.log_level` is ignored. The decision on
26
26
  # what levels to print is entirely deferred to the logger.
27
27
  class StripeConfiguration
28
- attr_accessor :api_key, :api_version, :client_id, :enable_telemetry, :logger, :stripe_account, :stripe_context
28
+ attr_accessor :api_key, :api_version, :authenticator, :client_id, :enable_telemetry, :logger,
29
+ :stripe_account, :stripe_context
29
30
 
30
31
  attr_reader :api_base, :uploads_base, :connect_base, :meter_events_base, :base_addresses, :ca_bundle_path,
31
32
  :log_level, :initial_network_retry_delay, :max_network_retries, :max_network_retry_delay,
@@ -52,6 +53,7 @@ module Stripe
52
53
 
53
54
  def initialize
54
55
  @api_version = ApiVersion::CURRENT
56
+
55
57
  @ca_bundle_path = Stripe::DEFAULT_CA_BUNDLE_PATH
56
58
  @enable_telemetry = true
57
59
  @verify_ssl_certs = true
data/lib/stripe/util.rb CHANGED
@@ -300,7 +300,13 @@ module Stripe
300
300
  when String
301
301
  { api_key: opts }
302
302
  when Hash
303
- check_api_key!(opts.fetch(:api_key)) if opts.key?(:api_key)
303
+ # If the user is using request signing for authentication,
304
+ # no need to check the api_key per request.
305
+ if !(opts.key?(:client) &&
306
+ opts.fetch(:client).config.authenticator) &&
307
+ opts.key?(:api_key)
308
+ check_api_key!(opts.fetch(:api_key))
309
+ end
304
310
  # Explicitly use dup here instead of clone to avoid preserving freeze
305
311
  # state on input params.
306
312
  opts.dup
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "13.0.2"
4
+ VERSION = "13.1.0-beta.2"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -13,6 +13,7 @@ require "set"
13
13
  require "socket"
14
14
  require "uri"
15
15
  require "forwardable"
16
+ require "base64"
16
17
 
17
18
  # Version
18
19
  require "stripe/api_version"
@@ -50,6 +51,7 @@ require "stripe/api_resource_test_helpers"
50
51
  require "stripe/singleton_api_resource"
51
52
  require "stripe/webhook"
52
53
  require "stripe/stripe_configuration"
54
+ require "stripe/request_signing_authenticator"
53
55
  require "stripe/thin_event"
54
56
 
55
57
  # Named API resources
@@ -85,6 +87,7 @@ module Stripe
85
87
 
86
88
  # User configurable options
87
89
  def_delegators :@config, :api_key, :api_key=
90
+ def_delegators :@config, :authenticator, :authenticator=
88
91
  def_delegators :@config, :api_version, :api_version=
89
92
  def_delegators :@config, :stripe_account, :stripe_account=
90
93
  def_delegators :@config, :api_base, :api_base=
@@ -132,6 +135,48 @@ module Stripe
132
135
  version: version,
133
136
  }
134
137
  end
138
+
139
+ def self.add_beta_version(beta_name, version)
140
+ if api_version.include?("; #{beta_name}=")
141
+ raise "Stripe version header #{api_version} already contains entry for beta #{beta_name}"
142
+ end
143
+
144
+ self.api_version = "#{api_version}; #{beta_name}=#{version}"
145
+ end
146
+
147
+ class RawRequest
148
+ def initialize
149
+ @opts = {}
150
+ end
151
+
152
+ def execute(method, url, base_address: :api, params: {}, opts: {}, usage: [])
153
+ opts = Util.normalize_opts(opts)
154
+ req_opts = RequestOptions.extract_opts_from_hash(opts)
155
+
156
+ requestor = APIRequestor.active_requestor
157
+ resp, = requestor.send(:execute_request_internal, method, url, base_address, params, req_opts,
158
+ usage)
159
+
160
+ requestor.interpret_response(resp)
161
+ end
162
+ end
163
+
164
+ # Sends a request to Stripe REST API
165
+ def self.raw_request(method, url, params = {}, opts = {}, base_address: :api)
166
+ req = RawRequest.new
167
+ req.execute(method, url, base_address: base_address, params: params, opts: opts,
168
+ usage: ["raw_request"])
169
+ end
170
+
171
+ def self.deserialize(data, api_mode: :v1)
172
+ data = JSON.parse(data) if data.is_a?(String)
173
+ Util.convert_to_stripe_object(data, {}, api_mode: api_mode)
174
+ end
175
+ class << self
176
+ extend Gem::Deprecate
177
+ deprecate :raw_request, "StripeClient#raw_request", 2024, 9
178
+ deprecate :deserialize, "StripeClient#deserialize", 2024, 9
179
+ end
135
180
  end
136
181
 
137
182
  Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.2
4
+ version: 13.1.0.pre.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-23 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
14
14
  for details.
@@ -30,9 +30,9 @@ files:
30
30
  - Rakefile
31
31
  - VERSION
32
32
  - examples/README.md
33
- - examples/example_template.rb
34
33
  - examples/meter_event_stream.rb
35
- - examples/thinevent_webhook_handler.rb
34
+ - examples/new_example.rb
35
+ - examples/stripe_webhook_handler.rb
36
36
  - exe/stripe-console
37
37
  - lib/data/ca-certificates.crt
38
38
  - lib/stripe.rb
@@ -60,9 +60,11 @@ files:
60
60
  - lib/stripe/oauth.rb
61
61
  - lib/stripe/object_types.rb
62
62
  - lib/stripe/request_options.rb
63
+ - lib/stripe/request_signing_authenticator.rb
63
64
  - lib/stripe/resources.rb
64
65
  - lib/stripe/resources/account.rb
65
66
  - lib/stripe/resources/account_link.rb
67
+ - lib/stripe/resources/account_notice.rb
66
68
  - lib/stripe/resources/account_session.rb
67
69
  - lib/stripe/resources/alipay_account.rb
68
70
  - lib/stripe/resources/apple_pay_domain.rb
@@ -83,6 +85,9 @@ files:
83
85
  - lib/stripe/resources/billing_portal/configuration.rb
84
86
  - lib/stripe/resources/billing_portal/session.rb
85
87
  - lib/stripe/resources/capability.rb
88
+ - lib/stripe/resources/capital/financing_offer.rb
89
+ - lib/stripe/resources/capital/financing_summary.rb
90
+ - lib/stripe/resources/capital/financing_transaction.rb
86
91
  - lib/stripe/resources/card.rb
87
92
  - lib/stripe/resources/cash_balance.rb
88
93
  - lib/stripe/resources/charge.rb
@@ -109,22 +114,29 @@ files:
109
114
  - lib/stripe/resources/file.rb
110
115
  - lib/stripe/resources/file_link.rb
111
116
  - lib/stripe/resources/financial_connections/account.rb
117
+ - lib/stripe/resources/financial_connections/account_inferred_balance.rb
112
118
  - lib/stripe/resources/financial_connections/account_owner.rb
113
119
  - lib/stripe/resources/financial_connections/account_ownership.rb
120
+ - lib/stripe/resources/financial_connections/institution.rb
114
121
  - lib/stripe/resources/financial_connections/session.rb
115
122
  - lib/stripe/resources/financial_connections/transaction.rb
116
123
  - lib/stripe/resources/forwarding/request.rb
117
124
  - lib/stripe/resources/funding_instructions.rb
125
+ - lib/stripe/resources/gift_cards/card.rb
126
+ - lib/stripe/resources/gift_cards/transaction.rb
118
127
  - lib/stripe/resources/identity/verification_report.rb
119
128
  - lib/stripe/resources/identity/verification_session.rb
120
129
  - lib/stripe/resources/invoice.rb
121
130
  - lib/stripe/resources/invoice_item.rb
122
131
  - lib/stripe/resources/invoice_line_item.rb
132
+ - lib/stripe/resources/invoice_payment.rb
123
133
  - lib/stripe/resources/invoice_rendering_template.rb
124
134
  - lib/stripe/resources/issuing/authorization.rb
125
135
  - lib/stripe/resources/issuing/card.rb
126
136
  - lib/stripe/resources/issuing/cardholder.rb
137
+ - lib/stripe/resources/issuing/credit_underwriting_record.rb
127
138
  - lib/stripe/resources/issuing/dispute.rb
139
+ - lib/stripe/resources/issuing/dispute_settlement_detail.rb
128
140
  - lib/stripe/resources/issuing/personalization_design.rb
129
141
  - lib/stripe/resources/issuing/physical_bundle.rb
130
142
  - lib/stripe/resources/issuing/token.rb
@@ -132,6 +144,8 @@ files:
132
144
  - lib/stripe/resources/line_item.rb
133
145
  - lib/stripe/resources/login_link.rb
134
146
  - lib/stripe/resources/mandate.rb
147
+ - lib/stripe/resources/margin.rb
148
+ - lib/stripe/resources/order.rb
135
149
  - lib/stripe/resources/payment_intent.rb
136
150
  - lib/stripe/resources/payment_link.rb
137
151
  - lib/stripe/resources/payment_method.rb
@@ -145,6 +159,8 @@ files:
145
159
  - lib/stripe/resources/product_feature.rb
146
160
  - lib/stripe/resources/promotion_code.rb
147
161
  - lib/stripe/resources/quote.rb
162
+ - lib/stripe/resources/quote_preview_invoice.rb
163
+ - lib/stripe/resources/quote_preview_subscription_schedule.rb
148
164
  - lib/stripe/resources/radar/early_fraud_warning.rb
149
165
  - lib/stripe/resources/radar/value_list.rb
150
166
  - lib/stripe/resources/radar/value_list_item.rb
@@ -163,8 +179,10 @@ files:
163
179
  - lib/stripe/resources/subscription.rb
164
180
  - lib/stripe/resources/subscription_item.rb
165
181
  - lib/stripe/resources/subscription_schedule.rb
182
+ - lib/stripe/resources/tax/association.rb
166
183
  - lib/stripe/resources/tax/calculation.rb
167
184
  - lib/stripe/resources/tax/calculation_line_item.rb
185
+ - lib/stripe/resources/tax/form.rb
168
186
  - lib/stripe/resources/tax/registration.rb
169
187
  - lib/stripe/resources/tax/settings.rb
170
188
  - lib/stripe/resources/tax/transaction.rb
@@ -176,6 +194,7 @@ files:
176
194
  - lib/stripe/resources/terminal/connection_token.rb
177
195
  - lib/stripe/resources/terminal/location.rb
178
196
  - lib/stripe/resources/terminal/reader.rb
197
+ - lib/stripe/resources/terminal/reader_collected_data.rb
179
198
  - lib/stripe/resources/test_helpers/test_clock.rb
180
199
  - lib/stripe/resources/token.rb
181
200
  - lib/stripe/resources/topup.rb
@@ -204,6 +223,7 @@ files:
204
223
  - lib/stripe/services/account_external_account_service.rb
205
224
  - lib/stripe/services/account_link_service.rb
206
225
  - lib/stripe/services/account_login_link_service.rb
226
+ - lib/stripe/services/account_notice_service.rb
207
227
  - lib/stripe/services/account_person_service.rb
208
228
  - lib/stripe/services/account_service.rb
209
229
  - lib/stripe/services/account_session_service.rb
@@ -226,6 +246,10 @@ files:
226
246
  - lib/stripe/services/billing_portal/session_service.rb
227
247
  - lib/stripe/services/billing_portal_service.rb
228
248
  - lib/stripe/services/billing_service.rb
249
+ - lib/stripe/services/capital/financing_offer_service.rb
250
+ - lib/stripe/services/capital/financing_summary_service.rb
251
+ - lib/stripe/services/capital/financing_transaction_service.rb
252
+ - lib/stripe/services/capital_service.rb
229
253
  - lib/stripe/services/charge_service.rb
230
254
  - lib/stripe/services/checkout/session_line_item_service.rb
231
255
  - lib/stripe/services/checkout/session_service.rb
@@ -258,32 +282,43 @@ files:
258
282
  - lib/stripe/services/exchange_rate_service.rb
259
283
  - lib/stripe/services/file_link_service.rb
260
284
  - lib/stripe/services/file_service.rb
285
+ - lib/stripe/services/financial_connections/account_inferred_balance_service.rb
261
286
  - lib/stripe/services/financial_connections/account_owner_service.rb
262
287
  - lib/stripe/services/financial_connections/account_service.rb
288
+ - lib/stripe/services/financial_connections/institution_service.rb
263
289
  - lib/stripe/services/financial_connections/session_service.rb
264
290
  - lib/stripe/services/financial_connections/transaction_service.rb
265
291
  - lib/stripe/services/financial_connections_service.rb
266
292
  - lib/stripe/services/forwarding/request_service.rb
267
293
  - lib/stripe/services/forwarding_service.rb
294
+ - lib/stripe/services/gift_cards/card_service.rb
295
+ - lib/stripe/services/gift_cards/transaction_service.rb
296
+ - lib/stripe/services/gift_cards_service.rb
268
297
  - lib/stripe/services/identity/verification_report_service.rb
269
298
  - lib/stripe/services/identity/verification_session_service.rb
270
299
  - lib/stripe/services/identity_service.rb
271
300
  - lib/stripe/services/invoice_item_service.rb
272
301
  - lib/stripe/services/invoice_line_item_service.rb
302
+ - lib/stripe/services/invoice_payment_service.rb
273
303
  - lib/stripe/services/invoice_rendering_template_service.rb
274
304
  - lib/stripe/services/invoice_service.rb
275
305
  - lib/stripe/services/invoice_upcoming_lines_service.rb
276
306
  - lib/stripe/services/issuing/authorization_service.rb
277
307
  - lib/stripe/services/issuing/card_service.rb
278
308
  - lib/stripe/services/issuing/cardholder_service.rb
309
+ - lib/stripe/services/issuing/credit_underwriting_record_service.rb
279
310
  - lib/stripe/services/issuing/dispute_service.rb
311
+ - lib/stripe/services/issuing/dispute_settlement_detail_service.rb
280
312
  - lib/stripe/services/issuing/personalization_design_service.rb
281
313
  - lib/stripe/services/issuing/physical_bundle_service.rb
282
314
  - lib/stripe/services/issuing/token_service.rb
283
315
  - lib/stripe/services/issuing/transaction_service.rb
284
316
  - lib/stripe/services/issuing_service.rb
285
317
  - lib/stripe/services/mandate_service.rb
318
+ - lib/stripe/services/margin_service.rb
286
319
  - lib/stripe/services/oauth_service.rb
320
+ - lib/stripe/services/order_line_item_service.rb
321
+ - lib/stripe/services/order_service.rb
287
322
  - lib/stripe/services/payment_intent_service.rb
288
323
  - lib/stripe/services/payment_link_line_item_service.rb
289
324
  - lib/stripe/services/payment_link_service.rb
@@ -298,6 +333,9 @@ files:
298
333
  - lib/stripe/services/promotion_code_service.rb
299
334
  - lib/stripe/services/quote_computed_upfront_line_items_service.rb
300
335
  - lib/stripe/services/quote_line_item_service.rb
336
+ - lib/stripe/services/quote_line_service.rb
337
+ - lib/stripe/services/quote_preview_invoice_service.rb
338
+ - lib/stripe/services/quote_preview_subscription_schedule_service.rb
301
339
  - lib/stripe/services/quote_service.rb
302
340
  - lib/stripe/services/radar/early_fraud_warning_service.rb
303
341
  - lib/stripe/services/radar/value_list_item_service.rb
@@ -320,8 +358,10 @@ files:
320
358
  - lib/stripe/services/subscription_item_usage_record_summary_service.rb
321
359
  - lib/stripe/services/subscription_schedule_service.rb
322
360
  - lib/stripe/services/subscription_service.rb
361
+ - lib/stripe/services/tax/association_service.rb
323
362
  - lib/stripe/services/tax/calculation_line_item_service.rb
324
363
  - lib/stripe/services/tax/calculation_service.rb
364
+ - lib/stripe/services/tax/form_service.rb
325
365
  - lib/stripe/services/tax/registration_service.rb
326
366
  - lib/stripe/services/tax/settings_service.rb
327
367
  - lib/stripe/services/tax/transaction_line_item_service.rb
@@ -333,6 +373,7 @@ files:
333
373
  - lib/stripe/services/terminal/configuration_service.rb
334
374
  - lib/stripe/services/terminal/connection_token_service.rb
335
375
  - lib/stripe/services/terminal/location_service.rb
376
+ - lib/stripe/services/terminal/reader_collected_data_service.rb
336
377
  - lib/stripe/services/terminal/reader_service.rb
337
378
  - lib/stripe/services/terminal_service.rb
338
379
  - lib/stripe/services/test_helpers/confirmation_token_service.rb
@@ -413,9 +454,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
413
454
  version: 2.3.0
414
455
  required_rubygems_version: !ruby/object:Gem::Requirement
415
456
  requirements:
416
- - - ">="
457
+ - - ">"
417
458
  - !ruby/object:Gem::Version
418
- version: '0'
459
+ version: 1.3.1
419
460
  requirements: []
420
461
  rubygems_version: 3.3.27
421
462
  signing_key:
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # example_template.py - This is a template for defining new examples. It is not intended to be used directly.
4
- #
5
- # <describe what this example does>
6
- #
7
- # In this example, we:
8
- # - <key step 1>
9
- # - <key step 2
10
- # - ...
11
- #
12
- # <describe assumptions about the user's stripe account, environment, or configuration;
13
- # or things to watch out for when running>
14
-
15
- require "stripe"
16
- require "date"
17
-
18
- class ExampleTemplate
19
- attr_accessor :api_key
20
-
21
- def initialize(api_key)
22
- @api_key = api_key
23
- end
24
-
25
- def do_something_great
26
- puts "Hello World"
27
- # client = Stripe::StripeClient.new(api_key)
28
- # client.v1
29
- end
30
- end
31
-
32
- # Send meter events
33
- api_key = "{{API_KEY}}"
34
-
35
- example = ExampleTemplate.new(api_key)
36
- example.do_something_great