stripe 10.10.0 → 10.11.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +285 -40
  3. data/README.md +11 -0
  4. data/VERSION +1 -1
  5. data/lib/stripe/api_operations/request.rb +2 -1
  6. data/lib/stripe/api_version.rb +1 -0
  7. data/lib/stripe/object_types.rb +23 -0
  8. data/lib/stripe/request_signing_authenticator.rb +79 -0
  9. data/lib/stripe/resources/account_notice.rb +32 -0
  10. data/lib/stripe/resources/capital/financing_offer.rb +49 -0
  11. data/lib/stripe/resources/capital/financing_summary.rb +15 -0
  12. data/lib/stripe/resources/capital/financing_transaction.rb +27 -0
  13. data/lib/stripe/resources/confirmation_token.rb +16 -0
  14. data/lib/stripe/resources/customer.rb +11 -0
  15. data/lib/stripe/resources/customer_entitlement.rb +12 -0
  16. data/lib/stripe/resources/customer_entitlement_summary.rb +12 -0
  17. data/lib/stripe/resources/entitlements/event.rb +26 -0
  18. data/lib/stripe/resources/entitlements/feature.rb +38 -0
  19. data/lib/stripe/resources/financial_connections/account.rb +3 -0
  20. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +14 -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 +53 -0
  24. data/lib/stripe/resources/invoice_payment.rb +12 -0
  25. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +88 -0
  26. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  27. data/lib/stripe/resources/issuing/physical_bundle.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_phase.rb +39 -0
  33. data/lib/stripe/resources/quote_preview_invoice.rb +43 -0
  34. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +11 -0
  35. data/lib/stripe/resources/subscription_schedule.rb +20 -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.rb +22 -0
  39. data/lib/stripe/stripe_client.rb +62 -28
  40. data/lib/stripe/stripe_configuration.rb +2 -1
  41. data/lib/stripe/util.rb +8 -1
  42. data/lib/stripe/version.rb +1 -1
  43. data/lib/stripe.rb +46 -0
  44. metadata +26 -3
@@ -8,12 +8,16 @@ module Stripe
8
8
  extend Stripe::APIOperations::Create
9
9
  extend Stripe::APIOperations::List
10
10
  include Stripe::APIOperations::Save
11
+ extend Stripe::APIOperations::NestedResource
11
12
 
12
13
  OBJECT_NAME = "quote"
13
14
  def self.object_name
14
15
  "quote"
15
16
  end
16
17
 
18
+ nested_resource_class_methods :preview_invoice, operations: %i[list]
19
+ nested_resource_class_methods :preview_subscription_schedule, operations: %i[list]
20
+
17
21
  # Accepts the specified quote.
18
22
  def accept(params = {}, opts = {})
19
23
  request_stripe_object(
@@ -64,6 +68,46 @@ module Stripe
64
68
  )
65
69
  end
66
70
 
71
+ # Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
72
+ def list_lines(params = {}, opts = {})
73
+ request_stripe_object(
74
+ method: :get,
75
+ path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(self["id"]) }),
76
+ params: params,
77
+ opts: opts
78
+ )
79
+ end
80
+
81
+ # Preview the invoice line items that would be generated by accepting the quote.
82
+ def list_preview_invoice_lines(preview_invoice, params = {}, opts = {})
83
+ request_stripe_object(
84
+ method: :get,
85
+ path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(self["id"]), preview_invoice: CGI.escape(preview_invoice) }),
86
+ params: params,
87
+ opts: opts
88
+ )
89
+ end
90
+
91
+ # Converts a stale quote to draft.
92
+ def mark_draft(params = {}, opts = {})
93
+ request_stripe_object(
94
+ method: :post,
95
+ path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(self["id"]) }),
96
+ params: params,
97
+ opts: opts
98
+ )
99
+ end
100
+
101
+ # Converts a draft or open quote to stale.
102
+ def mark_stale(params = {}, opts = {})
103
+ request_stripe_object(
104
+ method: :post,
105
+ path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(self["id"]) }),
106
+ params: params,
107
+ opts: opts
108
+ )
109
+ end
110
+
67
111
  # Download the PDF for a finalized quote
