stripe 19.2.0.pre.alpha.2 → 19.2.0.pre.alpha.4

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stripe/events/unknown_event_notification.rb +1 -0
  3. data/lib/stripe/object_types.rb +1 -0
  4. data/lib/stripe/params/account_create_params.rb +20 -1
  5. data/lib/stripe/params/account_update_params.rb +20 -1
  6. data/lib/stripe/params/confirmation_token_create_params.rb +13 -0
  7. data/lib/stripe/params/delegated_checkout/requested_session_confirm_params.rb +4 -0
  8. data/lib/stripe/params/payment_intent_confirm_params.rb +13 -0
  9. data/lib/stripe/params/payment_intent_create_params.rb +13 -0
  10. data/lib/stripe/params/payment_intent_update_params.rb +13 -0
  11. data/lib/stripe/params/payment_location_create_params.rb +54 -0
  12. data/lib/stripe/params/payment_location_delete_params.rb +6 -0
  13. data/lib/stripe/params/payment_location_retrieve_params.rb +13 -0
  14. data/lib/stripe/params/payment_location_update_params.rb +54 -0
  15. data/lib/stripe/params/payment_method_create_params.rb +13 -0
  16. data/lib/stripe/params/setup_intent_confirm_params.rb +13 -0
  17. data/lib/stripe/params/setup_intent_create_params.rb +13 -0
  18. data/lib/stripe/params/setup_intent_update_params.rb +13 -0
  19. data/lib/stripe/params/test_helpers/confirmation_token_create_params.rb +13 -0
  20. data/lib/stripe/params/v2/core/account_create_params.rb +76 -2
  21. data/lib/stripe/params/v2/core/account_update_params.rb +76 -2
  22. data/lib/stripe/params.rb +4 -0
  23. data/lib/stripe/resources/capability.rb +36 -1
  24. data/lib/stripe/resources/confirmation_token.rb +26 -0
  25. data/lib/stripe/resources/invoice_item.rb +34 -1
  26. data/lib/stripe/resources/issuing/dispute.rb +68 -0
  27. data/lib/stripe/resources/payment_location.rb +159 -0
  28. data/lib/stripe/resources/payment_method.rb +26 -0
  29. data/lib/stripe/resources/shared_payment/granted_token.rb +26 -0
  30. data/lib/stripe/resources/subscription.rb +44 -0
  31. data/lib/stripe/resources/v2/core/account.rb +116 -2
  32. data/lib/stripe/resources/v2/core/event_notification.rb +1 -0
  33. data/lib/stripe/resources.rb +1 -0
  34. data/lib/stripe/services/payment_location_service.rb +50 -0
  35. data/lib/stripe/services/v1_services.rb +2 -1
  36. data/lib/stripe/services.rb +1 -0
  37. data/lib/stripe/stripe_client.rb +8 -1
  38. data/lib/stripe/stripe_event_notification_handler.rb +2478 -0
  39. data/lib/stripe/version.rb +1 -1
  40. data/lib/stripe.rb +1 -0
  41. data/rbi/stripe/resources/v2/core/event_notification.rbi +3 -0
  42. data/rbi/stripe/stripe_client.rbi +13 -0
  43. data/rbi/stripe.rbi +1291 -86
  44. metadata +9 -2
@@ -662,6 +662,29 @@ module Stripe
662
662
  end
663
663
  end
664
664
 
665
+ class GiftCard < ::Stripe::StripeObject
666
+ # The brand of the gift card.
667
+ attr_reader :brand
668
+ # The expiration month of the gift card.
669
+ attr_reader :exp_month
670
+ # The expiration year of the gift card.
671
+ attr_reader :exp_year
672
+ # Uniquely identifies the gift card.
673
+ attr_reader :fingerprint
674
+ # The first six digits of the gift card number.
675
+ attr_reader :first6
676
+ # The last four digits of the gift card number.
677
+ attr_reader :last4
678
+
679
+ def self.inner_class_types
680
+ @inner_class_types = {}
681
+ end
682
+
683
+ def self.field_remappings
684
+ @field_remappings = {}
685
+ end
686
+ end
687
+
665
688
  class Giropay < ::Stripe::StripeObject
666
689
  def self.inner_class_types
667
690
  @inner_class_types = {}
@@ -1369,6 +1392,8 @@ module Stripe
1369
1392
  attr_reader :eps
1370
1393
  # Attribute for field fpx
1371
1394
  attr_reader :fpx
1395
+ # Attribute for field gift_card
1396
+ attr_reader :gift_card
1372
1397
  # Attribute for field giropay
1373
1398
  attr_reader :giropay
1374
1399
  # Attribute for field gopay
@@ -1478,6 +1503,7 @@ module Stripe
1478
1503
  customer_balance: CustomerBalance,
