@leaflow/sdk 0.0.0-dev.226.g0b19393 → 0.0.0-dev.228.g03b4230

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.
@@ -83,6 +83,8 @@ export type ListCreditGrantsResult = operations["list-credit-grants"]["responses
83
83
  export type ListCreditGrantsQuery = operations["list-credit-grants"]["parameters"]["query"];
84
84
  /** The success response body of `GET /account/v1/refunds`. */
85
85
  export type ListRefundsResult = operations["list-refunds"]["responses"][200]["content"]["application/json"];
86
+ /** The query parameters of `GET /account/v1/refunds`. */
87
+ export type ListRefundsQuery = operations["list-refunds"]["parameters"]["query"];
86
88
  /** The success response body of `GET /account/v1/usage-charges`. */
87
89
  export type ListUsageChargesResult = operations["list-usage-charges"]["responses"][200]["content"]["application/json"];
88
90
  /** The query parameters of `GET /account/v1/usage-charges`. */
@@ -607,7 +607,10 @@ export interface paths {
607
607
  path?: never;
608
608
  cookie?: never;
609
609
  };
610
- /** List refunds */
610
+ /**
611
+ * List refunds
612
+ * @description Newest first.
613
+ */
611
614
  get: operations["list-refunds"];
612
615
  put?: never;
613
616
  post?: never;
@@ -1771,11 +1774,23 @@ export interface components {
1771
1774
  invoice_id?: string;
1772
1775
  /** Format: uuid */
1773
1776
  transaction_id?: string;
1774
- /** Format: uuid */
1777
+ /**
1778
+ * Format: uuid
1779
+ * @description The credit grant that paid, or for a refund, the credit grant restored.
1780
+ */
1775
1781
  credit_grant_id?: string;
1776
1782
  credit_grant?: components["schemas"]["ObjectIdentity"];
1777
1783
  /** Format: uuid */
1778
1784
  refund_id?: string;
1785
+ /**
1786
+ * @description Present on refunds. Where this part of the refund goes.
1787
+ *
1788
+ * - `balance`: back to the account balance.
1789
+ * - `credit`: back to the credit grant that paid, which keeps its original expiry.
1790
+ * - `gateway`: back to the payment method it was paid with.
1791
+ * @enum {string}
1792
+ */
1793
+ refund_destination?: "balance" | "credit" | "gateway";
1779
1794
  /**
1780
1795
  * @description `failed` means the operation did not succeed; for a gateway payment, that the gateway declined
1781
1796
  * it. `canceled` means a gateway payment was withdrawn without collecting money. After either,
@@ -1803,9 +1818,17 @@ export interface components {
1803
1818
  /** Format: int64 */
1804
1819
  billing_account_id?: number;
1805
1820
  type: components["schemas"]["TransactionType"];
1806
- /** @description Signed. Positive adds to the balance, negative takes from it. */
1821
+ /**
1822
+ * @description Signed by type: positive for `topup` and `payment`, negative for `refund` and `payout`.
1823
+ * An `adjustment` is positive when it adds to the balance and negative when it takes from
1824
+ * it. For the other types the sign does not tell the effect on the balance: a payment from
1825
+ * the balance lowers it, while a payment by gateway or by credit leaves it unchanged.
1826
+ */
1807
1827
  amount: components["schemas"]["Money"];
1808
- /** @description How much of this batch has not been spent yet. Zero on negative batches. */
1828
+ /**
1829
+ * @description How much of this transaction is still available in the balance. Only top-ups, positive
1830
+ * adjustments and gateway payments later returned to the balance can be non-zero.
1831
+ */
1809
1832
  remaining_amount: components["schemas"]["Money"];
1810
1833
  currency: string;
1811
1834
  reason?: string;
@@ -1854,28 +1877,71 @@ export interface components {
1854
1877
  billing_account_id?: number;
1855
1878
  /** Format: uuid */
1856
1879
  invoice_id?: string | null;
1857
- /** Format: uuid */
1880
+ /**
1881
+ * Format: uuid
1882
+ * @description The order the refund belongs to: the order that caused it, such as a downgrade, otherwise
1883
+ * the order of the refunded invoice. Null for refunds of top-ups and of usage invoices.
1884
+ */
1858
1885
  order_id?: string | null;
1886
+ /** @description The whole refund. Equals balance_amount plus credit_amount plus gateway_amount. */
1859
1887
  amount: components["schemas"]["Money"];
1888
+ /** @description The part returned to the account balance. */
1889
+ balance_amount: components["schemas"]["Money"];
1890
+ /** @description The part restored to the credit grants that paid for it. */
1891
+ credit_amount: components["schemas"]["Money"];
1892
+ /** @description The part returned to the payment method it was paid with. */
1893
+ gateway_amount: components["schemas"]["Money"];
1860
1894
  /** @description What has actually been returned. */
1861
1895
  settled_amount?: components["schemas"]["Money"];
1862
1896
  currency: string;
1863
1897
  /**
1864
- * @description Where the refunded money went — back to the account balance, or back to the payment method it came from.
1898
+ * @deprecated
1899
+ * @description Use balance_amount, credit_amount and gateway_amount, which also show a refund split between several destinations.
1865
1900
  * @enum {string}
1866
1901
  */
1867
1902
  destination?: "balance" | "gateway";
1868
1903
  /**
1869
- * @description Summary of the related refund transactions. Succeeded only when every part succeeds.
1870
- * Pending and processing do not mean funds have been returned. Partial success remains
1871
- * visible in settled_amount and transactions, including when another part has failed.
1904
+ * @description Summary of the parts in `transactions`.
1905
+ *
1906
+ * - `pending`: nothing has been returned yet, and at least one part is in progress.
1907
+ * - `processing`: some parts have been returned, and at least one is still in progress.
1908
+ * - `succeeded`: every part has been returned.
1909
+ * - `failed`: no part is in progress and at least one has failed. What was returned is in
1910
+ * settled_amount.
1911
+ *
1912
+ * Returns to the balance and to credit grants complete shortly after the refund is made; a
1913
+ * return to a payment method completes when the gateway confirms it.
1872
1914
  * @enum {string}
1873
1915
  */
1874
1916
  status: "pending" | "processing" | "succeeded" | "failed";
1875
- reason?: string;
1917
+ /**
1918
+ * Format: date-time
1919
+ * @description When the last part was returned. Present with `succeeded`.
1920
+ */
1921
+ settled_at?: string;
1922
+ reason: components["schemas"]["RefundReason"];
1876
1923
  /** Format: date-time */
1877
1924
  created_at: string;
1878
1925
  };
1926
+ /**
1927
+ * @description Why the refund was made. Clients map the code to their own wording. More codes may be added;
1928
+ * treat an unknown code as a refund without a stated reason.
1929
+ *
1930
+ * - `provisioning_failed`: the purchase could not be delivered.
1931
+ * - `order_expired`: the order expired after part of it had been paid.
1932
+ * - `order_canceled`: the account holder canceled the order after part of it had been paid.
1933
+ * - `change_canceled`: a scheduled change was withdrawn after it had been paid.
1934
+ * - `change_expired`: a scheduled change could not take effect before its time passed.
1935
+ * - `subscription_canceled`: the subscription was canceled and its unused value returned under
1936
+ * its refund terms.
1937
+ * - `future_period_canceled`: a renewal that had not started yet was withdrawn.
1938
+ * - `downgrade_difference`: the unused value above the new price after a downgrade.
1939
+ * - `usage_true_up`: usage priced again over the whole month cost less than was charged.
1940
+ * - `payment_not_applied`: a payment arrived after its invoice could no longer be paid.
1941
+ * - `operator`: made by the platform operator.
1942
+ * @enum {string}
1943
+ */
1944
+ RefundReason: "provisioning_failed" | "order_expired" | "order_canceled" | "change_canceled" | "change_expired" | "subscription_canceled" | "future_period_canceled" | "downgrade_difference" | "usage_true_up" | "payment_not_applied" | "operator";
1879
1945
  RefundList: {
1880
1946
  items: components["schemas"]["Refund"][];
1881
1947
  /** Format: int64 */
@@ -3380,6 +3446,14 @@ export interface operations {
3380
3446
  page_size?: components["parameters"]["PageSize"];
3381
3447
  /** @description Restrict to one of your accounts. All of them when omitted. */
3382
3448
  billing_account_id?: components["parameters"]["AccountIdQuery"];
3449
+ /** @description Only the refunds of this invoice. */
3450
+ invoice_id?: string;
3451
+ /**
3452
+ * @description Only the refunds that belong to this order: those of its invoice, such as the refund of a
3453
+ * purchase that could not be delivered, and those it caused on an earlier invoice, such as
3454
+ * the difference returned after a downgrade.
3455
+ */
3456
+ order_id?: string;
3383
3457
  };
3384
3458
  header?: never;
3385
3459
  path?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.226.g0b19393",
3
+ "version": "0.0.0-dev.228.g03b4230",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {