stripe 10.11.0 → 10.12.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +292 -48
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +11 -0
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/request.rb +2 -1
  7. data/lib/stripe/api_version.rb +1 -0
  8. data/lib/stripe/object_types.rb +22 -0
  9. data/lib/stripe/request_signing_authenticator.rb +79 -0
  10. data/lib/stripe/resources/account.rb +69 -69
  11. data/lib/stripe/resources/account_notice.rb +32 -0
  12. data/lib/stripe/resources/apple_pay_domain.rb +4 -4
  13. data/lib/stripe/resources/apps/secret.rb +5 -5
  14. data/lib/stripe/resources/capital/financing_offer.rb +49 -0
  15. data/lib/stripe/resources/capital/financing_summary.rb +15 -0
  16. data/lib/stripe/resources/capital/financing_transaction.rb +27 -0
  17. data/lib/stripe/resources/checkout/session.rb +21 -21
  18. data/lib/stripe/resources/confirmation_token.rb +16 -0
  19. data/lib/stripe/resources/credit_note.rb +35 -35
  20. data/lib/stripe/resources/customer.rb +66 -55
  21. data/lib/stripe/resources/customer_entitlement.rb +12 -0
  22. data/lib/stripe/resources/customer_entitlement_summary.rb +12 -0
  23. data/lib/stripe/resources/entitlements/feature.rb +38 -0
  24. data/lib/stripe/resources/ephemeral_key.rb +9 -9
  25. data/lib/stripe/resources/file.rb +5 -5
  26. data/lib/stripe/resources/financial_connections/account.rb +37 -34
  27. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +14 -0
  28. data/lib/stripe/resources/gift_cards/card.rb +59 -0
  29. data/lib/stripe/resources/gift_cards/transaction.rb +93 -0
  30. data/lib/stripe/resources/identity/verification_session.rb +38 -38
  31. data/lib/stripe/resources/invoice.rb +113 -60
  32. data/lib/stripe/resources/invoice_payment.rb +12 -0
  33. data/lib/stripe/resources/issuing/authorization.rb +8 -8
  34. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +88 -0
  35. data/lib/stripe/resources/issuing/dispute.rb +16 -16
  36. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  37. data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
  38. data/lib/stripe/resources/margin.rb +37 -0
  39. data/lib/stripe/resources/order.rb +120 -0
  40. data/lib/stripe/resources/payment_intent.rb +150 -100
  41. data/lib/stripe/resources/payment_link.rb +10 -10
  42. data/lib/stripe/resources/payment_method.rb +17 -17
  43. data/lib/stripe/resources/payment_method_domain.rb +29 -29
  44. data/lib/stripe/resources/payout.rb +22 -22
  45. data/lib/stripe/resources/quote.rb +136 -32
  46. data/lib/stripe/resources/quote_phase.rb +39 -0
  47. data/lib/stripe/resources/quote_preview_invoice.rb +43 -0
  48. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +11 -0
  49. data/lib/stripe/resources/setup_intent.rb +32 -32
  50. data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -4
  51. data/lib/stripe/resources/source.rb +17 -17
  52. data/lib/stripe/resources/subscription.rb +36 -36
  53. data/lib/stripe/resources/subscription_schedule.rb +31 -11
  54. data/lib/stripe/resources/tax/calculation.rb +10 -10
  55. data/lib/stripe/resources/tax/form.rb +49 -0
  56. data/lib/stripe/resources/tax/transaction.rb +10 -10
  57. data/lib/stripe/resources/terminal/reader.rb +101 -41
  58. data/lib/stripe/resources/treasury/financial_account.rb +25 -25
  59. data/lib/stripe/resources/treasury/transaction_entry.rb +4 -4
  60. data/lib/stripe/resources.rb +21 -0
  61. data/lib/stripe/stripe_client.rb +62 -28
  62. data/lib/stripe/stripe_configuration.rb +2 -1
  63. data/lib/stripe/util.rb +8 -1
  64. data/lib/stripe/version.rb +1 -1
  65. data/lib/stripe.rb +54 -0
  66. metadata +25 -3
@@ -0,0 +1,93 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module GiftCards
6
+ # A gift card transaction represents a single transaction on a referenced gift card.
7
+ # A transaction is in one of three states, `confirmed`, `held` or `canceled`. A `confirmed`
8
+ # transaction is one that has added/deducted funds. A `held` transaction has created a
9
+ # temporary hold on funds, which can then be cancelled or confirmed. A `held` transaction
10
+ # can be confirmed into a `confirmed` transaction, or canceled into a `canceled` transaction.
11
+ # A `canceled` transaction has no effect on a gift card's balance.
12
+ class Transaction < APIResource
13
+ extend Stripe::APIOperations::Create
14
+ extend Stripe::APIOperations::List
15
+ include Stripe::APIOperations::Save
16
+
17
+ OBJECT_NAME = "gift_cards.transaction"
18
+ def self.object_name
19
+ "gift_cards.transaction"
20
+ end
21
+
22
+ # Cancel a gift card transaction
23
+ def cancel(params = {}, opts = {})
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: format("/v1/gift_cards/transactions/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
27
+ params: params,
28
+ opts: opts
29
+ )
30
+ end
31
+
32
+ # Cancel a gift card transaction
33
+ def self.cancel(id, params = {}, opts = {})
34
+ request_stripe_object(
35
+ method: :post,
36
+ path: format("/v1/gift_cards/transactions/%<id>s/cancel", { id: CGI.escape(id) }),
37
+ params: params,
38
+ opts: opts
39
+ )
40
+ end
41
+
42
+ # Confirm a gift card transaction
43
+ def confirm(params = {}, opts = {})
44
+ request_stripe_object(
45
+ method: :post,
46
+ path: format("/v1/gift_cards/transactions/%<id>s/confirm", { id: CGI.escape(self["id"]) }),
47
+ params: params,
48
+ opts: opts
49
+ )
50
+ end
51
+
52
+ # Confirm a gift card transaction
53
+ def self.confirm(id, params = {}, opts = {})
54
+ request_stripe_object(
55
+ method: :post,
56
+ path: format("/v1/gift_cards/transactions/%<id>s/confirm", { id: CGI.escape(id) }),
57
+ params: params,
58
+ opts: opts
59
+ )
60
+ end
61
+
62
+ # Create a gift card transaction
63
+ def self.create(params = {}, opts = {})
64
+ request_stripe_object(
65
+ method: :post,
66
+ path: "/v1/gift_cards/transactions",
67
+ params: params,
68
+ opts: opts
69
+ )
70
+ end
71
+
72
+ # List gift card transactions for a gift card
73
+ def self.list(filters = {}, opts = {})
74
+ request_stripe_object(
75
+ method: :get,
76
+ path: "/v1/gift_cards/transactions",
77
+ params: filters,
78
+ opts: opts
79
+ )
80
+ end
81
+
82
+ # Update a gift card transaction
83
+ def self.update(id, params = {}, opts = {})
84
+ request_stripe_object(
85
+ method: :post,
86
+ path: format("/v1/gift_cards/transactions/%<id>s", { id: CGI.escape(id) }),
87
+ params: params,
88
+ opts: opts
89
+ )
90
+ end
91
+ end
92
+ end
93
+ end
@@ -36,6 +36,44 @@ module Stripe
36
36
  )
37
37
  end
38
38
 
39
+ # A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
40
+ #
41
+ # Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
42
+ def self.cancel(session, params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :post,
45
+ path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
46
+ params: params,
47
+ opts: opts
48
+ )
49
+ end
50
+
51
+ # Creates a VerificationSession object.
52
+ #
53
+ # After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
54
+ #
55
+ # If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
56
+ #
57
+ # Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents)
58
+ def self.create(params = {}, opts = {})
59
+ request_stripe_object(
60
+ method: :post,
61
+ path: "/v1/identity/verification_sessions",
62
+ params: params,
63
+ opts: opts
64
+ )
65
+ end
66
+
67
+ # Returns a list of VerificationSessions
68
+ def self.list(filters = {}, opts = {})
69
+ request_stripe_object(
70
+ method: :get,
71
+ path: "/v1/identity/verification_sessions",
72
+ params: filters,
73
+ opts: opts
74
+ )
75
+ end
76
+
39
77
  # Redact a VerificationSession to remove all collected information from Stripe. This will redact
40
78
  # the VerificationSession and all objects related to it, including VerificationReports, Events,
41
79
  # request logs, etc.
@@ -64,18 +102,6 @@ module Stripe
64
102
  )
65
103
  end
66
104
 
67
- # A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
68
- #
69
- # Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
70
- def self.cancel(session, params = {}, opts = {})
71
- request_stripe_object(
72
- method: :post,
73
- path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
74
- params: params,
75
- opts: opts
76
- )
77
- end
78
-
79
105
  # Redact a VerificationSession to remove all collected information from Stripe. This will redact
80
106
  # the VerificationSession and all objects related to it, including VerificationReports, Events,
81
107
  # request logs, etc.
@@ -104,32 +130,6 @@ module Stripe
104
130
  )
105
131
  end
106
132
 
107
- # Creates a VerificationSession object.
108
- #
109
- # After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
110
- #
111
- # If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
112
- #
113
- # Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents)
114
- def self.create(params = {}, opts = {})
115
- request_stripe_object(
116
- method: :post,
117
- path: "/v1/identity/verification_sessions",
118
- params: params,
119
- opts: opts
120
- )
121
- end
122
-
123
- # Returns a list of VerificationSessions
124
- def self.list(filters = {}, opts = {})
125
- request_stripe_object(
126
- method: :get,
127
- path: "/v1/identity/verification_sessions",
128
- params: filters,
129
- opts: opts
130
- )
131
- end
132
-
133
133
  # Updates a VerificationSession object.
134
134
  #
135
135
  # When the session status is requires_input, you can use this method to update the
@@ -40,59 +40,95 @@ module Stripe
40
40
  extend Stripe::APIOperations::List
41
41
  extend Stripe::APIOperations::Search
42
42
  include Stripe::APIOperations::Save
43
+ extend Stripe::APIOperations::NestedResource
43
44
 
44
45
  OBJECT_NAME = "invoice"
45
46
  def self.object_name
46
47
  "invoice"
47
48
  end
48
49
 
49
- # Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
50
- def finalize_invoice(params = {}, opts = {})
50
+ nested_resource_class_methods :payment, operations: %i[retrieve list]
51
+
52
+ # Attaches a PaymentIntent to the invoice, adding it to the list of payments.
53
+ # When the PaymentIntent's status changes to succeeded, the payment is credited
54
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
55
+ # invoice's status becomes paid.
56
+ #
57
+ # If the PaymentIntent's status is already succeeded when it is attached, it is
58
+ # credited to the invoice immediately.
59
+ #
60
+ # Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
61
+ def attach_payment_intent(params = {}, opts = {})
51
62
  request_stripe_object(
52
63
  method: :post,
53
- path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }),
64
+ path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(self["id"]) }),
54
65
  params: params,
55
66
  opts: opts
56
67
  )
57
68
  end
58
69
 
59
- # Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
60
- def mark_uncollectible(params = {}, opts = {})
70
+ # Attaches a PaymentIntent to the invoice, adding it to the list of payments.
71
+ # When the PaymentIntent's status changes to succeeded, the payment is credited
72
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
73
+ # invoice's status becomes paid.
74
+ #
75
+ # If the PaymentIntent's status is already succeeded when it is attached, it is
76
+ # credited to the invoice immediately.
77
+ #
78
+ # Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
79
+ def self.attach_payment_intent(invoice, params = {}, opts = {})
61
80
  request_stripe_object(
62
81
  method: :post,
63
- path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
82
+ path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(invoice) }),
64
83
  params: params,
65
84
  opts: opts
66
85
  )
67
86
  end
68
87
 
69
- # Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
70
- def pay(params = {}, opts = {})
88
+ # This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
89
+ def self.create(params = {}, opts = {})
90
+ request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
91
+ end
92
+
93
+ # At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
94
+ #
95
+ # Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount.
96
+ #
97
+ # You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass a proration_date parameter when doing the actual subscription update. The value passed in should be the same as the subscription_proration_date returned on the upcoming invoice resource. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_proration_date on the upcoming invoice resource.
98
+ def self.create_preview(params = {}, opts = {})
71
99
  request_stripe_object(
72
100
  method: :post,
73
- path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
101
+ path: "/v1/invoices/create_preview",
74
102
  params: params,
75
103
  opts: opts
76
104
  )
77
105
  end
78
106
 
79
- # Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
80
- #
81
- # Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
82
- def send_invoice(params = {}, opts = {})
107
+ # Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
108
+ def self.delete(id, params = {}, opts = {})
83
109
  request_stripe_object(
84
- method: :post,
85
- path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
110
+ method: :delete,
111
+ path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }),
86
112
  params: params,
87
113
  opts: opts
88
114
  )
89
115
  end
90
116
 
91
- # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
92
- def void_invoice(params = {}, opts = {})
117
+ # Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
118
+ def delete(params = {}, opts = {})
119
+ request_stripe_object(
120
+ method: :delete,
121
+ path: format("/v1/invoices/%<invoice>s", { invoice: CGI.escape(self["id"]) }),
122
+ params: params,
123
+ opts: opts
124
+ )
125
+ end
126
+
127
+ # Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
128
+ def finalize_invoice(params = {}, opts = {})
93
129
  request_stripe_object(
94
130
  method: :post,
95
- path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
131
+ path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }),
96
132
  params: params,
97
133
  opts: opts
98
134
  )
@@ -108,6 +144,11 @@ module Stripe
108
144
  )
109
145
  end
110
146
 
147
+ # You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
148
+ def self.list(filters = {}, opts = {})
149
+ request_stripe_object(method: :get, path: "/v1/invoices", params: filters, opts: opts)
150
+ end
151
+
111
152
  # When retrieving an upcoming invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
112
153
  def self.list_upcoming_line_items(params = {}, opts = {})
113
154
  request_stripe_object(
@@ -118,6 +159,16 @@ module Stripe
118
159
  )
119
160
  end
120
161
 
162
+ # Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
163
+ def mark_uncollectible(params = {}, opts = {})
164
+ request_stripe_object(
165
+ method: :post,
166
+ path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
167
+ params: params,
168
+ opts: opts
169
+ )
170
+ end
171
+
121
172
  # Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
122
173
  def self.mark_uncollectible(invoice, params = {}, opts = {})
123
174
  request_stripe_object(
@@ -128,6 +179,16 @@ module Stripe
128
179
  )
129
180
  end
130
181
 
182
+ # Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
183
+ def pay(params = {}, opts = {})
184
+ request_stripe_object(
185
+ method: :post,
186
+ path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
187
+ params: params,
188
+ opts: opts
189
+ )
190
+ end
191
+
131
192
  # Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
132
193
  def self.pay(invoice, params = {}, opts = {})
133
194
  request_stripe_object(
@@ -138,6 +199,26 @@ module Stripe
138
199
  )
139
200
  end
140
201
 
202
+ def self.search(params = {}, opts = {})
203
+ request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts)
204
+ end
205
+
206
+ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
207
+ search(params, opts).auto_paging_each(&blk)
208
+ end
209
+
210
+ # Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
211
+ #
212
+ # Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
213
+ def send_invoice(params = {}, opts = {})
214
+ request_stripe_object(
215
+ method: :post,
216
+ path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
217
+ params: params,
218
+ opts: opts
219
+ )
220
+ end
221
+
141
222
  # Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
142
223
  #
143
224
  # Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
@@ -159,64 +240,36 @@ module Stripe
159
240
  request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts)
160
241
  end
161
242
 
162
- # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
163
- def self.void_invoice(invoice, params = {}, opts = {})
243
+ # Draft invoices are fully editable. Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized),
244
+ # monetary values, as well as collection_method, become uneditable.
245
+ #
246
+ # If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on,
247
+ # sending reminders for, or [automatically reconciling](https://stripe.com/docs/billing/invoices/reconciliation) invoices, pass
248
+ # auto_advance=false.
249
+ def self.update(id, params = {}, opts = {})
164
250
  request_stripe_object(
165
251
  method: :post,
166
- path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
167
- params: params,
168
- opts: opts
169
- )
170
- end
171
-
172
- # This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
173
- def self.create(params = {}, opts = {})
174
- request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
175
- end
176
-
177
- # Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
178
- def self.delete(id, params = {}, opts = {})
179
- request_stripe_object(
180
- method: :delete,
181
252
  path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }),
182
253
  params: params,
183
254
  opts: opts
184
255
  )
185
256
  end
186
257
 
187
- # Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
188
- def delete(params = {}, opts = {})
258
+ # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
259
+ def void_invoice(params = {}, opts = {})
189
260
  request_stripe_object(
190
- method: :delete,
191
- path: format("/v1/invoices/%<invoice>s", { invoice: CGI.escape(self["id"]) }),
261
+ method: :post,
262
+ path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
192
263
  params: params,
193
264
  opts: opts
194
265
  )
195
266
  end
196
267
 
197
- # You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
198
- def self.list(filters = {}, opts = {})
199
- request_stripe_object(method: :get, path: "/v1/invoices", params: filters, opts: opts)
200
- end
201
-
202
- def self.search(params = {}, opts = {})
203
- request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts)
204
- end
205
-
206
- def self.search_auto_paging_each(params = {}, opts = {}, &blk)
207
- search(params, opts).auto_paging_each(&blk)
208
- end
209
-
210
- # Draft invoices are fully editable. Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized),
211
- # monetary values, as well as collection_method, become uneditable.
212
- #
213
- # If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on,
214
- # sending reminders for, or [automatically reconciling](https://stripe.com/docs/billing/invoices/reconciliation) invoices, pass
215
- # auto_advance=false.
216
- def self.update(id, params = {}, opts = {})
268
+ # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
269
+ def self.void_invoice(invoice, params = {}, opts = {})
217
270
  request_stripe_object(
218
271
  method: :post,
219
- path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }),
272
+ path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
220
273
  params: params,
221
274
  opts: opts
222
275
  )
@@ -0,0 +1,12 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # The invoice payment object
6
+ class InvoicePayment < APIResource
7
+ OBJECT_NAME = "invoice_payment"
8
+ def self.object_name
9
+ "invoice_payment"
10
+ end
11
+ end
12
+ end
@@ -28,23 +28,23 @@ module Stripe
28
28
  )
29
29
  end
30
30
 
31
- # [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
32
- # This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
33
- def decline(params = {}, opts = {})
31
+ # [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
32
+ # This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
33
+ def self.approve(authorization, params = {}, opts = {})
34
34
  request_stripe_object(
35
35
  method: :post,
36
- path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
36
+ path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
37
37
  params: params,
38
38
  opts: opts
39
39
  )
40
40
  end
41
41
 
42
- # [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
43
- # This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
44
- def self.approve(authorization, params = {}, opts = {})
42
+ # [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
43
+ # This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
44
+ def decline(params = {}, opts = {})
45
45
  request_stripe_object(
46
46
  method: :post,
47
- path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
47
+ path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
48
48
  params: params,
49
49
  opts: opts
50
50
  )
@@ -0,0 +1,88 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Issuing
6
+ # Every time an applicant submits an application for a Charge Card product your platform offers, or every time your platform takes a proactive credit decision on an existing account, you must record the decision by creating a new `CreditUnderwritingRecord` object on a connected account.
7
+ #
8
+ # [Follow the guide](https://stripe.com/docs/issuing/credit/report-credit-decisions-and-manage-aans) to learn about your requirements as a platform.
9
+ class CreditUnderwritingRecord < APIResource
10
+ extend Stripe::APIOperations::List
11
+
12
+ OBJECT_NAME = "issuing.credit_underwriting_record"
13
+ def self.object_name
14
+ "issuing.credit_underwriting_record"
15
+ end
16
+
17
+ # Update a CreditUnderwritingRecord object to correct mistakes.
18
+ def correct(params = {}, opts = {})
19
+ request_stripe_object(
20
+ method: :post,
21
+ path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/correct", { credit_underwriting_record: CGI.escape(self["id"]) }),
22
+ params: params,
23
+ opts: opts
24
+ )
25
+ end
26
+
27
+ # Update a CreditUnderwritingRecord object to correct mistakes.
28
+ def self.correct(credit_underwriting_record, params = {}, opts = {})
29
+ request_stripe_object(
30
+ method: :post,
31
+ path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/correct", { credit_underwriting_record: CGI.escape(credit_underwriting_record) }),
32
+ params: params,
33
+ opts: opts
34
+ )
35
+ end
36
+
37
+ # Creates a CreditUnderwritingRecord object with information about a credit application submission.
38
+ def self.create_from_application(params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: "/v1/issuing/credit_underwriting_records/create_from_application",
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ # Creates a CreditUnderwritingRecord object from an underwriting decision coming from a proactive review of an existing accountholder.
48
+ def self.create_from_proactive_review(params = {}, opts = {})
49
+ request_stripe_object(
50
+ method: :post,
51
+ path: "/v1/issuing/credit_underwriting_records/create_from_proactive_review",
52
+ params: params,
53
+ opts: opts
54
+ )
55
+ end
56
+
57
+ # Retrieves a list of CreditUnderwritingRecord objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
58
+ def self.list(filters = {}, opts = {})
59
+ request_stripe_object(
60
+ method: :get,
61
+ path: "/v1/issuing/credit_underwriting_records",
62
+ params: filters,
63
+ opts: opts
64
+ )
65
+ end
66
+
67
+ # Update a CreditUnderwritingRecord object from a decision made on a credit application.
68
+ def report_decision(params = {}, opts = {})
69
+ request_stripe_object(
70
+ method: :post,
71
+ path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/report_decision", { credit_underwriting_record: CGI.escape(self["id"]) }),
72
+ params: params,
73
+ opts: opts
74
+ )
75
+ end
76
+
77
+ # Update a CreditUnderwritingRecord object from a decision made on a credit application.
78
+ def self.report_decision(credit_underwriting_record, params = {}, opts = {})
79
+ request_stripe_object(
80
+ method: :post,
81
+ path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/report_decision", { credit_underwriting_record: CGI.escape(credit_underwriting_record) }),
82
+ params: params,
83
+ opts: opts
84
+ )
85
+ end
86
+ end
87
+ end
88
+ end