@leaflow/sdk 0.30.0 → 0.32.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/dist/billing/v1/index.d.ts +6 -2
- package/dist/billing/v1/schema.d.ts +183 -13
- package/package.json +1 -1
|
@@ -38,8 +38,12 @@ export type CancelSubscriptionResult = operations["cancel-subscription"]["respon
|
|
|
38
38
|
export type CancelSubscriptionQuery = operations["cancel-subscription"]["parameters"]["query"];
|
|
39
39
|
/** `GET /account/v1/billing-accounts/{accountKey}/top-ups/{paymentId}` 成功时的响应体。 */
|
|
40
40
|
export type ReadTopUpResult = operations["read-top-up"]["responses"][200]["content"]["application/json"];
|
|
41
|
-
/** `
|
|
42
|
-
export type
|
|
41
|
+
/** `GET /account/v1/billing-accounts/{accountKey}/payment-method` 成功时的响应体。 */
|
|
42
|
+
export type ReadPaymentMethodResult = operations["read-payment-method"]["responses"][200]["content"]["application/json"];
|
|
43
|
+
/** `POST /account/v1/billing-accounts/{accountKey}/payment-method` 成功时的响应体。 */
|
|
44
|
+
export type StartPaymentMethodSetupResult = operations["start-payment-method-setup"]["responses"][200]["content"]["application/json"];
|
|
45
|
+
/** `POST /account/v1/billing-accounts/{accountKey}/billing-portal` 成功时的响应体。 */
|
|
46
|
+
export type StartBillingPortalResult = operations["start-billing-portal"]["responses"][200]["content"]["application/json"];
|
|
43
47
|
/** `GET /account/v1/billing-accounts/{accountKey}/offers` 成功时的响应体。 */
|
|
44
48
|
export type ListOffersResult = operations["list-offers"]["responses"][200]["content"]["application/json"];
|
|
45
49
|
/** `POST /account/v1/billing-accounts/{accountKey}/offers/{offerKey}/purchase` 成功时的响应体。 */
|
|
@@ -363,32 +363,102 @@ export interface paths {
|
|
|
363
363
|
patch?: never;
|
|
364
364
|
trace?: never;
|
|
365
365
|
};
|
|
366
|
-
"/account/v1/billing-accounts/{accountKey}/
|
|
366
|
+
"/account/v1/billing-accounts/{accountKey}/payment-method": {
|
|
367
367
|
parameters: {
|
|
368
368
|
query?: never;
|
|
369
369
|
header?: never;
|
|
370
370
|
path?: never;
|
|
371
371
|
cookie?: never;
|
|
372
372
|
};
|
|
373
|
-
|
|
373
|
+
/**
|
|
374
|
+
* Whether this account can be charged
|
|
375
|
+
* @description Answers whether a payment method is on file, and nothing else.
|
|
376
|
+
*
|
|
377
|
+
* ## It is a payment method, not a card
|
|
378
|
+
*
|
|
379
|
+
* A card is one kind. Direct debit and the recurring-payment mandates offered by regional
|
|
380
|
+
* wallets are others, and they occupy the same slot: something the provider can charge later
|
|
381
|
+
* without the account holder present. Naming the slot after cards would put an assumption
|
|
382
|
+
* into the contract that stops being true the day a second kind is accepted.
|
|
383
|
+
*
|
|
384
|
+
* ## Why there is no brand, no last four digits, no expiry
|
|
385
|
+
*
|
|
386
|
+
* Those would have to be read from the payment provider, and the two answers can disagree: a
|
|
387
|
+
* method present at the provider that the billing engine has not recorded as the default is
|
|
388
|
+
* exactly the state in which money cannot be collected — while a page built on the provider's
|
|
389
|
+
* answer would be showing one. What matters here is whether the party that will run the
|
|
390
|
+
* charge believes it can, so the answer comes from that party alone.
|
|
391
|
+
*
|
|
392
|
+
* To see it, replace it, or remove it, open the billing portal.
|
|
393
|
+
*
|
|
394
|
+
* ## Read this before offering a paid plan, not after
|
|
395
|
+
*
|
|
396
|
+
* `ready` being false is why the engine refuses to start a paid subscription. Discovering it
|
|
397
|
+
* at purchase time turns a missing payment method into a rejection whose wording is about
|
|
398
|
+
* something else entirely.
|
|
399
|
+
*
|
|
400
|
+
* An account that has never had one returns `ready: false`. That is the normal state of a
|
|
401
|
+
* new account, not an error.
|
|
402
|
+
*/
|
|
403
|
+
get: operations["read-payment-method"];
|
|
374
404
|
put?: never;
|
|
375
405
|
/**
|
|
376
|
-
* Add or replace the
|
|
377
|
-
* @description Begins adding a
|
|
378
|
-
* payment provider's own page, and **no card data ever reaches this
|
|
406
|
+
* Add or replace the payment method on file
|
|
407
|
+
* @description Begins adding a payment method. Returns a URL to send the browser to; the details are
|
|
408
|
+
* entered there, on the payment provider's own page, and **no card data ever reaches this
|
|
409
|
+
* platform**.
|
|
410
|
+
*
|
|
411
|
+
* Which kinds are offered is the provider's decision, not this API's — a card today, a
|
|
412
|
+
* wallet mandate or a direct debit wherever the provider supports charging one later without
|
|
413
|
+
* the account holder present.
|
|
379
414
|
*
|
|
380
415
|
* ## This is a prerequisite for buying a plan, not a convenience
|
|
381
416
|
*
|
|
382
|
-
* A plan is charged by invoice, and the invoice is collected from the
|
|
383
|
-
*
|
|
417
|
+
* A plan is charged by invoice, and the invoice is collected from the method on file. A
|
|
418
|
+
* subscription cannot start for an account that has none — so "add a payment method, then
|
|
384
419
|
* buy" is the order the system requires, not a flow that was chosen.
|
|
385
420
|
*
|
|
386
421
|
* It is *not* a prerequisite for topping up: a top-up collects the money there and then.
|
|
387
422
|
*
|
|
388
|
-
* Replacing
|
|
389
|
-
*
|
|
423
|
+
* Replacing uses the same operation. The new method becomes the default and the old one stops
|
|
424
|
+
* being used; nothing else about the account changes.
|
|
390
425
|
*/
|
|
391
|
-
post: operations["start-
|
|
426
|
+
post: operations["start-payment-method-setup"];
|
|
427
|
+
delete?: never;
|
|
428
|
+
options?: never;
|
|
429
|
+
head?: never;
|
|
430
|
+
patch?: never;
|
|
431
|
+
trace?: never;
|
|
432
|
+
};
|
|
433
|
+
"/account/v1/billing-accounts/{accountKey}/billing-portal": {
|
|
434
|
+
parameters: {
|
|
435
|
+
query?: never;
|
|
436
|
+
header?: never;
|
|
437
|
+
path?: never;
|
|
438
|
+
cookie?: never;
|
|
439
|
+
};
|
|
440
|
+
get?: never;
|
|
441
|
+
put?: never;
|
|
442
|
+
/**
|
|
443
|
+
* Open the hosted billing portal
|
|
444
|
+
* @description Returns a URL to the payment provider's own portal, where the card can be replaced or
|
|
445
|
+
* removed, the billing address changed, and past invoices downloaded.
|
|
446
|
+
*
|
|
447
|
+
* ## Why replacing a card is not a form on this platform
|
|
448
|
+
*
|
|
449
|
+
* A form would mean a card number field, and no card data ever reaches this platform. The
|
|
450
|
+
* portal moves the whole interaction to the provider; only a session URL comes back.
|
|
451
|
+
*
|
|
452
|
+
* ## Something has to be able to replace an expiring card
|
|
453
|
+
*
|
|
454
|
+
* Cards expire. Once one does, the invoices for a plan stop being collectable, dunning runs
|
|
455
|
+
* out, and the projects paid for by this account are suspended for non-payment. Without this
|
|
456
|
+
* operation the account holder watches that happen with nowhere to fix it — adding a card
|
|
457
|
+
* does not help, since that operation only makes sense when there is none.
|
|
458
|
+
*
|
|
459
|
+
* The URL is single-use and expires. Do not store it.
|
|
460
|
+
*/
|
|
461
|
+
post: operations["start-billing-portal"];
|
|
392
462
|
delete?: never;
|
|
393
463
|
options?: never;
|
|
394
464
|
head?: never;
|
|
@@ -732,13 +802,43 @@ export interface components {
|
|
|
732
802
|
*/
|
|
733
803
|
offer_key?: string;
|
|
734
804
|
};
|
|
735
|
-
|
|
805
|
+
PaymentMethodSetupSession: {
|
|
806
|
+
/**
|
|
807
|
+
* Format: uri
|
|
808
|
+
* @description Send the browser here. It expires, so do not store it
|
|
809
|
+
*/
|
|
810
|
+
url: string;
|
|
811
|
+
};
|
|
812
|
+
BillingPortalSession: {
|
|
736
813
|
/**
|
|
737
814
|
* Format: uri
|
|
738
815
|
* @description Send the browser here. It expires, so do not store it
|
|
739
816
|
*/
|
|
740
817
|
url: string;
|
|
741
818
|
};
|
|
819
|
+
/**
|
|
820
|
+
* @description Whether money can be collected from this account later, without the account holder present.
|
|
821
|
+
*
|
|
822
|
+
* Deliberately not called a card: a card is one kind of payment method, and direct debit and
|
|
823
|
+
* the recurring mandates offered by regional wallets occupy the same slot.
|
|
824
|
+
*/
|
|
825
|
+
PaymentMethod: {
|
|
826
|
+
/**
|
|
827
|
+
* @description True when the billing engine holds a default payment method for this account and can
|
|
828
|
+
* therefore collect an invoice.
|
|
829
|
+
*
|
|
830
|
+
* This is the precondition for a paid plan. While it is false, starting a paid
|
|
831
|
+
* subscription is refused, and the refusal is about billing setup rather than about the
|
|
832
|
+
* plan — so check this first and say what is actually missing.
|
|
833
|
+
*
|
|
834
|
+
* It says nothing about which kind is on file. To show or change that, send the account
|
|
835
|
+
* holder to the billing portal.
|
|
836
|
+
*
|
|
837
|
+
* A free plan does not require it, which is what allows a new account to be placed on the
|
|
838
|
+
* default tier before anyone has entered a card.
|
|
839
|
+
*/
|
|
840
|
+
ready: boolean;
|
|
841
|
+
};
|
|
742
842
|
TopUpSession: {
|
|
743
843
|
/**
|
|
744
844
|
* @description Identifies this attempt. Quote it in a support conversation — it is what ties the payment
|
|
@@ -1441,7 +1541,77 @@ export interface operations {
|
|
|
1441
1541
|
};
|
|
1442
1542
|
};
|
|
1443
1543
|
};
|
|
1444
|
-
"
|
|
1544
|
+
"read-payment-method": {
|
|
1545
|
+
parameters: {
|
|
1546
|
+
query?: never;
|
|
1547
|
+
header?: never;
|
|
1548
|
+
path: {
|
|
1549
|
+
/**
|
|
1550
|
+
* @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
|
|
1551
|
+
* which is why the key is what addresses the account.
|
|
1552
|
+
*/
|
|
1553
|
+
accountKey: components["parameters"]["AccountKey"];
|
|
1554
|
+
};
|
|
1555
|
+
cookie?: never;
|
|
1556
|
+
};
|
|
1557
|
+
requestBody?: never;
|
|
1558
|
+
responses: {
|
|
1559
|
+
/** @description OK */
|
|
1560
|
+
200: {
|
|
1561
|
+
headers: {
|
|
1562
|
+
[name: string]: unknown;
|
|
1563
|
+
};
|
|
1564
|
+
content: {
|
|
1565
|
+
"application/json": components["schemas"]["PaymentMethod"];
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
/** @description Error */
|
|
1569
|
+
default: {
|
|
1570
|
+
headers: {
|
|
1571
|
+
[name: string]: unknown;
|
|
1572
|
+
};
|
|
1573
|
+
content: {
|
|
1574
|
+
"application/json": components["schemas"]["Error"];
|
|
1575
|
+
};
|
|
1576
|
+
};
|
|
1577
|
+
};
|
|
1578
|
+
};
|
|
1579
|
+
"start-payment-method-setup": {
|
|
1580
|
+
parameters: {
|
|
1581
|
+
query?: never;
|
|
1582
|
+
header?: never;
|
|
1583
|
+
path: {
|
|
1584
|
+
/**
|
|
1585
|
+
* @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
|
|
1586
|
+
* which is why the key is what addresses the account.
|
|
1587
|
+
*/
|
|
1588
|
+
accountKey: components["parameters"]["AccountKey"];
|
|
1589
|
+
};
|
|
1590
|
+
cookie?: never;
|
|
1591
|
+
};
|
|
1592
|
+
requestBody?: never;
|
|
1593
|
+
responses: {
|
|
1594
|
+
/** @description OK */
|
|
1595
|
+
200: {
|
|
1596
|
+
headers: {
|
|
1597
|
+
[name: string]: unknown;
|
|
1598
|
+
};
|
|
1599
|
+
content: {
|
|
1600
|
+
"application/json": components["schemas"]["PaymentMethodSetupSession"];
|
|
1601
|
+
};
|
|
1602
|
+
};
|
|
1603
|
+
/** @description Error */
|
|
1604
|
+
default: {
|
|
1605
|
+
headers: {
|
|
1606
|
+
[name: string]: unknown;
|
|
1607
|
+
};
|
|
1608
|
+
content: {
|
|
1609
|
+
"application/json": components["schemas"]["Error"];
|
|
1610
|
+
};
|
|
1611
|
+
};
|
|
1612
|
+
};
|
|
1613
|
+
};
|
|
1614
|
+
"start-billing-portal": {
|
|
1445
1615
|
parameters: {
|
|
1446
1616
|
query?: never;
|
|
1447
1617
|
header?: never;
|
|
@@ -1462,7 +1632,7 @@ export interface operations {
|
|
|
1462
1632
|
[name: string]: unknown;
|
|
1463
1633
|
};
|
|
1464
1634
|
content: {
|
|
1465
|
-
"application/json": components["schemas"]["
|
|
1635
|
+
"application/json": components["schemas"]["BillingPortalSession"];
|
|
1466
1636
|
};
|
|
1467
1637
|
};
|
|
1468
1638
|
/** @description Error */
|