1479
1504
  eps: Eps,
1480
1505
  fpx: Fpx,
1506
+ gift_card: GiftCard,
1481
1507
  giropay: Giropay,
1482
1508
  gopay: Gopay,
1483
1509
  grabpay: Grabpay,
@@ -789,6 +789,47 @@ module Stripe
789
789
  end
790
790
  end
791
791
 
792
+ class StatusDetails < ::Stripe::StripeObject
793
+ class Paused < ::Stripe::StripeObject
794
+ class Subscription < ::Stripe::StripeObject
795
+ # The reason that the subscription was paused.
796
+ attr_reader :type
797
+
798
+ def self.inner_class_types
799
+ @inner_class_types = {}
800
+ end
801
+
802
+ def self.field_remappings
803
+ @field_remappings = {}
804
+ end
805
+ end
806
+ # Information on the `type=subscription` pause.
807
+ attr_reader :subscription
808
+ # Unix timestamp in seconds of when the subscription status transitioned to `paused`.
809
+ attr_reader :transitioned_at
810
+ # The type of pause.
811
+ attr_reader :type
812
+
813
+ def self.inner_class_types
814
+ @inner_class_types = { subscription: Subscription }
815
+ end
816
+
817
+ def self.field_remappings
818
+ @field_remappings = {}
819
+ end
820
+ end
821
+ # Indicates when and why the subscription transitioned to the paused status.
822
+ attr_reader :paused
823
+
824
+ def self.inner_class_types
825
+ @inner_class_types = { paused: Paused }
826
+ end
827
+
828
+ def self.field_remappings
829
+ @field_remappings = {}
830
+ end
831
+ end
832
+
792
833
  class TransferData < ::Stripe::StripeObject
793
834
  # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
794
835
  attr_reader :amount_percent
@@ -932,6 +973,8 @@ module Stripe
932
973
  #
933
974
  # If subscription `collection_method=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.
934
975
  attr_reader :status
976
+ # Describes changes to the subscription's status.
977
+ attr_reader :status_details
935
978
  # ID of the test clock this subscription belongs to.
936
979
  attr_reader :test_clock
937
980
  # The account (if any) the 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.
@@ -1149,6 +1192,7 @@ module Stripe
1149
1192
  pending_update: PendingUpdate,
1150
1193
  prebilling: Prebilling,
1151
1194
  presentment_details: PresentmentDetails,
1195
+ status_details: StatusDetails,
1152
1196
  transfer_data: TransferData,
1153
1197
  trial_settings: TrialSettings,
1154
1198
  }
@@ -458,6 +458,35 @@ module Stripe
458
458
  end
459
459
 
460
460
  class Lead < ::Stripe::StripeObject
461
+ class DebitCard < ::Stripe::StripeObject
462
+ class StatusDetail < ::Stripe::StripeObject
463
+ # Machine-readable code explaining the reason for the Capability to be in its current status.
464
+ attr_reader :code
465
+ # Machine-readable code explaining how to make the Capability active.
466
+ attr_reader :resolution
467
+
468
+ def self.inner_class_types
469
+ @inner_class_types = {}
470
+ end
471
+
472
+ def self.field_remappings
473
+ @field_remappings = {}
474
+ end
475
+ end
476
+ # The status of the Capability.
477
+ attr_reader :status
478
+ # Additional details about the capability's status. This value is empty when `status` is `active`.
479
+ attr_reader :status_details
480
+
481
+ def self.inner_class_types
482
+ @inner_class_types = { status_details: StatusDetail }
483
+ end
484
+
485
+ def self.field_remappings
486
+ @field_remappings = {}
487
+ end
488
+ end
489
+
461
490
  class PrepaidCard < ::Stripe::StripeObject
462
491
  class StatusDetail < ::Stripe::StripeObject
463
492
  # Machine-readable code explaining the reason for the Capability to be in its current status.
@@ -486,11 +515,13 @@ module Stripe
486
515
  @field_remappings = {}
487
516
  end
488
517
  end
518
+ # Can create consumer issuing debit cards with Lead as BIN sponsor.
519
+ attr_reader :debit_card
489
520
  # Can create consumer issuing prepaid cards with Lead as BIN sponsor.
490
521
  attr_reader :prepaid_card
491
522
 
492
523
  def self.inner_class_types
493
- @inner_class_types = { prepaid_card: PrepaidCard }
524
+ @inner_class_types = { debit_card: DebitCard, prepaid_card: PrepaidCard }
494
525
  end
495
526
 
496
527
  def self.field_remappings
@@ -4688,6 +4719,83 @@ module Stripe
4688
4719
  end
4689
4720
  end
4690
4721
 
