stripe 9.2.0.pre.beta.1 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +342 -479
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +0 -11
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/request.rb +0 -2
  7. data/lib/stripe/api_version.rb +0 -1
  8. data/lib/stripe/object_types.rb +1 -17
  9. data/lib/stripe/resources/account_link.rb +1 -1
  10. data/lib/stripe/resources/financial_connections/account.rb +0 -39
  11. data/lib/stripe/resources/issuing/card.rb +0 -18
  12. data/lib/stripe/resources/payment_method_domain.rb +34 -0
  13. data/lib/stripe/resources/quote.rb +0 -100
  14. data/lib/stripe/resources/subscription_schedule.rb +0 -18
  15. data/lib/stripe/resources/terminal/reader.rb +0 -54
  16. data/lib/stripe/resources.rb +1 -17
  17. data/lib/stripe/stripe_client.rb +26 -60
  18. data/lib/stripe/stripe_configuration.rb +0 -2
  19. data/lib/stripe/util.rb +1 -8
  20. data/lib/stripe/version.rb +1 -1
  21. data/lib/stripe.rb +0 -46
  22. metadata +5 -22
  23. data/lib/stripe/request_signing_authenticator.rb +0 -83
  24. data/lib/stripe/resources/capital/financing_offer.rb +0 -32
  25. data/lib/stripe/resources/capital/financing_summary.rb +0 -12
  26. data/lib/stripe/resources/capital/financing_transaction.rb +0 -13
  27. data/lib/stripe/resources/customer_session.rb +0 -12
  28. data/lib/stripe/resources/financial_connections/inferred_balance.rb +0 -13
  29. data/lib/stripe/resources/financial_connections/transaction.rb +0 -13
  30. data/lib/stripe/resources/gift_cards/card.rb +0 -25
  31. data/lib/stripe/resources/gift_cards/transaction.rb +0 -56
  32. data/lib/stripe/resources/issuing/card_bundle.rb +0 -13
  33. data/lib/stripe/resources/issuing/card_design.rb +0 -58
  34. data/lib/stripe/resources/order.rb +0 -89
  35. data/lib/stripe/resources/payment_method_configuration.rb +0 -13
  36. data/lib/stripe/resources/quote_phase.rb +0 -29
  37. data/lib/stripe/resources/quote_preview_invoice.rb +0 -42
  38. data/lib/stripe/resources/quote_preview_schedule.rb +0 -10
  39. data/lib/stripe/resources/tax/form.rb +0 -39
  40. data/lib/stripe/resources/tax/registration.rb +0 -19
@@ -212,10 +212,9 @@ module Stripe
212
212
  end
213
213
 
214
214
  def execute_request(method, path,
215
- api_base: nil, api_key: nil,
216
- headers: {}, params: {}, api_mode: nil)
215
+ api_base: nil, api_key: nil, headers: {}, params: {})
217
216
  http_resp, api_key = execute_request_internal(
218
- method, path, api_base, api_key, headers, params, api_mode
217
+ method, path, api_base, api_key, headers, params
219
218
  )
220
219
 
221
220
  begin
@@ -246,7 +245,6 @@ module Stripe
246
245
  def execute_request_stream(method, path,
247
246
  api_base: nil, api_key: nil,
248
247
  headers: {}, params: {},
249
- api_mode: nil,
250
248
  &read_body_chunk_block)
251
249
  unless block_given?
252
250
  raise ArgumentError,
@@ -254,8 +252,7 @@ module Stripe
254
252
  end
255
253
 
256
254
  http_resp, api_key = execute_request_internal(
257
- method, path, api_base, api_key,
258
- headers, params, api_mode, &read_body_chunk_block
255
+ method, path, api_base, api_key, headers, params, &read_body_chunk_block
259
256
  )
260
257
 
261
258
  # When the read_body_chunk_block is given, we no longer have access to the
@@ -435,7 +432,7 @@ module Stripe
435
432
 
436
433
  private def execute_request_internal(method, path,
437
434
  api_base, api_key, headers, params,
438
- api_mode, &read_body_chunk_block)
435
+ &read_body_chunk_block)
439
436
  raise ArgumentError, "method should be a symbol" \
440
437
  unless method.is_a?(Symbol)
441
438
  raise ArgumentError, "path should be a string" \
@@ -443,10 +440,9 @@ module Stripe
443
440
 
444
441
  api_base ||= config.api_base
445
442
  api_key ||= config.api_key
446
- authenticator ||= config.authenticator
447
443
  params = Util.objects_to_ids(params)
448
444
 
449
- check_keys!(api_key, authenticator)
445
+ check_api_key!(api_key)
450
446
 
451
447
  body_params = nil
452
448
  query_params = nil
@@ -459,9 +455,8 @@ module Stripe
459
455
 
460
456
  query_params, path = merge_query_params(query_params, path)
461
457
 
462
- headers = request_headers(api_key, method, api_mode)
458
+ headers = request_headers(api_key, method)
463
459
  .update(Util.normalize_headers(headers))
464
-
465
460
  url = api_url(path, api_base)
466
461
 
467
462
  # Merge given query parameters with any already encoded in the path.
@@ -472,16 +467,13 @@ module Stripe
472
467
  # a log-friendly variant of the encoded form. File objects are displayed
473
468
  # as such instead of as their file contents.
474
469
  body, body_log =
475
- body_params ? encode_body(body_params, headers, api_mode) : [nil, nil]
476
-
477
- authenticator.authenticate(method, headers, body) unless api_key
470
+ body_params ? encode_body(body_params, headers) : [nil, nil]
478
471
 
479
472
  # stores information on the request we're about to make so that we don't
480
473
  # have to pass as many parameters around for logging.
481
474
  context = RequestLogContext.new
482
475
  context.account = headers["Stripe-Account"]
483
476
  context.api_key = api_key
484
- context.authenticator = authenticator
485
477
  context.api_version = headers["Stripe-Version"]
486
478
  context.body = body_log
487
479
  context.idempotency_key = headers["Idempotency-Key"]
@@ -520,16 +512,8 @@ module Stripe
520
512
  (api_base || config.api_base) + url
521
513
  end
522
514
 
523
- private def check_keys!(api_key, authenticator)
524
- if api_key && authenticator
525
- raise AuthenticationError, "Can't specify both API key " \
526
- "and authenticator. Either set your API key" \
527
- 'using "Stripe.api_key = <API-KEY>", or set your authenticator ' \
528
- 'using "Stripe.authenticator = <AUTHENTICATOR>"' \
529
- end
530
-
531
- unless api_key || authenticator
532
- # Default to missing API key error message for general users.
515
+ private def check_api_key!(api_key)
516
+ unless api_key
533
517
  raise AuthenticationError, "No API key provided. " \
534
518
  'Set your API key using "Stripe.api_key = <API-KEY>". ' \
535
519
  "You can generate API keys from the Stripe web interface. " \
@@ -548,7 +532,7 @@ module Stripe
548
532
  # Encodes a set of body parameters using multipart if `Content-Type` is set
549
533
  # for that, or standard form-encoding otherwise. Returns the encoded body
550
534
  # and a version of the encoded body that's safe to be logged.
551
- private def encode_body(body_params, headers, api_mode)
535
+ private def encode_body(body_params, headers)
552
536
  body = nil
553
537
  flattened_params = Util.flatten_params(body_params)
554
538
 
@@ -564,22 +548,15 @@ module Stripe
564
548
  flattened_params =
565
549
  flattened_params.map { |k, v| [k, v.is_a?(String) ? v : v.to_s] }.to_h
566
550
 
567
- elsif api_mode == :preview
568
- body = JSON.generate(body_params)
569
- headers["Content-Type"] = "application/json"
570
551
  else
571
552
  body = Util.encode_parameters(body_params)
572
553
  end
573
554
 
574
- if api_mode == :preview
575
- body_log = body
576
- else
577
- # We don't use `Util.encode_parameters` partly as an optimization (to
578
- # not redo work we've already done), and partly because the encoded
579
- # forms of certain characters introduce a lot of visual noise and it's
580
- # nice to have a clearer format for logs.
581
- body_log = flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
582
- end
555
+ # We don't use `Util.encode_parameters` partly as an optimization (to not
556
+ # redo work we've already done), and partly because the encoded forms of
557
+ # certain characters introduce a lot of visual noise and it's nice to
558
+ # have a clearer format for logs.
559
+ body_log = flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
583
560
 
