orb-billing 4.17.1 → 4.19.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 +27 -0
- package/core.d.ts.map +1 -1
- package/core.js +6 -0
- package/core.js.map +1 -1
- package/core.mjs +6 -0
- package/core.mjs.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/internal/qs/formats.d.ts +6 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +11 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +8 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +280 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +276 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.ts +14 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +229 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/package.json +2 -4
- package/resources/coupons/coupons.d.ts +14 -0
- package/resources/coupons/coupons.d.ts.map +1 -1
- package/resources/coupons/coupons.js.map +1 -1
- package/resources/coupons/coupons.mjs.map +1 -1
- package/resources/events/backfills.d.ts +13 -11
- package/resources/events/backfills.d.ts.map +1 -1
- package/resources/events/backfills.js.map +1 -1
- package/resources/events/backfills.mjs.map +1 -1
- package/resources/invoices.d.ts +188 -6
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs.map +1 -1
- package/resources/plans/plans.d.ts +2 -2
- package/resources/subscriptions.d.ts +2 -2
- package/src/core.ts +5 -0
- package/src/index.ts +1 -1
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +9 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +388 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/resources/coupons/coupons.ts +14 -0
- package/src/resources/events/backfills.ts +13 -11
- package/src/resources/invoices.ts +248 -6
- package/src/resources/plans/plans.ts +2 -2
- package/src/resources/subscriptions.ts +2 -2
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { RFC1738 } from './formats';
|
|
2
|
+
import type { DefaultEncoder, Format } from './types';
|
|
3
|
+
|
|
4
|
+
const has = Object.prototype.hasOwnProperty;
|
|
5
|
+
const is_array = Array.isArray;
|
|
6
|
+
|
|
7
|
+
const hex_table = (() => {
|
|
8
|
+
const array = [];
|
|
9
|
+
for (let i = 0; i < 256; ++i) {
|
|
10
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return array;
|
|
14
|
+
})();
|
|
15
|
+
|
|
16
|
+
function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
|
|
17
|
+
while (queue.length > 1) {
|
|
18
|
+
const item = queue.pop();
|
|
19
|
+
if (!item) continue;
|
|
20
|
+
|
|
21
|
+
const obj = item.obj[item.prop];
|
|
22
|
+
|
|
23
|
+
if (is_array(obj)) {
|
|
24
|
+
const compacted: unknown[] = [];
|
|
25
|
+
|
|
26
|
+
for (let j = 0; j < obj.length; ++j) {
|
|
27
|
+
if (typeof obj[j] !== 'undefined') {
|
|
28
|
+
compacted.push(obj[j]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
item.obj[item.prop] = compacted;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function array_to_object(source: any[], options: { plainObjects: boolean }) {
|
|
39
|
+
const obj = options && options.plainObjects ? Object.create(null) : {};
|
|
40
|
+
for (let i = 0; i < source.length; ++i) {
|
|
41
|
+
if (typeof source[i] !== 'undefined') {
|
|
42
|
+
obj[i] = source[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function merge(
|
|
50
|
+
target: any,
|
|
51
|
+
source: any,
|
|
52
|
+
options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
|
|
53
|
+
) {
|
|
54
|
+
if (!source) {
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof source !== 'object') {
|
|
59
|
+
if (is_array(target)) {
|
|
60
|
+
target.push(source);
|
|
61
|
+
} else if (target && typeof target === 'object') {
|
|
62
|
+
if (
|
|
63
|
+
(options && (options.plainObjects || options.allowPrototypes)) ||
|
|
64
|
+
!has.call(Object.prototype, source)
|
|
65
|
+
) {
|
|
66
|
+
target[source] = true;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
return [target, source];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!target || typeof target !== 'object') {
|
|
76
|
+
return [target].concat(source);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let mergeTarget = target;
|
|
80
|
+
if (is_array(target) && !is_array(source)) {
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
mergeTarget = array_to_object(target, options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (is_array(target) && is_array(source)) {
|
|
86
|
+
source.forEach(function (item, i) {
|
|
87
|
+
if (has.call(target, i)) {
|
|
88
|
+
const targetItem = target[i];
|
|
89
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
90
|
+
target[i] = merge(targetItem, item, options);
|
|
91
|
+
} else {
|
|
92
|
+
target.push(item);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
target[i] = item;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return target;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
102
|
+
const value = source[key];
|
|
103
|
+
|
|
104
|
+
if (has.call(acc, key)) {
|
|
105
|
+
acc[key] = merge(acc[key], value, options);
|
|
106
|
+
} else {
|
|
107
|
+
acc[key] = value;
|
|
108
|
+
}
|
|
109
|
+
return acc;
|
|
110
|
+
}, mergeTarget);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function assign_single_source(target: any, source: any) {
|
|
114
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
115
|
+
acc[key] = source[key];
|
|
116
|
+
return acc;
|
|
117
|
+
}, target);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function decode(str: string, _: any, charset: string) {
|
|
121
|
+
const strWithoutPlus = str.replace(/\+/g, ' ');
|
|
122
|
+
if (charset === 'iso-8859-1') {
|
|
123
|
+
// unescape never throws, no try...catch needed:
|
|
124
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
125
|
+
}
|
|
126
|
+
// utf-8
|
|
127
|
+
try {
|
|
128
|
+
return decodeURIComponent(strWithoutPlus);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
return strWithoutPlus;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const limit = 1024;
|
|
135
|
+
|
|
136
|
+
export const encode: (
|
|
137
|
+
str: any,
|
|
138
|
+
defaultEncoder: DefaultEncoder,
|
|
139
|
+
charset: string,
|
|
140
|
+
type: 'key' | 'value',
|
|
141
|
+
format: Format,
|
|
142
|
+
) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
|
|
143
|
+
// This code was originally written by Brian White for the io.js core querystring library.
|
|
144
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
145
|
+
if (str.length === 0) {
|
|
146
|
+
return str;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let string = str;
|
|
150
|
+
if (typeof str === 'symbol') {
|
|
151
|
+
string = Symbol.prototype.toString.call(str);
|
|
152
|
+
} else if (typeof str !== 'string') {
|
|
153
|
+
string = String(str);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (charset === 'iso-8859-1') {
|
|
157
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
158
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let out = '';
|
|
163
|
+
for (let j = 0; j < string.length; j += limit) {
|
|
164
|
+
const segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
165
|
+
const arr = [];
|
|
166
|
+
|
|
167
|
+
for (let i = 0; i < segment.length; ++i) {
|
|
168
|
+
let c = segment.charCodeAt(i);
|
|
169
|
+
if (
|
|
170
|
+
c === 0x2d || // -
|
|
171
|
+
c === 0x2e || // .
|
|
172
|
+
c === 0x5f || // _
|
|
173
|
+
c === 0x7e || // ~
|
|
174
|
+
(c >= 0x30 && c <= 0x39) || // 0-9
|
|
175
|
+
(c >= 0x41 && c <= 0x5a) || // a-z
|
|
176
|
+
(c >= 0x61 && c <= 0x7a) || // A-Z
|
|
177
|
+
(format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
178
|
+
) {
|
|
179
|
+
arr[arr.length] = segment.charAt(i);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (c < 0x80) {
|
|
184
|
+
arr[arr.length] = hex_table[c];
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (c < 0x800) {
|
|
189
|
+
arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (c < 0xd800 || c >= 0xe000) {
|
|
194
|
+
arr[arr.length] =
|
|
195
|
+
hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
i += 1;
|
|
200
|
+
c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
|
|
201
|
+
|
|
202
|
+
arr[arr.length] =
|
|
203
|
+
hex_table[0xf0 | (c >> 18)]! +
|
|
204
|
+
hex_table[0x80 | ((c >> 12) & 0x3f)] +
|
|
205
|
+
hex_table[0x80 | ((c >> 6) & 0x3f)] +
|
|
206
|
+
hex_table[0x80 | (c & 0x3f)];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
out += arr.join('');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return out;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export function compact(value: any) {
|
|
216
|
+
const queue = [{ obj: { o: value }, prop: 'o' }];
|
|
217
|
+
const refs = [];
|
|
218
|
+
|
|
219
|
+
for (let i = 0; i < queue.length; ++i) {
|
|
220
|
+
const item = queue[i];
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
const obj = item.obj[item.prop];
|
|
223
|
+
|
|
224
|
+
const keys = Object.keys(obj);
|
|
225
|
+
for (let j = 0; j < keys.length; ++j) {
|
|
226
|
+
const key = keys[j]!;
|
|
227
|
+
const val = obj[key];
|
|
228
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
229
|
+
queue.push({ obj: obj, prop: key });
|
|
230
|
+
refs.push(val);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
compact_queue(queue);
|
|
236
|
+
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function is_regexp(obj: any) {
|
|
241
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function is_buffer(obj: any) {
|
|
245
|
+
if (!obj || typeof obj !== 'object') {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function combine(a: any, b: any) {
|
|
253
|
+
return [].concat(a, b);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function maybe_map<T>(val: T[], fn: (v: T) => T) {
|
|
257
|
+
if (is_array(val)) {
|
|
258
|
+
const mapped = [];
|
|
259
|
+
for (let i = 0; i < val.length; i += 1) {
|
|
260
|
+
mapped.push(fn(val[i]!));
|
|
261
|
+
}
|
|
262
|
+
return mapped;
|
|
263
|
+
}
|
|
264
|
+
return fn(val);
|
|
265
|
+
}
|
|
@@ -85,6 +85,20 @@ export class CouponsPage extends Page<Coupon> {}
|
|
|
85
85
|
* "UPGRADE20" that offers a 20% discount on the first month of the new plan. This
|
|
86
86
|
* code can be applied during the upgrade process in your billing portal, making it
|
|
87
87
|
* straightforward for users to benefit from the new features at a reduced cost.
|
|
88
|
+
*
|
|
89
|
+
* ## Coupon scoping
|
|
90
|
+
*
|
|
91
|
+
* When a coupon is applied on a subscription, it creates a discount adjustment
|
|
92
|
+
* that applies to all of the prices on the subscription at the time of the coupon
|
|
93
|
+
* application. Notably, coupons do not scope in new price additions to a
|
|
94
|
+
* subscription automatically — if a new price is added to the subscription with a
|
|
95
|
+
* subscription edit or plan version migration, the discount created with the
|
|
96
|
+
* coupon will not apply to it automatically. If you'd like the coupon to apply to
|
|
97
|
+
* newly added prices, you can
|
|
98
|
+
* [edit the adjustment intervals](add-edit-price-intervals.api.mdx) to end the
|
|
99
|
+
* discount interval created by the coupon at the time of the migration and add a
|
|
100
|
+
* new one starting at the time of the migration that includes the newly added
|
|
101
|
+
* prices you'd like the coupon to apply to.
|
|
88
102
|
*/
|
|
89
103
|
export interface Coupon {
|
|
90
104
|
/**
|
|
@@ -121,8 +121,8 @@ export interface BackfillCreateResponse {
|
|
|
121
121
|
created_at: string;
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
* The
|
|
125
|
-
* to
|
|
124
|
+
* The Orb-generated ID of the customer to which this backfill is scoped. If
|
|
125
|
+
* `null`, this backfill is scoped to all customers.
|
|
126
126
|
*/
|
|
127
127
|
customer_id: string | null;
|
|
128
128
|
|
|
@@ -169,8 +169,8 @@ export interface BackfillListResponse {
|
|
|
169
169
|
created_at: string;
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
|
-
* The
|
|
173
|
-
* to
|
|
172
|
+
* The Orb-generated ID of the customer to which this backfill is scoped. If
|
|
173
|
+
* `null`, this backfill is scoped to all customers.
|
|
174
174
|
*/
|
|
175
175
|
customer_id: string | null;
|
|
176
176
|
|
|
@@ -217,8 +217,8 @@ export interface BackfillCloseResponse {
|
|
|
217
217
|
created_at: string;
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
|
-
* The
|
|
221
|
-
* to
|
|
220
|
+
* The Orb-generated ID of the customer to which this backfill is scoped. If
|
|
221
|
+
* `null`, this backfill is scoped to all customers.
|
|
222
222
|
*/
|
|
223
223
|
customer_id: string | null;
|
|
224
224
|
|
|
@@ -265,8 +265,8 @@ export interface BackfillFetchResponse {
|
|
|
265
265
|
created_at: string;
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
|
-
* The
|
|
269
|
-
* to
|
|
268
|
+
* The Orb-generated ID of the customer to which this backfill is scoped. If
|
|
269
|
+
* `null`, this backfill is scoped to all customers.
|
|
270
270
|
*/
|
|
271
271
|
customer_id: string | null;
|
|
272
272
|
|
|
@@ -313,8 +313,8 @@ export interface BackfillRevertResponse {
|
|
|
313
313
|
created_at: string;
|
|
314
314
|
|
|
315
315
|
/**
|
|
316
|
-
* The
|
|
317
|
-
* to
|
|
316
|
+
* The Orb-generated ID of the customer to which this backfill is scoped. If
|
|
317
|
+
* `null`, this backfill is scoped to all customers.
|
|
318
318
|
*/
|
|
319
319
|
customer_id: string | null;
|
|
320
320
|
|
|
@@ -364,7 +364,8 @@ export interface BackfillCreateParams {
|
|
|
364
364
|
close_time?: string | null;
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
|
-
* The ID of the customer to which this backfill is scoped.
|
|
367
|
+
* The Orb-generated ID of the customer to which this backfill is scoped. Omitting
|
|
368
|
+
* this field will scope the backfill to all customers.
|
|
368
369
|
*/
|
|
369
370
|
customer_id?: string | null;
|
|
370
371
|
|
|
@@ -377,6 +378,7 @@ export interface BackfillCreateParams {
|
|
|
377
378
|
|
|
378
379
|
/**
|
|
379
380
|
* The external customer ID of the customer to which this backfill is scoped.
|
|
381
|
+
* Omitting this field will scope the backfill to all customers.
|
|
380
382
|
*/
|
|
381
383
|
external_customer_id?: string | null;
|
|
382
384
|
|
|
@@ -50,6 +50,10 @@ export class Invoices extends APIResource {
|
|
|
50
50
|
* the next page of results if they exist.
|
|
51
51
|
*
|
|
52
52
|
* By default, this only returns invoices that are `issued`, `paid`, or `synced`.
|
|
53
|
+
*
|
|
54
|
+
* When fetching any `draft` invoices, this returns the last-computed invoice
|
|
55
|
+
* values for each draft invoice, which may not always be up-to-date since Orb
|
|
56
|
+
* regularly refreshes invoices asynchronously.
|
|
53
57
|
*/
|
|
54
58
|
list(query?: InvoiceListParams, options?: Core.RequestOptions): Core.PagePromise<InvoicesPage, Invoice>;
|
|
55
59
|
list(options?: Core.RequestOptions): Core.PagePromise<InvoicesPage, Invoice>;
|
|
@@ -284,9 +288,9 @@ export interface Invoice {
|
|
|
284
288
|
* provided, the first discount in the list will be returned. If the list is empty,
|
|
285
289
|
* `None` will be returned.
|
|
286
290
|
*/
|
|
287
|
-
discount:
|
|
291
|
+
discount: Invoice.PercentageDiscount | Invoice.AmountDiscount | Invoice.TrialDiscount | null;
|
|
288
292
|
|
|
289
|
-
discounts: Array<
|
|
293
|
+
discounts: Array<Invoice.PercentageDiscount | Invoice.AmountDiscount | Invoice.TrialDiscount>;
|
|
290
294
|
|
|
291
295
|
/**
|
|
292
296
|
* When the invoice payment is due.
|
|
@@ -301,7 +305,8 @@ export interface Invoice {
|
|
|
301
305
|
eligible_to_issue_at: string | null;
|
|
302
306
|
|
|
303
307
|
/**
|
|
304
|
-
* A URL for the invoice portal.
|
|
308
|
+
* A URL for the customer-facing invoice portal. This URL expires 30 days after the
|
|
309
|
+
* invoice's due date, or 60 days after being re-generated through the UI.
|
|
305
310
|
*/
|
|
306
311
|
hosted_invoice_url: string | null;
|
|
307
312
|
|
|
@@ -826,6 +831,120 @@ export namespace Invoice {
|
|
|
826
831
|
value: string;
|
|
827
832
|
}
|
|
828
833
|
|
|
834
|
+
export interface PercentageDiscount {
|
|
835
|
+
/**
|
|
836
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
837
|
+
* this can be a subset of prices.
|
|
838
|
+
*/
|
|
839
|
+
applies_to_price_ids: Array<string>;
|
|
840
|
+
|
|
841
|
+
discount_type: 'percentage';
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Only available if discount_type is `percentage`. This is a number between 0
|
|
845
|
+
* and 1.
|
|
846
|
+
*/
|
|
847
|
+
percentage_discount: number;
|
|
848
|
+
|
|
849
|
+
reason?: string | null;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export interface AmountDiscount {
|
|
853
|
+
/**
|
|
854
|
+
* Only available if discount_type is `amount`.
|
|
855
|
+
*/
|
|
856
|
+
amount_discount: string;
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
860
|
+
* this can be a subset of prices.
|
|
861
|
+
*/
|
|
862
|
+
applies_to_price_ids: Array<string>;
|
|
863
|
+
|
|
864
|
+
discount_type: 'amount';
|
|
865
|
+
|
|
866
|
+
reason?: string | null;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export interface TrialDiscount {
|
|
870
|
+
/**
|
|
871
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
872
|
+
* this can be a subset of prices.
|
|
873
|
+
*/
|
|
874
|
+
applies_to_price_ids: Array<string>;
|
|
875
|
+
|
|
876
|
+
discount_type: 'trial';
|
|
877
|
+
|
|
878
|
+
reason?: string | null;
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* Only available if discount_type is `trial`
|
|
882
|
+
*/
|
|
883
|
+
trial_amount_discount?: string | null;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Only available if discount_type is `trial`
|
|
887
|
+
*/
|
|
888
|
+
trial_percentage_discount?: number | null;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
export interface PercentageDiscount {
|
|
892
|
+
/**
|
|
893
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
894
|
+
* this can be a subset of prices.
|
|
895
|
+
*/
|
|
896
|
+
applies_to_price_ids: Array<string>;
|
|
897
|
+
|
|
898
|
+
discount_type: 'percentage';
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Only available if discount_type is `percentage`. This is a number between 0
|
|
902
|
+
* and 1.
|
|
903
|
+
*/
|
|
904
|
+
percentage_discount: number;
|
|
905
|
+
|
|
906
|
+
reason?: string | null;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
export interface AmountDiscount {
|
|
910
|
+
/**
|
|
911
|
+
* Only available if discount_type is `amount`.
|
|
912
|
+
*/
|
|
913
|
+
amount_discount: string;
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
917
|
+
* this can be a subset of prices.
|
|
918
|
+
*/
|
|
919
|
+
applies_to_price_ids: Array<string>;
|
|
920
|
+
|
|
921
|
+
discount_type: 'amount';
|
|
922
|
+
|
|
923
|
+
reason?: string | null;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
export interface TrialDiscount {
|
|
927
|
+
/**
|
|
928
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
929
|
+
* this can be a subset of prices.
|
|
930
|
+
*/
|
|
931
|
+
applies_to_price_ids: Array<string>;
|
|
932
|
+
|
|
933
|
+
discount_type: 'trial';
|
|
934
|
+
|
|
935
|
+
reason?: string | null;
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Only available if discount_type is `trial`
|
|
939
|
+
*/
|
|
940
|
+
trial_amount_discount?: string | null;
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Only available if discount_type is `trial`
|
|
944
|
+
*/
|
|
945
|
+
trial_percentage_discount?: number | null;
|
|
946
|
+
}
|
|
947
|
+
|
|
829
948
|
export interface LineItem {
|
|
830
949
|
/**
|
|
831
950
|
* A unique ID for this line item.
|
|
@@ -1457,9 +1576,17 @@ export interface InvoiceFetchUpcomingResponse {
|
|
|
1457
1576
|
* provided, the first discount in the list will be returned. If the list is empty,
|
|
1458
1577
|
* `None` will be returned.
|
|
1459
1578
|
*/
|
|
1460
|
-
discount:
|
|
1579
|
+
discount:
|
|
1580
|
+
| InvoiceFetchUpcomingResponse.PercentageDiscount
|
|
1581
|
+
| InvoiceFetchUpcomingResponse.AmountDiscount
|
|
1582
|
+
| InvoiceFetchUpcomingResponse.TrialDiscount
|
|
1583
|
+
| null;
|
|
1461
1584
|
|
|
1462
|
-
discounts: Array<
|
|
1585
|
+
discounts: Array<
|
|
1586
|
+
| InvoiceFetchUpcomingResponse.PercentageDiscount
|
|
1587
|
+
| InvoiceFetchUpcomingResponse.AmountDiscount
|
|
1588
|
+
| InvoiceFetchUpcomingResponse.TrialDiscount
|
|
1589
|
+
>;
|
|
1463
1590
|
|
|
1464
1591
|
/**
|
|
1465
1592
|
* When the invoice payment is due.
|
|
@@ -1474,7 +1601,8 @@ export interface InvoiceFetchUpcomingResponse {
|
|
|
1474
1601
|
eligible_to_issue_at: string | null;
|
|
1475
1602
|
|
|
1476
1603
|
/**
|
|
1477
|
-
* A URL for the invoice portal.
|
|
1604
|
+
* A URL for the customer-facing invoice portal. This URL expires 30 days after the
|
|
1605
|
+
* invoice's due date, or 60 days after being re-generated through the UI.
|
|
1478
1606
|
*/
|
|
1479
1607
|
hosted_invoice_url: string | null;
|
|
1480
1608
|
|
|
@@ -1999,6 +2127,120 @@ export namespace InvoiceFetchUpcomingResponse {
|
|
|
1999
2127
|
value: string;
|
|
2000
2128
|
}
|
|
2001
2129
|
|
|
2130
|
+
export interface PercentageDiscount {
|
|
2131
|
+
/**
|
|
2132
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
2133
|
+
* this can be a subset of prices.
|
|
2134
|
+
*/
|
|
2135
|
+
applies_to_price_ids: Array<string>;
|
|
2136
|
+
|
|
2137
|
+
discount_type: 'percentage';
|
|
2138
|
+
|
|
2139
|
+
/**
|
|
2140
|
+
* Only available if discount_type is `percentage`. This is a number between 0
|
|
2141
|
+
* and 1.
|
|
2142
|
+
*/
|
|
2143
|
+
percentage_discount: number;
|
|
2144
|
+
|
|
2145
|
+
reason?: string | null;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
export interface AmountDiscount {
|
|
2149
|
+
/**
|
|
2150
|
+
* Only available if discount_type is `amount`.
|
|
2151
|
+
*/
|
|
2152
|
+
amount_discount: string;
|
|
2153
|
+
|
|
2154
|
+
/**
|
|
2155
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
2156
|
+
* this can be a subset of prices.
|
|
2157
|
+
*/
|
|
2158
|
+
applies_to_price_ids: Array<string>;
|
|
2159
|
+
|
|
2160
|
+
discount_type: 'amount';
|
|
2161
|
+
|
|
2162
|
+
reason?: string | null;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
export interface TrialDiscount {
|
|
2166
|
+
/**
|
|
2167
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
2168
|
+
* this can be a subset of prices.
|
|
2169
|
+
*/
|
|
2170
|
+
applies_to_price_ids: Array<string>;
|
|
2171
|
+
|
|
2172
|
+
discount_type: 'trial';
|
|
2173
|
+
|
|
2174
|
+
reason?: string | null;
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* Only available if discount_type is `trial`
|
|
2178
|
+
*/
|
|
2179
|
+
trial_amount_discount?: string | null;
|
|
2180
|
+
|
|
2181
|
+
/**
|
|
2182
|
+
* Only available if discount_type is `trial`
|
|
2183
|
+
*/
|
|
2184
|
+
trial_percentage_discount?: number | null;
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
export interface PercentageDiscount {
|
|
2188
|
+
/**
|
|
2189
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
2190
|
+
* this can be a subset of prices.
|
|
2191
|
+
*/
|
|
2192
|
+
applies_to_price_ids: Array<string>;
|
|
2193
|
+
|
|
2194
|
+
discount_type: 'percentage';
|
|
2195
|
+
|
|
2196
|
+
/**
|
|
2197
|
+
* Only available if discount_type is `percentage`. This is a number between 0
|
|
2198
|
+
* and 1.
|
|
2199
|
+
*/
|
|
2200
|
+
percentage_discount: number;
|
|
2201
|
+
|
|
2202
|
+
reason?: string | null;
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
export interface AmountDiscount {
|
|
2206
|
+
/**
|
|
2207
|
+
* Only available if discount_type is `amount`.
|
|
2208
|
+
*/
|
|
2209
|
+
amount_discount: string;
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
2213
|
+
* this can be a subset of prices.
|
|
2214
|
+
*/
|
|
2215
|
+
applies_to_price_ids: Array<string>;
|
|
2216
|
+
|
|
2217
|
+
discount_type: 'amount';
|
|
2218
|
+
|
|
2219
|
+
reason?: string | null;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
export interface TrialDiscount {
|
|
2223
|
+
/**
|
|
2224
|
+
* List of price_ids that this discount applies to. For plan/plan phase discounts,
|
|
2225
|
+
* this can be a subset of prices.
|
|
2226
|
+
*/
|
|
2227
|
+
applies_to_price_ids: Array<string>;
|
|
2228
|
+
|
|
2229
|
+
discount_type: 'trial';
|
|
2230
|
+
|
|
2231
|
+
reason?: string | null;
|
|
2232
|
+
|
|
2233
|
+
/**
|
|
2234
|
+
* Only available if discount_type is `trial`
|
|
2235
|
+
*/
|
|
2236
|
+
trial_amount_discount?: string | null;
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* Only available if discount_type is `trial`
|
|
2240
|
+
*/
|
|
2241
|
+
trial_percentage_discount?: number | null;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2002
2244
|
export interface LineItem {
|
|
2003
2245
|
/**
|
|
2004
2246
|
* A unique ID for this line item.
|
|
@@ -103,8 +103,8 @@ export interface Plan {
|
|
|
103
103
|
created_at: string;
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
* An ISO 4217 currency string or custom pricing unit (`credits`) for
|
|
107
|
-
* prices.
|
|
106
|
+
* @deprecated: An ISO 4217 currency string or custom pricing unit (`credits`) for
|
|
107
|
+
* this plan's prices.
|
|
108
108
|
*/
|
|
109
109
|
currency: string;
|
|
110
110
|
|
|
@@ -93,11 +93,11 @@ export class Subscriptions extends APIResource {
|
|
|
93
93
|
* "tiers": [
|
|
94
94
|
* {
|
|
95
95
|
* "first_unit":"1",
|
|
96
|
-
* "last_unit": "
|
|
96
|
+
* "last_unit": "11",
|
|
97
97
|
* "unit_amount": "0.50"
|
|
98
98
|
* },
|
|
99
99
|
* {
|
|
100
|
-
* "first_unit": "
|
|
100
|
+
* "first_unit": "11",
|
|
101
101
|
* "last_unit": null,
|
|
102
102
|
* "unit_amount": "0.10"
|
|
103
103
|
* }
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.19.0'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.19.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED