stripe 5.41.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +256 -0
  3. data/Gemfile +5 -2
  4. data/Makefile +13 -0
  5. data/OPENAPI_VERSION +1 -0
  6. data/README.md +40 -6
  7. data/VERSION +1 -1
  8. data/lib/data/ca-certificates.crt +1241 -1937
  9. data/lib/stripe/api_operations/create.rb +6 -2
  10. data/lib/stripe/api_operations/delete.rb +12 -7
  11. data/lib/stripe/api_operations/list.rb +6 -9
  12. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  13. data/lib/stripe/api_operations/request.rb +10 -0
  14. data/lib/stripe/api_operations/save.rb +13 -3
  15. data/lib/stripe/api_operations/search.rb +16 -0
  16. data/lib/stripe/api_resource.rb +3 -18
  17. data/lib/stripe/api_resource_test_helpers.rb +49 -0
  18. data/lib/stripe/api_version.rb +8 -0
  19. data/lib/stripe/connection_manager.rb +22 -1
  20. data/lib/stripe/instrumentation.rb +45 -7
  21. data/lib/stripe/object_types.rb +29 -10
  22. data/lib/stripe/resources/account.rb +36 -9
  23. data/lib/stripe/resources/account_link.rb +4 -0
  24. data/lib/stripe/resources/application_fee_refund.rb +5 -0
  25. data/lib/stripe/resources/apps/secret.rb +40 -0
  26. data/lib/stripe/resources/balance.rb +11 -0
  27. data/lib/stripe/resources/balance_transaction.rb +4 -0
  28. data/lib/stripe/resources/bank_account.rb +7 -0
  29. data/lib/stripe/resources/billing_portal/configuration.rb +1 -0
  30. data/lib/stripe/resources/billing_portal/session.rb +14 -0
  31. data/lib/stripe/resources/capability.rb +3 -0
  32. data/lib/stripe/resources/card.rb +6 -3
  33. data/lib/stripe/resources/cash_balance.rb +23 -0
  34. data/lib/stripe/resources/charge.rb +23 -3
  35. data/lib/stripe/resources/checkout/session.rb +41 -5
  36. data/lib/stripe/resources/country_spec.rb +6 -0
  37. data/lib/stripe/resources/coupon.rb +3 -0
  38. data/lib/stripe/resources/credit_note.rb +27 -9
  39. data/lib/stripe/resources/credit_note_line_item.rb +1 -0
  40. data/lib/stripe/resources/customer.rb +124 -12
  41. data/lib/stripe/resources/customer_balance_transaction.rb +6 -0
  42. data/lib/stripe/resources/customer_cash_balance_transaction.rb +14 -0
  43. data/lib/stripe/resources/discount.rb +4 -0
  44. data/lib/stripe/resources/dispute.rb +17 -3
  45. data/lib/stripe/resources/event.rb +29 -0
  46. data/lib/stripe/resources/exchange_rate.rb +11 -0
  47. data/lib/stripe/resources/file.rb +7 -0
  48. data/lib/stripe/resources/file_link.rb +3 -0
  49. data/lib/stripe/resources/financial_connections/account.rb +67 -0
  50. data/lib/stripe/resources/financial_connections/account_owner.rb +11 -0
  51. data/lib/stripe/resources/financial_connections/account_ownership.rb +11 -0
  52. data/lib/stripe/resources/financial_connections/session.rb +13 -0
  53. data/lib/stripe/resources/funding_instructions.rb +21 -0
  54. data/lib/stripe/resources/identity/verification_report.rb +11 -0
  55. data/lib/stripe/resources/identity/verification_session.rb +31 -5
  56. data/lib/stripe/resources/invoice.rb +105 -17
  57. data/lib/stripe/resources/invoice_item.rb +11 -0
  58. data/lib/stripe/resources/issuing/authorization.rb +25 -5
  59. data/lib/stripe/resources/issuing/card.rb +78 -8
  60. data/lib/stripe/resources/issuing/cardholder.rb +3 -0
  61. data/lib/stripe/resources/issuing/dispute.rb +13 -3
  62. data/lib/stripe/resources/issuing/transaction.rb +5 -0
  63. data/lib/stripe/resources/line_item.rb +1 -0
  64. data/lib/stripe/resources/login_link.rb +1 -0
  65. data/lib/stripe/resources/mandate.rb +1 -0
  66. data/lib/stripe/resources/payment_intent.rb +103 -6
  67. data/lib/stripe/resources/payment_link.rb +35 -0
  68. data/lib/stripe/resources/payment_method.rb +25 -5
  69. data/lib/stripe/resources/payout.rb +28 -5
  70. data/lib/stripe/resources/person.rb +6 -0
  71. data/lib/stripe/resources/plan.rb +8 -0
  72. data/lib/stripe/resources/price.rb +15 -0
  73. data/lib/stripe/resources/product.rb +17 -0
  74. data/lib/stripe/resources/promotion_code.rb +2 -0
  75. data/lib/stripe/resources/quote.rb +58 -35
  76. data/lib/stripe/resources/radar/early_fraud_warning.rb +4 -0
  77. data/lib/stripe/resources/radar/value_list.rb +3 -0
  78. data/lib/stripe/resources/radar/value_list_item.rb +3 -0
  79. data/lib/stripe/resources/refund.rb +49 -0
  80. data/lib/stripe/resources/reporting/report_run.rb +8 -0
  81. data/lib/stripe/resources/reporting/report_type.rb +8 -1
  82. data/lib/stripe/resources/reversal.rb +13 -0
  83. data/lib/stripe/resources/review.rb +14 -3
  84. data/lib/stripe/resources/setup_attempt.rb +4 -0
  85. data/lib/stripe/resources/setup_intent.rb +60 -5
  86. data/lib/stripe/resources/shipping_rate.rb +2 -0
  87. data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -0
  88. data/lib/stripe/resources/source.rb +26 -6
  89. data/lib/stripe/resources/source_transaction.rb +4 -0
  90. data/lib/stripe/resources/subscription.rb +57 -3
  91. data/lib/stripe/resources/subscription_item.rb +2 -7
  92. data/lib/stripe/resources/subscription_schedule.rb +23 -5
  93. data/lib/stripe/resources/tax/calculation.rb +33 -0
  94. data/lib/stripe/resources/tax/calculation_line_item.rb +10 -0
  95. data/lib/stripe/resources/tax/settings.rb +15 -0
  96. data/lib/stripe/resources/tax/transaction.rb +49 -0
  97. data/lib/stripe/resources/tax/transaction_line_item.rb +10 -0
  98. data/lib/stripe/resources/tax_code.rb +1 -0
  99. data/lib/stripe/resources/tax_id.rb +4 -0
  100. data/lib/stripe/resources/tax_rate.rb +3 -0
  101. data/lib/stripe/resources/terminal/configuration.rb +16 -0
  102. data/lib/stripe/resources/terminal/connection_token.rb +3 -0
  103. data/lib/stripe/resources/terminal/location.rb +3 -0
  104. data/lib/stripe/resources/terminal/reader.rb +119 -0
  105. data/lib/stripe/resources/test_helpers/test_clock.rb +35 -0
  106. data/lib/stripe/resources/token.rb +20 -0
  107. data/lib/stripe/resources/topup.rb +15 -3
  108. data/lib/stripe/resources/transfer.rb +10 -11
  109. data/lib/stripe/resources/treasury/credit_reversal.rb +14 -0
  110. data/lib/stripe/resources/treasury/debit_reversal.rb +14 -0
  111. data/lib/stripe/resources/treasury/financial_account.rb +52 -0
  112. data/lib/stripe/resources/treasury/financial_account_features.rb +12 -0
  113. data/lib/stripe/resources/treasury/inbound_transfer.rb +94 -0
  114. data/lib/stripe/resources/treasury/outbound_payment.rb +96 -0
  115. data/lib/stripe/resources/treasury/outbound_transfer.rb +100 -0
  116. data/lib/stripe/resources/treasury/received_credit.rb +30 -0
  117. data/lib/stripe/resources/treasury/received_debit.rb +30 -0
  118. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  119. data/lib/stripe/resources/treasury/transaction_entry.rb +17 -0
  120. data/lib/stripe/resources/usage_record.rb +4 -0
  121. data/lib/stripe/resources/webhook_endpoint.rb +7 -0
  122. data/lib/stripe/resources.rb +27 -10
  123. data/lib/stripe/search_result_object.rb +86 -0
  124. data/lib/stripe/stripe_client.rb +37 -22
  125. data/lib/stripe/stripe_configuration.rb +5 -1
  126. data/lib/stripe/stripe_object.rb +2 -2
  127. data/lib/stripe/util.rb +85 -2
  128. data/lib/stripe/version.rb +1 -1
  129. data/lib/stripe.rb +5 -1
  130. data/stripe.gemspec +3 -3
  131. metadata +39 -14
  132. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  133. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  134. data/lib/stripe/resources/issuing/card_details.rb +0 -10
  135. data/lib/stripe/resources/order.rb +0 -33
  136. data/lib/stripe/resources/order_return.rb +0 -10
  137. data/lib/stripe/resources/recipient.rb +0 -14
  138. data/lib/stripe/resources/sku.rb +0 -13
  139. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -2,11 +2,60 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # `Refund` objects allow you to refund a charge that has previously been created
