@flexprice/sdk 2.1.47 → 2.1.48-dev.2
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/docs/sdk/models/billing-term-input.md +29 -0
- package/docs/sdk/models/billing-term-kind.md +17 -0
- package/docs/sdk/models/billing-term-owner-type.md +15 -0
- package/docs/sdk/models/billing-term-split.md +17 -0
- package/docs/sdk/models/billing-term-value-type.md +19 -0
- package/docs/sdk/models/billing-terms-response.md +16 -0
- package/docs/sdk/models/billingterm-instalment.md +40 -0
- package/docs/sdk/models/billingterm-term.md +36 -0
- package/docs/sdk/models/cancellation-fee-input.md +19 -0
- package/docs/sdk/models/cancellation-fee-type.md +17 -0
- package/docs/sdk/models/commitment-response.md +3 -1
- package/docs/sdk/models/create-commitment-request.md +3 -1
- package/docs/sdk/models/get-commitment-billing-terms-request.md +17 -0
- package/docs/sdk/models/instalment-bill-trigger.md +17 -0
- package/docs/sdk/models/instalment-delivery.md +17 -0
- package/docs/sdk/models/instalment-kind.md +17 -0
- package/docs/sdk/models/instalment-status.md +17 -0
- package/docs/sdk/models/invoice-billing-reason.md +1 -1
- package/docs/sdk/models/invoice-line-item-response.md +1 -0
- package/docs/sdk/models/list-commitment-instalments-request.md +18 -0
- package/docs/sdk/models/list-instalments-response.md +15 -0
- package/docs/sdk/models/preview-commitment-billing-terms-request.md +21 -0
- package/docs/sdk/models/replace-billing-terms-request.md +17 -0
- package/docs/sdk/models/replace-commitment-billing-terms-request.md +21 -0
- package/docs/sdk/models/terminate-commitment-request.md +2 -2
- package/docs/sdk/models/trigger-commitment-instalment-request.md +20 -0
- package/docs/sdk/models/trigger-instalment-request.md +15 -0
- package/docs/sdk/models/webhook-dto-billing-instalment-webhook-payload.md +16 -0
- package/docs/sdk/models/webhook-dto-billing-terms-webhook-payload.md +18 -0
- package/docs/sdk/models/webhook-dto-invoice-line-item.md +1 -0
- package/docs/sdk/models/webhook-event-name.md +1 -1
- package/docs/sdks/commitments/README.md +384 -1
- package/docs/sdks/webhookevents/README.md +414 -0
- package/esm/funcs/commitments-get-commitment-billing-terms.d.ts +17 -0
- package/esm/funcs/commitments-get-commitment-billing-terms.d.ts.map +1 -0
- package/esm/funcs/commitments-get-commitment-billing-terms.js +91 -0
- package/esm/funcs/commitments-get-commitment-billing-terms.js.map +1 -0
- package/esm/funcs/commitments-list-commitment-instalments.d.ts +17 -0
- package/esm/funcs/commitments-list-commitment-instalments.d.ts.map +1 -0
- package/esm/funcs/commitments-list-commitment-instalments.js +96 -0
- package/esm/funcs/commitments-list-commitment-instalments.js.map +1 -0
- package/esm/funcs/commitments-preview-commitment-billing-terms.d.ts +17 -0
- package/esm/funcs/commitments-preview-commitment-billing-terms.d.ts.map +1 -0
- package/esm/funcs/commitments-preview-commitment-billing-terms.js +93 -0
- package/esm/funcs/commitments-preview-commitment-billing-terms.js.map +1 -0
- package/esm/funcs/commitments-replace-commitment-billing-terms.d.ts +17 -0
- package/esm/funcs/commitments-replace-commitment-billing-terms.d.ts.map +1 -0
- package/esm/funcs/commitments-replace-commitment-billing-terms.js +93 -0
- package/esm/funcs/commitments-replace-commitment-billing-terms.js.map +1 -0
- package/esm/funcs/commitments-terminate-commitment.d.ts +1 -1
- package/esm/funcs/commitments-terminate-commitment.js +1 -1
- package/esm/funcs/commitments-trigger-commitment-instalment.d.ts +17 -0
- package/esm/funcs/commitments-trigger-commitment-instalment.d.ts.map +1 -0
- package/esm/funcs/commitments-trigger-commitment-instalment.js +98 -0
- package/esm/funcs/commitments-trigger-commitment-instalment.js.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.d.ts +17 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.d.ts.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.js +69 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.js.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.d.ts +17 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.d.ts.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.js +69 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.js.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.d.ts +17 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.d.ts.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.js +69 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.js.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.d.ts +17 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.d.ts.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.js +69 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.js.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.d.ts +17 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.d.ts.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.js +69 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.js.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.d.ts +17 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.d.ts.map +1 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.js +69 -0
- package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/config.js.map +1 -1
- package/esm/sdk/commitments.d.ts +36 -1
- package/esm/sdk/commitments.d.ts.map +1 -1
- package/esm/sdk/commitments.js +51 -1
- package/esm/sdk/commitments.js.map +1 -1
- package/esm/sdk/models/billing-term-input.d.ts +61 -0
- package/esm/sdk/models/billing-term-input.d.ts.map +1 -0
- package/esm/sdk/models/billing-term-input.js +40 -0
- package/esm/sdk/models/billing-term-input.js.map +1 -0
- package/esm/sdk/models/billing-term-kind.d.ts +12 -0
- package/esm/sdk/models/billing-term-kind.d.ts.map +1 -0
- package/esm/sdk/models/billing-term-kind.js +13 -0
- package/esm/sdk/models/billing-term-kind.js.map +1 -0
- package/esm/sdk/models/billing-term-owner-type.d.ts +9 -0
- package/esm/sdk/models/billing-term-owner-type.d.ts.map +1 -0
- package/esm/sdk/models/billing-term-owner-type.js +10 -0
- package/esm/sdk/models/billing-term-owner-type.js.map +1 -0
- package/esm/sdk/models/billing-term-split.d.ts +12 -0
- package/esm/sdk/models/billing-term-split.d.ts.map +1 -0
- package/esm/sdk/models/billing-term-split.js +13 -0
- package/esm/sdk/models/billing-term-split.js.map +1 -0
- package/esm/sdk/models/billing-term-value-type.d.ts +19 -0
- package/esm/sdk/models/billing-term-value-type.d.ts.map +1 -0
- package/esm/sdk/models/billing-term-value-type.js +17 -0
- package/esm/sdk/models/billing-term-value-type.js.map +1 -0
- package/esm/sdk/models/billing-terms-response.d.ts +13 -0
- package/esm/sdk/models/billing-terms-response.d.ts.map +1 -0
- package/esm/sdk/models/billing-terms-response.js +22 -0
- package/esm/sdk/models/billing-terms-response.js.map +1 -0
- package/esm/sdk/models/billingterm-instalment.d.ts +43 -0
- package/esm/sdk/models/billingterm-instalment.d.ts.map +1 -0
- package/esm/sdk/models/billingterm-instalment.js +68 -0
- package/esm/sdk/models/billingterm-instalment.js.map +1 -0
- package/esm/sdk/models/billingterm-term.d.ts +55 -0
- package/esm/sdk/models/billingterm-term.d.ts.map +1 -0
- package/esm/sdk/models/billingterm-term.js +62 -0
- package/esm/sdk/models/billingterm-term.js.map +1 -0
- package/esm/sdk/models/cancellation-fee-input.d.ts +18 -0
- package/esm/sdk/models/cancellation-fee-input.d.ts.map +1 -0
- package/esm/sdk/models/cancellation-fee-input.js +14 -0
- package/esm/sdk/models/cancellation-fee-input.js.map +1 -0
- package/esm/sdk/models/cancellation-fee-type.d.ts +16 -0
- package/esm/sdk/models/cancellation-fee-type.d.ts.map +1 -0
- package/esm/sdk/models/cancellation-fee-type.js +14 -0
- package/esm/sdk/models/cancellation-fee-type.js.map +1 -0
- package/esm/sdk/models/commitment-response.d.ts +9 -1
- package/esm/sdk/models/commitment-response.d.ts.map +1 -1
- package/esm/sdk/models/commitment-response.js +7 -1
- package/esm/sdk/models/commitment-response.js.map +1 -1
- package/esm/sdk/models/create-commitment-request.d.ts +12 -0
- package/esm/sdk/models/create-commitment-request.d.ts.map +1 -1
- package/esm/sdk/models/create-commitment-request.js +6 -0
- package/esm/sdk/models/create-commitment-request.js.map +1 -1
- package/esm/sdk/models/get-commitment-billing-terms-op.d.ts +15 -0
- package/esm/sdk/models/get-commitment-billing-terms-op.d.ts.map +1 -0
- package/esm/sdk/models/get-commitment-billing-terms-op.js +12 -0
- package/esm/sdk/models/get-commitment-billing-terms-op.js.map +1 -0
- package/esm/sdk/models/index.d.ts +24 -0
- package/esm/sdk/models/index.d.ts.map +1 -1
- package/esm/sdk/models/index.js +24 -0
- package/esm/sdk/models/index.js.map +1 -1
- package/esm/sdk/models/instalment-bill-trigger.d.ts +12 -0
- package/esm/sdk/models/instalment-bill-trigger.d.ts.map +1 -0
- package/esm/sdk/models/instalment-bill-trigger.js +13 -0
- package/esm/sdk/models/instalment-bill-trigger.js.map +1 -0
- package/esm/sdk/models/instalment-delivery.d.ts +12 -0
- package/esm/sdk/models/instalment-delivery.d.ts.map +1 -0
- package/esm/sdk/models/instalment-delivery.js +13 -0
- package/esm/sdk/models/instalment-delivery.js.map +1 -0
- package/esm/sdk/models/instalment-kind.d.ts +10 -0
- package/esm/sdk/models/instalment-kind.d.ts.map +1 -0
- package/esm/sdk/models/instalment-kind.js +11 -0
- package/esm/sdk/models/instalment-kind.js.map +1 -0
- package/esm/sdk/models/instalment-status.d.ts +11 -0
- package/esm/sdk/models/instalment-status.d.ts.map +1 -0
- package/esm/sdk/models/instalment-status.js +12 -0
- package/esm/sdk/models/instalment-status.js.map +1 -0
- package/esm/sdk/models/invoice-billing-reason.d.ts +1 -0
- package/esm/sdk/models/invoice-billing-reason.d.ts.map +1 -1
- package/esm/sdk/models/invoice-billing-reason.js +1 -0
- package/esm/sdk/models/invoice-billing-reason.js.map +1 -1
- package/esm/sdk/models/invoice-line-item-response.d.ts +4 -0
- package/esm/sdk/models/invoice-line-item-response.d.ts.map +1 -1
- package/esm/sdk/models/invoice-line-item-response.js +2 -0
- package/esm/sdk/models/invoice-line-item-response.js.map +1 -1
- package/esm/sdk/models/list-commitment-instalments-op.d.ts +20 -0
- package/esm/sdk/models/list-commitment-instalments-op.d.ts.map +1 -0
- package/esm/sdk/models/list-commitment-instalments-op.js +13 -0
- package/esm/sdk/models/list-commitment-instalments-op.js.map +1 -0
- package/esm/sdk/models/list-instalments-response.d.ts +11 -0
- package/esm/sdk/models/list-instalments-response.d.ts.map +1 -0
- package/esm/sdk/models/list-instalments-response.js +15 -0
- package/esm/sdk/models/list-instalments-response.js.map +1 -0
- package/esm/sdk/models/preview-commitment-billing-terms-op.d.ts +21 -0
- package/esm/sdk/models/preview-commitment-billing-terms-op.d.ts.map +1 -0
- package/esm/sdk/models/preview-commitment-billing-terms-op.js +14 -0
- package/esm/sdk/models/preview-commitment-billing-terms-op.js.map +1 -0
- package/esm/sdk/models/replace-billing-terms-request.d.ts +13 -0
- package/esm/sdk/models/replace-billing-terms-request.d.ts.map +1 -0
- package/esm/sdk/models/replace-billing-terms-request.js +18 -0
- package/esm/sdk/models/replace-billing-terms-request.js.map +1 -0
- package/esm/sdk/models/replace-commitment-billing-terms-op.d.ts +21 -0
- package/esm/sdk/models/replace-commitment-billing-terms-op.d.ts.map +1 -0
- package/esm/sdk/models/replace-commitment-billing-terms-op.js +14 -0
- package/esm/sdk/models/replace-commitment-billing-terms-op.js.map +1 -0
- package/esm/sdk/models/terminate-commitment-request.d.ts +6 -2
- package/esm/sdk/models/terminate-commitment-request.d.ts.map +1 -1
- package/esm/sdk/models/terminate-commitment-request.js +2 -1
- package/esm/sdk/models/terminate-commitment-request.js.map +1 -1
- package/esm/sdk/models/trigger-commitment-instalment-op.d.ts +26 -0
- package/esm/sdk/models/trigger-commitment-instalment-op.d.ts.map +1 -0
- package/esm/sdk/models/trigger-commitment-instalment-op.js +20 -0
- package/esm/sdk/models/trigger-commitment-instalment-op.js.map +1 -0
- package/esm/sdk/models/trigger-instalment-request.d.ts +15 -0
- package/esm/sdk/models/trigger-instalment-request.d.ts.map +1 -0
- package/esm/sdk/models/trigger-instalment-request.js +17 -0
- package/esm/sdk/models/trigger-instalment-request.js.map +1 -0
- package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.d.ts +13 -0
- package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.d.ts.map +1 -0
- package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.js +22 -0
- package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.js.map +1 -0
- package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.d.ts +16 -0
- package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.d.ts.map +1 -0
- package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.js +28 -0
- package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.js.map +1 -0
- package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts +1 -0
- package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts.map +1 -1
- package/esm/sdk/models/webhook-dto-invoice-line-item.js +2 -0
- package/esm/sdk/models/webhook-dto-invoice-line-item.js.map +1 -1
- package/esm/sdk/models/webhook-event-name.d.ts +6 -0
- package/esm/sdk/models/webhook-event-name.d.ts.map +1 -1
- package/esm/sdk/models/webhook-event-name.js +6 -0
- package/esm/sdk/models/webhook-event-name.js.map +1 -1
- package/esm/sdk/webhook-events.d.ts +42 -0
- package/esm/sdk/webhook-events.d.ts.map +1 -1
- package/esm/sdk/webhook-events.js +60 -0
- package/esm/sdk/webhook-events.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +3 -3
- package/src/funcs/commitments-get-commitment-billing-terms.ts +182 -0
- package/src/funcs/commitments-list-commitment-instalments.ts +191 -0
- package/src/funcs/commitments-preview-commitment-billing-terms.ts +192 -0
- package/src/funcs/commitments-replace-commitment-billing-terms.ts +190 -0
- package/src/funcs/commitments-terminate-commitment.ts +1 -1
- package/src/funcs/commitments-trigger-commitment-instalment.ts +197 -0
- package/src/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.ts +144 -0
- package/src/funcs/webhook-events-post-webhook-events-billing-instalment-created.ts +144 -0
- package/src/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.ts +144 -0
- package/src/funcs/webhook-events-post-webhook-events-billing-instalment-updated.ts +144 -0
- package/src/funcs/webhook-events-post-webhook-events-billing-terms-created.ts +144 -0
- package/src/funcs/webhook-events-post-webhook-events-billing-terms-updated.ts +144 -0
- package/src/lib/config.ts +3 -3
- package/src/sdk/commitments.ts +101 -1
- package/src/sdk/models/billing-term-input.ts +116 -0
- package/src/sdk/models/billing-term-kind.ts +24 -0
- package/src/sdk/models/billing-term-owner-type.ts +16 -0
- package/src/sdk/models/billing-term-split.ts +24 -0
- package/src/sdk/models/billing-term-value-type.ts +31 -0
- package/src/sdk/models/billing-terms-response.ts +49 -0
- package/src/sdk/models/billingterm-instalment.ts +128 -0
- package/src/sdk/models/billingterm-term.ts +136 -0
- package/src/sdk/models/cancellation-fee-input.ts +40 -0
- package/src/sdk/models/cancellation-fee-type.ts +23 -0
- package/src/sdk/models/commitment-response.ts +22 -2
- package/src/sdk/models/create-commitment-request.ts +23 -0
- package/src/sdk/models/get-commitment-billing-terms-op.ts +35 -0
- package/src/sdk/models/index.ts +24 -0
- package/src/sdk/models/instalment-bill-trigger.ts +24 -0
- package/src/sdk/models/instalment-delivery.ts +24 -0
- package/src/sdk/models/instalment-kind.ts +19 -0
- package/src/sdk/models/instalment-status.ts +20 -0
- package/src/sdk/models/invoice-billing-reason.ts +1 -0
- package/src/sdk/models/invoice-line-item-response.ts +6 -0
- package/src/sdk/models/list-commitment-instalments-op.ts +41 -0
- package/src/sdk/models/list-instalments-response.ts +35 -0
- package/src/sdk/models/preview-commitment-billing-terms-op.ts +46 -0
- package/src/sdk/models/replace-billing-terms-request.ts +43 -0
- package/src/sdk/models/replace-commitment-billing-terms-op.ts +46 -0
- package/src/sdk/models/terminate-commitment-request.ts +11 -3
- package/src/sdk/models/trigger-commitment-instalment-op.ts +60 -0
- package/src/sdk/models/trigger-instalment-request.ts +41 -0
- package/src/sdk/models/webhook-dto-billing-instalment-webhook-payload.ts +53 -0
- package/src/sdk/models/webhook-dto-billing-terms-webhook-payload.ts +61 -0
- package/src/sdk/models/webhook-dto-invoice-line-item.ts +3 -0
- package/src/sdk/models/webhook-event-name.ts +6 -0
- package/src/sdk/webhook-events.ts +96 -0
package/src/sdk/commitments.ts
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { commitmentsCreateCommitment } from "../funcs/commitments-create-commitment.js";
|
|
6
|
+
import { commitmentsGetCommitmentBillingTerms } from "../funcs/commitments-get-commitment-billing-terms.js";
|
|
6
7
|
import { commitmentsGetCommitment } from "../funcs/commitments-get-commitment.js";
|
|
8
|
+
import { commitmentsListCommitmentInstalments } from "../funcs/commitments-list-commitment-instalments.js";
|
|
9
|
+
import { commitmentsPreviewCommitmentBillingTerms } from "../funcs/commitments-preview-commitment-billing-terms.js";
|
|
7
10
|
import { commitmentsPreviewCommitment } from "../funcs/commitments-preview-commitment.js";
|
|
8
11
|
import { commitmentsQueryCommitment } from "../funcs/commitments-query-commitment.js";
|
|
12
|
+
import { commitmentsReplaceCommitmentBillingTerms } from "../funcs/commitments-replace-commitment-billing-terms.js";
|
|
9
13
|
import { commitmentsTerminateCommitment } from "../funcs/commitments-terminate-commitment.js";
|
|
14
|
+
import { commitmentsTriggerCommitmentInstalment } from "../funcs/commitments-trigger-commitment-instalment.js";
|
|
10
15
|
import { commitmentsUpdateCommitment } from "../funcs/commitments-update-commitment.js";
|
|
11
16
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
12
17
|
import { unwrapAsync } from "../types/fp.js";
|
|
@@ -100,11 +105,106 @@ export class Commitments extends ClientSDK {
|
|
|
100
105
|
));
|
|
101
106
|
}
|
|
102
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Get billing terms
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* Returns the commitment's current billing terms with its scheduled and invoiced instalments in billing order. Invoiced instalments may come from terms an edit replaced. Cancelled instalments are listed by the instalments endpoint.
|
|
113
|
+
*/
|
|
114
|
+
async getCommitmentBillingTerms(
|
|
115
|
+
id: string,
|
|
116
|
+
options?: RequestOptions,
|
|
117
|
+
): Promise<models.BillingTermsResponse> {
|
|
118
|
+
return unwrapAsync(commitmentsGetCommitmentBillingTerms(
|
|
119
|
+
this,
|
|
120
|
+
id,
|
|
121
|
+
options,
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Edit billing terms
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* Replaces the whole set of billing terms of an active commitment. Its scheduled instalments are cancelled and the new terms generate instalments for what the invoiced ones leave of the commitment total; invoiced instalments and their invoices are kept. A term without bill_on or start_date starts at the billing period holding now, or at the commitment start once its term has ended. Returns the new terms with the scheduled and invoiced instalments in billing order.
|
|
130
|
+
*/
|
|
131
|
+
async replaceCommitmentBillingTerms(
|
|
132
|
+
id: string,
|
|
133
|
+
body: models.ReplaceBillingTermsRequest,
|
|
134
|
+
options?: RequestOptions,
|
|
135
|
+
): Promise<models.BillingTermsResponse> {
|
|
136
|
+
return unwrapAsync(commitmentsReplaceCommitmentBillingTerms(
|
|
137
|
+
this,
|
|
138
|
+
id,
|
|
139
|
+
body,
|
|
140
|
+
options,
|
|
141
|
+
));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Preview billing terms edit
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* Returns what editing the billing terms would produce, without saving anything: the new terms with the invoiced and new instalments in billing order.
|
|
149
|
+
*/
|
|
150
|
+
async previewCommitmentBillingTerms(
|
|
151
|
+
id: string,
|
|
152
|
+
body: models.ReplaceBillingTermsRequest,
|
|
153
|
+
options?: RequestOptions,
|
|
154
|
+
): Promise<models.BillingTermsResponse> {
|
|
155
|
+
return unwrapAsync(commitmentsPreviewCommitmentBillingTerms(
|
|
156
|
+
this,
|
|
157
|
+
id,
|
|
158
|
+
body,
|
|
159
|
+
options,
|
|
160
|
+
));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* List instalments
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* Lists the instalments of the commitment in billing order. Without a status filter every instalment is listed, cancelled ones included.
|
|
168
|
+
*/
|
|
169
|
+
async listCommitmentInstalments(
|
|
170
|
+
id: string,
|
|
171
|
+
status?: Array<string> | undefined,
|
|
172
|
+
options?: RequestOptions,
|
|
173
|
+
): Promise<models.ListInstalmentsResponse> {
|
|
174
|
+
return unwrapAsync(commitmentsListCommitmentInstalments(
|
|
175
|
+
this,
|
|
176
|
+
id,
|
|
177
|
+
status,
|
|
178
|
+
options,
|
|
179
|
+
));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Trigger instalment
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* Bills a manual instalment of an active commitment on bill_on, now by default, which must fall within the commitment term. The instalment goes on the first subscription invoice at or after that date, or on its own invoice once due when the commitment's instalment_invoicing is separate_invoice. Either way it waits while the subscription is trialing or paused. Until it is triggered, a manual instalment waits at the end of the term, and bill_on can only move earlier; edit the billing terms to bill it later.
|
|
187
|
+
*/
|
|
188
|
+
async triggerCommitmentInstalment(
|
|
189
|
+
id: string,
|
|
190
|
+
instalmentId: string,
|
|
191
|
+
body?: models.TriggerInstalmentRequest | undefined,
|
|
192
|
+
options?: RequestOptions,
|
|
193
|
+
): Promise<models.BillingtermInstalment> {
|
|
194
|
+
return unwrapAsync(commitmentsTriggerCommitmentInstalment(
|
|
195
|
+
this,
|
|
196
|
+
id,
|
|
197
|
+
instalmentId,
|
|
198
|
+
body,
|
|
199
|
+
options,
|
|
200
|
+
));
|
|
201
|
+
}
|
|
202
|
+
|
|
103
203
|
/**
|
|
104
204
|
* Terminate commitment
|
|
105
205
|
*
|
|
106
206
|
* @remarks
|
|
107
|
-
* Ends a commitment
|
|
207
|
+
* Ends a commitment immediately. effective_at defaults to now and cannot be in the future. Under billing terms, its scheduled instalments are cancelled and any amount it earned beyond what is already invoiced is billed as a settlement. The settlement and a fixed cancellation fee, when given, are billed together on one one-off invoice.
|
|
108
208
|
*/
|
|
109
209
|
async terminateCommitment(
|
|
110
210
|
id: string,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import {
|
|
8
|
+
BillingTermKind,
|
|
9
|
+
BillingTermKind$outboundSchema,
|
|
10
|
+
} from "./billing-term-kind.js";
|
|
11
|
+
import {
|
|
12
|
+
BillingTermSplit,
|
|
13
|
+
BillingTermSplit$outboundSchema,
|
|
14
|
+
} from "./billing-term-split.js";
|
|
15
|
+
import {
|
|
16
|
+
BillingTermValueType,
|
|
17
|
+
BillingTermValueType$outboundSchema,
|
|
18
|
+
} from "./billing-term-value-type.js";
|
|
19
|
+
import {
|
|
20
|
+
InstalmentBillTrigger,
|
|
21
|
+
InstalmentBillTrigger$outboundSchema,
|
|
22
|
+
} from "./instalment-bill-trigger.js";
|
|
23
|
+
import {
|
|
24
|
+
InvoiceCadence,
|
|
25
|
+
InvoiceCadence$outboundSchema,
|
|
26
|
+
} from "./invoice-cadence.js";
|
|
27
|
+
|
|
28
|
+
export type BillingTermInput = {
|
|
29
|
+
/**
|
|
30
|
+
* BillOn is a whole second, the commitment start by default. On an edit it defaults to the start of the billing
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* period holding now, or to the commitment start once the term has ended.
|
|
34
|
+
*/
|
|
35
|
+
billOn?: string | undefined;
|
|
36
|
+
billTrigger?: InstalmentBillTrigger | undefined;
|
|
37
|
+
endDate?: Date | undefined;
|
|
38
|
+
invoiceCadence?: InvoiceCadence | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* InvoiceLabel names the term's instalments on the invoice, "Instalment {n} of {of}" by default. {n} and {of} are
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* filled with each instalment's place among all of the commitment's instalments and their count.
|
|
44
|
+
*/
|
|
45
|
+
invoiceLabel?: string | undefined;
|
|
46
|
+
kind: BillingTermKind;
|
|
47
|
+
metadata?: { [k: string]: string } | undefined;
|
|
48
|
+
periodCount?: number | undefined;
|
|
49
|
+
split?: BillingTermSplit | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* StartDate defaults like BillOn; EndDate defaults to the commitment end. Both are whole seconds.
|
|
52
|
+
*/
|
|
53
|
+
startDate?: Date | undefined;
|
|
54
|
+
value?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* fixed or remainder; percentage is reserved and rejected as not supported yet
|
|
57
|
+
*/
|
|
58
|
+
valueType: BillingTermValueType;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** @internal */
|
|
62
|
+
export type BillingTermInput$Outbound = {
|
|
63
|
+
bill_on?: string | undefined;
|
|
64
|
+
bill_trigger?: string | undefined;
|
|
65
|
+
end_date?: string | undefined;
|
|
66
|
+
invoice_cadence?: string | undefined;
|
|
67
|
+
invoice_label?: string | undefined;
|
|
68
|
+
kind: string;
|
|
69
|
+
metadata?: { [k: string]: string } | undefined;
|
|
70
|
+
period_count?: number | undefined;
|
|
71
|
+
split?: string | undefined;
|
|
72
|
+
start_date?: string | undefined;
|
|
73
|
+
value?: string | undefined;
|
|
74
|
+
value_type: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const BillingTermInput$outboundSchema: z.ZodMiniType<
|
|
79
|
+
BillingTermInput$Outbound,
|
|
80
|
+
BillingTermInput
|
|
81
|
+
> = z.pipe(
|
|
82
|
+
z.object({
|
|
83
|
+
billOn: z.optional(z.string()),
|
|
84
|
+
billTrigger: z.optional(InstalmentBillTrigger$outboundSchema),
|
|
85
|
+
endDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
|
|
86
|
+
invoiceCadence: z.optional(InvoiceCadence$outboundSchema),
|
|
87
|
+
invoiceLabel: z.optional(z.string()),
|
|
88
|
+
kind: BillingTermKind$outboundSchema,
|
|
89
|
+
metadata: z.optional(z.record(z.string(), z.string())),
|
|
90
|
+
periodCount: z.optional(z.int()),
|
|
91
|
+
split: z.optional(BillingTermSplit$outboundSchema),
|
|
92
|
+
startDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
|
|
93
|
+
value: z.optional(z.string()),
|
|
94
|
+
valueType: BillingTermValueType$outboundSchema,
|
|
95
|
+
}),
|
|
96
|
+
z.transform((v) => {
|
|
97
|
+
return remap$(v, {
|
|
98
|
+
billOn: "bill_on",
|
|
99
|
+
billTrigger: "bill_trigger",
|
|
100
|
+
endDate: "end_date",
|
|
101
|
+
invoiceCadence: "invoice_cadence",
|
|
102
|
+
invoiceLabel: "invoice_label",
|
|
103
|
+
periodCount: "period_count",
|
|
104
|
+
startDate: "start_date",
|
|
105
|
+
valueType: "value_type",
|
|
106
|
+
});
|
|
107
|
+
}),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
export function billingTermInputToJSON(
|
|
111
|
+
billingTermInput: BillingTermInput,
|
|
112
|
+
): string {
|
|
113
|
+
return JSON.stringify(
|
|
114
|
+
BillingTermInput$outboundSchema.parse(billingTermInput),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import * as openEnums from "../../types/enums.js";
|
|
7
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
8
|
+
|
|
9
|
+
export const BillingTermKind = {
|
|
10
|
+
Once: "once",
|
|
11
|
+
Recurring: "recurring",
|
|
12
|
+
} as const;
|
|
13
|
+
export type BillingTermKind = OpenEnum<typeof BillingTermKind>;
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const BillingTermKind$inboundSchema: z.ZodMiniType<
|
|
17
|
+
BillingTermKind,
|
|
18
|
+
unknown
|
|
19
|
+
> = openEnums.inboundSchema(BillingTermKind);
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const BillingTermKind$outboundSchema: z.ZodMiniType<
|
|
22
|
+
string,
|
|
23
|
+
BillingTermKind
|
|
24
|
+
> = openEnums.outboundSchema(BillingTermKind);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const BillingTermOwnerType = {
|
|
9
|
+
Commitment: "commitment",
|
|
10
|
+
} as const;
|
|
11
|
+
export type BillingTermOwnerType = ClosedEnum<typeof BillingTermOwnerType>;
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const BillingTermOwnerType$inboundSchema: z.ZodMiniEnum<
|
|
15
|
+
typeof BillingTermOwnerType
|
|
16
|
+
> = z.enum(BillingTermOwnerType);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import * as openEnums from "../../types/enums.js";
|
|
7
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
8
|
+
|
|
9
|
+
export const BillingTermSplit = {
|
|
10
|
+
Even: "even",
|
|
11
|
+
Proportional: "proportional",
|
|
12
|
+
} as const;
|
|
13
|
+
export type BillingTermSplit = OpenEnum<typeof BillingTermSplit>;
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const BillingTermSplit$inboundSchema: z.ZodMiniType<
|
|
17
|
+
BillingTermSplit,
|
|
18
|
+
unknown
|
|
19
|
+
> = openEnums.inboundSchema(BillingTermSplit);
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const BillingTermSplit$outboundSchema: z.ZodMiniType<
|
|
22
|
+
string,
|
|
23
|
+
BillingTermSplit
|
|
24
|
+
> = openEnums.outboundSchema(BillingTermSplit);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import * as openEnums from "../../types/enums.js";
|
|
7
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* fixed or remainder; percentage is reserved and rejected as not supported yet
|
|
11
|
+
*/
|
|
12
|
+
export const BillingTermValueType = {
|
|
13
|
+
Fixed: "fixed",
|
|
14
|
+
Percentage: "percentage",
|
|
15
|
+
Remainder: "remainder",
|
|
16
|
+
} as const;
|
|
17
|
+
/**
|
|
18
|
+
* fixed or remainder; percentage is reserved and rejected as not supported yet
|
|
19
|
+
*/
|
|
20
|
+
export type BillingTermValueType = OpenEnum<typeof BillingTermValueType>;
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const BillingTermValueType$inboundSchema: z.ZodMiniType<
|
|
24
|
+
BillingTermValueType,
|
|
25
|
+
unknown
|
|
26
|
+
> = openEnums.inboundSchema(BillingTermValueType);
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const BillingTermValueType$outboundSchema: z.ZodMiniType<
|
|
29
|
+
string,
|
|
30
|
+
BillingTermValueType
|
|
31
|
+
> = openEnums.outboundSchema(BillingTermValueType);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import {
|
|
11
|
+
BillingtermInstalment,
|
|
12
|
+
BillingtermInstalment$inboundSchema,
|
|
13
|
+
} from "./billingterm-instalment.js";
|
|
14
|
+
import {
|
|
15
|
+
BillingtermTerm,
|
|
16
|
+
BillingtermTerm$inboundSchema,
|
|
17
|
+
} from "./billingterm-term.js";
|
|
18
|
+
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
19
|
+
|
|
20
|
+
export type BillingTermsResponse = {
|
|
21
|
+
billingTerms?: Array<BillingtermTerm> | undefined;
|
|
22
|
+
instalments?: Array<BillingtermInstalment> | undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const BillingTermsResponse$inboundSchema: z.ZodMiniType<
|
|
27
|
+
BillingTermsResponse,
|
|
28
|
+
unknown
|
|
29
|
+
> = z.pipe(
|
|
30
|
+
z.object({
|
|
31
|
+
billing_terms: types.optional(z.array(BillingtermTerm$inboundSchema)),
|
|
32
|
+
instalments: types.optional(z.array(BillingtermInstalment$inboundSchema)),
|
|
33
|
+
}),
|
|
34
|
+
z.transform((v) => {
|
|
35
|
+
return remap$(v, {
|
|
36
|
+
"billing_terms": "billingTerms",
|
|
37
|
+
});
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export function billingTermsResponseFromJSON(
|
|
42
|
+
jsonString: string,
|
|
43
|
+
): SafeParseResult<BillingTermsResponse, SDKValidationError> {
|
|
44
|
+
return safeParse(
|
|
45
|
+
jsonString,
|
|
46
|
+
(x) => BillingTermsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
47
|
+
`Failed to parse 'BillingTermsResponse' from JSON`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import {
|
|
11
|
+
BillingTermOwnerType,
|
|
12
|
+
BillingTermOwnerType$inboundSchema,
|
|
13
|
+
} from "./billing-term-owner-type.js";
|
|
14
|
+
import {
|
|
15
|
+
InstalmentBillTrigger,
|
|
16
|
+
InstalmentBillTrigger$inboundSchema,
|
|
17
|
+
} from "./instalment-bill-trigger.js";
|
|
18
|
+
import {
|
|
19
|
+
InstalmentDelivery,
|
|
20
|
+
InstalmentDelivery$inboundSchema,
|
|
21
|
+
} from "./instalment-delivery.js";
|
|
22
|
+
import {
|
|
23
|
+
InstalmentKind,
|
|
24
|
+
InstalmentKind$inboundSchema,
|
|
25
|
+
} from "./instalment-kind.js";
|
|
26
|
+
import {
|
|
27
|
+
InstalmentStatus,
|
|
28
|
+
InstalmentStatus$inboundSchema,
|
|
29
|
+
} from "./instalment-status.js";
|
|
30
|
+
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
31
|
+
import { Status, Status$inboundSchema } from "./status.js";
|
|
32
|
+
|
|
33
|
+
export type BillingtermInstalment = {
|
|
34
|
+
amount?: string | undefined;
|
|
35
|
+
billOn?: string | undefined;
|
|
36
|
+
billTrigger?: InstalmentBillTrigger | undefined;
|
|
37
|
+
billingTermId?: string | undefined;
|
|
38
|
+
createdAt?: Date | undefined;
|
|
39
|
+
createdBy?: string | undefined;
|
|
40
|
+
currency?: string | undefined;
|
|
41
|
+
customerId?: string | undefined;
|
|
42
|
+
delivery?: InstalmentDelivery | undefined;
|
|
43
|
+
environmentId?: string | undefined;
|
|
44
|
+
id?: string | undefined;
|
|
45
|
+
instalmentStatus?: InstalmentStatus | undefined;
|
|
46
|
+
invoiceId?: string | undefined;
|
|
47
|
+
invoiceLabel?: string | undefined;
|
|
48
|
+
kind?: InstalmentKind | undefined;
|
|
49
|
+
metadata?: { [k: string]: string } | undefined;
|
|
50
|
+
ownerId?: string | undefined;
|
|
51
|
+
ownerType?: BillingTermOwnerType | undefined;
|
|
52
|
+
servicePeriodEnd?: Date | undefined;
|
|
53
|
+
servicePeriodStart?: Date | undefined;
|
|
54
|
+
status?: Status | undefined;
|
|
55
|
+
subscriptionId?: string | undefined;
|
|
56
|
+
tenantId?: string | undefined;
|
|
57
|
+
triggeredAt?: Date | undefined;
|
|
58
|
+
updatedAt?: Date | undefined;
|
|
59
|
+
updatedBy?: string | undefined;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
export const BillingtermInstalment$inboundSchema: z.ZodMiniType<
|
|
64
|
+
BillingtermInstalment,
|
|
65
|
+
unknown
|
|
66
|
+
> = z.pipe(
|
|
67
|
+
z.object({
|
|
68
|
+
amount: types.optional(types.string()),
|
|
69
|
+
bill_on: types.optional(types.string()),
|
|
70
|
+
bill_trigger: types.optional(InstalmentBillTrigger$inboundSchema),
|
|
71
|
+
billing_term_id: types.optional(types.string()),
|
|
72
|
+
created_at: types.optional(types.date()),
|
|
73
|
+
created_by: types.optional(types.string()),
|
|
74
|
+
currency: types.optional(types.string()),
|
|
75
|
+
customer_id: types.optional(types.string()),
|
|
76
|
+
delivery: types.optional(InstalmentDelivery$inboundSchema),
|
|
77
|
+
environment_id: types.optional(types.string()),
|
|
78
|
+
id: types.optional(types.string()),
|
|
79
|
+
instalment_status: types.optional(InstalmentStatus$inboundSchema),
|
|
80
|
+
invoice_id: types.optional(types.string()),
|
|
81
|
+
invoice_label: types.optional(types.string()),
|
|
82
|
+
kind: types.optional(InstalmentKind$inboundSchema),
|
|
83
|
+
metadata: types.optional(z.record(z.string(), types.string())),
|
|
84
|
+
owner_id: types.optional(types.string()),
|
|
85
|
+
owner_type: types.optional(BillingTermOwnerType$inboundSchema),
|
|
86
|
+
service_period_end: types.optional(types.date()),
|
|
87
|
+
service_period_start: types.optional(types.date()),
|
|
88
|
+
status: types.optional(Status$inboundSchema),
|
|
89
|
+
subscription_id: types.optional(types.string()),
|
|
90
|
+
tenant_id: types.optional(types.string()),
|
|
91
|
+
triggered_at: types.optional(types.date()),
|
|
92
|
+
updated_at: types.optional(types.date()),
|
|
93
|
+
updated_by: types.optional(types.string()),
|
|
94
|
+
}),
|
|
95
|
+
z.transform((v) => {
|
|
96
|
+
return remap$(v, {
|
|
97
|
+
"bill_on": "billOn",
|
|
98
|
+
"bill_trigger": "billTrigger",
|
|
99
|
+
"billing_term_id": "billingTermId",
|
|
100
|
+
"created_at": "createdAt",
|
|
101
|
+
"created_by": "createdBy",
|
|
102
|
+
"customer_id": "customerId",
|
|
103
|
+
"environment_id": "environmentId",
|
|
104
|
+
"instalment_status": "instalmentStatus",
|
|
105
|
+
"invoice_id": "invoiceId",
|
|
106
|
+
"invoice_label": "invoiceLabel",
|
|
107
|
+
"owner_id": "ownerId",
|
|
108
|
+
"owner_type": "ownerType",
|
|
109
|
+
"service_period_end": "servicePeriodEnd",
|
|
110
|
+
"service_period_start": "servicePeriodStart",
|
|
111
|
+
"subscription_id": "subscriptionId",
|
|
112
|
+
"tenant_id": "tenantId",
|
|
113
|
+
"triggered_at": "triggeredAt",
|
|
114
|
+
"updated_at": "updatedAt",
|
|
115
|
+
"updated_by": "updatedBy",
|
|
116
|
+
});
|
|
117
|
+
}),
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export function billingtermInstalmentFromJSON(
|
|
121
|
+
jsonString: string,
|
|
122
|
+
): SafeParseResult<BillingtermInstalment, SDKValidationError> {
|
|
123
|
+
return safeParse(
|
|
124
|
+
jsonString,
|
|
125
|
+
(x) => BillingtermInstalment$inboundSchema.parse(JSON.parse(x)),
|
|
126
|
+
`Failed to parse 'BillingtermInstalment' from JSON`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import {
|
|
11
|
+
BillingTermKind,
|
|
12
|
+
BillingTermKind$inboundSchema,
|
|
13
|
+
} from "./billing-term-kind.js";
|
|
14
|
+
import {
|
|
15
|
+
BillingTermOwnerType,
|
|
16
|
+
BillingTermOwnerType$inboundSchema,
|
|
17
|
+
} from "./billing-term-owner-type.js";
|
|
18
|
+
import {
|
|
19
|
+
BillingTermSplit,
|
|
20
|
+
BillingTermSplit$inboundSchema,
|
|
21
|
+
} from "./billing-term-split.js";
|
|
22
|
+
import {
|
|
23
|
+
BillingTermValueType,
|
|
24
|
+
BillingTermValueType$inboundSchema,
|
|
25
|
+
} from "./billing-term-value-type.js";
|
|
26
|
+
import {
|
|
27
|
+
InstalmentBillTrigger,
|
|
28
|
+
InstalmentBillTrigger$inboundSchema,
|
|
29
|
+
} from "./instalment-bill-trigger.js";
|
|
30
|
+
import {
|
|
31
|
+
InvoiceCadence,
|
|
32
|
+
InvoiceCadence$inboundSchema,
|
|
33
|
+
} from "./invoice-cadence.js";
|
|
34
|
+
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
35
|
+
import { Status, Status$inboundSchema } from "./status.js";
|
|
36
|
+
|
|
37
|
+
export type BillingtermTerm = {
|
|
38
|
+
billOn?: string | undefined;
|
|
39
|
+
billTrigger?: InstalmentBillTrigger | undefined;
|
|
40
|
+
createdAt?: Date | undefined;
|
|
41
|
+
createdBy?: string | undefined;
|
|
42
|
+
endDate?: Date | undefined;
|
|
43
|
+
environmentId?: string | undefined;
|
|
44
|
+
id?: string | undefined;
|
|
45
|
+
invoiceCadence?: InvoiceCadence | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* InvoiceLabel names its instalments on the invoice, after the owner's label. It may use {n} and {of}, which number
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* all of the owner's instalments together.
|
|
51
|
+
*/
|
|
52
|
+
invoiceLabel?: string | undefined;
|
|
53
|
+
kind?: BillingTermKind | undefined;
|
|
54
|
+
metadata?: { [k: string]: string } | undefined;
|
|
55
|
+
ownerId?: string | undefined;
|
|
56
|
+
ownerType?: BillingTermOwnerType | undefined;
|
|
57
|
+
periodCount?: number | undefined;
|
|
58
|
+
split?: BillingTermSplit | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Recurring terms.
|
|
61
|
+
*/
|
|
62
|
+
startDate?: Date | undefined;
|
|
63
|
+
status?: Status | undefined;
|
|
64
|
+
tenantId?: string | undefined;
|
|
65
|
+
updatedAt?: Date | undefined;
|
|
66
|
+
updatedBy?: string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Value is the amount of a fixed term, per instalment on a recurring one; it is nil for a remainder term.
|
|
69
|
+
*/
|
|
70
|
+
value?: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* fixed or remainder; percentage is reserved and rejected as not supported yet
|
|
73
|
+
*/
|
|
74
|
+
valueType?: BillingTermValueType | undefined;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const BillingtermTerm$inboundSchema: z.ZodMiniType<
|
|
79
|
+
BillingtermTerm,
|
|
80
|
+
unknown
|
|
81
|
+
> = z.pipe(
|
|
82
|
+
z.object({
|
|
83
|
+
bill_on: types.optional(types.string()),
|
|
84
|
+
bill_trigger: types.optional(InstalmentBillTrigger$inboundSchema),
|
|
85
|
+
created_at: types.optional(types.date()),
|
|
86
|
+
created_by: types.optional(types.string()),
|
|
87
|
+
end_date: types.optional(types.date()),
|
|
88
|
+
environment_id: types.optional(types.string()),
|
|
89
|
+
id: types.optional(types.string()),
|
|
90
|
+
invoice_cadence: types.optional(InvoiceCadence$inboundSchema),
|
|
91
|
+
invoice_label: types.optional(types.string()),
|
|
92
|
+
kind: types.optional(BillingTermKind$inboundSchema),
|
|
93
|
+
metadata: types.optional(z.record(z.string(), types.string())),
|
|
94
|
+
owner_id: types.optional(types.string()),
|
|
95
|
+
owner_type: types.optional(BillingTermOwnerType$inboundSchema),
|
|
96
|
+
period_count: types.optional(types.number()),
|
|
97
|
+
split: types.optional(BillingTermSplit$inboundSchema),
|
|
98
|
+
start_date: types.optional(types.date()),
|
|
99
|
+
status: types.optional(Status$inboundSchema),
|
|
100
|
+
tenant_id: types.optional(types.string()),
|
|
101
|
+
updated_at: types.optional(types.date()),
|
|
102
|
+
updated_by: types.optional(types.string()),
|
|
103
|
+
value: types.optional(types.string()),
|
|
104
|
+
value_type: types.optional(BillingTermValueType$inboundSchema),
|
|
105
|
+
}),
|
|
106
|
+
z.transform((v) => {
|
|
107
|
+
return remap$(v, {
|
|
108
|
+
"bill_on": "billOn",
|
|
109
|
+
"bill_trigger": "billTrigger",
|
|
110
|
+
"created_at": "createdAt",
|
|
111
|
+
"created_by": "createdBy",
|
|
112
|
+
"end_date": "endDate",
|
|
113
|
+
"environment_id": "environmentId",
|
|
114
|
+
"invoice_cadence": "invoiceCadence",
|
|
115
|
+
"invoice_label": "invoiceLabel",
|
|
116
|
+
"owner_id": "ownerId",
|
|
117
|
+
"owner_type": "ownerType",
|
|
118
|
+
"period_count": "periodCount",
|
|
119
|
+
"start_date": "startDate",
|
|
120
|
+
"tenant_id": "tenantId",
|
|
121
|
+
"updated_at": "updatedAt",
|
|
122
|
+
"updated_by": "updatedBy",
|
|
123
|
+
"value_type": "valueType",
|
|
124
|
+
});
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
export function billingtermTermFromJSON(
|
|
129
|
+
jsonString: string,
|
|
130
|
+
): SafeParseResult<BillingtermTerm, SDKValidationError> {
|
|
131
|
+
return safeParse(
|
|
132
|
+
jsonString,
|
|
133
|
+
(x) => BillingtermTerm$inboundSchema.parse(JSON.parse(x)),
|
|
134
|
+
`Failed to parse 'BillingtermTerm' from JSON`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import {
|
|
7
|
+
CancellationFeeType,
|
|
8
|
+
CancellationFeeType$outboundSchema,
|
|
9
|
+
} from "./cancellation-fee-type.js";
|
|
10
|
+
|
|
11
|
+
export type CancellationFeeInput = {
|
|
12
|
+
/**
|
|
13
|
+
* fixed; percentage is reserved and rejected as not supported yet
|
|
14
|
+
*/
|
|
15
|
+
type: CancellationFeeType;
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export type CancellationFeeInput$Outbound = {
|
|
21
|
+
type: string;
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const CancellationFeeInput$outboundSchema: z.ZodMiniType<
|
|
27
|
+
CancellationFeeInput$Outbound,
|
|
28
|
+
CancellationFeeInput
|
|
29
|
+
> = z.object({
|
|
30
|
+
type: CancellationFeeType$outboundSchema,
|
|
31
|
+
value: z.string(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export function cancellationFeeInputToJSON(
|
|
35
|
+
cancellationFeeInput: CancellationFeeInput,
|
|
36
|
+
): string {
|
|
37
|
+
return JSON.stringify(
|
|
38
|
+
CancellationFeeInput$outboundSchema.parse(cancellationFeeInput),
|
|
39
|
+
);
|
|
40
|
+
}
|