@fonderie/client 0.13.0 → 0.14.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/brain/signatures.md +3 -0
- package/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -244,6 +244,12 @@ interface IPaymentMethodDTO {
|
|
|
244
244
|
interface IPaymentMethodResult {
|
|
245
245
|
paymentMethod: IPaymentMethodDTO | null;
|
|
246
246
|
}
|
|
247
|
+
interface ISetupIntentResult {
|
|
248
|
+
clientSecret: string;
|
|
249
|
+
}
|
|
250
|
+
interface ISavePaymentMethodInput {
|
|
251
|
+
paymentMethodId: string;
|
|
252
|
+
}
|
|
247
253
|
interface IInvoiceDTO {
|
|
248
254
|
id: string;
|
|
249
255
|
number: string | null;
|
|
@@ -746,6 +752,9 @@ declare class BillingClient {
|
|
|
746
752
|
limit?: number;
|
|
747
753
|
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
748
754
|
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
755
|
+
setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>;
|
|
756
|
+
savePaymentMethod(input: ISavePaymentMethodInput): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
757
|
+
removePaymentMethod(): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
749
758
|
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
750
759
|
}
|
|
751
760
|
|
package/dist/index.d.ts
CHANGED
|
@@ -244,6 +244,12 @@ interface IPaymentMethodDTO {
|
|
|
244
244
|
interface IPaymentMethodResult {
|
|
245
245
|
paymentMethod: IPaymentMethodDTO | null;
|
|
246
246
|
}
|
|
247
|
+
interface ISetupIntentResult {
|
|
248
|
+
clientSecret: string;
|
|
249
|
+
}
|
|
250
|
+
interface ISavePaymentMethodInput {
|
|
251
|
+
paymentMethodId: string;
|
|
252
|
+
}
|
|
247
253
|
interface IInvoiceDTO {
|
|
248
254
|
id: string;
|
|
249
255
|
number: string | null;
|
|
@@ -746,6 +752,9 @@ declare class BillingClient {
|
|
|
746
752
|
limit?: number;
|
|
747
753
|
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
748
754
|
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
755
|
+
setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>;
|
|
756
|
+
savePaymentMethod(input: ISavePaymentMethodInput): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
757
|
+
removePaymentMethod(): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
749
758
|
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
750
759
|
}
|
|
751
760
|
|
package/dist/index.js
CHANGED
|
@@ -535,6 +535,37 @@ var BillingClient = class {
|
|
|
535
535
|
bust: opts?.bust
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
|
+
// Begin in-app card entry — returns a SetupIntent client secret for the
|
|
539
|
+
// provider's embedded card element (Stripe Payment Element); the user never
|
|
540
|
+
// leaves the site. 501 when the provider has no in-app card support.
|
|
541
|
+
setupPaymentMethod() {
|
|
542
|
+
return this.http.request({
|
|
543
|
+
method: "POST",
|
|
544
|
+
path: "/billing/payment-method/setup",
|
|
545
|
+
token: this.tokens.get(),
|
|
546
|
+
workspaceId: this.workspaceId
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
// Save the card after the client confirms the SetupIntent: makes it the
|
|
550
|
+
// default and records it. 422 when the card isn't attached to this customer.
|
|
551
|
+
savePaymentMethod(input) {
|
|
552
|
+
return this.http.request({
|
|
553
|
+
method: "PUT",
|
|
554
|
+
path: "/billing/payment-method",
|
|
555
|
+
body: input,
|
|
556
|
+
token: this.tokens.get(),
|
|
557
|
+
workspaceId: this.workspaceId
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
// Remove the saved card (detach at the provider + clear the record).
|
|
561
|
+
removePaymentMethod() {
|
|
562
|
+
return this.http.request({
|
|
563
|
+
method: "DELETE",
|
|
564
|
+
path: "/billing/payment-method",
|
|
565
|
+
token: this.tokens.get(),
|
|
566
|
+
workspaceId: this.workspaceId
|
|
567
|
+
});
|
|
568
|
+
}
|
|
538
569
|
// The customer's invoices, newest first — each links out to the hosted
|
|
539
570
|
// invoice / PDF. 501 when the provider can't list them.
|
|
540
571
|
listInvoices(opts) {
|