6
+ # but not yet refunded. Funds will be refunded to the credit or debit card that
7
+ # was originally charged.
8
+ #
9
+ # Related guide: [Refunds](https://stripe.com/docs/refunds)
5
10
  class Refund < APIResource
6
11
  extend Stripe::APIOperations::Create
7
12
  extend Stripe::APIOperations::List
8
13
  include Stripe::APIOperations::Save
9
14
 
10
15
  OBJECT_NAME = "refund"
16
+
17
+ def cancel(params = {}, opts = {})
18
+ request_stripe_object(
19
+ method: :post,
20
+ path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(self["id"]) }),
21
+ params: params,
22
+ opts: opts
23
+ )
24
+ end
25
+
26
+ def self.cancel(refund, params = {}, opts = {})
27
+ request_stripe_object(
28
+ method: :post,
29
+ path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(refund) }),
30
+ params: params,
31
+ opts: opts
32
+ )
33
+ end
34
+
35
+ def test_helpers
36
+ TestHelpers.new(self)
37
+ end
38
+
39
+ class TestHelpers < APIResourceTestHelpers
40
+ RESOURCE_CLASS = Refund
41
+
42
+ def self.expire(refund, params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :post,
45
+ path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(refund) }),
46
+ params: params,
47
+ opts: opts
48
+ )
49
+ end
50
+
51
+ def expire(params = {}, opts = {})
52
+ @resource.request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(@resource["id"]) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
59
+ end
11
60
  end
12
61
  end
@@ -3,6 +3,14 @@
3
3
 
4
4
  module Stripe
5
5
  module Reporting
6
+ # The Report Run object represents an instance of a report type generated with
7
+ # specific run parameters. Once the object is created, Stripe begins processing the report.
8
+ # When the report has finished running, it will give you a reference to a file
9
+ # where you can retrieve your results. For an overview, see
10
+ # [API Access to Reports](https://stripe.com/docs/reporting/statements/api).
11
+ #
12
+ # Note that certain report types can only be run based on your live-mode data (not test-mode
13
+ # data), and will error when queried without a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).
6
14
  class ReportRun < APIResource
7
15
  extend Stripe::APIOperations::Create
8
16
  extend Stripe::APIOperations::List
@@ -3,8 +3,15 @@
3
3
 
4
4
  module Stripe
5
5
  module Reporting
6
+ # The Report Type resource corresponds to a particular type of report, such as
7
+ # the "Activity summary" or "Itemized payouts" reports. These objects are
8
+ # identified by an ID belonging to a set of enumerated values. See
9
+ # [API Access to Reports documentation](https://stripe.com/docs/reporting/statements/api)
10
+ # for those Report Type IDs, along with required and optional parameters.
11
+ #
12
+ # Note that certain report types can only be run based on your live-mode data (not test-mode
13
+ # data), and will error when queried without a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).
6
14
  class ReportType < APIResource
7
- extend Stripe::APIOperations::Create
8
15
  extend Stripe::APIOperations::List
9
16
 
10
17
  OBJECT_NAME = "reporting.report_type"
@@ -2,6 +2,19 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # [Stripe Connect](https://stripe.com/docs/connect) platforms can reverse transfers made to a
6
+ # connected account, either entirely or partially, and can also specify whether
7
+ # to refund any related application fees. Transfer reversals add to the
8
+ # platform's balance and subtract from the destination account's balance.
9
+ #
10
+ # Reversing a transfer that was made for a [destination
11
+ # charge](https://stripe.com/docs/connect/destination-charges) is allowed only up to the amount of
12
+ # the charge. It is possible to reverse a
13
+ # [transfer_group](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options)
14
+ # transfer only if the destination account has enough balance to cover the
15
+ # reversal.
16
+ #
17
+ # Related guide: [Reversing transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#reversing-transfers)
5
18
  class Reversal < APIResource
6
19
  extend Stripe::APIOperations::List
7
20
  include Stripe::APIOperations::Save
@@ -2,17 +2,28 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Reviews can be used to supplement automated fraud detection with human expertise.
6
+ #
7
+ # Learn more about [Radar](https://stripe.com/radar) and reviewing payments
8
+ # [here](https://stripe.com/docs/radar/reviews).
5
9
  class Review < APIResource
6
10
  extend Stripe::APIOperations::List
7
11
 
8
12
  OBJECT_NAME = "review"
9
13
 
10
- custom_method :approve, http_verb: :post
11
-
12
14
  def approve(params = {}, opts = {})
13
15
  request_stripe_object(
14
16
  method: :post,
15
- path: resource_url + "/approve",
17
+ path: format("/v1/reviews/%<review>s/approve", { review: CGI.escape(self["id"]) }),
18
+ params: params,
19
+ opts: opts
20
+ )
21
+ end
22
+
23
+ def self.approve(review, params = {}, opts = {})
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: format("/v1/reviews/%<review>s/approve", { review: CGI.escape(review) }),
16
27
  params: params,
17
28
  opts: opts
18
29
  )
@@ -2,6 +2,10 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A SetupAttempt describes one attempted confirmation of a SetupIntent,
6
+ # whether that confirmation was successful or unsuccessful. You can use
7
+ # SetupAttempts to inspect details of a specific attempt at setting up a
8
+ # payment method using a SetupIntent.
5
9
  class SetupAttempt < APIResource
6
10
  extend Stripe::APIOperations::List
7
11
 
@@ -2,6 +2,28 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments.
6
+ # For example, you could use a SetupIntent to set up and save your customer's card without immediately collecting a payment.
7
+ # Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow.
8
+ #
9
+ # Create a SetupIntent as soon as you're ready to collect your customer's payment credentials.
10
+ # Do not maintain long-lived, unconfirmed SetupIntents as they may no longer be valid.
11
+ # The SetupIntent then transitions through multiple [statuses](https://stripe.com/docs/payments/intents#intent-statuses) as it guides
12
+ # you through the setup process.
13
+ #
14
+ # Successful SetupIntents result in payment credentials that are optimized for future payments.
15
+ # For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) may need to be run through
16
+ # [Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication) at the time of payment method collection
17
+ # in order to streamline later [off-session payments](https://stripe.com/docs/payments/setup-intents).
18
+ # If the SetupIntent is used with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer), upon success,
19
+ # it will automatically attach the resulting payment method to that Customer.
20
+ # We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on
21
+ # PaymentIntents to save payment methods in order to prevent saving invalid or unoptimized payment methods.
22
+ #
23
+ # By using SetupIntents, you ensure that your customers experience the minimum set of required friction,
24
+ # even as regulations change over time.
25
+ #
26
+ # Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents)
5
27
  class SetupIntent < APIResource
6
28
  extend Stripe::APIOperations::Create
7
29
  extend Stripe::APIOperations::List
@@ -9,13 +31,10 @@ module Stripe
9
31
 
10
32
  OBJECT_NAME = "setup_intent"
11
33
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :confirm, http_verb: :post
14
-
15
34
  def cancel(params = {}, opts = {})
16
35
  request_stripe_object(
17
36
  method: :post,
18
- path: resource_url + "/cancel",
37
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
19
38
  params: params,
20
39
  opts: opts
21
40
  )
@@ -24,7 +43,43 @@ module Stripe
24
43
  def confirm(params = {}, opts = {})
25
44
  request_stripe_object(
26
45
  method: :post,
27
- path: resource_url + "/confirm",
46
+ path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
47
+ params: params,
48
+ opts: opts
49
+ )
50
+ end
51
+
52
+ def verify_microdeposits(params = {}, opts = {})
53
+ request_stripe_object(
54
+ method: :post,
55
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
56
+ params: params,
57
+ opts: opts
58
+ )
59
+ end
60
+
61
+ def self.cancel(intent, params = {}, opts = {})
62
+ request_stripe_object(
63
+ method: :post,
64
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
65
+ params: params,
66
+ opts: opts
67
+ )
68
+ end
69
+
70
+ def self.confirm(intent, params = {}, opts = {})
71
+ request_stripe_object(
72
+ method: :post,
73
+ path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
74
+ params: params,
75
+ opts: opts
76
+ )
77
+ end
78
+
79
+ def self.verify_microdeposits(intent, params = {}, opts = {})
80
+ request_stripe_object(
81
+ method: :post,
82
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
28
83
  params: params,
29
84
  opts: opts
30
85
  )
@@ -2,6 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Shipping rates describe the price of shipping presented to your customers and
6
+ # applied to a purchase. For more information, see [Charge for shipping](https://stripe.com/docs/payments/during-payment/charge-shipping).
5
7
  class ShippingRate < APIResource
6
8
  extend Stripe::APIOperations::Create
7
9
  extend Stripe::APIOperations::List
@@ -3,6 +3,10 @@
3
3
 
4
4
  module Stripe
5
5
  module Sigma
6
+ # If you have [scheduled a Sigma query](https://stripe.com/docs/sigma/scheduled-queries), you'll
7
+ # receive a `sigma.scheduled_query_run.created` webhook each time the query
8
+ # runs. The webhook contains a `ScheduledQueryRun` object, which you can use to
9
+ # retrieve the query results.
6
10
  class ScheduledQueryRun < APIResource
7
11
  extend Stripe::APIOperations::List
8
12
 
@@ -2,6 +2,16 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # `Source` objects allow you to accept a variety of payment methods. They
6
+ # represent a customer's payment instrument, and can be used with the Stripe API
7
+ # just like a `Card` object: once chargeable, they can be charged, or can be
8
+ # attached to customers.
9
+ #
10
+ # Stripe doesn't recommend using the deprecated [Sources API](https://stripe.com/docs/api/sources).
11
+ # We recommend that you adopt the [PaymentMethods API](https://stripe.com/docs/api/payment_methods).
12
+ # This newer API provides access to our latest features and payment method types.
13
+ #
14
+ # Related guides: [Sources API](https://stripe.com/docs/sources) and [Sources & Customers](https://stripe.com/docs/sources/customers).
5
15
  class Source < APIResource
6
16
  extend Stripe::APIOperations::Create
7
17
  include Stripe::APIOperations::Save
@@ -9,15 +19,22 @@ module Stripe
9
19
 
10
20
  OBJECT_NAME = "source"
11
21
 
12
- custom_method :verify, http_verb: :post
13
-
14
22
  nested_resource_class_methods :source_transaction,
15
23
  operations: %i[retrieve list]
16
24
 
17
25
  def verify(params = {}, opts = {})
18
26
  request_stripe_object(
19
27
  method: :post,
20
- path: resource_url + "/verify",
28
+ path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(self["id"]) }),
29
+ params: params,
30
+ opts: opts
31
+ )
32
+ end
33
+
34
+ def self.verify(source, params = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :post,
37
+ path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(source) }),
21
38
  params: params,
22
39
  opts: opts
23
40
  )
@@ -37,9 +54,12 @@ module Stripe
37
54
  end
38
55
 
39
56
  def source_transactions(params = {}, opts = {})
40
- resp, opts = execute_resource_request(:get, resource_url + "/source_transactions", params,
41
- opts)
42
- Util.convert_to_stripe_object(resp.data, opts)
57
+ request_stripe_object(
58
+ method: :get,
59
+ path: resource_url + "/source_transactions",
60
+ params: params,
61
+ opts: opts
62
+ )
43
63
  end
44
64
  extend Gem::Deprecate
45
65
  deprecate :source_transactions, :"Source.list_source_transactions", 2020, 1
@@ -2,6 +2,10 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Some payment methods have no required amount that a customer must send.
6
+ # Customers can be instructed to send any amount, and it can be made up of
7
+ # multiple transactions. As such, sources can have multiple associated
8
+ # transactions.
5
9
  class SourceTransaction < StripeObject
6
10
  OBJECT_NAME = "source_transaction"
7
11
  end
@@ -2,25 +2,79 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Subscriptions allow you to charge a customer on a recurring basis.
6
+ #
7
+ # Related guide: [Creating subscriptions](https://stripe.com/docs/billing/subscriptions/creating)
5
8
  class Subscription < APIResource
6
9
  extend Stripe::APIOperations::Create
7
- include Stripe::APIOperations::Delete
8
10
  extend Stripe::APIOperations::List
11
+ extend Stripe::APIOperations::Search
9
12
  include Stripe::APIOperations::Save
10
13
 
11
14
  OBJECT_NAME = "subscription"
12
15
 
13
- custom_method :delete_discount, http_verb: :delete, http_path: "discount"
16
+ def cancel(params = {}, opts = {})
17
+ request_stripe_object(
18
+ method: :delete,
19
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(self["id"]) }),
20
+ params: params,
21
+ opts: opts
22
+ )
23
+ end
14
24
 
15
25
  def delete_discount(params = {}, opts = {})
16
26
  request_stripe_object(
17
27
  method: :delete,
18
- path: resource_url + "/discount",
28
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(self["id"]) }),
29
+ params: params,
30
+ opts: opts
31
+ )
32
+ end
33
+
34
+ def resume(params = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :post,
37
+ path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(self["id"]) }),
38
+ params: params,
39
+ opts: opts
40
+ )
41
+ end
42
+
43
+ def self.cancel(subscription_exposed_id, params = {}, opts = {})
44
+ request_stripe_object(
45
+ method: :delete,
46
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
47
+ params: params,
48
+ opts: opts
49
+ )
50
+ end
51
+
52
+ def self.delete_discount(subscription_exposed_id, params = {}, opts = {})
53
+ request_stripe_object(
54
+ method: :delete,
55
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
56
+ params: params,
57
+ opts: opts
58
+ )
59
+ end
60
+
61
+ def self.resume(subscription, params = {}, opts = {})
62
+ request_stripe_object(
63
+ method: :post,
64
+ path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(subscription) }),
19
65
  params: params,
20
66
  opts: opts
21
67
  )
22
68
  end
23
69
 
24
70
  save_nested_resource :source
71
+
72
+ def self.search(params = {}, opts = {})
73
+ _search("/v1/subscriptions/search", params, opts)
74
+ end
75
+
76
+ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
77
+ search(params, opts).auto_paging_each(&blk)
78
+ end
25
79
  end
26
80
  end
@@ -2,6 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Subscription items allow you to create customer subscriptions with more than
6
+ # one plan, making it easy to represent complex billing relationships.
5
7
  class SubscriptionItem < APIResource
6
8
  extend Stripe::APIOperations::Create
7
9
  include Stripe::APIOperations::Delete
@@ -15,12 +17,5 @@ module Stripe
15
17
  nested_resource_class_methods :usage_record_summary,
16
18
  operations: %i[list],
17
19
  resource_plural: "usage_record_summaries"
18
-
19
- def usage_record_summaries(params = {}, opts = {})
20
- resp, opts = execute_resource_request(:get, resource_url + "/usage_record_summaries", params, opts)
21
- Util.convert_to_stripe_object(resp.data, opts)
22
- end
23
- extend Gem::Deprecate
24
- deprecate :usage_record_summaries, :"SubscriptionItem.list_usage_record_summaries", 2020, 1
25
20
  end
26
21
  end
@@ -2,6 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.
6
+ #
7
+ # Related guide: [Subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules)
5
8
  class SubscriptionSchedule < APIResource
6
9
  extend Stripe::APIOperations::Create
7
10
  extend Stripe::APIOperations::List
@@ -9,13 +12,10 @@ module Stripe
9
12
 
10
13
  OBJECT_NAME = "subscription_schedule"
11
14
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :release, http_verb: :post
14
-
15
15
  def cancel(params = {}, opts = {})
16
16
  request_stripe_object(
17
17
  method: :post,
18
- path: resource_url + "/cancel",
18
+ path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(self["id"]) }),
19
19
  params: params,
20
20
  opts: opts
21
21
  )
@@ -24,7 +24,25 @@ module Stripe
24
24
  def release(params = {}, opts = {})
25
25
  request_stripe_object(
26
26
  method: :post,
27
- path: resource_url + "/release",
27
+ path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(self["id"]) }),
28
+ params: params,
29
+ opts: opts
30
+ )
31
+ end
32
+
33
+ def self.cancel(schedule, params = {}, opts = {})
34
+ request_stripe_object(
35
+ method: :post,
36
+ path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(schedule) }),
37
+ params: params,
38
+ opts: opts
39
+ )
40
+ end
41
+
42
+ def self.release(schedule, params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :post,
45
+ path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }),
28
46
  params: params,
29
47
  opts: opts
30
48
  )
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ # A Tax Calculation allows you to calculate the tax to collect from your customer.
7
+ #
8
+ # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom)
9
+ class Calculation < APIResource
10
+ extend Stripe::APIOperations::Create
11
+
12
+ OBJECT_NAME = "tax.calculation"
13
+
14
+ def list_line_items(params = {}, opts = {})
15
+ request_stripe_object(
16
+ method: :get,
17
+ path: format("/v1/tax/calculations/%<calculation>s/line_items", { calculation: CGI.escape(self["id"]) }),
18
+ params: params,
19
+ opts: opts
20
+ )
21
+ end
22
+
23
+ def self.list_line_items(calculation, params = {}, opts = {})
24
+ request_stripe_object(
25
+ method: :get,
26
+ path: format("/v1/tax/calculations/%<calculation>s/line_items", { calculation: CGI.escape(calculation) }),
27
+ params: params,
28
+ opts: opts
29
+ )
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,10 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ class CalculationLineItem < APIResource
7
+ OBJECT_NAME = "tax.calculation_line_item"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ # You can use Tax `Settings` to manage configurations used by Stripe Tax calculations.
7
+ #
8
+ # Related guide: [Using the Settings API](https://stripe.com/docs/tax/settings-api)
9
+ class Settings < SingletonAPIResource
10
+ include Stripe::APIOperations::Save
11
+
12
+ OBJECT_NAME = "tax.settings"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,49 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ # A Tax Transaction records the tax collected from or refunded to your customer.
7
+ #
8
+ # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom#tax-transaction)
9
+ class Transaction < APIResource
10
+ OBJECT_NAME = "tax.transaction"
11
+
12
+ def list_line_items(params = {}, opts = {})
13
+ request_stripe_object(
14
+ method: :get,
15
+ path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.create_from_calculation(params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: "/v1/tax/transactions/create_from_calculation",
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.create_reversal(params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: "/v1/tax/transactions/create_reversal",
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.list_line_items(transaction, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :get,
42
+ path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(transaction) }),
43
+ params: params,
44
+ opts: opts
45
+ )
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,10 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ class TransactionLineItem < APIResource
7
+ OBJECT_NAME = "tax.transaction_line_item"
8
+ end
9
+ end
10
+ end
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # [Tax codes](https://stripe.com/docs/tax/tax-categories) classify goods and services for tax purposes.
5
6
  class TaxCode < APIResource
6
7
  extend Stripe::APIOperations::List
7
8
 
@@ -2,6 +2,10 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # You can add one or multiple tax IDs to a [customer](https://stripe.com/docs/api/customers).
6
+ # A customer's tax IDs are displayed on invoices and credit notes issued for the customer.
7
+ #
8
+ # Related guide: [Customer tax identification numbers](https://stripe.com/docs/billing/taxes/tax-ids)
5
9
  class TaxId < APIResource
6
10
  include Stripe::APIOperations::Delete
7
11
  extend Stripe::APIOperations::List
@@ -2,6 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax.
6
+ #
7
+ # Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates)
5
8
  class TaxRate < APIResource
6
9
  extend Stripe::APIOperations::Create
7
10
  extend Stripe::APIOperations::List
@@ -0,0 +1,16 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Terminal
6
+ # A Configurations object represents how features should be configured for terminal readers.
7
+ class Configuration < APIResource
8
+ extend Stripe::APIOperations::Create
9
+ include Stripe::APIOperations::Delete
10
+ extend Stripe::APIOperations::List
11
+ include Stripe::APIOperations::Save
12
+
13
+ OBJECT_NAME = "terminal.configuration"
14
+ end
15
+ end
16
+ end