@fonderie/client 0.14.0 → 0.15.1
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/brain/signatures.md +16 -0
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/brain/signatures.md
CHANGED
|
@@ -192,6 +192,7 @@ new BillingClient(http: HttpClient, tokens: TokenStore): BillingClient
|
|
|
192
192
|
.getWallet(opts?: IReadOptions | undefined): Promise<IApiResponse<IWalletResult>>
|
|
193
193
|
.setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>
|
|
194
194
|
.createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>
|
|
195
|
+
.purchaseWalletPack(input: IWalletPurchaseInput): Promise<IApiResponse<IWalletPurchaseResult>>
|
|
195
196
|
.getWalletTransactions(opts?: (IReadOptions & { cursor?: string; limit?: number; }) | undefined): Promise<IApiResponse<IWalletTransactionsResult>>
|
|
196
197
|
.getPaymentMethod(opts?: IReadOptions | undefined): Promise<IApiResponse<IPaymentMethodResult>>
|
|
197
198
|
.setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>
|
|
@@ -743,6 +744,7 @@ interface IInvoiceDTO {
|
|
|
743
744
|
currency: string;
|
|
744
745
|
status: string;
|
|
745
746
|
created: string;
|
|
747
|
+
dueDate: string | null;
|
|
746
748
|
hostedInvoiceUrl: string | null;
|
|
747
749
|
invoicePdf: string | null;
|
|
748
750
|
}
|
|
@@ -1014,6 +1016,20 @@ interface IWalletDTO {
|
|
|
1014
1016
|
grantedExpiresAt?: string | null;
|
|
1015
1017
|
}
|
|
1016
1018
|
|
|
1019
|
+
interface IWalletPurchaseInput {
|
|
1020
|
+
packId: string;
|
|
1021
|
+
idempotencyKey: string;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
interface IWalletPurchaseResult {
|
|
1025
|
+
status: 'credited' | 'checkout_required' | 'declined' | 'processing';
|
|
1026
|
+
balance?: string;
|
|
1027
|
+
currency?: string;
|
|
1028
|
+
credits?: string;
|
|
1029
|
+
duplicate?: boolean;
|
|
1030
|
+
reason?: 'no_saved_card' | 'authentication_required';
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1017
1033
|
interface IWalletResult {
|
|
1018
1034
|
wallet: IWalletDTO;
|
|
1019
1035
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -545,6 +545,21 @@ var BillingClient = class {
|
|
|
545
545
|
workspaceId: this.workspaceId
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
+
// Buy a credit pack in-app by charging the saved card — no redirect. Inspect
|
|
549
|
+
// `result.status`: 'credited' (done — refresh the wallet), 'checkout_required'
|
|
550
|
+
// (no saved card or the card needs 3-D Secure → fall back to
|
|
551
|
+
// createWalletCheckout), 'declined', or 'processing' (indeterminate — retry
|
|
552
|
+
// with the SAME idempotencyKey). Generate one idempotencyKey per attempt and
|
|
553
|
+
// reuse it on retry so a double-submit can't double-charge.
|
|
554
|
+
purchaseWalletPack(input) {
|
|
555
|
+
return this.http.request({
|
|
556
|
+
method: "POST",
|
|
557
|
+
path: "/billing/wallet/purchase",
|
|
558
|
+
body: input,
|
|
559
|
+
token: this.tokens.get(),
|
|
560
|
+
workspaceId: this.workspaceId
|
|
561
|
+
});
|
|
562
|
+
}
|
|
548
563
|
// The wallet ledger, newest first — every credit/debit with a running
|
|
549
564
|
// balanceAfter. Cursor-paginated: pass the previous result's `nextCursor`.
|
|
550
565
|
getWalletTransactions(opts) {
|