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
@@ -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(
@@ -24,6 +28,16 @@ module Stripe
24
28
  )
25
29
  end
26
30
 
31
+ # Accepts the specified quote.
32
+ def self.accept(quote, params = {}, opts = {})
33
+ request_stripe_object(
34
+ method: :post,
35
+ path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
36
+ params: params,
37
+ opts: opts
38
+ )
39
+ end
40
+
27
41
  # Cancels the quote.
28
42
  def cancel(params = {}, opts = {})
29
43
  request_stripe_object(
@@ -34,6 +48,21 @@ module Stripe
34
48
  )
35
49
  end
36
50
 
51
+ # Cancels the quote.
52
+ def self.cancel(quote, params = {}, opts = {})
53
+ request_stripe_object(
54
+ method: :post,
55
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
56
+ params: params,
57
+ opts: opts
58
+ )
59
+ end
60
+
61
+ # 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).
62
+ def self.create(params = {}, opts = {})
63
+ request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts)
64
+ end
65
+
37
66
  # Finalizes the quote.
38
67
  def finalize_quote(params = {}, opts = {})
39
68
  request_stripe_object(
@@ -44,6 +73,21 @@ module Stripe
44
73
  )
45
74
  end
46
75
 
76
+ # Finalizes the quote.
77
+ def self.finalize_quote(quote, params = {}, opts = {})
78
+ request_stripe_object(
79
+ method: :post,
80
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
81
+ params: params,
82
+ opts: opts
83
+ )
84
+ end
85
+
86
+ # Returns a list of your quotes.
87
+ def self.list(filters = {}, opts = {})
88
+ request_stripe_object(method: :get, path: "/v1/quotes", params: filters, opts: opts)
89
+ end
90
+
47
91
  # When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
48
92
  def list_computed_upfront_line_items(params = {}, opts = {})
49
93
  request_stripe_object(
@@ -54,6 +98,16 @@ module Stripe
54
98
  )
55
99
  end
56
100
 
101
+ # When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
102
+ def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
103
+ request_stripe_object(
104
+ method: :get,
105
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
106
+ params: params,
107
+ opts: opts
108
+ )
109
+ end
110
+
57
111
  # When retrieving a quote, 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.
58
112
  def list_line_items(params = {}, opts = {})
59
113
  request_stripe_object(
@@ -64,69 +118,109 @@ module Stripe
64
118
  )
65
119
  end
66
120
 
67
- # Download the PDF for a finalized quote
68
- def pdf(params = {}, opts = {}, &read_body_chunk_block)
69
- config = opts[:client]&.config || Stripe.config
70
- opts = { api_base: config.uploads_base }.merge(opts)
71
- request_stream(
121
+ # When retrieving a quote, 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.
122
+ def self.list_line_items(quote, params = {}, opts = {})
123
+ request_stripe_object(
72
124
  method: :get,
73
- path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }),
125
+ path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }),
74
126
  params: params,
75
- opts: opts,
76
- &read_body_chunk_block
127
+ opts: opts
77
128
  )
78
129
  end
79
130
 
80
- # Accepts the specified quote.
81
- def self.accept(quote, params = {}, opts = {})
131
+ # 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.
132
+ def list_lines(params = {}, opts = {})
82
133
  request_stripe_object(
83
- method: :post,
84
- path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
134
+ method: :get,
135
+ path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(self["id"]) }),
85
136
  params: params,
86
137
  opts: opts
87
138
  )
88
139
  end
89
140
 
90
- # Cancels the quote.
91
- def self.cancel(quote, params = {}, opts = {})
141
+ # 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.
142
+ def self.list_lines(quote, params = {}, opts = {})
143
+ request_stripe_object(
144
+ method: :get,
145
+ path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(quote) }),
146
+ params: params,
147
+ opts: opts
148
+ )
149
+ end
150
+
151
+ # Preview the invoice line items that would be generated by accepting the quote.
152
+ def list_preview_invoice_lines(preview_invoice, params = {}, opts = {})
153
+ request_stripe_object(
154
+ method: :get,
155
+ path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(self["id"]), preview_invoice: CGI.escape(preview_invoice) }),
156
+ params: params,
157
+ opts: opts
158
+ )
159
+ end
160
+
161
+ # Preview the invoice line items that would be generated by accepting the quote.
162
+ def self.list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {})
163
+ request_stripe_object(
164
+ method: :get,
165
+ path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(quote), preview_invoice: CGI.escape(preview_invoice) }),
166
+ params: params,
167
+ opts: opts
168
+ )
169
+ end
170
+
171
+ # Converts a stale quote to draft.
172
+ def mark_draft(params = {}, opts = {})
92
173
  request_stripe_object(
93
174
  method: :post,
94
- path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
175
+ path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(self["id"]) }),
95
176
  params: params,