68
112
  def pdf(params = {}, opts = {}, &read_body_chunk_block)
69
113
  config = opts[:client]&.config || Stripe.config
@@ -77,6 +121,16 @@ module Stripe
77
121
  )
78
122
  end
79
123
 
124
+ # Recompute the upcoming invoice estimate for the quote.
125
+ def reestimate(params = {}, opts = {})
126
+ request_stripe_object(
127
+ method: :post,
128
+ path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(self["id"]) }),
129
+ params: params,
130
+ opts: opts
131
+ )
132
+ end
133
+
80
134
  # Accepts the specified quote.
81
135
  def self.accept(quote, params = {}, opts = {})
82
136
  request_stripe_object(
@@ -127,6 +181,46 @@ module Stripe
127
181
  )
128
182
  end
129
183
 
184
+ # Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
185
+ def self.list_lines(quote, params = {}, opts = {})
186
+ request_stripe_object(
187
+ method: :get,
188
+ path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(quote) }),
189
+ params: params,
190
+ opts: opts
191
+ )
192
+ end
193
+
194
+ # Preview the invoice line items that would be generated by accepting the quote.
195
+ def self.list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {})
196
+ request_stripe_object(
197
+ method: :get,
198
+ path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(quote), preview_invoice: CGI.escape(preview_invoice) }),
199
+ params: params,
200
+ opts: opts
201
+ )
202
+ end
203
+
204
+ # Converts a stale quote to draft.
205
+ def self.mark_draft(quote, params = {}, opts = {})
206
+ request_stripe_object(
207
+ method: :post,
208
+ path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(quote) }),
209
+ params: params,
210
+ opts: opts
211
+ )
212
+ end
213
+
214
+ # Converts a draft or open quote to stale.
215
+ def self.mark_stale(quote, params = {}, opts = {})
216
+ request_stripe_object(
217
+ method: :post,
218
+ path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(quote) }),
219
+ params: params,
220
+ opts: opts
221
+ )
222
+ end
223
+
130
224
  # Download the PDF for a finalized quote
131
225
  def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
132
226
  config = opts[:client]&.config || Stripe.config
@@ -140,6 +234,16 @@ module Stripe
140
234
  )
141
235
  end
142
236
 
237
+ # Recompute the upcoming invoice estimate for the quote.
238
+ def self.reestimate(quote, params = {}, opts = {})
239
+ request_stripe_object(
240
+ method: :post,
241
+ path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(quote) }),
242
+ params: params,
243
+ opts: opts
244
+ )
245
+ end
246
+
143
247
  # A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
144
248
  def self.create(params = {}, opts = {})
145
249
  request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts)
@@ -0,0 +1,39 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # A quote phase describes the line items, coupons, and trialing status of a subscription for a predefined time period.
6
+ class QuotePhase < APIResource
7
+ extend Stripe::APIOperations::List
8
+
9
+ OBJECT_NAME = "quote_phase"
10
+ def self.object_name
11
+ "quote_phase"
12
+ end
13
+
14
+ # When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
15
+ def list_line_items(params = {}, opts = {})
16
+ request_stripe_object(
17
+ method: :get,
18
+ path: format("/v1/quote_phases/%<quote_phase>s/line_items", { quote_phase: CGI.escape(self["id"]) }),
19
+ params: params,
20
+ opts: opts
21
+ )
22
+ end
23
+
24
+ # When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
25
+ def self.list_line_items(quote_phase, params = {}, opts = {})
26
+ request_stripe_object(
27
+ method: :get,
28
+ path: format("/v1/quote_phases/%<quote_phase>s/line_items", { quote_phase: CGI.escape(quote_phase) }),
29
+ params: params,
30
+ opts: opts
31
+ )
32
+ end
33
+
34
+ # Returns a list of quote phases.
35
+ def self.list(filters = {}, opts = {})
36
+ request_stripe_object(method: :get, path: "/v1/quote_phases", params: filters, opts: opts)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,43 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # Invoices are statements of amounts owed by a customer, and are either
6
+ # generated one-off, or generated periodically from a subscription.
7
+ #
8
+ # They contain [invoice items](https://stripe.com/docs/api#invoiceitems), and proration adjustments
9
+ # that may be caused by subscription upgrades/downgrades (if necessary).
10
+ #
11
+ # If your invoice is configured to be billed through automatic charges,
12
+ # Stripe automatically finalizes your invoice and attempts payment. Note
13
+ # that finalizing the invoice,
14
+ # [when automatic](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection), does
15
+ # not happen immediately as the invoice is created. Stripe waits
16
+ # until one hour after the last webhook was successfully sent (or the last
17
+ # webhook timed out after failing). If you (and the platforms you may have
18
+ # connected to) have no webhooks configured, Stripe waits one hour after
19
+ # creation to finalize the invoice.
20
+ #
21
+ # If your invoice is configured to be billed by sending an email, then based on your
22
+ # [email settings](https://dashboard.stripe.com/account/billing/automatic),
23
+ # Stripe will email the invoice to your customer and await payment. These
24
+ # emails can contain a link to a hosted page to pay the invoice.
25
+ #
26
+ # Stripe applies any customer credit on the account before determining the
27
+ # amount due for the invoice (i.e., the amount that will be actually
28
+ # charged). If the amount due for the invoice is less than Stripe's [minimum allowed charge
29
+ # per currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts), the
30
+ # invoice is automatically marked paid, and we add the amount due to the
31
+ # customer's credit balance which is applied to the next invoice.
32
+ #
33
+ # More details on the customer's credit balance are
34
+ # [here](https://stripe.com/docs/billing/customer/balance).
35
+ #
36
+ # Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending)
37
+ class QuotePreviewInvoice < APIResource
38
+ OBJECT_NAME = "quote_preview_invoice"
39
+ def self.object_name
40
+ "quote_preview_invoice"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,11 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class QuotePreviewSubscriptionSchedule < APIResource
6
+ OBJECT_NAME = "quote_preview_subscription_schedule"
7
+ def self.object_name
8
+ "quote_preview_subscription_schedule"
9
+ end
10
+ end
11
+ end
@@ -15,6 +15,16 @@ module Stripe
15
15
  "subscription_schedule"
16
16
  end
17
17
 
18
+ # Amends an existing subscription schedule.
19
+ def amend(params = {}, opts = {})
20
+ request_stripe_object(
21
+ method: :post,
22
+ path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(self["id"]) }),
23
+ params: params,
24
+ opts: opts
25
+ )
26
+ end
27
+
18
28
  # Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
19
29
  def cancel(params = {}, opts = {})
20
30
  request_stripe_object(
@@ -35,6 +45,16 @@ module Stripe
35
45
  )
36
46
  end
37
47
 
48
+ # Amends an existing subscription schedule.
49
+ def self.amend(schedule, params = {}, opts = {})
50
+ request_stripe_object(
51
+ method: :post,
52
+ path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(schedule) }),
53
+ params: params,
54
+ opts: opts
55
+ )
56
+ end
57
+
38
58
  # Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
39
59
  def self.cancel(schedule, params = {}, opts = {})
40
60
  request_stripe_object(
@@ -0,0 +1,49 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ # Tax forms are legal documents which are delivered to one or more tax authorities for information reporting purposes.
7
+ #
8
+ # Related guide: [US tax reporting for Connect platforms](https://stripe.com/docs/connect/tax-reporting)
9
+ class Form < APIResource
10
+ extend Stripe::APIOperations::List
11
+
12
+ OBJECT_NAME = "tax.form"
13
+ def self.object_name
14
+ "tax.form"
15
+ end
16
+
17
+ # Download the PDF for a tax form.
18
+ def pdf(params = {}, opts = {}, &read_body_chunk_block)
19
+ config = opts[:client]&.config || Stripe.config
20
+ opts = { api_base: config.uploads_base }.merge(opts)
21
+ request_stream(
22
+ method: :get,
23
+ path: format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(self["id"]) }),
24
+ params: params,
25
+ opts: opts,
26
+ &read_body_chunk_block
27
+ )
28
+ end
29
+
30
+ # Download the PDF for a tax form.
31
+ def self.pdf(id, params = {}, opts = {}, &read_body_chunk_block)
32
+ config = opts[:client]&.config || Stripe.config
33
+ opts = { api_base: config.uploads_base }.merge(opts)
34
+ execute_resource_request_stream(
35
+ :get,
36
+ format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(id) }),
37
+ params,
38
+ opts,
39
+ &read_body_chunk_block
40
+ )
41
+ end
42
+
43
+ # 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.
44
+ def self.list(filters = {}, opts = {})
45
+ request_stripe_object(method: :get, path: "/v1/tax/forms", params: filters, opts: opts)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -27,6 +27,36 @@ module Stripe
27
27
  )
28
28
  end
29
29
 
30
+ # Initiates an input collection flow on a Reader.
31
+ def collect_inputs(params = {}, opts = {})
32
+ request_stripe_object(
33
+ method: :post,
34
+ path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(self["id"]) }),
35
+ params: params,
36
+ opts: opts
37
+ )
38
+ end
39
+
40
+ # Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
41
+ def collect_payment_method(params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :post,
44
+ path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(self["id"]) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
49
+
50
+ # Finalizes a payment on a Reader.
51
+ def confirm_payment_intent(params = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(self["id"]) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
59
+
30
60
  # Initiates a payment flow on a Reader.
31
61
  def process_payment_intent(params = {}, opts = {})
32
62
  request_stripe_object(
@@ -77,6 +107,36 @@ module Stripe
77
107
  )
78
108
  end
79
109
 
110
+ # Initiates an input collection flow on a Reader.
111
+ def self.collect_inputs(reader, params = {}, opts = {})
112
+ request_stripe_object(
113
+ method: :post,
114
+ path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(reader) }),
115
+ params: params,
116
+ opts: opts
117
+ )
118
+ end
119
+
120
+ # Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
121
+ def self.collect_payment_method(reader, params = {}, opts = {})
122
+ request_stripe_object(
123
+ method: :post,
124
+ path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(reader) }),
125
+ params: params,
126
+ opts: opts
127
+ )
128
+ end
129
+
130
+ # Finalizes a payment on a Reader.
131
+ def self.confirm_payment_intent(reader, params = {}, opts = {})
132
+ request_stripe_object(
133
+ method: :post,
134
+ path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(reader) }),
135
+ params: params,
136
+ opts: opts
137
+ )
138
+ end
139
+
80
140
  # Initiates a payment flow on a Reader.
81
141
  def self.process_payment_intent(reader, params = {}, opts = {})
82
142
  request_stripe_object(
@@ -3,6 +3,7 @@
3
3
 
4
4
  require "stripe/resources/account"
5
5
  require "stripe/resources/account_link"
6
+ require "stripe/resources/account_notice"
6
7
  require "stripe/resources/account_session"
7
8
  require "stripe/resources/apple_pay_domain"
8
9
  require "stripe/resources/application_fee"
@@ -14,6 +15,9 @@ require "stripe/resources/bank_account"
14
15
  require "stripe/resources/billing_portal/configuration"
15
16
  require "stripe/resources/billing_portal/session"
16
17
  require "stripe/resources/capability"
18
+ require "stripe/resources/capital/financing_offer"
19
+ require "stripe/resources/capital/financing_summary"
20
+ require "stripe/resources/capital/financing_transaction"
17
21
  require "stripe/resources/card"
18
22
  require "stripe/resources/cash_balance"
19
23
  require "stripe/resources/charge"
@@ -21,6 +25,7 @@ require "stripe/resources/checkout/session"
21
25
  require "stripe/resources/climate/order"
22
26
  require "stripe/resources/climate/product"
23
27
  require "stripe/resources/climate/supplier"
28
+ require "stripe/resources/confirmation_token"
24
29
  require "stripe/resources/country_spec"
25
30
  require "stripe/resources/coupon"
26
31
  require "stripe/resources/credit_note"
@@ -28,34 +33,47 @@ require "stripe/resources/credit_note_line_item"
28
33
  require "stripe/resources/customer"
29
34
  require "stripe/resources/customer_balance_transaction"
30
35
  require "stripe/resources/customer_cash_balance_transaction"
36
+ require "stripe/resources/customer_entitlement"
37
+ require "stripe/resources/customer_entitlement_summary"
31
38
  require "stripe/resources/customer_session"
32
39
  require "stripe/resources/discount"
33
40
  require "stripe/resources/dispute"
41
+ require "stripe/resources/entitlements/event"
42
+ require "stripe/resources/entitlements/feature"
34
43
  require "stripe/resources/ephemeral_key"
35
44
  require "stripe/resources/event"
36
45
  require "stripe/resources/exchange_rate"
37
46
  require "stripe/resources/file"
38
47
  require "stripe/resources/file_link"
39
48
  require "stripe/resources/financial_connections/account"
49
+ require "stripe/resources/financial_connections/account_inferred_balance"
40
50
  require "stripe/resources/financial_connections/account_owner"
41
51
  require "stripe/resources/financial_connections/account_ownership"
42
52
  require "stripe/resources/financial_connections/session"
43
53
  require "stripe/resources/financial_connections/transaction"
44
54
  require "stripe/resources/funding_instructions"
55
+ require "stripe/resources/gift_cards/card"
56
+ require "stripe/resources/gift_cards/transaction"
45
57
  require "stripe/resources/identity/verification_report"
46
58
  require "stripe/resources/identity/verification_session"
47
59
  require "stripe/resources/invoice"
48
60
  require "stripe/resources/invoice_item"
49
61
  require "stripe/resources/invoice_line_item"
62
+ require "stripe/resources/invoice_payment"
50
63
  require "stripe/resources/issuing/authorization"
51
64
  require "stripe/resources/issuing/card"
52
65
  require "stripe/resources/issuing/cardholder"
66
+ require "stripe/resources/issuing/credit_underwriting_record"
53
67
  require "stripe/resources/issuing/dispute"
68
+ require "stripe/resources/issuing/personalization_design"
69
+ require "stripe/resources/issuing/physical_bundle"
54
70
  require "stripe/resources/issuing/token"
55
71
  require "stripe/resources/issuing/transaction"
56
72
  require "stripe/resources/line_item"
57
73
  require "stripe/resources/login_link"
58
74
  require "stripe/resources/mandate"
75
+ require "stripe/resources/margin"
76
+ require "stripe/resources/order"
59
77
  require "stripe/resources/payment_intent"
60
78
  require "stripe/resources/payment_link"
61
79
  require "stripe/resources/payment_method"
@@ -68,6 +86,9 @@ require "stripe/resources/price"
68
86
  require "stripe/resources/product"
69
87
  require "stripe/resources/promotion_code"
70
88
  require "stripe/resources/quote"
89
+ require "stripe/resources/quote_phase"
90
+ require "stripe/resources/quote_preview_invoice"
91
+ require "stripe/resources/quote_preview_subscription_schedule"
71
92
  require "stripe/resources/radar/early_fraud_warning"
72
93
  require "stripe/resources/radar/value_list"
73
94
  require "stripe/resources/radar/value_list_item"
@@ -87,6 +108,7 @@ require "stripe/resources/subscription_item"
87
108
  require "stripe/resources/subscription_schedule"
88
109
  require "stripe/resources/tax/calculation"
89
110
  require "stripe/resources/tax/calculation_line_item"
111
+ require "stripe/resources/tax/form"
90
112
  require "stripe/resources/tax/registration"
91
113
  require "stripe/resources/tax/settings"
92
114
  require "stripe/resources/tax/transaction"