@tirdad/sdk 2.1.47 → 2.1.48
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/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 +2 -2
- package/esm/lib/config.js +2 -2
- 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 +67 -0
- package/esm/sdk/models/billing-term-input.d.ts.map +1 -0
- package/esm/sdk/models/billing-term-input.js +43 -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 +57 -0
- package/esm/sdk/models/billingterm-term.d.ts.map +1 -0
- package/esm/sdk/models/billingterm-term.js +65 -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/get-subscription-v2-op.d.ts +1 -1
- 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 +2 -0
- package/esm/sdk/models/invoice-billing-reason.d.ts.map +1 -1
- package/esm/sdk/models/invoice-billing-reason.js +2 -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/subscription-response-v2.d.ts +5 -0
- package/esm/sdk/models/subscription-response-v2.d.ts.map +1 -1
- package/esm/sdk/models/subscription-response-v2.js +2 -0
- package/esm/sdk/models/subscription-response-v2.js.map +1 -1
- package/esm/sdk/models/subscription-response.d.ts +5 -0
- package/esm/sdk/models/subscription-response.d.ts.map +1 -1
- package/esm/sdk/models/subscription-response.js +2 -0
- package/esm/sdk/models/subscription-response.js.map +1 -1
- 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/update-commitment-request.d.ts +5 -0
- package/esm/sdk/models/update-commitment-request.d.ts.map +1 -1
- package/esm/sdk/models/update-commitment-request.js +2 -0
- package/esm/sdk/models/update-commitment-request.js.map +1 -1
- 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 +1 -1
- 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 +2 -2
- package/src/sdk/commitments.ts +101 -1
- package/src/sdk/models/billing-term-input.ts +127 -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 +143 -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/get-subscription-v2-op.ts +1 -1
- 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 +2 -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/subscription-response-v2.ts +9 -0
- package/src/sdk/models/subscription-response.ts +9 -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/update-commitment-request.ts +7 -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 its instalment_invoicing, the term's or else the commitment's, 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 those already due by effective_at are billed together as one settlement; later instalments are not billed and nothing is refunded. 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,127 @@
|
|
|
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
|
+
InstalmentDelivery,
|
|
25
|
+
InstalmentDelivery$outboundSchema,
|
|
26
|
+
} from "./instalment-delivery.js";
|
|
27
|
+
import {
|
|
28
|
+
InvoiceCadence,
|
|
29
|
+
InvoiceCadence$outboundSchema,
|
|
30
|
+
} from "./invoice-cadence.js";
|
|
31
|
+
|
|
32
|
+
export type BillingTermInput = {
|
|
33
|
+
/**
|
|
34
|
+
* BillOn defaults to the commitment start, or on an edit to the start of the billing period holding now (the
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* commitment start once its term has ended). A manual term omits it and waits at the commitment end.
|
|
38
|
+
*/
|
|
39
|
+
billOn?: string | undefined;
|
|
40
|
+
billTrigger?: InstalmentBillTrigger | undefined;
|
|
41
|
+
endDate?: Date | undefined;
|
|
42
|
+
instalmentInvoicing?: InstalmentDelivery | undefined;
|
|
43
|
+
invoiceCadence?: InvoiceCadence | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* InvoiceLabel names the term's instalments, "Instalment {n} of {of}" by default. {n} and {of} count only the
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* commitment's instalments whose labels use them.
|
|
49
|
+
*/
|
|
50
|
+
invoiceLabel?: string | undefined;
|
|
51
|
+
kind: BillingTermKind;
|
|
52
|
+
metadata?: { [k: string]: string } | undefined;
|
|
53
|
+
periodCount?: number | undefined;
|
|
54
|
+
split?: BillingTermSplit | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* StartDate and EndDate are edges of the periods the term steps on: billing periods, or anniversary ones when it is
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* invoiced separately; by default, the period holding the commitment start (now, on an edit) to the commitment end.
|
|
60
|
+
*/
|
|
61
|
+
startDate?: Date | undefined;
|
|
62
|
+
value?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* fixed or remainder; percentage is reserved and rejected as not supported yet
|
|
65
|
+
*/
|
|
66
|
+
valueType: BillingTermValueType;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** @internal */
|
|
70
|
+
export type BillingTermInput$Outbound = {
|
|
71
|
+
bill_on?: string | undefined;
|
|
72
|
+
bill_trigger?: string | undefined;
|
|
73
|
+
end_date?: string | undefined;
|
|
74
|
+
instalment_invoicing?: string | undefined;
|
|
75
|
+
invoice_cadence?: string | undefined;
|
|
76
|
+
invoice_label?: string | undefined;
|
|
77
|
+
kind: string;
|
|
78
|
+
metadata?: { [k: string]: string } | undefined;
|
|
79
|
+
period_count?: number | undefined;
|
|
80
|
+
split?: string | undefined;
|
|
81
|
+
start_date?: string | undefined;
|
|
82
|
+
value?: string | undefined;
|
|
83
|
+
value_type: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const BillingTermInput$outboundSchema: z.ZodMiniType<
|
|
88
|
+
BillingTermInput$Outbound,
|
|
89
|
+
BillingTermInput
|
|
90
|
+
> = z.pipe(
|
|
91
|
+
z.object({
|
|
92
|
+
billOn: z.optional(z.string()),
|
|
93
|
+
billTrigger: z.optional(InstalmentBillTrigger$outboundSchema),
|
|
94
|
+
endDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
|
|
95
|
+
instalmentInvoicing: z.optional(InstalmentDelivery$outboundSchema),
|
|
96
|
+
invoiceCadence: z.optional(InvoiceCadence$outboundSchema),
|
|
97
|
+
invoiceLabel: z.optional(z.string()),
|
|
98
|
+
kind: BillingTermKind$outboundSchema,
|
|
99
|
+
metadata: z.optional(z.record(z.string(), z.string())),
|
|
100
|
+
periodCount: z.optional(z.int()),
|
|
101
|
+
split: z.optional(BillingTermSplit$outboundSchema),
|
|
102
|
+
startDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
|
|
103
|
+
value: z.optional(z.string()),
|
|
104
|
+
valueType: BillingTermValueType$outboundSchema,
|
|
105
|
+
}),
|
|
106
|
+
z.transform((v) => {
|
|
107
|
+
return remap$(v, {
|
|
108
|
+
billOn: "bill_on",
|
|
109
|
+
billTrigger: "bill_trigger",
|
|
110
|
+
endDate: "end_date",
|
|
111
|
+
instalmentInvoicing: "instalment_invoicing",
|
|
112
|
+
invoiceCadence: "invoice_cadence",
|
|
113
|
+
invoiceLabel: "invoice_label",
|
|
114
|
+
periodCount: "period_count",
|
|
115
|
+
startDate: "start_date",
|
|
116
|
+
valueType: "value_type",
|
|
117
|
+
});
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
export function billingTermInputToJSON(
|
|
122
|
+
billingTermInput: BillingTermInput,
|
|
123
|
+
): string {
|
|
124
|
+
return JSON.stringify(
|
|
125
|
+
BillingTermInput$outboundSchema.parse(billingTermInput),
|
|
126
|
+
);
|
|
127
|
+
}
|
|
@@ -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,143 @@
|
|
|
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
|
+
InstalmentDelivery,
|
|
32
|
+
InstalmentDelivery$inboundSchema,
|
|
33
|
+
} from "./instalment-delivery.js";
|
|
34
|
+
import {
|
|
35
|
+
InvoiceCadence,
|
|
36
|
+
InvoiceCadence$inboundSchema,
|
|
37
|
+
} from "./invoice-cadence.js";
|
|
38
|
+
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
39
|
+
import { Status, Status$inboundSchema } from "./status.js";
|
|
40
|
+
|
|
41
|
+
export type BillingtermTerm = {
|
|
42
|
+
billOn?: string | undefined;
|
|
43
|
+
billTrigger?: InstalmentBillTrigger | undefined;
|
|
44
|
+
createdAt?: Date | undefined;
|
|
45
|
+
createdBy?: string | undefined;
|
|
46
|
+
endDate?: Date | undefined;
|
|
47
|
+
environmentId?: string | undefined;
|
|
48
|
+
id?: string | undefined;
|
|
49
|
+
instalmentInvoicing?: InstalmentDelivery | undefined;
|
|
50
|
+
invoiceCadence?: InvoiceCadence | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* InvoiceLabel names its instalments on the invoice, after the owner's label. It may use {n} and {of}, which number
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* the owner's instalments whose labels use them.
|
|
56
|
+
*/
|
|
57
|
+
invoiceLabel?: string | undefined;
|
|
58
|
+
kind?: BillingTermKind | undefined;
|
|
59
|
+
metadata?: { [k: string]: string } | undefined;
|
|
60
|
+
ownerId?: string | undefined;
|
|
61
|
+
ownerType?: BillingTermOwnerType | undefined;
|
|
62
|
+
periodCount?: number | undefined;
|
|
63
|
+
split?: BillingTermSplit | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Recurring terms.
|
|
66
|
+
*/
|
|
67
|
+
startDate?: Date | undefined;
|
|
68
|
+
status?: Status | undefined;
|
|
69
|
+
tenantId?: string | undefined;
|
|
70
|
+
updatedAt?: Date | undefined;
|
|
71
|
+
updatedBy?: string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Value is the amount of a fixed term, per instalment on a recurring one; it is nil for a remainder term.
|
|
74
|
+
*/
|
|
75
|
+
value?: string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* fixed or remainder; percentage is reserved and rejected as not supported yet
|
|
78
|
+
*/
|
|
79
|
+
valueType?: BillingTermValueType | undefined;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** @internal */
|
|
83
|
+
export const BillingtermTerm$inboundSchema: z.ZodMiniType<
|
|
84
|
+
BillingtermTerm,
|
|
85
|
+
unknown
|
|
86
|
+
> = z.pipe(
|
|
87
|
+
z.object({
|
|
88
|
+
bill_on: types.optional(types.string()),
|
|
89
|
+
bill_trigger: types.optional(InstalmentBillTrigger$inboundSchema),
|
|
90
|
+
created_at: types.optional(types.date()),
|
|
91
|
+
created_by: types.optional(types.string()),
|
|
92
|
+
end_date: types.optional(types.date()),
|
|
93
|
+
environment_id: types.optional(types.string()),
|
|
94
|
+
id: types.optional(types.string()),
|
|
95
|
+
instalment_invoicing: types.optional(InstalmentDelivery$inboundSchema),
|
|
96
|
+
invoice_cadence: types.optional(InvoiceCadence$inboundSchema),
|
|
97
|
+
invoice_label: types.optional(types.string()),
|
|
98
|
+
kind: types.optional(BillingTermKind$inboundSchema),
|
|
99
|
+
metadata: types.optional(z.record(z.string(), types.string())),
|
|
100
|
+
owner_id: types.optional(types.string()),
|
|
101
|
+
owner_type: types.optional(BillingTermOwnerType$inboundSchema),
|
|
102
|
+
period_count: types.optional(types.number()),
|
|
103
|
+
split: types.optional(BillingTermSplit$inboundSchema),
|
|
104
|
+
start_date: types.optional(types.date()),
|
|
105
|
+
status: types.optional(Status$inboundSchema),
|
|
106
|
+
tenant_id: types.optional(types.string()),
|
|
107
|
+
updated_at: types.optional(types.date()),
|
|
108
|
+
updated_by: types.optional(types.string()),
|
|
109
|
+
value: types.optional(types.string()),
|
|
110
|
+
value_type: types.optional(BillingTermValueType$inboundSchema),
|
|
111
|
+
}),
|
|
112
|
+
z.transform((v) => {
|
|
113
|
+
return remap$(v, {
|
|
114
|
+
"bill_on": "billOn",
|
|
115
|
+
"bill_trigger": "billTrigger",
|
|
116
|
+
"created_at": "createdAt",
|
|
117
|
+
"created_by": "createdBy",
|
|
118
|
+
"end_date": "endDate",
|
|
119
|
+
"environment_id": "environmentId",
|
|
120
|
+
"instalment_invoicing": "instalmentInvoicing",
|
|
121
|
+
"invoice_cadence": "invoiceCadence",
|
|
122
|
+
"invoice_label": "invoiceLabel",
|
|
123
|
+
"owner_id": "ownerId",
|
|
124
|
+
"owner_type": "ownerType",
|
|
125
|
+
"period_count": "periodCount",
|
|
126
|
+
"start_date": "startDate",
|
|
127
|
+
"tenant_id": "tenantId",
|
|
128
|
+
"updated_at": "updatedAt",
|
|
129
|
+
"updated_by": "updatedBy",
|
|
130
|
+
"value_type": "valueType",
|
|
131
|
+
});
|
|
132
|
+
}),
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
export function billingtermTermFromJSON(
|
|
136
|
+
jsonString: string,
|
|
137
|
+
): SafeParseResult<BillingtermTerm, SDKValidationError> {
|
|
138
|
+
return safeParse(
|
|
139
|
+
jsonString,
|
|
140
|
+
(x) => BillingtermTerm$inboundSchema.parse(JSON.parse(x)),
|
|
141
|
+
`Failed to parse 'BillingtermTerm' from JSON`,
|
|
142
|
+
);
|
|
143
|
+
}
|