@isnap/sdk 2.2.0-next.227 → 2.2.0-next.228
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.
|
@@ -2972,7 +2972,7 @@ export interface paths {
|
|
|
2972
2972
|
parameters: {
|
|
2973
2973
|
query?: {
|
|
2974
2974
|
/** @description Keep the pre-orders in this status. */
|
|
2975
|
-
status?: "draft" | "provisioning" | "fulfilled" | "cancelled";
|
|
2975
|
+
status?: "draft" | "awaiting_payment" | "provisioning" | "fulfilled" | "cancelled";
|
|
2976
2976
|
/** @description The `next_cursor` of the previous page. Omit it for the first page. An unreadable cursor restarts from the first page, without an error. */
|
|
2977
2977
|
cursor?: string;
|
|
2978
2978
|
/** @description Number of pre-orders per page, from 1 to 100. Default: 25. */
|
|
@@ -3036,7 +3036,7 @@ export interface paths {
|
|
|
3036
3036
|
* Create a pre-order
|
|
3037
3037
|
* @description Creates a draft pre-order for one rented iMessage line. Accepts an API key. A line-scoped key is not limited to its list on this operation. A draft has no effect: it creates no line, takes no payment, and never expires. Call `POST /v1/pre-orders/{id}/confirm` to commit it. There is no limit on the number of drafts. `Idempotency-Key` is ignored: a repeated call creates another draft. Creating a draft sends no event.
|
|
3038
3038
|
*
|
|
3039
|
-
* `preferred_area_codes` lists up to 5 area codes in order of preference, and `inbound_only` chooses between an inbound-only line and a two-way line. `billing_tier`, when sent, must be `rental_iphone`: `rental_android` returns `400 android_rental_not_purchasable`, and the four other values return `400 tier_not_pre_orderable`. `billing_anchor_at` is stored on the pre-order and carried onto the line
|
|
3039
|
+
* `preferred_area_codes` lists up to 5 area codes in order of preference, and `inbound_only` chooses between an inbound-only line and a two-way line. `billing_tier`, when sent, must be `rental_iphone`: `rental_android` returns `400 android_rental_not_purchasable`, and the four other values return `400 tier_not_pre_orderable`. `billing_anchor_at` is stored on the pre-order and carried onto the line when the line is created: a value more than 31 days after the call returns `400 billing_anchor_too_far`, and it is not checked again. A key that is not listed, `quantity` included, returns `400 validation_failed`: one pre-order is one line.
|
|
3040
3040
|
*/
|
|
3041
3041
|
post: {
|
|
3042
3042
|
parameters: {
|
|
@@ -3162,11 +3162,17 @@ export interface paths {
|
|
|
3162
3162
|
put?: never;
|
|
3163
3163
|
/**
|
|
3164
3164
|
* Confirm a pre-order
|
|
3165
|
-
* @description Commits a draft pre-order. Accepts an API key. A line-scoped key is not limited to its list on this operation: it can confirm any draft of the account. The
|
|
3165
|
+
* @description Commits a draft pre-order. Accepts an API key. A line-scoped key is not limited to its list on this operation: it can confirm any draft of the account. The confirmation sends no event: iSnap sends `pre_order.fulfilled`, which carries the `line_id`, when the line is handed over.
|
|
3166
3166
|
*
|
|
3167
|
-
*
|
|
3167
|
+
* The build of a pre-order sets `status` to `provisioning` and `estimated_fulfillment` to the time the build starts plus 72 hours, and creates on your account a rented iMessage line with `status: provisioning`, with the `inbound_only` and the `billing_anchor_at` of the pre-order. When a number is in stock in one of your area codes, in their order of preference, it is assigned to the line when the build starts. A pre-order with no `preferred_area_codes` takes any number in stock.
|
|
3168
3168
|
*
|
|
3169
|
-
*
|
|
3169
|
+
* For a wholesale partner the build starts with the confirmation. A wholesale partner pays nothing at confirmation: `stripe_client_secret` is `null`, and the line is billed on the monthly invoice from the day it is handed over.
|
|
3170
|
+
*
|
|
3171
|
+
* For a direct account the build starts when the first month is paid. Confirm starts a monthly subscription, sets `status` to `awaiting_payment` and returns `stripe_client_secret`, a client secret that your payment page passes to the payment form of Stripe to collect the first month. Only card payments are accepted. Until that payment succeeds, no line is created and `estimated_fulfillment` is `null`. After paying, read the pre-order with `GET /v1/pre-orders/{id}` until `status` is `provisioning`. When the first month is not paid within 23 hours of the confirmation, `status` becomes `cancelled` and iSnap sends `pre_order.cancelled`. When a credit balance of the account at Stripe covers the first month, there is nothing to pay: the build starts with the confirmation and `stripe_client_secret` is `null`. The first month starts at the confirmation, not when the line is handed over, and the next invoice is issued one month after the confirmation. The hand-over of the line takes no payment and does not change when the subscription is invoiced.
|
|
3172
|
+
*
|
|
3173
|
+
* Confirm can be repeated while `status` is `awaiting_payment`: it returns the same client secret and starts no second subscription. Repeated after the payment succeeded, it returns the pre-order in `provisioning`.
|
|
3174
|
+
*
|
|
3175
|
+
* Any other pre-order returns `400 pre_order_not_draft`, including one that was canceled because its first month was not paid in time. A confirmation that runs at the same time as a cancellation, or for a wholesale partner as another confirmation, returns `409 pre_order_not_draft`. When Stripe cannot be reached, the call returns `503 payment_provider_unavailable`: nothing changed, and the call can be repeated. When Stripe refuses the request for the account, the call returns `409 payment_setup_failed`: nothing changed, and repeating the call does not help. Once its build has started, a pre-order cannot be canceled through the API.
|
|
3170
3176
|
*/
|
|
3171
3177
|
post: {
|
|
3172
3178
|
parameters: {
|
|
@@ -3180,7 +3186,7 @@ export interface paths {
|
|
|
3180
3186
|
};
|
|
3181
3187
|
requestBody?: never;
|
|
3182
3188
|
responses: {
|
|
3183
|
-
/** @description The pre-order, in status `provisioning
|
|
3189
|
+
/** @description The pre-order: in status `awaiting_payment` with its `stripe_client_secret` for a direct account whose first month is due, in status `provisioning` otherwise. */
|
|
3184
3190
|
200: {
|
|
3185
3191
|
headers: {
|
|
3186
3192
|
[name: string]: unknown;
|
|
@@ -3200,7 +3206,7 @@ export interface paths {
|
|
|
3200
3206
|
};
|
|
3201
3207
|
};
|
|
3202
3208
|
};
|
|
3203
|
-
/** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_not_draft` when the pre-order is
|
|
3209
|
+
/** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_not_draft` when the pre-order is neither a draft nor in `awaiting_payment`, except a pre-order in `provisioning` whose first month was paid, which a repeated confirm returns. */
|
|
3204
3210
|
400: {
|
|
3205
3211
|
headers: {
|
|
3206
3212
|
[name: string]: unknown;
|
|
@@ -3227,6 +3233,15 @@ export interface paths {
|
|
|
3227
3233
|
"application/json": components["schemas"]["ErrorEnvelope"];
|
|
3228
3234
|
};
|
|
3229
3235
|
};
|
|
3236
|
+
/** @description Conflict. `error.code` is `pre_order_not_draft` when a cancellation, or for a wholesale partner another confirmation, ran at the same time and won. It is `payment_setup_failed` when Stripe refused the request for the account: repeating the call does not help. */
|
|
3237
|
+
409: {
|
|
3238
|
+
headers: {
|
|
3239
|
+
[name: string]: unknown;
|
|
3240
|
+
};
|
|
3241
|
+
content: {
|
|
3242
|
+
"application/json": components["schemas"]["ErrorEnvelope"];
|
|
3243
|
+
};
|
|
3244
|
+
};
|
|
3230
3245
|
/** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
|
|
3231
3246
|
429: {
|
|
3232
3247
|
headers: {
|
|
@@ -3245,6 +3260,15 @@ export interface paths {
|
|
|
3245
3260
|
"application/json": components["schemas"]["ErrorEnvelope"];
|
|
3246
3261
|
};
|
|
3247
3262
|
};
|
|
3263
|
+
/** @description Service unavailable. `error.code` is `payment_provider_unavailable`: Stripe could not be reached. Nothing changed, and the call can be repeated. */
|
|
3264
|
+
503: {
|
|
3265
|
+
headers: {
|
|
3266
|
+
[name: string]: unknown;
|
|
3267
|
+
};
|
|
3268
|
+
content: {
|
|
3269
|
+
"application/json": components["schemas"]["ErrorEnvelope"];
|
|
3270
|
+
};
|
|
3271
|
+
};
|
|
3248
3272
|
};
|
|
3249
3273
|
};
|
|
3250
3274
|
delete?: never;
|
|
@@ -3262,7 +3286,7 @@ export interface paths {
|
|
|
3262
3286
|
};
|
|
3263
3287
|
/**
|
|
3264
3288
|
* Get a pre-order
|
|
3265
|
-
* @description Returns one pre-order of the account. Accepts an API key. A line-scoped key is not limited to its list on this operation. A pre-order carries no line id: the line it produces is announced by `pre_order.fulfilled`, which carries the `line_id`. `stripe_client_secret` is `null` here. A pre-order of another account, or an unknown id, returns `404 not_found`.
|
|
3289
|
+
* @description Returns one pre-order of the account. Accepts an API key. A line-scoped key is not limited to its list on this operation. A pre-order carries no line id: the line it produces is announced by `pre_order.fulfilled`, which carries the `line_id`. `stripe_client_secret` is `null` here. Reading a pre-order in status `awaiting_payment` checks its first-month payment with Stripe: when that payment has succeeded, the build starts and the pre-order is returned in `provisioning`. When Stripe cannot be reached, the read still answers, with the pre-order in `awaiting_payment`. A pre-order of another account, or an unknown id, returns `404 not_found`.
|
|
3266
3290
|
*/
|
|
3267
3291
|
get: {
|
|
3268
3292
|
parameters: {
|
|
@@ -3448,7 +3472,7 @@ export interface paths {
|
|
|
3448
3472
|
put?: never;
|
|
3449
3473
|
/**
|
|
3450
3474
|
* Cancel a pre-order
|
|
3451
|
-
* @description Cancels a
|
|
3475
|
+
* @description Cancels a pre-order in status `draft` or `awaiting_payment`: nothing was created and nothing was charged. Accepts an API key. A line-scoped key is not limited to its list on this operation. Sets `status` to `cancelled` and sends `pre_order.cancelled`. For a pre-order in `awaiting_payment`, the first-month payment is canceled first: the client secret returned by confirm can no longer be used. When that first month is already paid, the call returns `409 pre_order_already_paid` and the build goes on. A pre-order that is `provisioning`, `fulfilled` or already `cancelled` returns `400 pre_order_already_confirmed`, and the cancellation of a draft that runs at the same time as another cancellation, or as the confirmation of a wholesale partner, returns `409 pre_order_already_confirmed`. When Stripe cannot be reached, the call returns `503 payment_provider_unavailable`: nothing changed, and the call can be repeated. When Stripe refuses the request for the account, the call returns `409 payment_setup_failed`: nothing changed, and repeating the call does not help. Once its build has started, a pre-order cannot be canceled through the API.
|
|
3452
3476
|
*/
|
|
3453
3477
|
post: {
|
|
3454
3478
|
parameters: {
|
|
@@ -3482,7 +3506,7 @@ export interface paths {
|
|
|
3482
3506
|
};
|
|
3483
3507
|
};
|
|
3484
3508
|
};
|
|
3485
|
-
/** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_already_confirmed` when the pre-order is
|
|
3509
|
+
/** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_already_confirmed` when the pre-order is `provisioning`, `fulfilled` or already `cancelled`. */
|
|
3486
3510
|
400: {
|
|
3487
3511
|
headers: {
|
|
3488
3512
|
[name: string]: unknown;
|
|
@@ -3509,7 +3533,7 @@ export interface paths {
|
|
|
3509
3533
|
"application/json": components["schemas"]["ErrorEnvelope"];
|
|
3510
3534
|
};
|
|
3511
3535
|
};
|
|
3512
|
-
/** @description Conflict. `error.code` is `pre_order_already_confirmed
|
|
3536
|
+
/** @description Conflict. `error.code` is `pre_order_already_paid` when the first month is already paid. It is `pre_order_already_confirmed` when a confirmation or another cancellation of the same draft ran at the same time and won. It is `payment_setup_failed` when Stripe refused the request for the account: repeating the call does not help. */
|
|
3513
3537
|
409: {
|
|
3514
3538
|
headers: {
|
|
3515
3539
|
[name: string]: unknown;
|
|
@@ -3536,6 +3560,15 @@ export interface paths {
|
|
|
3536
3560
|
"application/json": components["schemas"]["ErrorEnvelope"];
|
|
3537
3561
|
};
|
|
3538
3562
|
};
|
|
3563
|
+
/** @description Service unavailable. `error.code` is `payment_provider_unavailable`: Stripe could not be reached. Nothing changed, and the call can be repeated. */
|
|
3564
|
+
503: {
|
|
3565
|
+
headers: {
|
|
3566
|
+
[name: string]: unknown;
|
|
3567
|
+
};
|
|
3568
|
+
content: {
|
|
3569
|
+
"application/json": components["schemas"]["ErrorEnvelope"];
|
|
3570
|
+
};
|
|
3571
|
+
};
|
|
3539
3572
|
};
|
|
3540
3573
|
};
|
|
3541
3574
|
delete?: never;
|
|
@@ -9147,12 +9180,12 @@ export interface components {
|
|
|
9147
9180
|
preferred_area_codes: string[];
|
|
9148
9181
|
/** @description `true` for an inbound-only line, `false` for a two-way line. */
|
|
9149
9182
|
inbound_only: boolean;
|
|
9150
|
-
/** @description The billing anchor you set when creating the pre-order, carried onto the line
|
|
9183
|
+
/** @description The billing anchor you set when creating the pre-order, carried onto the line when the line is created. `null` when you set none. */
|
|
9151
9184
|
billing_anchor_at: string | null;
|
|
9152
9185
|
status: components["schemas"]["PreOrderStatus"];
|
|
9153
|
-
/** @description Client secret for the payment form of Stripe, to collect the first month. Set only in the response of `POST /v1/pre-orders/{id}/confirm`,
|
|
9186
|
+
/** @description Client secret for the payment form of Stripe, to collect the first month. Set only in the response of `POST /v1/pre-orders/{id}/confirm`, when that response carries the pre-order in status `awaiting_payment`: the first time and every time confirm is repeated. `null` in every other response. */
|
|
9154
9187
|
stripe_client_secret: string | null;
|
|
9155
|
-
/** @description Estimated time of the hand-over of the line: the time
|
|
9188
|
+
/** @description Estimated time of the hand-over of the line: the time the build starts plus 72 hours. Set once, when the build starts, and never revised. `null` while the pre-order is `draft` or `awaiting_payment`, and on a pre-order canceled before its build started. */
|
|
9156
9189
|
estimated_fulfillment: string | null;
|
|
9157
9190
|
device_status?: components["schemas"]["DeviceFulfillmentStatus"];
|
|
9158
9191
|
/** @description Timestamp of creation, ISO 8601 in UTC. */
|
|
@@ -9170,12 +9203,12 @@ export interface components {
|
|
|
9170
9203
|
} | null;
|
|
9171
9204
|
};
|
|
9172
9205
|
/**
|
|
9173
|
-
* @description `draft`: created, with no effect. `
|
|
9206
|
+
* @description `draft`: created, with no effect. `awaiting_payment`: confirmed by a direct account, and the first month is due; nothing is built until it is paid. `provisioning`: the build has started, and the line is being prepared. `fulfilled`: the line is handed over. `cancelled`: the pre-order ended with no line. You canceled it, its first month was not paid within 23 hours of the confirmation, or its subscription was canceled before the first payment. A pre-order whose build has started never becomes `cancelled`.
|
|
9174
9207
|
* @enum {string}
|
|
9175
9208
|
*/
|
|
9176
|
-
PreOrderStatus: "draft" | "provisioning" | "fulfilled" | "cancelled";
|
|
9209
|
+
PreOrderStatus: "draft" | "awaiting_payment" | "provisioning" | "fulfilled" | "cancelled";
|
|
9177
9210
|
/**
|
|
9178
|
-
* @description Progress of the line. `awaiting_hardware`: the line is not ready; also the value of a draft
|
|
9211
|
+
* @description Progress of the line. `awaiting_hardware`: the line is not ready; also the value of a pre-order that has no line: a draft, a pre-order in `awaiting_payment`, a canceled pre-order. `ready`: the line is prepared. `deployed`: the line is handed over. `received` and `setup_in_progress` are declared and never returned. Always present on a pre-order, and never `null`.
|
|
9179
9212
|
* @enum {string|null}
|
|
9180
9213
|
*/
|
|
9181
9214
|
DeviceFulfillmentStatus: "awaiting_hardware" | "received" | "setup_in_progress" | "ready" | "deployed" | null;
|
|
@@ -28,14 +28,34 @@ export declare class PreOrdersResource extends BaseResource {
|
|
|
28
28
|
create(body: CreatePreOrderBody, opts?: RequestOptions): Promise<PreOrder>;
|
|
29
29
|
/**
|
|
30
30
|
* `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
|
|
31
|
-
* binding step: engages the one-month commitment (full month, no proration)
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
31
|
+
* binding step: engages the one-month commitment (full month, no proration).
|
|
32
|
+
*
|
|
33
|
+
* A wholesale partner (billed at the end of the month) gets the pre-order
|
|
34
|
+
* back in `provisioning`: the line is being built, and the
|
|
35
|
+
* `pre_order.fulfilled` webhook fires when it is live.
|
|
36
|
+
*
|
|
37
|
+
* A direct account gets it back in `awaiting_payment` with
|
|
38
|
+
* `stripe_client_secret`, the client secret of the first-month payment, to
|
|
39
|
+
* confirm with the Stripe Payment Element (card only). Nothing is built until
|
|
40
|
+
* that payment succeeds; the pre-order then moves to `provisioning`: read it
|
|
41
|
+
* with `get()` until it leaves `awaiting_payment`. Calling `confirm()` again
|
|
42
|
+
* while it is `awaiting_payment` returns the same secret. When the first
|
|
43
|
+
* month is already paid (the account's credit balance covers it, or
|
|
44
|
+
* `confirm()` is repeated after the payment), the pre-order comes back in
|
|
45
|
+
* `provisioning` with `stripe_client_secret: null`.
|
|
46
|
+
*
|
|
47
|
+
* The first month starts at the confirmation, not when the line is handed
|
|
48
|
+
* over, and the next invoice is issued one month after the confirmation. The
|
|
49
|
+
* hand-over of the line takes no payment and does not change when the
|
|
50
|
+
* subscription is invoiced.
|
|
51
|
+
*
|
|
52
|
+
* An unpaid first month cancels the pre-order 23 hours after the
|
|
53
|
+
* confirmation; `confirm()` on it then throws a `BadRequestError` (400
|
|
54
|
+
* `pre_order_not_draft`), like any confirm of a pre-order that is not a
|
|
55
|
+
* draft. A 503 `payment_provider_unavailable` means nothing changed and the
|
|
56
|
+
* call can be repeated (the SDK retries it). A `ConflictError` with 409
|
|
57
|
+
* `payment_setup_failed` means the payment provider refused the request for
|
|
58
|
+
* the account: it is not retried, and repeating it does not help.
|
|
39
59
|
*/
|
|
40
60
|
confirm(id: string, opts?: RequestOptions): Promise<PreOrder>;
|
|
41
61
|
/**
|
|
@@ -51,7 +71,12 @@ export declare class PreOrdersResource extends BaseResource {
|
|
|
51
71
|
* `has_more` is false.
|
|
52
72
|
*/
|
|
53
73
|
list(query?: ListPreOrdersQuery, opts?: RequestOptions): Promise<PreOrderListData>;
|
|
54
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. Reading a
|
|
76
|
+
* pre-order that is `awaiting_payment` checks its first-month payment: once
|
|
77
|
+
* it has succeeded, the pre-order comes back in `provisioning`.
|
|
78
|
+
* `stripe_client_secret` is always `null` here.
|
|
79
|
+
*/
|
|
55
80
|
get(id: string, opts?: RequestOptions): Promise<PreOrder>;
|
|
56
81
|
/**
|
|
57
82
|
* `PATCH /v1/pre-orders/{id}` — merge `metadata` into the pre-order's tags.
|
|
@@ -64,9 +89,13 @@ export declare class PreOrdersResource extends BaseResource {
|
|
|
64
89
|
*/
|
|
65
90
|
update(id: string, body: PatchPreOrderBody, opts?: RequestOptions): Promise<PreOrder>;
|
|
66
91
|
/**
|
|
67
|
-
* `POST /v1/pre-orders/{id}/cancel` — cancel a
|
|
68
|
-
*
|
|
69
|
-
*
|
|
92
|
+
* `POST /v1/pre-orders/{id}/cancel` — cancel a `draft` or `awaiting_payment`
|
|
93
|
+
* pre-order. Free: nothing is charged or built in either status. For an
|
|
94
|
+
* `awaiting_payment` pre-order the first-month payment is voided first, so
|
|
95
|
+
* its client secret can no longer charge; a first month already paid throws
|
|
96
|
+
* a `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
|
|
97
|
+
* `provisioning`, `fulfilled` or already `cancelled` is refused (400
|
|
98
|
+
* `pre_order_already_confirmed`).
|
|
70
99
|
*/
|
|
71
100
|
cancel(id: string, opts?: RequestOptions): Promise<PreOrder>;
|
|
72
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preorders.d.ts","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;AACxD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAA;AAIpE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAC1C,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAC/C,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AACnG,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAA;AAEtE,qBAAa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;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAS7D;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,KAAK,GAAE,kBAAuB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOtF;;;;;OAKG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASzD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASrF;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQ7D"}
|
|
@@ -22,14 +22,34 @@ export class PreOrdersResource extends BaseResource {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
|
|
25
|
-
* binding step: engages the one-month commitment (full month, no proration)
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
25
|
+
* binding step: engages the one-month commitment (full month, no proration).
|
|
26
|
+
*
|
|
27
|
+
* A wholesale partner (billed at the end of the month) gets the pre-order
|
|
28
|
+
* back in `provisioning`: the line is being built, and the
|
|
29
|
+
* `pre_order.fulfilled` webhook fires when it is live.
|
|
30
|
+
*
|
|
31
|
+
* A direct account gets it back in `awaiting_payment` with
|
|
32
|
+
* `stripe_client_secret`, the client secret of the first-month payment, to
|
|
33
|
+
* confirm with the Stripe Payment Element (card only). Nothing is built until
|
|
34
|
+
* that payment succeeds; the pre-order then moves to `provisioning`: read it
|
|
35
|
+
* with `get()` until it leaves `awaiting_payment`. Calling `confirm()` again
|
|
36
|
+
* while it is `awaiting_payment` returns the same secret. When the first
|
|
37
|
+
* month is already paid (the account's credit balance covers it, or
|
|
38
|
+
* `confirm()` is repeated after the payment), the pre-order comes back in
|
|
39
|
+
* `provisioning` with `stripe_client_secret: null`.
|
|
40
|
+
*
|
|
41
|
+
* The first month starts at the confirmation, not when the line is handed
|
|
42
|
+
* over, and the next invoice is issued one month after the confirmation. The
|
|
43
|
+
* hand-over of the line takes no payment and does not change when the
|
|
44
|
+
* subscription is invoiced.
|
|
45
|
+
*
|
|
46
|
+
* An unpaid first month cancels the pre-order 23 hours after the
|
|
47
|
+
* confirmation; `confirm()` on it then throws a `BadRequestError` (400
|
|
48
|
+
* `pre_order_not_draft`), like any confirm of a pre-order that is not a
|
|
49
|
+
* draft. A 503 `payment_provider_unavailable` means nothing changed and the
|
|
50
|
+
* call can be repeated (the SDK retries it). A `ConflictError` with 409
|
|
51
|
+
* `payment_setup_failed` means the payment provider refused the request for
|
|
52
|
+
* the account: it is not retried, and repeating it does not help.
|
|
33
53
|
*/
|
|
34
54
|
confirm(id, opts) {
|
|
35
55
|
return this.client.request('POST', `/v1/pre-orders/${encodeURIComponent(id)}/confirm`, undefined, opts);
|
|
@@ -52,7 +72,12 @@ export class PreOrdersResource extends BaseResource {
|
|
|
52
72
|
query: { ...opts?.query, ...query }
|
|
53
73
|
});
|
|
54
74
|
}
|
|
55
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. Reading a
|
|
77
|
+
* pre-order that is `awaiting_payment` checks its first-month payment: once
|
|
78
|
+
* it has succeeded, the pre-order comes back in `provisioning`.
|
|
79
|
+
* `stripe_client_secret` is always `null` here.
|
|
80
|
+
*/
|
|
56
81
|
get(id, opts) {
|
|
57
82
|
return this.client.request('GET', `/v1/pre-orders/${encodeURIComponent(id)}`, undefined, opts);
|
|
58
83
|
}
|
|
@@ -69,9 +94,13 @@ export class PreOrdersResource extends BaseResource {
|
|
|
69
94
|
return this.client.request('PATCH', `/v1/pre-orders/${encodeURIComponent(id)}`, body, opts);
|
|
70
95
|
}
|
|
71
96
|
/**
|
|
72
|
-
* `POST /v1/pre-orders/{id}/cancel` — cancel a
|
|
73
|
-
*
|
|
74
|
-
*
|
|
97
|
+
* `POST /v1/pre-orders/{id}/cancel` — cancel a `draft` or `awaiting_payment`
|
|
98
|
+
* pre-order. Free: nothing is charged or built in either status. For an
|
|
99
|
+
* `awaiting_payment` pre-order the first-month payment is voided first, so
|
|
100
|
+
* its client secret can no longer charge; a first month already paid throws
|
|
101
|
+
* a `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
|
|
102
|
+
* `provisioning`, `fulfilled` or already `cancelled` is refused (400
|
|
103
|
+
* `pre_order_already_confirmed`).
|
|
75
104
|
*/
|
|
76
105
|
cancel(id, opts) {
|
|
77
106
|
return this.client.request('POST', `/v1/pre-orders/${encodeURIComponent(id)}/cancel`, undefined, opts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preorders.js","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAexC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAwB,EAAE,IAAqB;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAW,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAC5E,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"preorders.js","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAexC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACj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