@moovio/sdk 0.0.0-dev.22 → 0.0.0-dev.24
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/README.md +26 -0
- package/bin/mcp-server.js +108 -29
- package/bin/mcp-server.js.map +19 -15
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.js +1 -1
- package/models/components/amountdetails.d.ts +26 -0
- package/models/components/amountdetails.d.ts.map +1 -0
- package/models/components/amountdetails.js +62 -0
- package/models/components/amountdetails.js.map +1 -0
- package/models/components/amountdetailsupdate.d.ts +26 -0
- package/models/components/amountdetailsupdate.d.ts.map +1 -0
- package/models/components/amountdetailsupdate.js +62 -0
- package/models/components/amountdetailsupdate.js.map +1 -0
- package/models/components/amountdetailsvalidationerror.d.ts +19 -0
- package/models/components/amountdetailsvalidationerror.d.ts.map +1 -0
- package/models/components/amountdetailsvalidationerror.js +61 -0
- package/models/components/amountdetailsvalidationerror.js.map +1 -0
- package/models/components/createinvoice.d.ts +3 -3
- package/models/components/createinvoice.d.ts.map +1 -1
- package/models/components/createinvoice.js +3 -3
- package/models/components/createinvoice.js.map +1 -1
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/invoice.d.ts +4 -3
- package/models/components/invoice.d.ts.map +1 -1
- package/models/components/invoice.js +3 -2
- package/models/components/invoice.js.map +1 -1
- package/models/components/transferconfig.d.ts +3 -0
- package/models/components/transferconfig.d.ts.map +1 -1
- package/models/components/transferconfig.js +3 -0
- package/models/components/transferconfig.js.map +1 -1
- package/models/components/transfercontrols.d.ts +43 -0
- package/models/components/transfercontrols.d.ts.map +1 -0
- package/models/components/transfercontrols.js +67 -0
- package/models/components/transfercontrols.js.map +1 -0
- package/models/components/updateinvoice.d.ts +9 -9
- package/models/components/updateinvoice.d.ts.map +1 -1
- package/models/components/updateinvoice.js +3 -3
- package/models/components/updateinvoice.js.map +1 -1
- package/models/errors/createinvoiceerror.d.ts +3 -3
- package/models/errors/createinvoiceerror.d.ts.map +1 -1
- package/models/errors/createinvoiceerror.js +4 -4
- package/models/errors/createinvoiceerror.js.map +1 -1
- package/models/errors/updateinvoiceerror.d.ts +3 -3
- package/models/errors/updateinvoiceerror.d.ts.map +1 -1
- package/models/errors/updateinvoiceerror.js +4 -4
- package/models/errors/updateinvoiceerror.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/amountdetails.ts +64 -0
- package/src/models/components/amountdetailsupdate.ts +68 -0
- package/src/models/components/amountdetailsvalidationerror.ts +58 -0
- package/src/models/components/createinvoice.ts +9 -9
- package/src/models/components/index.ts +4 -0
- package/src/models/components/invoice.ts +11 -5
- package/src/models/components/transferconfig.ts +10 -0
- package/src/models/components/transfercontrols.ts +86 -0
- package/src/models/components/updateinvoice.ts +15 -15
- package/src/models/errors/createinvoiceerror.ts +7 -7
- package/src/models/errors/updateinvoiceerror.ts +7 -7
- package/src/types/async.ts +8 -7
- package/src/types/primitives.ts +0 -24
- package/types/async.d.ts.map +1 -1
- package/types/async.js +8 -7
- package/types/async.js.map +1 -1
- package/types/primitives.d.ts +0 -2
- package/types/primitives.d.ts.map +1 -1
- package/types/primitives.js +0 -23
- package/types/primitives.js.map +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as types from "../../types/primitives.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
AmountDecimalUpdate,
|
|
12
|
+
AmountDecimalUpdate$inboundSchema,
|
|
13
|
+
AmountDecimalUpdate$Outbound,
|
|
14
|
+
AmountDecimalUpdate$outboundSchema,
|
|
15
|
+
} from "./amountdecimalupdate.js";
|
|
16
|
+
|
|
17
|
+
export type AmountDetailsUpdate = {
|
|
18
|
+
/**
|
|
19
|
+
* The amount of tax applied to the invoice.
|
|
20
|
+
*/
|
|
21
|
+
tax?: AmountDecimalUpdate | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The amount of surcharge applied to the invoice.
|
|
24
|
+
*/
|
|
25
|
+
surcharge?: AmountDecimalUpdate | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const AmountDetailsUpdate$inboundSchema: z.ZodType<
|
|
30
|
+
AmountDetailsUpdate,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
unknown
|
|
33
|
+
> = z.object({
|
|
34
|
+
tax: types.optional(AmountDecimalUpdate$inboundSchema),
|
|
35
|
+
surcharge: types.optional(AmountDecimalUpdate$inboundSchema),
|
|
36
|
+
});
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type AmountDetailsUpdate$Outbound = {
|
|
39
|
+
tax?: AmountDecimalUpdate$Outbound | undefined;
|
|
40
|
+
surcharge?: AmountDecimalUpdate$Outbound | undefined;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const AmountDetailsUpdate$outboundSchema: z.ZodType<
|
|
45
|
+
AmountDetailsUpdate$Outbound,
|
|
46
|
+
z.ZodTypeDef,
|
|
47
|
+
AmountDetailsUpdate
|
|
48
|
+
> = z.object({
|
|
49
|
+
tax: AmountDecimalUpdate$outboundSchema.optional(),
|
|
50
|
+
surcharge: AmountDecimalUpdate$outboundSchema.optional(),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export function amountDetailsUpdateToJSON(
|
|
54
|
+
amountDetailsUpdate: AmountDetailsUpdate,
|
|
55
|
+
): string {
|
|
56
|
+
return JSON.stringify(
|
|
57
|
+
AmountDetailsUpdate$outboundSchema.parse(amountDetailsUpdate),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export function amountDetailsUpdateFromJSON(
|
|
61
|
+
jsonString: string,
|
|
62
|
+
): SafeParseResult<AmountDetailsUpdate, SDKValidationError> {
|
|
63
|
+
return safeParse(
|
|
64
|
+
jsonString,
|
|
65
|
+
(x) => AmountDetailsUpdate$inboundSchema.parse(JSON.parse(x)),
|
|
66
|
+
`Failed to parse 'AmountDetailsUpdate' from JSON`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as types from "../../types/primitives.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type AmountDetailsValidationError = {
|
|
12
|
+
tax?: string | undefined;
|
|
13
|
+
surcharge?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const AmountDetailsValidationError$inboundSchema: z.ZodType<
|
|
18
|
+
AmountDetailsValidationError,
|
|
19
|
+
z.ZodTypeDef,
|
|
20
|
+
unknown
|
|
21
|
+
> = z.object({
|
|
22
|
+
tax: types.optional(types.string()),
|
|
23
|
+
surcharge: types.optional(types.string()),
|
|
24
|
+
});
|
|
25
|
+
/** @internal */
|
|
26
|
+
export type AmountDetailsValidationError$Outbound = {
|
|
27
|
+
tax?: string | undefined;
|
|
28
|
+
surcharge?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const AmountDetailsValidationError$outboundSchema: z.ZodType<
|
|
33
|
+
AmountDetailsValidationError$Outbound,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
AmountDetailsValidationError
|
|
36
|
+
> = z.object({
|
|
37
|
+
tax: z.string().optional(),
|
|
38
|
+
surcharge: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function amountDetailsValidationErrorToJSON(
|
|
42
|
+
amountDetailsValidationError: AmountDetailsValidationError,
|
|
43
|
+
): string {
|
|
44
|
+
return JSON.stringify(
|
|
45
|
+
AmountDetailsValidationError$outboundSchema.parse(
|
|
46
|
+
amountDetailsValidationError,
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
export function amountDetailsValidationErrorFromJSON(
|
|
51
|
+
jsonString: string,
|
|
52
|
+
): SafeParseResult<AmountDetailsValidationError, SDKValidationError> {
|
|
53
|
+
return safeParse(
|
|
54
|
+
jsonString,
|
|
55
|
+
(x) => AmountDetailsValidationError$inboundSchema.parse(JSON.parse(x)),
|
|
56
|
+
`Failed to parse 'AmountDetailsValidationError' from JSON`,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -8,11 +8,11 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
8
8
|
import * as types from "../../types/primitives.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./
|
|
11
|
+
AmountDetails,
|
|
12
|
+
AmountDetails$inboundSchema,
|
|
13
|
+
AmountDetails$Outbound,
|
|
14
|
+
AmountDetails$outboundSchema,
|
|
15
|
+
} from "./amountdetails.js";
|
|
16
16
|
import {
|
|
17
17
|
CreateInvoiceLineItems,
|
|
18
18
|
CreateInvoiceLineItems$inboundSchema,
|
|
@@ -32,7 +32,7 @@ export type CreateInvoice = {
|
|
|
32
32
|
lineItems: CreateInvoiceLineItems;
|
|
33
33
|
invoiceDate?: Date | undefined;
|
|
34
34
|
dueDate?: Date | undefined;
|
|
35
|
-
|
|
35
|
+
amountDetails?: AmountDetails | undefined;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
/** @internal */
|
|
@@ -46,7 +46,7 @@ export const CreateInvoice$inboundSchema: z.ZodType<
|
|
|
46
46
|
lineItems: CreateInvoiceLineItems$inboundSchema,
|
|
47
47
|
invoiceDate: types.optional(types.date()),
|
|
48
48
|
dueDate: types.optional(types.date()),
|
|
49
|
-
|
|
49
|
+
amountDetails: types.optional(AmountDetails$inboundSchema),
|
|
50
50
|
});
|
|
51
51
|
/** @internal */
|
|
52
52
|
export type CreateInvoice$Outbound = {
|
|
@@ -55,7 +55,7 @@ export type CreateInvoice$Outbound = {
|
|
|
55
55
|
lineItems: CreateInvoiceLineItems$Outbound;
|
|
56
56
|
invoiceDate?: string | undefined;
|
|
57
57
|
dueDate?: string | undefined;
|
|
58
|
-
|
|
58
|
+
amountDetails?: AmountDetails$Outbound | undefined;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
/** @internal */
|
|
@@ -69,7 +69,7 @@ export const CreateInvoice$outboundSchema: z.ZodType<
|
|
|
69
69
|
lineItems: CreateInvoiceLineItems$outboundSchema,
|
|
70
70
|
invoiceDate: z.date().transform(v => v.toISOString()).optional(),
|
|
71
71
|
dueDate: z.date().transform(v => v.toISOString()).optional(),
|
|
72
|
-
|
|
72
|
+
amountDetails: AmountDetails$outboundSchema.optional(),
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
export function createInvoiceToJSON(createInvoice: CreateInvoice): string {
|
|
@@ -41,6 +41,9 @@ export * from "./amountdecimalrange.js";
|
|
|
41
41
|
export * from "./amountdecimalrangeupdate.js";
|
|
42
42
|
export * from "./amountdecimalupdate.js";
|
|
43
43
|
export * from "./amountdecimalvalidationerror.js";
|
|
44
|
+
export * from "./amountdetails.js";
|
|
45
|
+
export * from "./amountdetailsupdate.js";
|
|
46
|
+
export * from "./amountdetailsvalidationerror.js";
|
|
44
47
|
export * from "./amountupdate.js";
|
|
45
48
|
export * from "./amountvalidationerror.js";
|
|
46
49
|
export * from "./applebillingcontact.js";
|
|
@@ -526,6 +529,7 @@ export * from "./transferachaddendarecord.js";
|
|
|
526
529
|
export * from "./transferamountdetails.js";
|
|
527
530
|
export * from "./transfercapture.js";
|
|
528
531
|
export * from "./transferconfig.js";
|
|
532
|
+
export * from "./transfercontrols.js";
|
|
529
533
|
export * from "./transferdestination.js";
|
|
530
534
|
export * from "./transferentrymode.js";
|
|
531
535
|
export * from "./transferfailurereason.js";
|
|
@@ -13,6 +13,12 @@ import {
|
|
|
13
13
|
AmountDecimal$Outbound,
|
|
14
14
|
AmountDecimal$outboundSchema,
|
|
15
15
|
} from "./amountdecimal.js";
|
|
16
|
+
import {
|
|
17
|
+
AmountDetails,
|
|
18
|
+
AmountDetails$inboundSchema,
|
|
19
|
+
AmountDetails$Outbound,
|
|
20
|
+
AmountDetails$outboundSchema,
|
|
21
|
+
} from "./amountdetails.js";
|
|
16
22
|
import {
|
|
17
23
|
InvoiceLineItems,
|
|
18
24
|
InvoiceLineItems$inboundSchema,
|
|
@@ -60,9 +66,9 @@ export type Invoice = {
|
|
|
60
66
|
*/
|
|
61
67
|
lineItems: InvoiceLineItems;
|
|
62
68
|
subtotalAmount: AmountDecimal;
|
|
63
|
-
|
|
69
|
+
amountDetails?: AmountDetails | undefined;
|
|
64
70
|
/**
|
|
65
|
-
* Total amount of the invoice,
|
|
71
|
+
* Total amount of the invoice, including subtotal, tax, and surcharge amounts.
|
|
66
72
|
*/
|
|
67
73
|
totalAmount: AmountDecimal;
|
|
68
74
|
/**
|
|
@@ -108,7 +114,7 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
|
|
|
108
114
|
status: InvoiceStatus$inboundSchema,
|
|
109
115
|
lineItems: InvoiceLineItems$inboundSchema,
|
|
110
116
|
subtotalAmount: AmountDecimal$inboundSchema,
|
|
111
|
-
|
|
117
|
+
amountDetails: types.optional(AmountDetails$inboundSchema),
|
|
112
118
|
totalAmount: AmountDecimal$inboundSchema,
|
|
113
119
|
pendingAmount: AmountDecimal$inboundSchema,
|
|
114
120
|
paidAmount: AmountDecimal$inboundSchema,
|
|
@@ -136,7 +142,7 @@ export type Invoice$Outbound = {
|
|
|
136
142
|
status: string;
|
|
137
143
|
lineItems: InvoiceLineItems$Outbound;
|
|
138
144
|
subtotalAmount: AmountDecimal$Outbound;
|
|
139
|
-
|
|
145
|
+
amountDetails?: AmountDetails$Outbound | undefined;
|
|
140
146
|
totalAmount: AmountDecimal$Outbound;
|
|
141
147
|
pendingAmount: AmountDecimal$Outbound;
|
|
142
148
|
paidAmount: AmountDecimal$Outbound;
|
|
@@ -169,7 +175,7 @@ export const Invoice$outboundSchema: z.ZodType<
|
|
|
169
175
|
status: InvoiceStatus$outboundSchema,
|
|
170
176
|
lineItems: InvoiceLineItems$outboundSchema,
|
|
171
177
|
subtotalAmount: AmountDecimal$outboundSchema,
|
|
172
|
-
|
|
178
|
+
amountDetails: AmountDetails$outboundSchema.optional(),
|
|
173
179
|
totalAmount: AmountDecimal$outboundSchema,
|
|
174
180
|
pendingAmount: AmountDecimal$outboundSchema,
|
|
175
181
|
paidAmount: AmountDecimal$outboundSchema,
|
|
@@ -13,6 +13,12 @@ import {
|
|
|
13
13
|
TipPresets$Outbound,
|
|
14
14
|
TipPresets$outboundSchema,
|
|
15
15
|
} from "./tippresets.js";
|
|
16
|
+
import {
|
|
17
|
+
TransferControls,
|
|
18
|
+
TransferControls$inboundSchema,
|
|
19
|
+
TransferControls$Outbound,
|
|
20
|
+
TransferControls$outboundSchema,
|
|
21
|
+
} from "./transfercontrols.js";
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
24
|
* Configurable options for a transfer.
|
|
@@ -22,6 +28,7 @@ export type TransferConfig = {
|
|
|
22
28
|
* Tip presets when calculating tips for a transfer.
|
|
23
29
|
*/
|
|
24
30
|
tipPresets?: TipPresets | undefined;
|
|
31
|
+
transferControls?: Array<TransferControls> | undefined;
|
|
25
32
|
};
|
|
26
33
|
|
|
27
34
|
/** @internal */
|
|
@@ -31,10 +38,12 @@ export const TransferConfig$inboundSchema: z.ZodType<
|
|
|
31
38
|
unknown
|
|
32
39
|
> = z.object({
|
|
33
40
|
tipPresets: types.optional(TipPresets$inboundSchema),
|
|
41
|
+
transferControls: types.optional(z.array(TransferControls$inboundSchema)),
|
|
34
42
|
});
|
|
35
43
|
/** @internal */
|
|
36
44
|
export type TransferConfig$Outbound = {
|
|
37
45
|
tipPresets?: TipPresets$Outbound | undefined;
|
|
46
|
+
transferControls?: Array<TransferControls$Outbound> | undefined;
|
|
38
47
|
};
|
|
39
48
|
|
|
40
49
|
/** @internal */
|
|
@@ -44,6 +53,7 @@ export const TransferConfig$outboundSchema: z.ZodType<
|
|
|
44
53
|
TransferConfig
|
|
45
54
|
> = z.object({
|
|
46
55
|
tipPresets: TipPresets$outboundSchema.optional(),
|
|
56
|
+
transferControls: z.array(TransferControls$outboundSchema).optional(),
|
|
47
57
|
});
|
|
48
58
|
|
|
49
59
|
export function transferConfigToJSON(transferConfig: TransferConfig): string {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as types from "../../types/primitives.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Controls for transfers created through a given partner
|
|
13
|
+
*/
|
|
14
|
+
export type TransferControls = {
|
|
15
|
+
/**
|
|
16
|
+
* ID of the merchant account.
|
|
17
|
+
*/
|
|
18
|
+
accountID: string;
|
|
19
|
+
/**
|
|
20
|
+
* ID of the partner account.
|
|
21
|
+
*/
|
|
22
|
+
partnerAccountID: string;
|
|
23
|
+
/**
|
|
24
|
+
* Indicates if the account is configured for debt repayment.
|
|
25
|
+
*/
|
|
26
|
+
debtRepayment: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Indicates if the account is allowed to set dynamic descriptors on transfers.
|
|
29
|
+
*/
|
|
30
|
+
allowDynamicDescriptor: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Indicates if the account is allowed to apply surcharges to transfers.
|
|
33
|
+
*/
|
|
34
|
+
allowSurcharge: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const TransferControls$inboundSchema: z.ZodType<
|
|
39
|
+
TransferControls,
|
|
40
|
+
z.ZodTypeDef,
|
|
41
|
+
unknown
|
|
42
|
+
> = z.object({
|
|
43
|
+
accountID: types.string(),
|
|
44
|
+
partnerAccountID: types.string(),
|
|
45
|
+
debtRepayment: types.boolean(),
|
|
46
|
+
allowDynamicDescriptor: types.boolean(),
|
|
47
|
+
allowSurcharge: types.boolean(),
|
|
48
|
+
});
|
|
49
|
+
/** @internal */
|
|
50
|
+
export type TransferControls$Outbound = {
|
|
51
|
+
accountID: string;
|
|
52
|
+
partnerAccountID: string;
|
|
53
|
+
debtRepayment: boolean;
|
|
54
|
+
allowDynamicDescriptor: boolean;
|
|
55
|
+
allowSurcharge: boolean;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const TransferControls$outboundSchema: z.ZodType<
|
|
60
|
+
TransferControls$Outbound,
|
|
61
|
+
z.ZodTypeDef,
|
|
62
|
+
TransferControls
|
|
63
|
+
> = z.object({
|
|
64
|
+
accountID: z.string(),
|
|
65
|
+
partnerAccountID: z.string(),
|
|
66
|
+
debtRepayment: z.boolean(),
|
|
67
|
+
allowDynamicDescriptor: z.boolean(),
|
|
68
|
+
allowSurcharge: z.boolean(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export function transferControlsToJSON(
|
|
72
|
+
transferControls: TransferControls,
|
|
73
|
+
): string {
|
|
74
|
+
return JSON.stringify(
|
|
75
|
+
TransferControls$outboundSchema.parse(transferControls),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
export function transferControlsFromJSON(
|
|
79
|
+
jsonString: string,
|
|
80
|
+
): SafeParseResult<TransferControls, SDKValidationError> {
|
|
81
|
+
return safeParse(
|
|
82
|
+
jsonString,
|
|
83
|
+
(x) => TransferControls$inboundSchema.parse(JSON.parse(x)),
|
|
84
|
+
`Failed to parse 'TransferControls' from JSON`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -8,11 +8,11 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
8
8
|
import * as types from "../../types/primitives.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./
|
|
11
|
+
AmountDetailsUpdate,
|
|
12
|
+
AmountDetailsUpdate$inboundSchema,
|
|
13
|
+
AmountDetailsUpdate$Outbound,
|
|
14
|
+
AmountDetailsUpdate$outboundSchema,
|
|
15
|
+
} from "./amountdetailsupdate.js";
|
|
16
16
|
import {
|
|
17
17
|
CreateInvoiceLineItemsUpdate,
|
|
18
18
|
CreateInvoiceLineItemsUpdate$inboundSchema,
|
|
@@ -34,17 +34,17 @@ export type UpdateInvoice = {
|
|
|
34
34
|
invoiceDate?: Date | null | undefined;
|
|
35
35
|
dueDate?: Date | null | undefined;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* The status can be updated to one of the following values under specific conditions:
|
|
38
38
|
*
|
|
39
39
|
* @remarks
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
40
|
+
* - `canceled`: Can only be set if the current status is `draft`, `unpaid`, or `overdue`. Canceling an invoice
|
|
41
|
+
* indicates the invoice is no longer expected to be paid (e.g., the charge was waived or terms changed).
|
|
42
|
+
* Canceled invoices still appear in list results by default and remain part of the invoice history.
|
|
43
|
+
* To completely discard an invoice created by mistake, use the delete endpoint instead.
|
|
44
|
+
* - `unpaid`: Can only be set if the current status is `draft`. Setting the status to `unpaid` finalizes the invoice and sends an email with a payment link to the customer.
|
|
45
45
|
*/
|
|
46
46
|
status?: InvoiceStatus | undefined;
|
|
47
|
-
|
|
47
|
+
amountDetails?: AmountDetailsUpdate | undefined;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
/** @internal */
|
|
@@ -58,7 +58,7 @@ export const UpdateInvoice$inboundSchema: z.ZodType<
|
|
|
58
58
|
invoiceDate: z.nullable(types.date()).optional(),
|
|
59
59
|
dueDate: z.nullable(types.date()).optional(),
|
|
60
60
|
status: types.optional(InvoiceStatus$inboundSchema),
|
|
61
|
-
|
|
61
|
+
amountDetails: types.optional(AmountDetailsUpdate$inboundSchema),
|
|
62
62
|
});
|
|
63
63
|
/** @internal */
|
|
64
64
|
export type UpdateInvoice$Outbound = {
|
|
@@ -67,7 +67,7 @@ export type UpdateInvoice$Outbound = {
|
|
|
67
67
|
invoiceDate?: string | null | undefined;
|
|
68
68
|
dueDate?: string | null | undefined;
|
|
69
69
|
status?: string | undefined;
|
|
70
|
-
|
|
70
|
+
amountDetails?: AmountDetailsUpdate$Outbound | undefined;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
/** @internal */
|
|
@@ -81,7 +81,7 @@ export const UpdateInvoice$outboundSchema: z.ZodType<
|
|
|
81
81
|
invoiceDate: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
82
82
|
dueDate: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
83
83
|
status: InvoiceStatus$outboundSchema.optional(),
|
|
84
|
-
|
|
84
|
+
amountDetails: AmountDetailsUpdate$outboundSchema.optional(),
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
export function updateInvoiceToJSON(updateInvoice: UpdateInvoice): string {
|
|
@@ -13,7 +13,7 @@ export type CreateInvoiceErrorData = {
|
|
|
13
13
|
lineItems?: components.CreateInvoiceLineItemsValidationError | undefined;
|
|
14
14
|
invoiceDate?: string | undefined;
|
|
15
15
|
dueDate?: string | undefined;
|
|
16
|
-
|
|
16
|
+
amountDetails?: components.AmountDetailsValidationError | undefined;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export class CreateInvoiceError extends MoovError {
|
|
@@ -22,7 +22,7 @@ export class CreateInvoiceError extends MoovError {
|
|
|
22
22
|
lineItems?: components.CreateInvoiceLineItemsValidationError | undefined;
|
|
23
23
|
invoiceDate?: string | undefined;
|
|
24
24
|
dueDate?: string | undefined;
|
|
25
|
-
|
|
25
|
+
amountDetails?: components.AmountDetailsValidationError | undefined;
|
|
26
26
|
|
|
27
27
|
/** The original data that was passed to this error instance. */
|
|
28
28
|
data$: CreateInvoiceErrorData;
|
|
@@ -43,7 +43,7 @@ export class CreateInvoiceError extends MoovError {
|
|
|
43
43
|
if (err.lineItems != null) this.lineItems = err.lineItems;
|
|
44
44
|
if (err.invoiceDate != null) this.invoiceDate = err.invoiceDate;
|
|
45
45
|
if (err.dueDate != null) this.dueDate = err.dueDate;
|
|
46
|
-
if (err.
|
|
46
|
+
if (err.amountDetails != null) this.amountDetails = err.amountDetails;
|
|
47
47
|
|
|
48
48
|
this.name = "CreateInvoiceError";
|
|
49
49
|
}
|
|
@@ -62,8 +62,8 @@ export const CreateInvoiceError$inboundSchema: z.ZodType<
|
|
|
62
62
|
),
|
|
63
63
|
invoiceDate: types.optional(types.string()),
|
|
64
64
|
dueDate: types.optional(types.string()),
|
|
65
|
-
|
|
66
|
-
components.
|
|
65
|
+
amountDetails: types.optional(
|
|
66
|
+
components.AmountDetailsValidationError$inboundSchema,
|
|
67
67
|
),
|
|
68
68
|
request$: z.instanceof(Request),
|
|
69
69
|
response$: z.instanceof(Response),
|
|
@@ -86,7 +86,7 @@ export type CreateInvoiceError$Outbound = {
|
|
|
86
86
|
| undefined;
|
|
87
87
|
invoiceDate?: string | undefined;
|
|
88
88
|
dueDate?: string | undefined;
|
|
89
|
-
|
|
89
|
+
amountDetails?: components.AmountDetailsValidationError$Outbound | undefined;
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
/** @internal */
|
|
@@ -103,6 +103,6 @@ export const CreateInvoiceError$outboundSchema: z.ZodType<
|
|
|
103
103
|
.optional(),
|
|
104
104
|
invoiceDate: z.string().optional(),
|
|
105
105
|
dueDate: z.string().optional(),
|
|
106
|
-
|
|
106
|
+
amountDetails: components.AmountDetailsValidationError$outboundSchema
|
|
107
107
|
.optional(),
|
|
108
108
|
}));
|
|
@@ -13,7 +13,7 @@ export type UpdateInvoiceErrorData = {
|
|
|
13
13
|
invoiceDate?: string | undefined;
|
|
14
14
|
dueDate?: string | undefined;
|
|
15
15
|
status?: string | undefined;
|
|
16
|
-
|
|
16
|
+
amountDetails?: components.AmountDetailsValidationError | undefined;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export class UpdateInvoiceError extends MoovError {
|
|
@@ -22,7 +22,7 @@ export class UpdateInvoiceError extends MoovError {
|
|
|
22
22
|
invoiceDate?: string | undefined;
|
|
23
23
|
dueDate?: string | undefined;
|
|
24
24
|
status?: string | undefined;
|
|
25
|
-
|
|
25
|
+
amountDetails?: components.AmountDetailsValidationError | undefined;
|
|
26
26
|
|
|
27
27
|
/** The original data that was passed to this error instance. */
|
|
28
28
|
data$: UpdateInvoiceErrorData;
|
|
@@ -41,7 +41,7 @@ export class UpdateInvoiceError extends MoovError {
|
|
|
41
41
|
if (err.invoiceDate != null) this.invoiceDate = err.invoiceDate;
|
|
42
42
|
if (err.dueDate != null) this.dueDate = err.dueDate;
|
|
43
43
|
if (err.status != null) this.status = err.status;
|
|
44
|
-
if (err.
|
|
44
|
+
if (err.amountDetails != null) this.amountDetails = err.amountDetails;
|
|
45
45
|
|
|
46
46
|
this.name = "UpdateInvoiceError";
|
|
47
47
|
}
|
|
@@ -60,8 +60,8 @@ export const UpdateInvoiceError$inboundSchema: z.ZodType<
|
|
|
60
60
|
invoiceDate: types.optional(types.string()),
|
|
61
61
|
dueDate: types.optional(types.string()),
|
|
62
62
|
status: types.optional(types.string()),
|
|
63
|
-
|
|
64
|
-
components.
|
|
63
|
+
amountDetails: types.optional(
|
|
64
|
+
components.AmountDetailsValidationError$inboundSchema,
|
|
65
65
|
),
|
|
66
66
|
request$: z.instanceof(Request),
|
|
67
67
|
response$: z.instanceof(Response),
|
|
@@ -82,7 +82,7 @@ export type UpdateInvoiceError$Outbound = {
|
|
|
82
82
|
invoiceDate?: string | undefined;
|
|
83
83
|
dueDate?: string | undefined;
|
|
84
84
|
status?: string | undefined;
|
|
85
|
-
|
|
85
|
+
amountDetails?: components.AmountDetailsValidationError$Outbound | undefined;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
/** @internal */
|
|
@@ -99,6 +99,6 @@ export const UpdateInvoiceError$outboundSchema: z.ZodType<
|
|
|
99
99
|
invoiceDate: z.string().optional(),
|
|
100
100
|
dueDate: z.string().optional(),
|
|
101
101
|
status: z.string().optional(),
|
|
102
|
-
|
|
102
|
+
amountDetails: components.AmountDetailsValidationError$outboundSchema
|
|
103
103
|
.optional(),
|
|
104
104
|
}));
|
package/src/types/async.ts
CHANGED
|
@@ -21,16 +21,17 @@ export type APICall =
|
|
|
21
21
|
|
|
22
22
|
export class APIPromise<T> implements Promise<T> {
|
|
23
23
|
readonly #promise: Promise<[T, APICall]>;
|
|
24
|
-
|
|
24
|
+
#unwrapped: Promise<T> | null;
|
|
25
25
|
|
|
26
26
|
readonly [Symbol.toStringTag] = "APIPromise";
|
|
27
27
|
|
|
28
28
|
constructor(p: [T, APICall] | Promise<[T, APICall]>) {
|
|
29
29
|
this.#promise = p instanceof Promise ? p : Promise.resolve(p);
|
|
30
|
-
this.#unwrapped =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
this.#unwrapped = p instanceof Promise ? null : Promise.resolve(p[0]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#getUnwrapped(): Promise<T> {
|
|
34
|
+
return (this.#unwrapped ??= this.#promise.then(([value]) => value));
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
then<TResult1 = T, TResult2 = never>(
|
|
@@ -55,11 +56,11 @@ export class APIPromise<T> implements Promise<T> {
|
|
|
55
56
|
| null
|
|
56
57
|
| undefined,
|
|
57
58
|
): Promise<T | TResult> {
|
|
58
|
-
return this.#
|
|
59
|
+
return this.#getUnwrapped().catch(onrejected);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
finally(onfinally?: (() => void) | null | undefined): Promise<T> {
|
|
62
|
-
return this.#
|
|
63
|
+
return this.#getUnwrapped().finally(onfinally);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
$inspect(): Promise<[T, APICall]> {
|
package/src/types/primitives.ts
CHANGED
|
@@ -62,24 +62,6 @@ export function number(): z.ZodType<number, z.ZodTypeDef, unknown> {
|
|
|
62
62
|
]);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export function bigint(): z.ZodType<bigint, z.ZodTypeDef, unknown> {
|
|
66
|
-
return z.union([
|
|
67
|
-
z.string().transform((x, ctx) => {
|
|
68
|
-
try {
|
|
69
|
-
return BigInt(x);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
ctx.addIssue({
|
|
72
|
-
code: "invalid_type",
|
|
73
|
-
expected: "bigint",
|
|
74
|
-
received: "string",
|
|
75
|
-
});
|
|
76
|
-
return z.NEVER;
|
|
77
|
-
}
|
|
78
|
-
}),
|
|
79
|
-
zodDefaultToZeroValue(0n),
|
|
80
|
-
]);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
65
|
export function date(): z.ZodType<Date, z.ZodTypeDef, unknown> {
|
|
84
66
|
return z.union([
|
|
85
67
|
z.union([z.string(), zodDefaultToZeroValue(0)]).transform((x) =>
|
|
@@ -106,12 +88,6 @@ export function literal<T extends string | number | boolean>(
|
|
|
106
88
|
return z.union([z.literal(value), zodDefaultToZeroValue(value)]);
|
|
107
89
|
}
|
|
108
90
|
|
|
109
|
-
export function literalBigInt<T extends bigint>(
|
|
110
|
-
value: T,
|
|
111
|
-
): z.ZodType<T, z.ZodTypeDef, unknown> {
|
|
112
|
-
return z.literal(String(value)).transform((x) => BigInt(x)) as any;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
91
|
export function optional<T extends z.ZodType>(t: T) {
|
|
116
92
|
return z.union([
|
|
117
93
|
// Null -> undefined
|
package/types/async.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../src/types/async.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GACf;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GACD;IACE,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GACD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEN,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;;IAI9C,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB;gBAEjC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../src/types/async.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GACf;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GACD;IACE,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GACD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEN,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;;IAI9C,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB;gBAEjC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IASnD,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EACjC,WAAW,CAAC,EACR,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAChD,IAAI,GACJ,SAAS,EACb,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GACnD,IAAI,GACJ,SAAS,GACZ,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAO/B,KAAK,CAAC,OAAO,GAAG,KAAK,EACnB,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GACjD,IAAI,GACJ,SAAS,GACZ,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAIvB,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhE,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;CAGlC"}
|