96
177
  opts: opts
97
178
  )
98
179
  end
99
180
 
100
- # Finalizes the quote.
101
- def self.finalize_quote(quote, params = {}, opts = {})
181
+ # Converts a stale quote to draft.
182
+ def self.mark_draft(quote, params = {}, opts = {})
102
183
  request_stripe_object(
103
184
  method: :post,
104
- path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
185
+ path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(quote) }),
105
186
  params: params,
106
187
  opts: opts
107
188
  )
108
189
  end
109
190
 
110
- # When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
111
- def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
191
+ # Converts a draft or open quote to stale.
192
+ def mark_stale(params = {}, opts = {})
112
193
  request_stripe_object(
113
- method: :get,
114
- path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
194
+ method: :post,
195
+ path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(self["id"]) }),
115
196
  params: params,
116
197
  opts: opts
117
198
  )
118
199
  end
119
200
 
120
- # When retrieving a quote, 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.
121
- def self.list_line_items(quote, params = {}, opts = {})
201
+ # Converts a draft or open quote to stale.
202
+ def self.mark_stale(quote, params = {}, opts = {})
122
203
  request_stripe_object(
123
- method: :get,
124
- path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }),
204
+ method: :post,
205
+ path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(quote) }),
125
206
  params: params,
126
207
  opts: opts
127
208
  )
128
209
  end
129
210
 
211
+ # Download the PDF for a finalized quote
212
+ def pdf(params = {}, opts = {}, &read_body_chunk_block)
213
+ config = opts[:client]&.config || Stripe.config
214
+ opts = { api_base: config.uploads_base }.merge(opts)
215
+ request_stream(
216
+ method: :get,
217
+ path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }),
218
+ params: params,
219
+ opts: opts,
220
+ &read_body_chunk_block
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,14 +234,24 @@ module Stripe
140
234
  )
141
235
  end
142
236
 
143
- # 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
- def self.create(params = {}, opts = {})
145
- request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts)
237
+ # Recompute the upcoming invoice estimate for the quote.
238
+ def reestimate(params = {}, opts = {})
239
+ request_stripe_object(
240
+ method: :post,
241
+ path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(self["id"]) }),
242
+ params: params,
243
+ opts: opts
244
+ )
146
245
  end
147
246
 
148
- # Returns a list of your quotes.
149
- def self.list(filters = {}, opts = {})
150
- request_stripe_object(method: :get, path: "/v1/quotes", params: filters, opts: opts)
247
+ # Recompute the upcoming invoice estimate for the quote.
248
+ def self.reestimate(quote, params = {}, opts = {})
249
+ request_stripe_object(
250
+ method: :post,
251
+ path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(quote) }),
252
+ params: params,
253
+ opts: opts
254
+ )
151
255
  end
152
256
 
153
257
  # A quote models prices and services for a customer.
@@ -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
+ # Returns a list of quote phases.
15
+ def self.list(filters = {}, opts = {})
16
+ request_stripe_object(method: :get, path: "/v1/quote_phases", params: filters, opts: opts)
17
+ end
18
+
19
+ # 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.
20
+ def list_line_items(params = {}, opts = {})
21
+ request_stripe_object(
22
+ method: :get,
23
+ path: format("/v1/quote_phases/%<quote_phase>s/line_items", { quote_phase: CGI.escape(self["id"]) }),
24
+ params: params,
25
+ opts: opts
26
+ )
27
+ end
28
+
29
+ # 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.
30
+ def self.list_line_items(quote_phase, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :get,
33
+ path: format("/v1/quote_phases/%<quote_phase>s/line_items", { quote_phase: CGI.escape(quote_phase) }),
34
+ params: params,
35
+ opts: opts
36
+ )
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
@@ -45,6 +45,18 @@ module Stripe
45
45
  )
46
46
  end
47
47
 
48
+ # You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
49
+ #
50
+ # After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
51
+ def self.cancel(intent, params = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
59
+
48
60
  # Confirm that your customer intends to set up the current or
49
61
  # provided payment method. For example, you would confirm a SetupIntent
50
62
  # when a customer hits the “Save” button on a payment method management
@@ -68,28 +80,6 @@ module Stripe
68
80
  )
69
81
  end
70
82
 
71
- # Verifies microdeposits on a SetupIntent object.
72
- def verify_microdeposits(params = {}, opts = {})
73
- request_stripe_object(
74
- method: :post,
75
- path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
76
- params: params,
77
- opts: opts
78
- )
79
- end
80
-
81
- # You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
82
- #
83
- # After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
84
- def self.cancel(intent, params = {}, opts = {})
85
- request_stripe_object(
86
- method: :post,
87
- path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
88
- params: params,
89
- opts: opts
90
- )
91
- end
92
-
93
83
  # Confirm that your customer intends to set up the current or
94
84
  # provided payment method. For example, you would confirm a SetupIntent
95
85
  # when a customer hits the “Save” button on a payment method management
@@ -113,16 +103,6 @@ module Stripe
113
103
  )
114
104
  end
115
105
 
116
- # Verifies microdeposits on a SetupIntent object.
117
- def self.verify_microdeposits(intent, params = {}, opts = {})
118
- request_stripe_object(
119
- method: :post,
120
- path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
121
- params: params,
122
- opts: opts
123
- )
124
- end
125
-
126
106
  # Creates a SetupIntent object.
127
107
  #
128
108
  # After you create the SetupIntent, attach a payment method and [confirm](https://stripe.com/docs/api/setup_intents/confirm)
@@ -145,5 +125,25 @@ module Stripe
145
125
  opts: opts
146
126
  )
147
127
  end
128
+
129
+ # Verifies microdeposits on a SetupIntent object.
130
+ def verify_microdeposits(params = {}, opts = {})
131
+ request_stripe_object(
132
+ method: :post,
133
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
134
+ params: params,
135
+ opts: opts
136
+ )
137
+ end
138
+
139
+ # Verifies microdeposits on a SetupIntent object.
140
+ def self.verify_microdeposits(intent, params = {}, opts = {})
141
+ request_stripe_object(
142
+ method: :post,
143
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
144
+ params: params,
145
+ opts: opts
146
+ )
147
+ end
148
148
  end
149
149
  end
@@ -15,10 +15,6 @@ module Stripe
15
15
  "scheduled_query_run"
16
16
  end
17
17
 
18
- def self.resource_url
19
- "/v1/sigma/scheduled_query_runs"
20
- end
21
-
22
18
  # Returns a list of scheduled query runs.
23
19
  def self.list(filters = {}, opts = {})
24
20
  request_stripe_object(
@@ -28,6 +24,10 @@ module Stripe
28
24
  opts: opts
29
25
  )
30
26
  end
27
+
28
+ def self.resource_url
29
+ "/v1/sigma/scheduled_query_runs"
30
+ end
31
31
  end
32
32
  end
33
33
  end
@@ -24,6 +24,23 @@ module Stripe
24
24
 
25
25
  nested_resource_class_methods :source_transaction, operations: %i[retrieve list]
26
26
 
27
+ # Creates a new source object.
28
+ def self.create(params = {}, opts = {})
29
+ request_stripe_object(method: :post, path: "/v1/sources", params: params, opts: opts)
30
+ end
31
+
32
+ # Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
33
+ #
34
+ # This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
35
+ def self.update(id, params = {}, opts = {})
36
+ request_stripe_object(
37
+ method: :post,
38
+ path: format("/v1/sources/%<id>s", { id: CGI.escape(id) }),
39
+ params: params,
40
+ opts: opts
41
+ )
42
+ end
43
+
27
44
  # Verify a given source.
28
45
  def verify(params = {}, opts = {})
29
46
  request_stripe_object(
@@ -67,22 +84,5 @@ module Stripe
67
84
  end
68
85
  extend Gem::Deprecate
69
86
  deprecate :source_transactions, :"Source.list_source_transactions", 2020, 1
70
-
71
- # Creates a new source object.
72
- def self.create(params = {}, opts = {})
73
- request_stripe_object(method: :post, path: "/v1/sources", params: params, opts: opts)
74
- end
75
-
76
- # Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
77
- #
78
- # This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
79
- def self.update(id, params = {}, opts = {})
80
- request_stripe_object(
81
- method: :post,
82
- path: format("/v1/sources/%<id>s", { id: CGI.escape(id) }),
83
- params: params,
84
- opts: opts
85
- )
86
- end
87
87
  end
88
88
  end
@@ -30,35 +30,36 @@ module Stripe
30
30
  )
31
31
  end
32
32
 
33
- # Removes the currently applied discount on a subscription.
34
- def delete_discount(params = {}, opts = {})
33
+ # Cancels a customer's subscription immediately. The customer will not be charged again for the subscription.
34
+ #
35
+ # Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
36
+ #
37
+ # By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
38
+ def self.cancel(subscription_exposed_id, params = {}, opts = {})
35
39
  request_stripe_object(
36
40
  method: :delete,
37
- path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(self["id"]) }),
38
- params: params,
39
- opts: opts
40
- )
41
- end
42
-
43
- # Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
44
- def resume(params = {}, opts = {})
45
- request_stripe_object(
46
- method: :post,
47
- path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(self["id"]) }),
41
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
48
42
  params: params,
49
43
  opts: opts
50
44
  )
51
45
  end
52
46
 
53
- # Cancels a customer's subscription immediately. The customer will not be charged again for the subscription.
47
+ # Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.
54
48
  #
55
- # Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
49
+ # When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
50
+ # The payment_behavior parameter determines the exact behavior of the initial payment.
56
51
  #
57
- # By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
58
- def self.cancel(subscription_exposed_id, params = {}, opts = {})
52
+ # To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
53
+ # Schedules provide the flexibility to model more complex billing configurations that change over time.
54
+ def self.create(params = {}, opts = {})
55
+ request_stripe_object(method: :post, path: "/v1/subscriptions", params: params, opts: opts)
56
+ end
57
+
58
+ # Removes the currently applied discount on a subscription.
59
+ def delete_discount(params = {}, opts = {})
59
60
  request_stripe_object(
60
61
  method: :delete,
61
- path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
62
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(self["id"]) }),
62
63
  params: params,
63
64
  opts: opts
64
65
  )
@@ -74,32 +75,29 @@ module Stripe
74
75
  )
75
76
  end
76
77
 
78
+ # By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled.
79
+ def self.list(filters = {}, opts = {})
80
+ request_stripe_object(method: :get, path: "/v1/subscriptions", params: filters, opts: opts)
81
+ end
82
+
77
83
  # Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
78
- def self.resume(subscription, params = {}, opts = {})
84
+ def resume(params = {}, opts = {})
79
85
  request_stripe_object(
80
86
  method: :post,
81
- path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(subscription) }),
87
+ path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(self["id"]) }),
82
88
  params: params,
83
89
  opts: opts
84
90
  )
85
91
  end
86
92
 
87
- save_nested_resource :source
88
-
89
- # Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.
90
- #
91
- # When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
92
- # The payment_behavior parameter determines the exact behavior of the initial payment.
93
- #
94
- # To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
95
- # Schedules provide the flexibility to model more complex billing configurations that change over time.
96
- def self.create(params = {}, opts = {})
97
- request_stripe_object(method: :post, path: "/v1/subscriptions", params: params, opts: opts)
98
- end
99
-
100
- # By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled.
101
- def self.list(filters = {}, opts = {})
102
- request_stripe_object(method: :get, path: "/v1/subscriptions", params: filters, opts: opts)
93
+ # Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
94
+ def self.resume(subscription, params = {}, opts = {})
95
+ request_stripe_object(
96
+ method: :post,
97
+ path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(subscription) }),
98
+ params: params,
99
+ opts: opts
100
+ )
103
101
  end
104
102
 
105
103
  def self.search(params = {}, opts = {})
@@ -144,5 +142,7 @@ module Stripe
144
142
  opts: opts
145
143
  )
146
144
  end
145
+
146
+ save_nested_resource :source
147
147
  end
148
148
  end