@fonderie/client 0.12.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 +67 -0
- package/dist/index.cjs +102 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -1
- package/dist/index.d.ts +68 -1
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -209,6 +209,61 @@ interface IWalletDTO {
|
|
|
209
209
|
interface IWalletResult {
|
|
210
210
|
wallet: IWalletDTO;
|
|
211
211
|
}
|
|
212
|
+
interface IWalletTransactionDTO {
|
|
213
|
+
id: string;
|
|
214
|
+
type: string;
|
|
215
|
+
amount: string;
|
|
216
|
+
balanceAfter: string;
|
|
217
|
+
currency: string;
|
|
218
|
+
description: string | null;
|
|
219
|
+
providerTxId: string | null;
|
|
220
|
+
metadata: Record<string, unknown>;
|
|
221
|
+
createdAt: string;
|
|
222
|
+
}
|
|
223
|
+
interface IWalletTransactionsResult {
|
|
224
|
+
transactions: IWalletTransactionDTO[];
|
|
225
|
+
nextCursor: string | null;
|
|
226
|
+
}
|
|
227
|
+
interface IWalletCheckoutInput {
|
|
228
|
+
packId: string;
|
|
229
|
+
}
|
|
230
|
+
interface ICancelSubscriptionInput {
|
|
231
|
+
atPeriodEnd?: boolean;
|
|
232
|
+
}
|
|
233
|
+
interface ISubscriptionChangeResult {
|
|
234
|
+
atPeriodEnd: boolean;
|
|
235
|
+
status: string;
|
|
236
|
+
currentPeriodEnd: string | null;
|
|
237
|
+
}
|
|
238
|
+
interface IPaymentMethodDTO {
|
|
239
|
+
brand: string;
|
|
240
|
+
last4: string;
|
|
241
|
+
expMonth: number;
|
|
242
|
+
expYear: number;
|
|
243
|
+
}
|
|
244
|
+
interface IPaymentMethodResult {
|
|
245
|
+
paymentMethod: IPaymentMethodDTO | null;
|
|
246
|
+
}
|
|
247
|
+
interface ISetupIntentResult {
|
|
248
|
+
clientSecret: string;
|
|
249
|
+
}
|
|
250
|
+
interface ISavePaymentMethodInput {
|
|
251
|
+
paymentMethodId: string;
|
|
252
|
+
}
|
|
253
|
+
interface IInvoiceDTO {
|
|
254
|
+
id: string;
|
|
255
|
+
number: string | null;
|
|
256
|
+
amountDue: string;
|
|
257
|
+
amountPaid: string;
|
|
258
|
+
currency: string;
|
|
259
|
+
status: string;
|
|
260
|
+
created: string;
|
|
261
|
+
hostedInvoiceUrl: string | null;
|
|
262
|
+
invoicePdf: string | null;
|
|
263
|
+
}
|
|
264
|
+
interface IInvoicesResult {
|
|
265
|
+
invoices: IInvoiceDTO[];
|
|
266
|
+
}
|
|
212
267
|
interface IWorkspaceAddressDTO {
|
|
213
268
|
line1: string;
|
|
214
269
|
line2: string;
|
|
@@ -683,12 +738,24 @@ declare class BillingClient {
|
|
|
683
738
|
updatePlan(planId: string, input: IUpdatePlanInput): Promise<IApiResponse<IPlanResult>>;
|
|
684
739
|
deletePlan(planId: string): Promise<IApiResponse<undefined>>;
|
|
685
740
|
getSubscription(opts?: IReadOptions): Promise<IApiResponse<ISubscriptionResult>>;
|
|
741
|
+
cancelSubscription(input?: ICancelSubscriptionInput): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
742
|
+
reactivateSubscription(): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
686
743
|
createCheckoutSession(input: ICheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
687
744
|
createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>;
|
|
688
745
|
recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>;
|
|
689
746
|
getUsage(metric: string, opts?: IReadOptions): Promise<IApiResponse<IUsageResult>>;
|
|
690
747
|
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
691
748
|
setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>;
|
|
749
|
+
createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
750
|
+
getWalletTransactions(opts?: IReadOptions & {
|
|
751
|
+
cursor?: string;
|
|
752
|
+
limit?: number;
|
|
753
|
+
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
754
|
+
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
755
|
+
setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>;
|
|
756
|
+
savePaymentMethod(input: ISavePaymentMethodInput): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
757
|
+
removePaymentMethod(): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
758
|
+
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
692
759
|
}
|
|
693
760
|
|
|
694
761
|
interface IListCustomersInput {
|
|
@@ -1023,4 +1090,4 @@ declare class CourierAdminClient {
|
|
|
1023
1090
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1024
1091
|
}
|
|
1025
1092
|
|
|
1026
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1093
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.d.ts
CHANGED
|
@@ -209,6 +209,61 @@ interface IWalletDTO {
|
|
|
209
209
|
interface IWalletResult {
|
|
210
210
|
wallet: IWalletDTO;
|
|
211
211
|
}
|
|
212
|
+
interface IWalletTransactionDTO {
|
|
213
|
+
id: string;
|
|
214
|
+
type: string;
|
|
215
|
+
amount: string;
|
|
216
|
+
balanceAfter: string;
|
|
217
|
+
currency: string;
|
|
218
|
+
description: string | null;
|
|
219
|
+
providerTxId: string | null;
|
|
220
|
+
metadata: Record<string, unknown>;
|
|
221
|
+
createdAt: string;
|
|
222
|
+
}
|
|
223
|
+
interface IWalletTransactionsResult {
|
|
224
|
+
transactions: IWalletTransactionDTO[];
|
|
225
|
+
nextCursor: string | null;
|
|
226
|
+
}
|
|
227
|
+
interface IWalletCheckoutInput {
|
|
228
|
+
packId: string;
|
|
229
|
+
}
|
|
230
|
+
interface ICancelSubscriptionInput {
|
|
231
|
+
atPeriodEnd?: boolean;
|
|
232
|
+
}
|
|
233
|
+
interface ISubscriptionChangeResult {
|
|
234
|
+
atPeriodEnd: boolean;
|
|
235
|
+
status: string;
|
|
236
|
+
currentPeriodEnd: string | null;
|
|
237
|
+
}
|
|
238
|
+
interface IPaymentMethodDTO {
|
|
239
|
+
brand: string;
|
|
240
|
+
last4: string;
|
|
241
|
+
expMonth: number;
|
|
242
|
+
expYear: number;
|
|
243
|
+
}
|
|
244
|
+
interface IPaymentMethodResult {
|
|
245
|
+
paymentMethod: IPaymentMethodDTO | null;
|
|
246
|
+
}
|
|
247
|
+
interface ISetupIntentResult {
|
|
248
|
+
clientSecret: string;
|
|
249
|
+
}
|
|
250
|
+
interface ISavePaymentMethodInput {
|
|
251
|
+
paymentMethodId: string;
|
|
252
|
+
}
|
|
253
|
+
interface IInvoiceDTO {
|
|
254
|
+
id: string;
|
|
255
|
+
number: string | null;
|
|
256
|
+
amountDue: string;
|
|
257
|
+
amountPaid: string;
|
|
258
|
+
currency: string;
|
|
259
|
+
status: string;
|
|
260
|
+
created: string;
|
|
261
|
+
hostedInvoiceUrl: string | null;
|
|
262
|
+
invoicePdf: string | null;
|
|
263
|
+
}
|
|
264
|
+
interface IInvoicesResult {
|
|
265
|
+
invoices: IInvoiceDTO[];
|
|
266
|
+
}
|
|
212
267
|
interface IWorkspaceAddressDTO {
|
|
213
268
|
line1: string;
|
|
214
269
|
line2: string;
|
|
@@ -683,12 +738,24 @@ declare class BillingClient {
|
|
|
683
738
|
updatePlan(planId: string, input: IUpdatePlanInput): Promise<IApiResponse<IPlanResult>>;
|
|
684
739
|
deletePlan(planId: string): Promise<IApiResponse<undefined>>;
|
|
685
740
|
getSubscription(opts?: IReadOptions): Promise<IApiResponse<ISubscriptionResult>>;
|
|
741
|
+
cancelSubscription(input?: ICancelSubscriptionInput): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
742
|
+
reactivateSubscription(): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
686
743
|
createCheckoutSession(input: ICheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
687
744
|
createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>;
|
|
688
745
|
recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>;
|
|
689
746
|
getUsage(metric: string, opts?: IReadOptions): Promise<IApiResponse<IUsageResult>>;
|
|
690
747
|
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
691
748
|
setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>;
|
|
749
|
+
createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
750
|
+
getWalletTransactions(opts?: IReadOptions & {
|
|
751
|
+
cursor?: string;
|
|
752
|
+
limit?: number;
|
|
753
|
+
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
754
|
+
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
755
|
+
setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>;
|
|
756
|
+
savePaymentMethod(input: ISavePaymentMethodInput): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
757
|
+
removePaymentMethod(): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
758
|
+
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
692
759
|
}
|
|
693
760
|
|
|
694
761
|
interface IListCustomersInput {
|
|
@@ -1023,4 +1090,4 @@ declare class CourierAdminClient {
|
|
|
1023
1090
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1024
1091
|
}
|
|
1025
1092
|
|
|
1026
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1093
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.js
CHANGED
|
@@ -419,6 +419,28 @@ var BillingClient = class {
|
|
|
419
419
|
bust: opts?.bust
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
+
// First-party cancel — no portal round-trip. Default keeps access until the
|
|
423
|
+
// paid-through date; pass { atPeriodEnd: false } to end it immediately. 501
|
|
424
|
+
// when the provider has no first-party cancel (the portal remains a fallback).
|
|
425
|
+
cancelSubscription(input) {
|
|
426
|
+
return this.http.request({
|
|
427
|
+
method: "POST",
|
|
428
|
+
path: "/billing/subscription/cancel",
|
|
429
|
+
body: input ?? {},
|
|
430
|
+
token: this.tokens.get(),
|
|
431
|
+
workspaceId: this.workspaceId
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
// Un-cancel a subscription scheduled to cancel at period end. Idempotent; 409
|
|
435
|
+
// when the subscription is already fully canceled (start a new checkout).
|
|
436
|
+
reactivateSubscription() {
|
|
437
|
+
return this.http.request({
|
|
438
|
+
method: "POST",
|
|
439
|
+
path: "/billing/subscription/reactivate",
|
|
440
|
+
token: this.tokens.get(),
|
|
441
|
+
workspaceId: this.workspaceId
|
|
442
|
+
});
|
|
443
|
+
}
|
|
422
444
|
// ── Checkout / portal ────────────────────────────────────────────────────────
|
|
423
445
|
createCheckoutSession(input) {
|
|
424
446
|
return this.http.request({
|
|
@@ -475,6 +497,86 @@ var BillingClient = class {
|
|
|
475
497
|
workspaceId: this.workspaceId
|
|
476
498
|
});
|
|
477
499
|
}
|
|
500
|
+
// Start a one-time credit-pack purchase. Returns a hosted checkout URL to
|
|
501
|
+
// redirect the buyer to; the wallet is credited by the payment webhook.
|
|
502
|
+
createWalletCheckout(input) {
|
|
503
|
+
return this.http.request({
|
|
504
|
+
method: "POST",
|
|
505
|
+
path: "/billing/wallet/checkout",
|
|
506
|
+
body: input,
|
|
507
|
+
token: this.tokens.get(),
|
|
508
|
+
workspaceId: this.workspaceId
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
// The wallet ledger, newest first — every credit/debit with a running
|
|
512
|
+
// balanceAfter. Cursor-paginated: pass the previous result's `nextCursor`.
|
|
513
|
+
getWalletTransactions(opts) {
|
|
514
|
+
const params = new URLSearchParams();
|
|
515
|
+
if (opts?.cursor) params.set("cursor", opts.cursor);
|
|
516
|
+
if (opts?.limit !== void 0) params.set("limit", String(opts.limit));
|
|
517
|
+
const qs = params.toString();
|
|
518
|
+
return this.http.request({
|
|
519
|
+
method: "GET",
|
|
520
|
+
path: `/billing/wallet/transactions${qs ? "?" + qs : ""}`,
|
|
521
|
+
token: this.tokens.get(),
|
|
522
|
+
workspaceId: this.workspaceId,
|
|
523
|
+
bust: opts?.bust
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
// ── Account ──────────────────────────────────────────────────────────────────
|
|
527
|
+
// The customer's card on file (brand/last4/expiry), or { paymentMethod: null }
|
|
528
|
+
// when none is stored. 501 when the provider can't retrieve it.
|
|
529
|
+
getPaymentMethod(opts) {
|
|
530
|
+
return this.http.request({
|
|
531
|
+
method: "GET",
|
|
532
|
+
path: "/billing/payment-method",
|
|
533
|
+
token: this.tokens.get(),
|
|
534
|
+
workspaceId: this.workspaceId,
|
|
535
|
+
bust: opts?.bust
|
|
536
|
+
});
|
|
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
|
+
}
|
|
569
|
+
// The customer's invoices, newest first — each links out to the hosted
|
|
570
|
+
// invoice / PDF. 501 when the provider can't list them.
|
|
571
|
+
listInvoices(opts) {
|
|
572
|
+
return this.http.request({
|
|
573
|
+
method: "GET",
|
|
574
|
+
path: "/billing/invoices",
|
|
575
|
+
token: this.tokens.get(),
|
|
576
|
+
workspaceId: this.workspaceId,
|
|
577
|
+
bust: opts?.bust
|
|
578
|
+
});
|
|
579
|
+
}
|
|
478
580
|
};
|
|
479
581
|
|
|
480
582
|
// src/modules/customers.ts
|