@leaflow/sdk 0.0.0-dev.198.g085a7a9 → 0.0.0-dev.202.gfb7bf64

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.
@@ -27,6 +27,8 @@ export type ListRatesQuery = operations["list-rates"]["parameters"]["query"];
27
27
  export type CreateEstimateResult = operations["create-estimate"]["responses"][200]["content"]["application/json"];
28
28
  /** The request body of `POST /api/v1/estimates`. */
29
29
  export type CreateEstimateBody = NonNullable<operations["create-estimate"]["requestBody"]>["content"]["application/json"];
30
+ /** The success response body of `GET /account/v1/currencies`. */
31
+ export type ListCurrenciesResult = operations["list-currencies"]["responses"][200]["content"]["application/json"];
30
32
  /** The success response body of `GET /account/v1/billing-accounts`. */
31
33
  export type ListBillingAccountsResult = operations["list-billing-accounts"]["responses"][200]["content"]["application/json"];
32
34
  /** The success response body of `POST /account/v1/billing-accounts`. */
@@ -41,6 +43,8 @@ export type UpdateBillingAccountResult = operations["update-billing-account"]["r
41
43
  export type UpdateBillingAccountBody = NonNullable<operations["update-billing-account"]["requestBody"]>["content"]["application/json"];
42
44
  /** The success response body of `GET /account/v1/billing-accounts/{accountId}/balance`. */
43
45
  export type GetAccountBalanceResult = operations["get-account-balance"]["responses"][200]["content"]["application/json"];
46
+ /** The success response body of `GET /account/v1/billing-accounts/{accountId}/payment-options`. */
47
+ export type ListPaymentOptionsResult = operations["list-payment-options"]["responses"][200]["content"]["application/json"];
44
48
  /** The success response body of `GET /account/v1/projects`. */
45
49
  export type ListBillingAccountProjectsResult = operations["list-billing-account-projects"]["responses"][200]["content"]["application/json"];
46
50
  /** The query parameters of `GET /account/v1/projects`. */
@@ -59,6 +63,8 @@ export type CreateTopUpResult = operations["create-top-up"]["responses"][201]["c
59
63
  export type CreateTopUpBody = NonNullable<operations["create-top-up"]["requestBody"]>["content"]["application/json"];
60
64
  /** The success response body of `GET /account/v1/top-ups/{topUpId}`. */
61
65
  export type GetTopUpResult = operations["get-top-up"]["responses"][200]["content"]["application/json"];
66
+ /** The success response body of `POST /account/v1/top-ups/{topUpId}/cancel`. */
67
+ export type CancelTopUpResult = operations["cancel-top-up"]["responses"][200]["content"]["application/json"];
62
68
  /** The success response body of `GET /account/v1/payment-methods`. */
63
69
  export type ListPaymentMethodsResult = operations["list-payment-methods"]["responses"][200]["content"]["application/json"];
64
70
  /** The success response body of `POST /account/v1/payment-methods/setup`. */
@@ -206,6 +206,27 @@ export interface paths {
206
206
  patch?: never;
207
207
  trace?: never;
208
208
  };
209
+ "/account/v1/currencies": {
210
+ parameters: {
211
+ query?: never;
212
+ header?: never;
213
+ path?: never;
214
+ cookie?: never;
215
+ };
216
+ /**
217
+ * List currencies accounts can be opened in
218
+ * @description The currencies a new billing account can be opened in. A retired currency is not listed,
219
+ * although accounts already opened in it keep working. Not paged: the set is a few rows.
220
+ */
221
+ get: operations["list-currencies"];
222
+ put?: never;
223
+ post?: never;
224
+ delete?: never;
225
+ options?: never;
226
+ head?: never;
227
+ patch?: never;
228
+ trace?: never;
229
+ };
209
230
  "/account/v1/billing-accounts": {
210
231
  parameters: {
211
232
  query?: never;
@@ -275,6 +296,31 @@ export interface paths {
275
296
  patch?: never;
276
297
  trace?: never;
277
298
  };
299
+ "/account/v1/billing-accounts/{accountId}/payment-options": {
300
+ parameters: {
301
+ query?: never;
302
+ header?: never;
303
+ path: {
304
+ accountId: components["parameters"]["AccountId"];
305
+ };
306
+ cookie?: never;
307
+ };
308
+ /**
309
+ * List payment options
310
+ * @description Lists the payment gateways and methods that currently accept payment in this account's currency, the
311
+ * preferred gateway first. Top-ups and invoice payments must name a gateway and method listed here;
312
+ * others are refused. An empty list means no online payment is available for this account. Not paged: the
313
+ * set is a few rows.
314
+ */
315
+ get: operations["list-payment-options"];
316
+ put?: never;
317
+ post?: never;
318
+ delete?: never;
319
+ options?: never;
320
+ head?: never;
321
+ patch?: never;
322
+ trace?: never;
323
+ };
278
324
  "/account/v1/projects": {
279
325
  parameters: {
280
326
  query?: never;
@@ -349,7 +395,8 @@ export interface paths {
349
395
  };
350
396
  /**
351
397
  * List top ups
352
- * @description Lists only the authenticated user's top-ups. Includes pending and failed attempts; no invoice is created for a top-up.
398
+ * @description Lists only the authenticated user's top-ups. Includes pending, failed and canceled attempts; no invoice is
399
+ * created for a top-up. Items carry no `action`; read a pending top-up with get-top-up to continue its payment.
353
400
  */
354
401
  get: operations["list-top-ups"];
355
402
  put?: never;
@@ -377,7 +424,12 @@ export interface paths {
377
424
  };
378
425
  /**
379
426
  * Get top up
380
- * @description Reads a top-up owned by the authenticated user, including its outcome and the part of it not yet spent. It is not an invoice.
427
+ * @description Reads a top-up owned by the authenticated user, including its outcome and the part of it not yet spent.
428
+ * It is not an invoice.
429
+ *
430
+ * While the top-up is pending, the answer includes the customer's next step as the payment gateway
431
+ * currently reports it, so that a payment interrupted by a closed page can be continued. When the gateway
432
+ * cannot be reached, the top-up is returned without `action`; read it again later.
381
433
  */
382
434
  get: operations["get-top-up"];
383
435
  put?: never;
@@ -388,6 +440,38 @@ export interface paths {
388
440
  patch?: never;
389
441
  trace?: never;
390
442
  };
443
+ "/account/v1/top-ups/{topUpId}/cancel": {
444
+ parameters: {
445
+ query?: never;
446
+ header?: never;
447
+ path: {
448
+ topUpId: string;
449
+ };
450
+ cookie?: never;
451
+ };
452
+ get?: never;
453
+ put?: never;
454
+ /**
455
+ * Cancel top up
456
+ * @description Withdraws a pending top-up owned by the authenticated user at the payment gateway. It becomes
457
+ * `canceled` with `cancellation_reason` `requested_by_customer`, and no money is collected for it. Canceling a
458
+ * top-up that is already canceled returns it unchanged.
459
+ *
460
+ * If the gateway has already collected the payment, nothing is withdrawn and the top-up is returned
461
+ * as `succeeded` with the balance increased. Check `status` in the answer rather than assuming the
462
+ * cancellation took effect.
463
+ *
464
+ * Fails with 409 and BILLING_TOPUP_NOT_CANCELABLE when the top-up has already succeeded or failed,
465
+ * with `status` naming that outcome, and while the gateway is processing the payment and can no
466
+ * longer withdraw it, with `status` set to `pending`; read the top-up again later in that case.
467
+ */
468
+ post: operations["cancel-top-up"];
469
+ delete?: never;
470
+ options?: never;
471
+ head?: never;
472
+ patch?: never;
473
+ trace?: never;
474
+ };
391
475
  "/account/v1/payment-methods": {
392
476
  parameters: {
393
477
  query?: never;
@@ -1320,6 +1404,22 @@ export interface components {
1320
1404
  /** Format: date-time */
1321
1405
  created_at: string;
1322
1406
  };
1407
+ /** @description A currency a billing account can be opened in. */
1408
+ Currency: {
1409
+ /** @description ISO 4217 alpha-3, uppercase. */
1410
+ code: string;
1411
+ /**
1412
+ * Format: int32
1413
+ * @description Decimal places of the currency, the ISO 4217 minor unit.
1414
+ */
1415
+ exponent: number;
1416
+ name: string;
1417
+ /** @description The smallest top-up accepted. Zero means no lower bound. */
1418
+ minimum_top_up: components["schemas"]["Money"];
1419
+ };
1420
+ CurrencyList: {
1421
+ items: components["schemas"]["Currency"][];
1422
+ };
1323
1423
  BillingAccountCreate: {
1324
1424
  currency: string;
1325
1425
  name?: string;
@@ -1414,13 +1514,19 @@ export interface components {
1414
1514
  */
1415
1515
  remaining_amount?: components["schemas"]["Money"];
1416
1516
  /**
1417
- * @description `pending` until the payment gateway confirms. The balance increases on `succeeded`.
1517
+ * @description `pending` until the payment gateway reaches a result. The balance increases on `succeeded`.
1418
1518
  *
1419
- * Unknown channel outcomes remain pending. Failed means the channel has confirmed that
1420
- * this attempt did not collect money; a browser redirect is not proof of payment.
1519
+ * `failed` means the gateway declined the payment. `canceled` means the attempt was withdrawn
1520
+ * without collecting money; `cancellation_reason` says why. Unknown gateway outcomes remain
1521
+ * `pending`, and a browser redirect is not proof of payment.
1522
+ *
1523
+ * `failed` and `canceled` are final. If the gateway nevertheless collects payment for such an
1524
+ * attempt, the amount is credited as a separate `succeeded` top-up.
1421
1525
  * @enum {string}
1422
1526
  */
1423
- status: "pending" | "succeeded" | "failed";
1527
+ status: "pending" | "succeeded" | "failed" | "canceled";
1528
+ /** @description Why the top-up was withdrawn. Present with `canceled`. */
1529
+ cancellation_reason?: components["schemas"]["PaymentCancellationReason"];
1424
1530
  /** @description Which payment gateway collected it. */
1425
1531
  payment_gateway?: string;
1426
1532
  /** @description The selected payment method, such as card, wechat_pay or alipay. */
@@ -1435,9 +1541,13 @@ export interface components {
1435
1541
  * the figure that appears on the customer's card or wallet statement.
1436
1542
  */
1437
1543
  presentment_amount?: components["schemas"]["Money"];
1438
- /** @description Why it did not go through. Present with `failed`. */
1544
+ /** @description Why the gateway declined it. Present with `failed`. */
1439
1545
  failure_reason?: string;
1440
- /** @description Present when the original top-up still needs customer interaction. Completing it does not replace confirmation of receipt. */
1546
+ /**
1547
+ * @description The customer's next step while the top-up is `pending` and the gateway still awaits them. Returned
1548
+ * by create-top-up and get-top-up as the gateway currently reports it; absent from list-top-ups and
1549
+ * once the top-up has a result. Completing it does not replace confirmation of receipt.
1550
+ */
1441
1551
  action?: components["schemas"]["PaymentAction"];
1442
1552
  /** Format: date-time */
1443
1553
  created_at: string;
@@ -1491,6 +1601,30 @@ export interface components {
1491
1601
  /** Format: int64 */
1492
1602
  total_count?: number;
1493
1603
  };
1604
+ /**
1605
+ * @description Why a gateway payment was withdrawn. `abandoned` means the customer did not complete it within the time
1606
+ * allowed for payment. `requested_by_customer` means the customer canceled it.
1607
+ * @enum {string}
1608
+ */
1609
+ PaymentCancellationReason: "abandoned" | "requested_by_customer";
1610
+ /** @description A payment gateway that accepts payment in the account's currency, with the methods it accepts. */
1611
+ PaymentOption: {
1612
+ /** @description The value to send as `payment_gateway`. */
1613
+ payment_gateway: string;
1614
+ methods: components["schemas"]["PaymentOptionMethod"][];
1615
+ };
1616
+ PaymentOptionMethod: {
1617
+ /** @description The value to send as `method_type`, such as card, wechat_pay or alipay. */
1618
+ method_type: string;
1619
+ /**
1620
+ * @description Whether a method of this type can be saved with create-payment-method-setup and charged later
1621
+ * without the customer present. Methods that are not reusable are paid anew each time.
1622
+ */
1623
+ reusable: boolean;
1624
+ };
1625
+ PaymentOptionList: {
1626
+ items: components["schemas"]["PaymentOption"][];
1627
+ };
1494
1628
  PaymentMethod: {
1495
1629
  /** Format: uuid */
1496
1630
  id: string;
@@ -1760,10 +1894,18 @@ export interface components {
1760
1894
  credit_grant?: components["schemas"]["ObjectIdentity"];
1761
1895
  /** Format: uuid */
1762
1896
  refund_id?: string;
1763
- /** @enum {string} */
1764
- status?: "pending" | "succeeded" | "failed";
1897
+ /**
1898
+ * @description `failed` means the operation did not succeed; for a gateway payment, that the gateway declined it.
1899
+ * `canceled` means a gateway payment was withdrawn without collecting money; an invoice it was meant
1900
+ * to pay remains open for another payment.
1901
+ * @enum {string}
1902
+ */
1903
+ status?: "pending" | "succeeded" | "failed" | "canceled";
1904
+ /** @description Why the payment was withdrawn. Present with `canceled`. */
1905
+ cancellation_reason?: components["schemas"]["PaymentCancellationReason"];
1765
1906
  payment_gateway?: string;
1766
1907
  method_type?: string;
1908
+ /** @description Why it failed. Present with `failed`. */
1767
1909
  failure_reason?: string;
1768
1910
  /** Format: date-time */
1769
1911
  settled_at?: string;
@@ -2902,6 +3044,27 @@ export interface operations {
2902
3044
  default: components["responses"]["Error"];
2903
3045
  };
2904
3046
  };
3047
+ "list-currencies": {
3048
+ parameters: {
3049
+ query?: never;
3050
+ header?: never;
3051
+ path?: never;
3052
+ cookie?: never;
3053
+ };
3054
+ requestBody?: never;
3055
+ responses: {
3056
+ /** @description OK */
3057
+ 200: {
3058
+ headers: {
3059
+ [name: string]: unknown;
3060
+ };
3061
+ content: {
3062
+ "application/json": components["schemas"]["CurrencyList"];
3063
+ };
3064
+ };
3065
+ default: components["responses"]["Error"];
3066
+ };
3067
+ };
2905
3068
  "list-billing-accounts": {
2906
3069
  parameters: {
2907
3070
  query?: {
@@ -3026,6 +3189,29 @@ export interface operations {
3026
3189
  default: components["responses"]["Error"];
3027
3190
  };
3028
3191
  };
3192
+ "list-payment-options": {
3193
+ parameters: {
3194
+ query?: never;
3195
+ header?: never;
3196
+ path: {
3197
+ accountId: components["parameters"]["AccountId"];
3198
+ };
3199
+ cookie?: never;
3200
+ };
3201
+ requestBody?: never;
3202
+ responses: {
3203
+ /** @description OK */
3204
+ 200: {
3205
+ headers: {
3206
+ [name: string]: unknown;
3207
+ };
3208
+ content: {
3209
+ "application/json": components["schemas"]["PaymentOptionList"];
3210
+ };
3211
+ };
3212
+ default: components["responses"]["Error"];
3213
+ };
3214
+ };
3029
3215
  "list-billing-account-projects": {
3030
3216
  parameters: {
3031
3217
  query?: {
@@ -3200,6 +3386,38 @@ export interface operations {
3200
3386
  default: components["responses"]["Error"];
3201
3387
  };
3202
3388
  };
3389
+ "cancel-top-up": {
3390
+ parameters: {
3391
+ query?: never;
3392
+ header?: never;
3393
+ path: {
3394
+ topUpId: string;
3395
+ };
3396
+ cookie?: never;
3397
+ };
3398
+ requestBody?: never;
3399
+ responses: {
3400
+ /** @description The top-up after the request, canceled or succeeded. */
3401
+ 200: {
3402
+ headers: {
3403
+ [name: string]: unknown;
3404
+ };
3405
+ content: {
3406
+ "application/json": components["schemas"]["TopUp"];
3407
+ };
3408
+ };
3409
+ /** @description The top-up already has another outcome or can no longer be withdrawn. */
3410
+ 409: {
3411
+ headers: {
3412
+ [name: string]: unknown;
3413
+ };
3414
+ content: {
3415
+ "application/json": components["schemas"]["Error"];
3416
+ };
3417
+ };
3418
+ default: components["responses"]["Error"];
3419
+ };
3420
+ };
3203
3421
  "list-payment-methods": {
3204
3422
  parameters: {
3205
3423
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.198.g085a7a9",
3
+ "version": "0.0.0-dev.202.gfb7bf64",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {