@sylphx/sdk 0.32.32 → 0.32.34

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/money.d.ts CHANGED
@@ -177,6 +177,21 @@ export interface CancelCustomerSubscriptionRequest {
177
177
  /** Refund the last payment in full; only with `at_period_end` false. */
178
178
  refundLastPayment?: boolean;
179
179
  }
180
+ /** Request to settle the hold against a terminal receipt. */
181
+ export interface CapturePlatformUsageHoldRequest {
182
+ /** Organization whose balance backs the hold. */
183
+ payerOrg: string;
184
+ /** Metered service associated with the execution. */
185
+ service: string;
186
+ /** Stable caller-generated identity of the metered execution. */
187
+ executionKey: string;
188
+ /** Actual amount, as a decimal string in pico-USD. Zero is valid. */
189
+ actualPicousd: string;
190
+ /** Stable receipt identity (include the provider/account namespace). */
191
+ terminalReceiptKey: string;
192
+ /** Authenticated platform service organization, as orgs/{org}; not the payer. */
193
+ parent: string;
194
+ }
180
195
  /**
181
196
  * A Catalog is an environment's features, products, and prices: the desired
182
197
  * state Money keeps its merchant account's processor objects equal to, by
@@ -594,6 +609,22 @@ export interface CheckoutSession {
594
609
  /** When the browser possession proof expires. The existing wire name is retained. */
595
610
  readonly claimSecretExpiresAt?: string;
596
611
  }
612
+ /** Request to claim dispatch using the reserved hold. */
613
+ export interface ClaimPlatformUsageHoldRequest {
614
+ /** Organization whose balance backs the hold. */
615
+ payerOrg: string;
616
+ /** Metered service associated with the execution. */
617
+ service: string;
618
+ /** Stable caller-generated identity of the metered execution. */
619
+ executionKey: string;
620
+ /** Authenticated platform service organization, as orgs/{org}; not the payer. */
621
+ parent: string;
622
+ /**
623
+ * Check these terms atomically before a fresh claim. Absence preserves the
624
+ * ordinary claim contract for platform callers that do not require a fuse.
625
+ */
626
+ preconditions?: PlatformUsageHoldClaimPreconditions;
627
+ }
597
628
  /** The request of ClientVerifyStorePurchase. */
598
629
  export interface ClientVerifyStorePurchaseRequest {
599
630
  /** The environment the purchase is verified in. */
@@ -1749,6 +1780,51 @@ export interface MerchantAccount {
1749
1780
  /** Fixed, actionable warnings; never Stripe response bodies or credentials. */
1750
1781
  readonly processorWarnings?: string[];
1751
1782
  }
1783
+ /** Preconditions for dispatching with an exact hold and a bounded monthly fuse. */
1784
+ export interface PlatformUsageHoldClaimPreconditions {
1785
+ /** The uid returned by ReservePlatformUsageHold. */
1786
+ holdUid?: string;
1787
+ /** Exact reserved upper bound, as a decimal string in pico-USD. */
1788
+ upperBoundPicousd?: string;
1789
+ /** Largest permitted positive monthly fuse, in USD cents. */
1790
+ maxMonthlyFuseUsdMinor?: string;
1791
+ }
1792
+ /**
1793
+ * Authority to dispatch and, separately, a deadline to submit the terminal
1794
+ * receipt. Amounts are canonical decimal strings in pico-USD (10^-12 USD).
1795
+ */
1796
+ export interface PlatformUsageHoldReceipt {
1797
+ /** Canonical resource name of the hold receipt. */
1798
+ name?: string;
1799
+ /** Stable identifier of the hold. */
1800
+ readonly uid?: string;
1801
+ /** Resource metadata, when available. */
1802
+ meta?: common.ResourceMeta;
1803
+ /** Organization whose balance backs the hold. */
1804
+ payerOrg?: string;
1805
+ /** Metered service associated with the execution. */
1806
+ service?: string;
1807
+ /** Stable caller-generated identity of the metered execution. */
1808
+ executionKey?: string;
1809
+ /** Maximum amount authorized by the hold, in pico-USD. */
1810
+ upperBoundPicousd?: string;
1811
+ /** Deadline to claim dispatch, as an RFC 3339 timestamp. */
1812
+ dispatchBy?: string;
1813
+ /** Deadline to submit a terminal receipt, as an RFC 3339 timestamp. */
1814
+ settleBy?: string;
1815
+ /** pending, in_flight, awaiting_settlement (receipt overdue), captured, released, or expired. */
1816
+ state?: string;
1817
+ /** Amount charged to the hold, in pico-USD. */
1818
+ capturedPicousd?: string;
1819
+ /** Amount returned from the hold, in pico-USD. */
1820
+ releasedPicousd?: string;
1821
+ /** Present only for a positive capture; this is the only billable journal. */
1822
+ ledgerTransactionId?: string;
1823
+ /** Whether the operation returned an already recorded result. */
1824
+ replayed?: boolean;
1825
+ /** Positive only on a fresh claim that verified the requested fuse ceiling. */
1826
+ readonly verifiedMonthlyFuseUsdMinor?: string;
1827
+ }
1752
1828
  /**
1753
1829
  * A Portal Session is a hosted page where a subject manages its
1754
1830
  * subscriptions, payment method, and invoices.
@@ -2004,6 +2080,19 @@ export interface RefundCheckoutSessionResponse {
2004
2080
  /** The refund receipt, read back from the processor after creation. */
2005
2081
  readonly refund?: Refund;
2006
2082
  }
2083
+ /** Request to return the hold without charging the payer. */
2084
+ export interface ReleasePlatformUsageHoldRequest {
2085
+ /** Organization whose balance backs the hold. */
2086
+ payerOrg: string;
2087
+ /** Metered service associated with the execution. */
2088
+ service: string;
2089
+ /** Stable caller-generated identity of the metered execution. */
2090
+ executionKey: string;
2091
+ /** Required after claim. An unknown dispatch or missing receipt is not proof. */
2092
+ definitiveNoCharge?: boolean;
2093
+ /** Authenticated platform service organization, as orgs/{org}; not the payer. */
2094
+ parent: string;
2095
+ }
2007
2096
  /** The request of ReleaseUsageInvoiceCollection. */
2008
2097
  export interface ReleaseUsageInvoiceCollectionRequest {
2009
2098
  /** The held invoice to release for collection. */
@@ -2060,6 +2149,23 @@ export interface ReportStorePurchaseUsageResponse {
2060
2149
  /** The store purchase that was answered. */
2061
2150
  storePurchase?: StorePurchase;
2062
2151
  }
2152
+ /** Request to reserve an upper bound against the payer balance. */
2153
+ export interface ReservePlatformUsageHoldRequest {
2154
+ /** Organization whose balance backs the hold. */
2155
+ payerOrg: string;
2156
+ /** Metered service associated with the execution. */
2157
+ service: string;
2158
+ /** Use a durable, caller-generated platform-hold:<unique-execution-id>. */
2159
+ executionKey: string;
2160
+ /** Maximum amount authorized by the hold, in pico-USD. */
2161
+ upperBoundPicousd: string;
2162
+ /** Deadline to claim dispatch, as an RFC 3339 timestamp. */
2163
+ dispatchBy: string;
2164
+ /** Deadline to submit a terminal receipt, as an RFC 3339 timestamp. */
2165
+ settleBy: string;
2166
+ /** Authenticated platform service organization, as orgs/{org}; not the payer. */
2167
+ parent: string;
2168
+ }
2063
2169
  /** Resolves held evidence without altering its original receipt. */
2064
2170
  export interface ResolveBankReceiptRequest {
2065
2171
  /** Receipt name. */
@@ -3155,6 +3261,8 @@ export type ProrationBehavior = 'create_prorations' | 'none' | 'always_invoice'
3155
3261
  * Namespace of Sylphx Money on `Sylphx`.
3156
3262
  */
3157
3263
  export declare class MoneyApi {
3264
+ /** The `platform_usage_holds` collection. */
3265
+ readonly platformUsageHolds: PlatformUsageHoldsCollection;
3158
3266
  /** The `bank_transfer_accounts` collection. */
3159
3267
  readonly bankTransferAccounts: BankTransferAccountsCollection;
3160
3268
  /** The `bank_receipts` collection. */
@@ -3215,6 +3323,43 @@ export declare class MoneyApi {
3215
3323
  readonly exchangeRates: ExchangeRatesCollection;
3216
3324
  constructor(client: runtime.Client);
3217
3325
  }
3326
+ /** `platform_usage_holds` of Sylphx Money: Resource type `money.sylphx.com/PlatformUsageHoldReceipt`. */
3327
+ export declare class PlatformUsageHoldsCollection {
3328
+ private readonly client;
3329
+ constructor(client: runtime.Client);
3330
+ /**
3331
+ * ReservePlatformUsageHold holds an upper bound before dispatch.
3332
+ *
3333
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:reserve` · permission `money:platform_usage:write` · effect `write`
3334
+ *
3335
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
3336
+ */
3337
+ reserve(request: ReservePlatformUsageHoldRequest): Promise<PlatformUsageHoldReceipt>;
3338
+ /**
3339
+ * ClaimPlatformUsageHold records that dispatch has been claimed against the hold.
3340
+ *
3341
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:claim` · permission `money:platform_usage:write` · effect `write`
3342
+ *
3343
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
3344
+ */
3345
+ claim(request: ClaimPlatformUsageHoldRequest): Promise<PlatformUsageHoldReceipt>;
3346
+ /**
3347
+ * CapturePlatformUsageHold settles the hold against a definitive terminal receipt.
3348
+ *
3349
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:capture` · permission `money:platform_usage:write` · effect `write`
3350
+ *
3351
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
3352
+ */
3353
+ capture(request: CapturePlatformUsageHoldRequest): Promise<PlatformUsageHoldReceipt>;
3354
+ /**
3355
+ * ReleasePlatformUsageHold returns the held funds when the execution will not be charged.
3356
+ *
3357
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:release` · permission `money:platform_usage:write` · effect `write`
3358
+ *
3359
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
3360
+ */
3361
+ release(request: ReleasePlatformUsageHoldRequest): Promise<PlatformUsageHoldReceipt>;
3362
+ }
3218
3363
  /** `bank_transfer_accounts` of Sylphx Money: Resource type `money.sylphx.com/BankTransferAccount`. */
3219
3364
  export declare class BankTransferAccountsCollection {
3220
3365
  private readonly client;
package/dist/money.js CHANGED
@@ -61,6 +61,12 @@ runtime.registerSchemas({
61
61
  ['atPeriodEnd', 'at_period_end'],
62
62
  ['refundLastPayment', 'refund_last_payment'],
63
63
  ],
64
+ 'sylphx.money.v1.CapturePlatformUsageHoldRequest': [
65
+ ['payerOrg', 'payer_org'],
66
+ ['executionKey', 'execution_key'],
67
+ ['actualPicousd', 'actual_picousd'],
68
+ ['terminalReceiptKey', 'terminal_receipt_key'],
69
+ ],
64
70
  'sylphx.money.v1.Catalog': [
65
71
  ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
66
72
  ['spec', 'spec', 'sylphx.money.v1.CatalogSpec'],
@@ -181,6 +187,11 @@ runtime.registerSchemas({
181
187
  ['claimSecret', 'claim_secret'],
182
188
  ['claimSecretExpiresAt', 'claim_secret_expires_at'],
183
189
  ],
190
+ 'sylphx.money.v1.ClaimPlatformUsageHoldRequest': [
191
+ ['payerOrg', 'payer_org'],
192
+ ['executionKey', 'execution_key'],
193
+ ['preconditions', 'preconditions', 'sylphx.money.v1.PlatformUsageHoldClaimPreconditions'],
194
+ ],
184
195
  'sylphx.money.v1.ClientVerifyStorePurchaseRequest': [
185
196
  ['subject', 'subject', 'sylphx.money.v1.Subject'],
186
197
  ['signedTransaction', 'signed_transaction'],
@@ -541,6 +552,23 @@ runtime.registerSchemas({
541
552
  ['processorPermissionsCheckTime', 'processor_permissions_check_time'],
542
553
  ['processorWarnings', 'processor_warnings'],
543
554
  ],
555
+ 'sylphx.money.v1.PlatformUsageHoldClaimPreconditions': [
556
+ ['holdUid', 'hold_uid'],
557
+ ['upperBoundPicousd', 'upper_bound_picousd'],
558
+ ['maxMonthlyFuseUsdMinor', 'max_monthly_fuse_usd_minor'],
559
+ ],
560
+ 'sylphx.money.v1.PlatformUsageHoldReceipt': [
561
+ ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
562
+ ['payerOrg', 'payer_org'],
563
+ ['executionKey', 'execution_key'],
564
+ ['upperBoundPicousd', 'upper_bound_picousd'],
565
+ ['dispatchBy', 'dispatch_by'],
566
+ ['settleBy', 'settle_by'],
567
+ ['capturedPicousd', 'captured_picousd'],
568
+ ['releasedPicousd', 'released_picousd'],
569
+ ['ledgerTransactionId', 'ledger_transaction_id'],
570
+ ['verifiedMonthlyFuseUsdMinor', 'verified_monthly_fuse_usd_minor'],
571
+ ],
544
572
  'sylphx.money.v1.PortalSession': [
545
573
  ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
546
574
  ['subject', 'subject', 'sylphx.money.v1.Subject'],
@@ -612,6 +640,11 @@ runtime.registerSchemas({
612
640
  'sylphx.money.v1.RefundCheckoutSessionResponse': [
613
641
  ['refund', 'refund', 'sylphx.money.v1.Refund'],
614
642
  ],
643
+ 'sylphx.money.v1.ReleasePlatformUsageHoldRequest': [
644
+ ['payerOrg', 'payer_org'],
645
+ ['executionKey', 'execution_key'],
646
+ ['definitiveNoCharge', 'definitive_no_charge'],
647
+ ],
615
648
  'sylphx.money.v1.ReleaseUsageInvoiceCollectionRequest': [],
616
649
  'sylphx.money.v1.ReleaseUsageReservationRequest': [],
617
650
  'sylphx.money.v1.ReportStorePurchaseUsageRequest': [
@@ -626,6 +659,13 @@ runtime.registerSchemas({
626
659
  ['storeConsumptionRequest', 'store_consumption_request', 'sylphx.money.v1.StoreConsumptionRequest'],
627
660
  ['storePurchase', 'store_purchase', 'sylphx.money.v1.StorePurchase'],
628
661
  ],
662
+ 'sylphx.money.v1.ReservePlatformUsageHoldRequest': [
663
+ ['payerOrg', 'payer_org'],
664
+ ['executionKey', 'execution_key'],
665
+ ['upperBoundPicousd', 'upper_bound_picousd'],
666
+ ['dispatchBy', 'dispatch_by'],
667
+ ['settleBy', 'settle_by'],
668
+ ],
629
669
  'sylphx.money.v1.ResolveBankReceiptRequest': [],
630
670
  'sylphx.money.v1.ResumeCustomerSubscriptionRequest': [],
631
671
  'sylphx.money.v1.RetireLicenceKeyRequest': [],
@@ -945,6 +985,8 @@ runtime.registerSchemas({
945
985
  * Namespace of Sylphx Money on `Sylphx`.
946
986
  */
947
987
  export class MoneyApi {
988
+ /** The `platform_usage_holds` collection. */
989
+ platformUsageHolds;
948
990
  /** The `bank_transfer_accounts` collection. */
949
991
  bankTransferAccounts;
950
992
  /** The `bank_receipts` collection. */
@@ -1004,6 +1046,7 @@ export class MoneyApi {
1004
1046
  /** The `exchange_rates` collection. */
1005
1047
  exchangeRates;
1006
1048
  constructor(client) {
1049
+ this.platformUsageHolds = new PlatformUsageHoldsCollection(client);
1007
1050
  this.bankTransferAccounts = new BankTransferAccountsCollection(client);
1008
1051
  this.bankReceipts = new BankReceiptsCollection(client);
1009
1052
  this.processorEvents = new ProcessorEventsCollection(client);
@@ -1035,6 +1078,81 @@ export class MoneyApi {
1035
1078
  this.exchangeRates = new ExchangeRatesCollection(client);
1036
1079
  }
1037
1080
  }
1081
+ /** `platform_usage_holds` of Sylphx Money: Resource type `money.sylphx.com/PlatformUsageHoldReceipt`. */
1082
+ export class PlatformUsageHoldsCollection {
1083
+ client;
1084
+ constructor(client) {
1085
+ this.client = client;
1086
+ }
1087
+ /**
1088
+ * ReservePlatformUsageHold holds an upper bound before dispatch.
1089
+ *
1090
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:reserve` · permission `money:platform_usage:write` · effect `write`
1091
+ *
1092
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
1093
+ */
1094
+ async reserve(request) {
1095
+ return this.client.call({
1096
+ method: 'POST',
1097
+ path: `/v1/${runtime.pathParam(request.parent, 'orgs/*', 'parent')}/platform_usage_holds:reserve`,
1098
+ body: runtime.omit(request, ['parent']),
1099
+ bodyType: 'sylphx.money.v1.ReservePlatformUsageHoldRequest',
1100
+ responseType: 'sylphx.money.v1.PlatformUsageHoldReceipt',
1101
+ mutation: true,
1102
+ });
1103
+ }
1104
+ /**
1105
+ * ClaimPlatformUsageHold records that dispatch has been claimed against the hold.
1106
+ *
1107
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:claim` · permission `money:platform_usage:write` · effect `write`
1108
+ *
1109
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
1110
+ */
1111
+ async claim(request) {
1112
+ return this.client.call({
1113
+ method: 'POST',
1114
+ path: `/v1/${runtime.pathParam(request.parent, 'orgs/*', 'parent')}/platform_usage_holds:claim`,
1115
+ body: runtime.omit(request, ['parent']),
1116
+ bodyType: 'sylphx.money.v1.ClaimPlatformUsageHoldRequest',
1117
+ responseType: 'sylphx.money.v1.PlatformUsageHoldReceipt',
1118
+ mutation: true,
1119
+ });
1120
+ }
1121
+ /**
1122
+ * CapturePlatformUsageHold settles the hold against a definitive terminal receipt.
1123
+ *
1124
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:capture` · permission `money:platform_usage:write` · effect `write`
1125
+ *
1126
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
1127
+ */
1128
+ async capture(request) {
1129
+ return this.client.call({
1130
+ method: 'POST',
1131
+ path: `/v1/${runtime.pathParam(request.parent, 'orgs/*', 'parent')}/platform_usage_holds:capture`,
1132
+ body: runtime.omit(request, ['parent']),
1133
+ bodyType: 'sylphx.money.v1.CapturePlatformUsageHoldRequest',
1134
+ responseType: 'sylphx.money.v1.PlatformUsageHoldReceipt',
1135
+ mutation: true,
1136
+ });
1137
+ }
1138
+ /**
1139
+ * ReleasePlatformUsageHold returns the held funds when the execution will not be charged.
1140
+ *
1141
+ * `POST /v1/{parent=orgs/*}/platform_usage_holds:release` · permission `money:platform_usage:write` · effect `write`
1142
+ *
1143
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `FAILED_PRECONDITION`, `IDEMPOTENCY_KEY_REUSED`, `UNAVAILABLE`.
1144
+ */
1145
+ async release(request) {
1146
+ return this.client.call({
1147
+ method: 'POST',
1148
+ path: `/v1/${runtime.pathParam(request.parent, 'orgs/*', 'parent')}/platform_usage_holds:release`,
1149
+ body: runtime.omit(request, ['parent']),
1150
+ bodyType: 'sylphx.money.v1.ReleasePlatformUsageHoldRequest',
1151
+ responseType: 'sylphx.money.v1.PlatformUsageHoldReceipt',
1152
+ mutation: true,
1153
+ });
1154
+ }
1155
+ }
1038
1156
  /** `bank_transfer_accounts` of Sylphx Money: Resource type `money.sylphx.com/BankTransferAccount`. */
1039
1157
  export class BankTransferAccountsCollection {
1040
1158
  client;