stripe 8.205.0 → 8.206.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 8.206.0 - 2022-03-01
4
+ * [#1361](https://github.com/stripe/stripe-node/pull/1361) [#1362](https://github.com/stripe/stripe-node/pull/1362) API Updates
5
+ * Add support for new resource `TestHelpers.TestClock`
6
+ * Add support for `test_clock` on `CustomerCreateParams`, `Customer`, `Invoice`, `InvoiceItem`, `QuoteCreateParams`, `Quote`, `Subscription`, and `SubscriptionSchedule`
7
+ * Add support for `pending_invoice_items_behavior` on `InvoiceCreateParams`
8
+ * Change type of `ProductUpdateParams.url` from `string` to `emptyStringable(string)`
9
+ * Add support for `next_action` on `Refund`
10
+
3
11
  ## 8.205.0 - 2022-02-25
4
12
  * [#1098](https://github.com/stripe/stripe-node/pull/1098) Typescript: add declaration for `onDone` on `autoPagingEach`
5
13
  * [#1357](https://github.com/stripe/stripe-node/pull/1357) Properly handle API errors with unknown error types
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.205.0
1
+ 8.206.0
@@ -0,0 +1,36 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ 'use strict';
4
+
5
+ const StripeResource = require('../../StripeResource');
6
+ const stripeMethod = StripeResource.method;
7
+
8
+ module.exports = StripeResource.extend({
9
+ path: 'test_helpers/test_clocks',
10
+
11
+ create: stripeMethod({
12
+ method: 'POST',
13
+ path: '',
14
+ }),
15
+
16
+ retrieve: stripeMethod({
17
+ method: 'GET',
18
+ path: '/{testClock}',
19
+ }),
20
+
21
+ list: stripeMethod({
22
+ method: 'GET',
23
+ path: '',
24
+ methodType: 'list',
25
+ }),
26
+
27
+ del: stripeMethod({
28
+ method: 'DELETE',
29
+ path: '/{testClock}',
30
+ }),
31
+
32
+ advance: stripeMethod({
33
+ method: 'POST',
34
+ path: '/{testClock}/advance',
35
+ }),
36
+ });
package/lib/resources.js CHANGED
@@ -91,4 +91,7 @@ module.exports = {
91
91
  Locations: require('./resources/Terminal/Locations'),
92
92
  Readers: require('./resources/Terminal/Readers'),
93
93
  }),
94
+ TestHelpers: resourceNamespace('testHelpers', {
95
+ TestClocks: require('./resources/TestHelpers/TestClocks'),
96
+ }),
94
97
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "8.205.0",
3
+ "version": "8.206.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -130,6 +130,11 @@ declare module 'stripe' {
130
130
  * The customer's tax IDs.
131
131
  */
132
132
  tax_ids?: ApiList<Stripe.TaxId>;
133
+
134
+ /**
135
+ * ID of the test clock this customer belongs to.
136
+ */
137
+ test_clock?: string | Stripe.TestHelpers.TestClock | null;
133
138
  }
134
139
 
135
140
  namespace Customer {
@@ -352,6 +357,11 @@ declare module 'stripe' {
352
357
  * The customer's tax IDs.
353
358
  */
354
359
  tax_id_data?: Array<CustomerCreateParams.TaxIdDatum>;
360
+
361
+ /**
362
+ * ID of the test clock to attach to the customer.
363
+ */
364
+ test_clock?: string;
355
365
  }
356
366
 
357
367
  namespace CustomerCreateParams {
@@ -105,6 +105,11 @@ declare module 'stripe' {
105
105
  */
106
106
  tax_rates: Array<Stripe.TaxRate> | null;
107
107
 
108
+ /**
109
+ * ID of the test clock this invoice item belongs to.
110
+ */
111
+ test_clock?: string | Stripe.TestHelpers.TestClock | null;
112
+
108
113
  /**
109
114
  * Unit amount (in the `currency` specified) of the invoice item.
110
115
  */
@@ -318,6 +318,11 @@ declare module 'stripe' {
318
318
  */
319
319
  tax: number | null;
320
320
 
321
+ /**
322
+ * ID of the test clock this invoice belongs to.
323
+ */
324
+ test_clock?: string | Stripe.TestHelpers.TestClock | null;
325
+
321
326
  threshold_reason?: Invoice.ThresholdReason;
322
327
 
323
328
  /**
@@ -894,6 +899,11 @@ declare module 'stripe' {
894
899
  */
895
900
  payment_settings?: InvoiceCreateParams.PaymentSettings;
896
901
 
902
+ /**
903
+ * How to handle pending invoice items on invoice creation. One of `include`, `include_and_require`, or `exclude`. `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. `include_and_require` will include any pending invoice items, if no pending invoice items exist then the request will fail. `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. Defaults to `include_and_require` if the parameter is omitted.
904
+ */
905
+ pending_invoice_items_behavior?: InvoiceCreateParams.PendingInvoiceItemsBehavior;
906
+
897
907
  /**
898
908
  * Extra information about a charge for the customer's credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`.
899
909
  */
@@ -1054,6 +1064,11 @@ declare module 'stripe' {
1054
1064
  | 'wechat_pay';
1055
1065
  }
1056
1066
 
1067
+ type PendingInvoiceItemsBehavior =
1068
+ | 'exclude'
1069
+ | 'include'
1070
+ | 'include_and_require';
1071
+
1057
1072
  interface TransferData {
1058
1073
  /**
1059
1074
  * The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred.
@@ -357,7 +357,7 @@ declare module 'stripe' {
357
357
  /**
358
358
  * A URL of a publicly-accessible webpage for this product.
359
359
  */
360
- url?: string;
360
+ url?: Stripe.Emptyable<string>;
361
361
  }
362
362
 
363
363
  namespace ProductUpdateParams {
@@ -149,6 +149,11 @@ declare module 'stripe' {
149
149
  */
150
150
  subscription_schedule: string | Stripe.SubscriptionSchedule | null;
151
151
 
152
+ /**
153
+ * ID of the test clock this quote belongs to.
154
+ */
155
+ test_clock?: string | Stripe.TestHelpers.TestClock | null;
156
+
152
157
  total_details: Quote.TotalDetails;
153
158
 
154
159
  /**
@@ -590,6 +595,11 @@ declare module 'stripe' {
590
595
  */
591
596
  subscription_data?: QuoteCreateParams.SubscriptionData;
592
597
 
598
+ /**
599
+ * ID of the test clock to attach to the quote.
600
+ */
601
+ test_clock?: string;
602
+
593
603
  /**
594
604
  * The data with which to automatically create a Transfer for each of the invoices.
595
605
  */
@@ -61,6 +61,8 @@ declare module 'stripe' {
61
61
  */
62
62
  metadata: Stripe.Metadata | null;
63
63
 
64
+ next_action?: Refund.NextAction;
65
+
64
66
  /**
65
67
  * ID of the PaymentIntent that was refunded.
66
68
  */
@@ -93,6 +95,43 @@ declare module 'stripe' {
93
95
  }
94
96
 
95
97
  namespace Refund {
98
+ interface NextAction {
99
+ /**
100
+ * Contains the refund details.
101
+ */
102
+ display_details: NextAction.DisplayDetails | null;
103
+
104
+ /**
105
+ * Type of the next action to perform.
106
+ */
107
+ type: string;
108
+ }
109
+
110
+ namespace NextAction {
111
+ interface DisplayDetails {
112
+ email_sent: DisplayDetails.EmailSent;
113
+
114
+ /**
115
+ * The expiry timestamp.
116
+ */
117
+ expires_at: number;
118
+ }
119
+
120
+ namespace DisplayDetails {
121
+ interface EmailSent {
122
+ /**
123
+ * The timestamp when the email was sent.
124
+ */
125
+ email_sent_at: number;
126
+
127
+ /**
128
+ * The recipient's email address.
129
+ */
130
+ email_sent_to: string;
131
+ }
132
+ }
133
+ }
134
+
96
135
  type Reason =
97
136
  | 'duplicate'
98
137
  | 'expired_uncaptured_charge'
@@ -82,6 +82,11 @@ declare module 'stripe' {
82
82
  * ID of the subscription managed by the subscription schedule.
83
83
  */
84
84
  subscription: string | Stripe.Subscription | null;
85
+
86
+ /**
87
+ * ID of the test clock this subscription schedule belongs to.
88
+ */
89
+ test_clock?: string | Stripe.TestHelpers.TestClock | null;
85
90
  }
86
91
 
87
92
  namespace SubscriptionSchedule {
@@ -176,6 +176,11 @@ declare module 'stripe' {
176
176
  */
177
177
  status: Subscription.Status;
178
178
 
179
+ /**
180
+ * ID of the test clock this subscription belongs to.
181
+ */
182
+ test_clock?: string | Stripe.TestHelpers.TestClock | null;
183
+
179
184
  /**
180
185
  * The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
181
186
  */
@@ -174,11 +174,19 @@ declare module 'stripe' {
174
174
  id: string,
175
175
  params?: LocationRetrieveParams,
176
176
  options?: RequestOptions
177
- ): Promise<Stripe.Response<Stripe.Terminal.Location>>;
177
+ ): Promise<
178
+ Stripe.Response<
179
+ Stripe.Terminal.Location | Stripe.Terminal.DeletedLocation
180
+ >
181
+ >;
178
182
  retrieve(
179
183
  id: string,
180
184
  options?: RequestOptions
181
- ): Promise<Stripe.Response<Stripe.Terminal.Location>>;
185
+ ): Promise<
186
+ Stripe.Response<
187
+ Stripe.Terminal.Location | Stripe.Terminal.DeletedLocation
188
+ >
189
+ >;
182
190
 
183
191
  /**
184
192
  * Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
@@ -187,7 +195,11 @@ declare module 'stripe' {
187
195
  id: string,
188
196
  params?: LocationUpdateParams,
189
197
  options?: RequestOptions
190
- ): Promise<Stripe.Response<Stripe.Terminal.Location>>;
198
+ ): Promise<
199
+ Stripe.Response<
200
+ Stripe.Terminal.Location | Stripe.Terminal.DeletedLocation
201
+ >
202
+ >;
191
203
 
192
204
  /**
193
205
  * Returns a list of Location objects.
@@ -0,0 +1,179 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace TestHelpers {
6
+ /**
7
+ * The TestClock object.
8
+ */
9
+ interface TestClock {
10
+ /**
11
+ * Unique identifier for the object.
12
+ */
13
+ id: string;
14
+
15
+ /**
16
+ * String representing the object's type. Objects of the same type share the same value.
17
+ */
18
+ object: 'test_helpers.test_clock';
19
+
20
+ /**
21
+ * Time at which the object was created. Measured in seconds since the Unix epoch.
22
+ */
23
+ created: number;
24
+
25
+ deleted?: void;
26
+
27
+ /**
28
+ * Time at which this clock is scheduled to auto delete.
29
+ */
30
+ deletes_after: number;
31
+
32
+ /**
33
+ * Time at which all objects belonging to this clock are frozen.
34
+ */
35
+ frozen_time: number;
36
+
37
+ /**
38
+ * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
39
+ */
40
+ livemode: boolean;
41
+
42
+ /**
43
+ * The custom name supplied at creation.
44
+ */
45
+ name: string | null;
46
+
47
+ /**
48
+ * The status of the Test Clock.
49
+ */
50
+ status: TestClock.Status;
51
+ }
52
+
53
+ namespace TestClock {
54
+ type Status = 'advancing' | 'internal_failure' | 'ready';
55
+ }
56
+
57
+ /**
58
+ * The DeletedTestClock object.
59
+ */
60
+ interface DeletedTestClock {
61
+ /**
62
+ * Unique identifier for the object.
63
+ */
64
+ id: string;
65
+
66
+ /**
67
+ * String representing the object's type. Objects of the same type share the same value.
68
+ */
69
+ object: 'test_helpers.test_clock';
70
+
71
+ /**
72
+ * Always true for a deleted object
73
+ */
74
+ deleted: true;
75
+ }
76
+
77
+ interface TestClockCreateParams {
78
+ /**
79
+ * The initial frozen time for this test clock.
80
+ */
81
+ frozen_time: number;
82
+
83
+ /**
84
+ * Specifies which fields in the response should be expanded.
85
+ */
86
+ expand?: Array<string>;
87
+
88
+ /**
89
+ * The name for this test clock.
90
+ */
91
+ name?: string;
92
+ }
93
+
94
+ interface TestClockRetrieveParams {
95
+ /**
96
+ * Specifies which fields in the response should be expanded.
97
+ */
98
+ expand?: Array<string>;
99
+ }
100
+
101
+ interface TestClockListParams extends PaginationParams {
102
+ /**
103
+ * Specifies which fields in the response should be expanded.
104
+ */
105
+ expand?: Array<string>;
106
+ }
107
+
108
+ interface TestClockDeleteParams {}
109
+
110
+ interface TestClockAdvanceParams {
111
+ /**
112
+ * The time to advance the test clock. Must be after the test clock's current frozen time. Cannot be more than two intervals in the future from the shortest subscription in this test clock. If there are no subscriptions in this test clock, it cannot be more than two years in the future.
113
+ */
114
+ frozen_time: number;
115
+
116
+ /**
117
+ * Specifies which fields in the response should be expanded.
118
+ */
119
+ expand?: Array<string>;
120
+ }
121
+
122
+ class TestClocksResource {
123
+ /**
124
+ * Creates a new test clock that can be attached to new customers and quotes.
125
+ */
126
+ create(
127
+ params: TestClockCreateParams,
128
+ options?: RequestOptions
129
+ ): Promise<Stripe.Response<Stripe.TestHelpers.TestClock>>;
130
+
131
+ /**
132
+ * Retrieves a test clock.
133
+ */
134
+ retrieve(
135
+ id: string,
136
+ params?: TestClockRetrieveParams,
137
+ options?: RequestOptions
138
+ ): Promise<Stripe.Response<Stripe.TestHelpers.TestClock>>;
139
+ retrieve(
140
+ id: string,
141
+ options?: RequestOptions
142
+ ): Promise<Stripe.Response<Stripe.TestHelpers.TestClock>>;
143
+
144
+ /**
145
+ * Returns a list of your test clocks.
146
+ */
147
+ list(
148
+ params?: TestClockListParams,
149
+ options?: RequestOptions
150
+ ): ApiListPromise<Stripe.TestHelpers.TestClock>;
151
+ list(
152
+ options?: RequestOptions
153
+ ): ApiListPromise<Stripe.TestHelpers.TestClock>;
154
+
155
+ /**
156
+ * Deletes a test clock.
157
+ */
158
+ del(
159
+ id: string,
160
+ params?: TestClockDeleteParams,
161
+ options?: RequestOptions
162
+ ): Promise<Stripe.Response<Stripe.TestHelpers.DeletedTestClock>>;
163
+ del(
164
+ id: string,
165
+ options?: RequestOptions
166
+ ): Promise<Stripe.Response<Stripe.TestHelpers.DeletedTestClock>>;
167
+
168
+ /**
169
+ * Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
170
+ */
171
+ advance(
172
+ id: string,
173
+ params: TestClockAdvanceParams,
174
+ options?: RequestOptions
175
+ ): Promise<Stripe.Response<Stripe.TestHelpers.TestClock>>;
176
+ }
177
+ }
178
+ }
179
+ }
@@ -97,6 +97,7 @@
97
97
  ///<reference path='./Terminal/ConnectionTokens.d.ts' />
98
98
  ///<reference path='./Terminal/Locations.d.ts' />
99
99
  ///<reference path='./Terminal/Readers.d.ts' />
100
+ ///<reference path='./TestHelpers/TestClocks.d.ts' />
100
101
  ///<reference path='./Tokens.d.ts' />
101
102
  ///<reference path='./Topups.d.ts' />
102
103
  ///<reference path='./TransferReversals.d.ts' />
@@ -210,6 +211,9 @@ declare module 'stripe' {
210
211
  locations: Stripe.Terminal.LocationsResource;
211
212
  readers: Stripe.Terminal.ReadersResource;
212
213
  };
214
+ testHelpers: {
215
+ testClocks: Stripe.TestHelpers.TestClocksResource;
216
+ };
213
217
  /**
214
218
  * API Errors
215
219
  */