4722
+ class DebitCard < ::Stripe::StripeObject
4723
+ class BankTerms < ::Stripe::StripeObject
4724
+ # The time when the Account's representative accepted the terms of service. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
4725
+ attr_reader :date
4726
+ # The IP address from which the Account's representative accepted the terms of service.
4727
+ attr_reader :ip
4728
+ # The URL to the service agreement the Account's representative accepted.
4729
+ attr_reader :url
4730
+ # The user agent of the browser from which the Account's representative accepted the terms of service.
4731
+ attr_reader :user_agent
4732
+
4733
+ def self.inner_class_types
4734
+ @inner_class_types = {}
4735
+ end
4736
+
4737
+ def self.field_remappings
4738
+ @field_remappings = {}
4739
+ end
4740
+ end
4741
+
4742
+ class FinancingDisclosures < ::Stripe::StripeObject
4743
+ # The time when the Account's representative accepted the terms of service. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
4744
+ attr_reader :date
4745
+ # The IP address from which the Account's representative accepted the terms of service.
4746
+ attr_reader :ip
4747
+ # The URL to the service agreement the Account's representative accepted.
4748
+ attr_reader :url
4749
+ # The user agent of the browser from which the Account's representative accepted the terms of service.
4750
+ attr_reader :user_agent
4751
+
4752
+ def self.inner_class_types
4753
+ @inner_class_types = {}
4754
+ end
4755
+
4756
+ def self.field_remappings
4757
+ @field_remappings = {}
4758
+ end
4759
+ end
4760
+
4761
+ class Platform < ::Stripe::StripeObject
4762
+ # The time when the Account's representative accepted the terms of service. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
4763
+ attr_reader :date
4764
+ # The IP address from which the Account's representative accepted the terms of service.
4765
+ attr_reader :ip
4766
+ # The URL to the service agreement the Account's representative accepted.
4767
+ attr_reader :url
4768
+ # The user agent of the browser from which the Account's representative accepted the terms of service.
4769
+ attr_reader :user_agent
4770
+
4771
+ def self.inner_class_types
4772
+ @inner_class_types = {}
4773
+ end
4774
+
4775
+ def self.field_remappings
4776
+ @field_remappings = {}
4777
+ end
4778
+ end
4779
+ # Bank terms of service acceptance for consumer issuing debit cards with Lead as BIN sponsor.
4780
+ attr_reader :bank_terms
4781
+ # Financial disclosures terms of service acceptance for consumer issuing debit cards with Lead as BIN sponsor.
4782
+ attr_reader :financing_disclosures
4783
+ # Platform terms of service acceptance for consumer issuing debit cards with Lead as BIN sponsor.
4784
+ attr_reader :platform
4785
+
4786
+ def self.inner_class_types
4787
+ @inner_class_types = {
4788
+ bank_terms: BankTerms,
4789
+ financing_disclosures: FinancingDisclosures,
4790
+ platform: Platform,
4791
+ }
4792
+ end
4793
+
4794
+ def self.field_remappings
4795
+ @field_remappings = {}
4796
+ end
4797
+ end
4798
+
4691
4799
  class PrepaidCard < ::Stripe::StripeObject
4692
4800
  class BankTerms < ::Stripe::StripeObject
4693
4801
  # The time when the Account's representative accepted the terms of service. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
@@ -4766,11 +4874,17 @@ module Stripe
4766
4874
  end
4767
4875
  # Terms of service acceptances for commercial issuing Apple Pay cards with Lead as BIN sponsor.
4768
4876
  attr_reader :apple_pay
4877
+ # Terms of service acceptances for consumer issuing debit cards with Lead as BIN sponsor.
4878
+ attr_reader :debit_card
4769
4879
  # Terms of service acceptances for commercial issuing revolving credit cards with Lead as BIN sponsor.
4770
4880
  attr_reader :prepaid_card
4771
4881
 
4772
4882
  def self.inner_class_types
4773
- @inner_class_types = { apple_pay: ApplePay, prepaid_card: PrepaidCard }
4883
+ @inner_class_types = {
4884
+ apple_pay: ApplePay,
4885
+ debit_card: DebitCard,
4886
+ prepaid_card: PrepaidCard,
4887
+ }
4774
4888
  end
4775
4889
 
4776
4890
  def self.field_remappings
@@ -1,3 +1,4 @@
1
+ # File copied from our code generator; changes here will be overwritten.
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
@@ -105,6 +105,7 @@ require "stripe/resources/payment_attempt_record"
105
105
  require "stripe/resources/payment_intent"
106
106
  require "stripe/resources/payment_intent_amount_details_line_item"
107
107
  require "stripe/resources/payment_link"
108
+ require "stripe/resources/payment_location"
108
109
  require "stripe/resources/payment_method"