584
561
  [body, body_log]
585
562
  end
@@ -768,11 +745,10 @@ module Stripe
768
745
  end
769
746
 
770
747
  private def specific_api_error(resp, error_data, context)
771
- message = error_data[:message]
772
748
  Util.log_error("Stripe API error",
773
749
  status: resp.http_status,
774
750
  error_code: error_data[:code],
775
- error_message: message,
751
+ error_message: error_data[:message],
776
752
  error_param: error_data[:param],
777
753
  error_type: error_data[:type],
778
754
  idempotency_key: context.idempotency_key,
@@ -793,26 +769,26 @@ module Stripe
793
769
  when 400, 404
794
770
  case error_data[:type]
795
771
  when "idempotency_error"
796
- IdempotencyError.new(message, **opts)
772
+ IdempotencyError.new(error_data[:message], **opts)
797
773
  else
798
774
  InvalidRequestError.new(
799
- message, error_data[:param],
775
+ error_data[:message], error_data[:param],
800
776
  **opts
801
777
  )
802
778
  end
803
779
  when 401
804
- AuthenticationError.new(message, **opts)
780
+ AuthenticationError.new(error_data[:message], **opts)
805
781
  when 402
806
782
  CardError.new(
807
- message, error_data[:param],
783
+ error_data[:message], error_data[:param],
808
784
  **opts
809
785
  )
810
786
  when 403
811
- PermissionError.new(message, **opts)
787
+ PermissionError.new(error_data[:message], **opts)
812
788
  when 429
813
- RateLimitError.new(message, **opts)
789
+ RateLimitError.new(error_data[:message], **opts)
814
790
  else
815
- APIError.new(message, **opts)
791
+ APIError.new(error_data[:message], **opts)
816
792
  end
817
793
  end
818
794
 
@@ -880,7 +856,7 @@ module Stripe
880
856
  message + "\n\n(Network error: #{error.message})"
881
857
  end
882
858
 
883
- private def request_headers(api_key, method, api_mode)
859
+ private def request_headers(api_key, method)
884
860
  user_agent = "Stripe/v1 RubyBindings/#{Stripe::VERSION}"
885
861
  unless Stripe.app_info.nil?
886
862
  user_agent += " " + format_app_info(Stripe.app_info)
@@ -889,13 +865,9 @@ module Stripe
889
865
  headers = {
890
866
  "User-Agent" => user_agent,
891
867
  "Authorization" => "Bearer #{api_key}",
868
+ "Content-Type" => "application/x-www-form-urlencoded",
892
869
  }
893
870
 
894
- if api_mode != :preview
895
- # TODO: (major) don't set Content-Type if method is not post
896
- headers["Content-Type"] = "application/x-www-form-urlencoded"
897
- end
898
-
899
871
  if config.enable_telemetry? && !@last_request_metrics.nil?
900
872
  headers["X-Stripe-Client-Telemetry"] = JSON.generate(
901
873
  last_request_metrics: @last_request_metrics.payload
@@ -908,12 +880,7 @@ module Stripe
908
880
  headers["Idempotency-Key"] ||= SecureRandom.uuid
909
881
  end
910
882
 
911
- if api_mode == :preview
912
- headers["Stripe-Version"] = ApiVersion::PREVIEW
913
- elsif config.api_version
914
- headers["Stripe-Version"] = config.api_version
915
- end
916
-
883
+ headers["Stripe-Version"] = config.api_version if config.api_version
917
884
  headers["Stripe-Account"] = config.stripe_account if config.stripe_account
918
885
 
919
886
  user_agent = @system_profiler.user_agent
@@ -999,7 +966,6 @@ module Stripe
999
966
  attr_accessor :body
1000
967
  attr_accessor :account
1001
968
  attr_accessor :api_key
1002
- attr_accessor :authenticator
1003
969
  attr_accessor :api_version
1004
970
  attr_accessor :idempotency_key
1005
971
  attr_accessor :method
@@ -27,7 +27,6 @@ module Stripe
27
27
  class StripeConfiguration
28
28
  attr_accessor :api_key
29
29
  attr_accessor :api_version
30
- attr_accessor :authenticator
31
30
  attr_accessor :client_id
32
31
  attr_accessor :enable_telemetry
33
32
  attr_accessor :logger
@@ -65,7 +64,6 @@ module Stripe
65
64
 
66
65
  def initialize
67
66
  @api_version = ApiVersion::CURRENT
68
-
69
67
  @ca_bundle_path = Stripe::DEFAULT_CA_BUNDLE_PATH
70
68
  @enable_telemetry = true
71
69
  @verify_ssl_certs = true
data/lib/stripe/util.rb CHANGED
@@ -7,7 +7,6 @@ module Stripe
7
7
  # Options that a user is allowed to specify.
8
8
  OPTS_USER_SPECIFIED = Set[
9
9
  :api_key,
10
- :authenticator,
11
10
  :idempotency_key,
12
11
  :stripe_account,
13
12
  :stripe_version
@@ -282,13 +281,7 @@ module Stripe
282
281
  when String
283
282
  { api_key: opts }
284
283
  when Hash
285
- # If the user is using request signing for authentication,
286
- # no need to check the api_key per request.
287
- if !(opts.key?(:client) &&
288
- opts.fetch(:client).config.authenticator) &&
289
- opts.key?(:api_key)
290
- check_api_key!(opts.fetch(:api_key))
291
- end
284
+ check_api_key!(opts.fetch(:api_key)) if opts.key?(:api_key)
292
285
  # Explicitly use dup here instead of clone to avoid preserving freeze
293
286
  # state on input params.
294
287
  opts.dup
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "9.2.0-beta.1"
4
+ VERSION = "9.2.0"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -13,7 +13,6 @@ require "set"
13
13
  require "socket"
14
14
  require "uri"
15
15
  require "forwardable"
16
- require "base64"
17
16
 
18
17
  # Version
19
18
  require "stripe/api_version"
@@ -45,7 +44,6 @@ require "stripe/api_resource_test_helpers"
45
44
  require "stripe/singleton_api_resource"
46
45
  require "stripe/webhook"
47
46
  require "stripe/stripe_configuration"
48
- require "stripe/request_signing_authenticator"
49
47
 
50
48
  # Named API resources
51
49
  require "stripe/resources"
@@ -72,7 +70,6 @@ module Stripe
72
70
 
73
71
  # User configurable options
74
72
  def_delegators :@config, :api_key, :api_key=
75
- def_delegators :@config, :authenticator, :authenticator=
76
73
  def_delegators :@config, :api_version, :api_version=
77
74
  def_delegators :@config, :stripe_account, :stripe_account=
78
75
  def_delegators :@config, :api_base, :api_base=
@@ -119,49 +116,6 @@ module Stripe
119
116
  version: version,
120
117
  }
121
118
  end
122
-
123
- class Preview
124
- def self._get_default_opts(opts)
125
- { api_mode: :preview }.merge(opts)
126
- end
127
-
128
- def self.get(url, opts = {})
129
- Stripe.raw_request(:get, url, {}, _get_default_opts(opts))
130
- end
131
-
132
- def self.post(url, params = {}, opts = {})
133
- Stripe.raw_request(:post, url, params, _get_default_opts(opts))
134
- end
135
-
136
- def self.delete(url, opts = {})
137
- Stripe.raw_request(:delete, url, {}, _get_default_opts(opts))
138
- end
139
- end
140
-
141
- class RawRequest
142
- include Stripe::APIOperations::Request
143
-
144
- def initialize
145
- @opts = {}
146
- end
147
-
148
- def execute(method, url, params = {}, opts = {})
149
- resp, = execute_resource_request(method, url, params, opts)
150
-
151
- resp
152
- end
153
- end
154
-
155
- # Sends a request to Stripe REST API
156
- def self.raw_request(method, url, params = {}, opts = {})
157
- req = RawRequest.new
158
- req.execute(method, url, params, opts)
159
- end
160
-
161
- def self.deserialize(data)
162
- data = JSON.parse(data) if data.is_a?(String)
163
- Util.convert_to_stripe_object(data, {})
164
- end
165
119
  end
166
120
 
167
121
  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: 9.2.0.pre.beta.1
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-01 00:00:00.000000000 Z
11
+ date: 2023-09-07 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.
@@ -50,7 +50,6 @@ files:
50
50
  - lib/stripe/multipart_encoder.rb
51
51
  - lib/stripe/oauth.rb
52
52
  - lib/stripe/object_types.rb
53
- - lib/stripe/request_signing_authenticator.rb
54
53
  - lib/stripe/resources.rb
55
54
  - lib/stripe/resources/account.rb
56
55
  - lib/stripe/resources/account_link.rb
@@ -66,9 +65,6 @@ files:
66
65
  - lib/stripe/resources/billing_portal/configuration.rb
67
66
  - lib/stripe/resources/billing_portal/session.rb
68
67
  - lib/stripe/resources/capability.rb
69
- - lib/stripe/resources/capital/financing_offer.rb
70
- - lib/stripe/resources/capital/financing_summary.rb
71
- - lib/stripe/resources/capital/financing_transaction.rb
72
68
  - lib/stripe/resources/card.rb
73
69
  - lib/stripe/resources/cash_balance.rb
74
70
  - lib/stripe/resources/charge.rb
@@ -80,7 +76,6 @@ files:
80
76
  - lib/stripe/resources/customer.rb
81
77
  - lib/stripe/resources/customer_balance_transaction.rb
82
78
  - lib/stripe/resources/customer_cash_balance_transaction.rb
83
- - lib/stripe/resources/customer_session.rb
84
79
  - lib/stripe/resources/discount.rb
85
80
  - lib/stripe/resources/dispute.rb
86
81
  - lib/stripe/resources/ephemeral_key.rb
@@ -91,12 +86,8 @@ files:
91
86
  - lib/stripe/resources/financial_connections/account.rb
92
87
  - lib/stripe/resources/financial_connections/account_owner.rb
93
88
  - lib/stripe/resources/financial_connections/account_ownership.rb
94
- - lib/stripe/resources/financial_connections/inferred_balance.rb
95
89
  - lib/stripe/resources/financial_connections/session.rb
96
- - lib/stripe/resources/financial_connections/transaction.rb
97
90
  - lib/stripe/resources/funding_instructions.rb
98
- - lib/stripe/resources/gift_cards/card.rb
99
- - lib/stripe/resources/gift_cards/transaction.rb
100
91
  - lib/stripe/resources/identity/verification_report.rb
101
92
  - lib/stripe/resources/identity/verification_session.rb
102
93
  - lib/stripe/resources/invoice.rb
@@ -104,19 +95,16 @@ files:
104
95
  - lib/stripe/resources/invoice_line_item.rb
105
96
  - lib/stripe/resources/issuing/authorization.rb
106
97
  - lib/stripe/resources/issuing/card.rb
107
- - lib/stripe/resources/issuing/card_bundle.rb
108
- - lib/stripe/resources/issuing/card_design.rb
109
98
  - lib/stripe/resources/issuing/cardholder.rb
110
99
  - lib/stripe/resources/issuing/dispute.rb
111
100
  - lib/stripe/resources/issuing/transaction.rb
112
101
  - lib/stripe/resources/line_item.rb
113
102
  - lib/stripe/resources/login_link.rb
114
103
  - lib/stripe/resources/mandate.rb
115
- - lib/stripe/resources/order.rb
116
104
  - lib/stripe/resources/payment_intent.rb
117
105
  - lib/stripe/resources/payment_link.rb
118
106
  - lib/stripe/resources/payment_method.rb
119
- - lib/stripe/resources/payment_method_configuration.rb
107
+ - lib/stripe/resources/payment_method_domain.rb
120
108
  - lib/stripe/resources/payout.rb
121
109
  - lib/stripe/resources/person.rb
122
110
  - lib/stripe/resources/plan.rb
@@ -124,9 +112,6 @@ files:
124
112
  - lib/stripe/resources/product.rb
125
113
  - lib/stripe/resources/promotion_code.rb
126
114
  - lib/stripe/resources/quote.rb
127
- - lib/stripe/resources/quote_phase.rb
128
- - lib/stripe/resources/quote_preview_invoice.rb
129
- - lib/stripe/resources/quote_preview_schedule.rb
130
115
  - lib/stripe/resources/radar/early_fraud_warning.rb
131
116
  - lib/stripe/resources/radar/value_list.rb
132
117
  - lib/stripe/resources/radar/value_list_item.rb
@@ -147,8 +132,6 @@ files:
147
132
  - lib/stripe/resources/subscription_schedule.rb
148
133
  - lib/stripe/resources/tax/calculation.rb
149
134
  - lib/stripe/resources/tax/calculation_line_item.rb
150
- - lib/stripe/resources/tax/form.rb
151
- - lib/stripe/resources/tax/registration.rb
152
135
  - lib/stripe/resources/tax/settings.rb
153
136
  - lib/stripe/resources/tax/transaction.rb
154
137
  - lib/stripe/resources/tax/transaction_line_item.rb
@@ -208,9 +191,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
191
  version: 2.3.0
209
192
  required_rubygems_version: !ruby/object:Gem::Requirement
210
193
  requirements:
211
- - - ">"
194
+ - - ">="
212
195
  - !ruby/object:Gem::Version
213
- version: 1.3.1
196
+ version: '0'
214
197
  requirements: []
215
198
  rubygems_version: 3.3.26
216
199
  signing_key:
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Stripe
4
- class RequestSigningAuthenticator
5
- AUTHORIZATION_HEADER_NAME = "Authorization"
6
- CONTENT_TYPE_HEADER_NAME = "Content-Type"
7
- STRIPE_CONTEXT_HEADER_NAME = "Stripe-Context"
8
- STRIPE_ACCOUNT_HEADER_NAME = "Stripe-Account"
9
- CONTENT_DIGEST_HEADER_NAME = "Content-Digest"
10
- SIGNATURE_INPUT_HEADER_NAME = "Signature-Input"
11
- SIGNATURE_HEADER_NAME = "Signature"
12
-
13
- attr_reader :auth_token, :sign_lambda
14
-
15
- def initialize(auth_token, sign_lambda)
16
- unless auth_token.is_a?(String)
17
- raise ArgumentError, "auth_token must be a string"
18
- end
19
- unless sign_lambda.is_a?(Proc)
20
- raise ArgumentError, "sign_lambda must be a lambda"
21
- end
22
-
23
- @auth_token = auth_token
24
- @sign_lambda = sign_lambda
25
- end
26
-
27
- def authenticate(method, headers, body)
28
- covered_headers = [CONTENT_TYPE_HEADER_NAME,
29
- CONTENT_DIGEST_HEADER_NAME,
30
- STRIPE_CONTEXT_HEADER_NAME,
31
- STRIPE_ACCOUNT_HEADER_NAME,
32
- AUTHORIZATION_HEADER_NAME,]
33
-
34
- headers[AUTHORIZATION_HEADER_NAME] = "STRIPE-V2-SIG #{auth_token}"
35
-
36
- if method == :get
37
- covered_headers -= [CONTENT_TYPE_HEADER_NAME,
38
- CONTENT_DIGEST_HEADER_NAME,]
39
- else
40
- content = body || ""
41
- headers[CONTENT_DIGEST_HEADER_NAME] =
42
- %(sha-256=:#{content_digest(content)}:)
43
- end
44
-
45
- covered_headers_formatted = covered_headers
46
- .map { |string| %("#{string.downcase}") }
47
- .join(" ")
48
-
49
- signature_input = "(#{covered_headers_formatted});created=#{created_time}"
50
-
51
- inputs = covered_headers
52
- .map { |header| %("#{header.downcase}": #{headers[header]}) }
53
- .join("\n")
54
-
55
- signature_base = %(#{inputs}\n"@signature-params": #{signature_input})
56
- .encode(Encoding::UTF_8)
57
-
58
- headers[SIGNATURE_INPUT_HEADER_NAME] = "sig1=#{signature_input}"
59
-
60
- headers[SIGNATURE_HEADER_NAME] =
61
- "sig1=:#{encoded_signature(signature_base)}:"
62
- end
63
-
64
- private def sign(signature_base)
65
- @sign_lambda.call(signature_base)
66
- end
67
-
68
- private def encoded_signature(signature_base)
69
- Base64.strict_encode64(sign(signature_base))
70
- rescue StandardError
71
- raise AuthenticationError, "Encountered '#{e.message} (#{e.class})' "\
72
- "when calculating request signature."
73
- end
74
-
75
- private def content_digest(content)
76
- Base64.strict_encode64(OpenSSL::Digest.new("SHA256").digest(content))
77
- end
78
-
79
- private def created_time
80
- Time.now.to_i
81
- end
82
- end
83
- end
@@ -1,32 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- module Capital
6
- # This is an object representing an offer of financing from
7
- # Stripe Capital to a Connect subaccount.
8
- class FinancingOffer < APIResource
9
- extend Stripe::APIOperations::List
10
-
11
- OBJECT_NAME = "capital.financing_offer"
12
-
13
- def mark_delivered(params = {}, opts = {})
14
- request_stripe_object(
15
- method: :post,
16
- path: format("/v1/capital/financing_offers/%<financing_offer>s/mark_delivered", { financing_offer: CGI.escape(self["id"]) }),
17
- params: params,
18
- opts: opts
19
- )
20
- end
21
-
22
- def self.mark_delivered(financing_offer, params = {}, opts = {})
23
- request_stripe_object(
24
- method: :post,
25
- path: format("/v1/capital/financing_offers/%<financing_offer>s/mark_delivered", { financing_offer: CGI.escape(financing_offer) }),
26
- params: params,
27
- opts: opts
28
- )
29
- end
30
- end
31
- end
32
- end
@@ -1,12 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- module Capital
6
- # A financing object describes an account's current financing state. Used by Connect
7
- # platforms to read the state of Capital offered to their connected accounts.
8
- class FinancingSummary < SingletonAPIResource
9
- OBJECT_NAME = "capital.financing_summary"
10
- end
11
- end
12
- end
@@ -1,13 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- module Capital
6
- # This is an object representing the details of a transaction on a Capital financing object.
7
- class FinancingTransaction < APIResource
8
- extend Stripe::APIOperations::List
9
-
10
- OBJECT_NAME = "capital.financing_transaction"
11
- end
12
- end
13
- end
@@ -1,12 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- # A customer session allows you to grant client access to Stripe's frontend SDKs (like StripeJs)
6
- # control over a customer.
7
- class CustomerSession < APIResource
8
- extend Stripe::APIOperations::Create
9
-
10
- OBJECT_NAME = "customer_session"
11
- end
12
- end
@@ -1,13 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- module FinancialConnections
6
- # A historical balance for the account on a particular day. It may be sourced from a balance snapshot provided by a financial institution, or inferred using transactions data.
7
- class InferredBalance < APIResource
8
- extend Stripe::APIOperations::List
9
-
10
- OBJECT_NAME = "financial_connections.account_inferred_balance"
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- module FinancialConnections
6
- # A Transaction represents a real transaction that affects a Financial Connections Account balance.
7
- class Transaction < APIResource
8
- extend Stripe::APIOperations::List
9
-
10
- OBJECT_NAME = "financial_connections.transaction"
11
- end
12
- end
13
- end
@@ -1,25 +0,0 @@
1
- # File generated from our OpenAPI spec
2
- # frozen_string_literal: true
3
-
4
- module Stripe
5
- module GiftCards
6
- # A gift card represents a single gift card owned by a customer, including the
7
- # remaining balance, gift card code, and whether or not it is active.
8
- class Card < APIResource
9
- extend Stripe::APIOperations::Create
10
- extend Stripe::APIOperations::List
11
- include Stripe::APIOperations::Save
12
-
13
- OBJECT_NAME = "gift_cards.card"
14
-
15
- def self.validate(params = {}, opts = {})
16
- request_stripe_object(
17
- method: :post,
18
- path: "/v1/gift_cards/cards/validate",
19
- params: params,
20
- opts: opts
21
- )
22
- end
23
- end
24
- end
25
- end