109
110
  require "stripe/resources/payment_method_balance"
110
111
  require "stripe/resources/payment_method_configuration"
@@ -0,0 +1,50 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PaymentLocationService < StripeService
6
+ # Create a Payment Location.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/payment_locations",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Delete a Payment Location.
18
+ def delete(id, params = {}, opts = {})
19
+ request(
20
+ method: :delete,
21
+ path: format("/v1/payment_locations/%<id>s", { id: CGI.escape(id) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Retrieve a Payment Location.
29
+ def retrieve(id, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/payment_locations/%<id>s", { id: CGI.escape(id) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Update a Payment Location.
40
+ def update(id, params = {}, opts = {})
41
+ request(
42
+ method: :post,
43
+ path: format("/v1/payment_locations/%<id>s", { id: CGI.escape(id) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+ end
50
+ 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_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_settings, :balance_transactions, :balance_transfers, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :delegated_checkout, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :external_accounts, :files, :file_links, :financial_connections, :forwarding, :fr_meal_vouchers_onboardings, :fx_quotes, :identity, :invoices, :invoice_items, :invoice_payments, :invoice_rendering_templates, :issuing, :mandates, :margins, :orchestration, :orders, :payment_attempt_records, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payment_records, :payouts, :plans, :prices, :privacy, :products, :product_catalog, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reserve, :reviews, :setup_attempts, :setup_intents, :shared_payment, :shipping_rates, :sigma, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :test_helpers, :tokens, :topups, :transfers, :treasury, :webhook_endpoints
7
+ attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_settings, :balance_transactions, :balance_transfers, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :delegated_checkout, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :external_accounts, :files, :file_links, :financial_connections, :forwarding, :fr_meal_vouchers_onboardings, :fx_quotes, :identity, :invoices, :invoice_items, :invoice_payments, :invoice_rendering_templates, :issuing, :mandates, :margins, :orchestration, :orders, :payment_attempt_records, :payment_intents, :payment_links, :payment_locations, :payment_methods, :payment_method_configurations, :payment_method_domains, :payment_records, :payouts, :plans, :prices, :privacy, :products, :product_catalog, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reserve, :reviews, :setup_attempts, :setup_intents, :shared_payment, :shipping_rates, :sigma, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :test_helpers, :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
@@ -62,6 +62,7 @@ module Stripe
62
62
  @payment_attempt_records = Stripe::PaymentAttemptRecordService.new(@requestor)
63
63
  @payment_intents = Stripe::PaymentIntentService.new(@requestor)
64
64
  @payment_links = Stripe::PaymentLinkService.new(@requestor)
65
+ @payment_locations = Stripe::PaymentLocationService.new(@requestor)
65
66
  @payment_methods = Stripe::PaymentMethodService.new(@requestor)
66
67
  @payment_method_configurations = Stripe::PaymentMethodConfigurationService.new(@requestor)
67
68
  @payment_method_domains = Stripe::PaymentMethodDomainService.new(@requestor)
@@ -116,6 +116,7 @@ require "stripe/services/payment_intent_amount_details_line_item_service"
116
116
  require "stripe/services/payment_intent_service"
117
117
  require "stripe/services/payment_link_line_item_service"
118
118
  require "stripe/services/payment_link_service"
119
+ require "stripe/services/payment_location_service"
119
120
  require "stripe/services/payment_method_configuration_service"
120
121
  require "stripe/services/payment_method_domain_service"
121
122
  require "stripe/services/payment_method_service"
@@ -8,9 +8,12 @@ module Stripe
8
8
  # attr_readers: The beginning of the section generated from our OpenAPI spec
9
9
  attr_reader :v1
10
10
  attr_reader :v2
11
-
12
11
  # attr_readers: The end of the section generated from our OpenAPI spec
13
12
 
13
+ # For internal use only. Does not provide a stable API and may be broken
14
+ # with future non-major changes.
15
+ attr_reader :requestor
16
+
14
17
  # For internal use only. Does not provide a stable API and may be broken
15
18
  # with future non-major changes.
16
19
  CLIENT_OPTIONS = Set.new(%i[api_key stripe_account stripe_context api_version api_base uploads_base connect_base meter_events_base client_id])
@@ -93,5 +96,9 @@ module Stripe
93
96
  data = JSON.parse(data) if data.is_a?(String)
94
97
  Util.convert_to_stripe_object(data, {}, api_mode: api_mode, requestor: @requestor)
95
98
  end
99
+
100
+ def notification_handler(webhook_secret, &fallback_callback)
101
+ ::Stripe::StripeEventNotificationHandler.new(self, webhook_secret, &fallback_callback)
102
+ end
96
103
  end
97
104
  end