@paygentic/sdk 0.7.18 → 0.7.19
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 +9 -3
- package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.d.ts +19 -0
- package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.js +125 -0
- package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.js.map +1 -0
- package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.d.ts +19 -0
- package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.js +124 -0
- package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.js.map +1 -0
- package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.d.ts +19 -0
- package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.js +129 -0
- package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +2 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoicerefund.d.ts +95 -0
- package/dist/commonjs/models/invoicerefund.d.ts.map +1 -0
- package/dist/commonjs/models/invoicerefund.js +81 -0
- package/dist/commonjs/models/invoicerefund.js.map +1 -0
- package/dist/commonjs/models/invoicerefundlist.d.ts +31 -0
- package/dist/commonjs/models/invoicerefundlist.d.ts.map +1 -0
- package/dist/commonjs/models/invoicerefundlist.js +60 -0
- package/dist/commonjs/models/invoicerefundlist.js.map +1 -0
- package/dist/commonjs/models/operations/createinvoicerefund.d.ts +30 -0
- package/dist/commonjs/models/operations/createinvoicerefund.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createinvoicerefund.js +64 -0
- package/dist/commonjs/models/operations/createinvoicerefund.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listinvoicerefunds.d.ts +15 -0
- package/dist/commonjs/models/operations/listinvoicerefunds.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listinvoicerefunds.js +49 -0
- package/dist/commonjs/models/operations/listinvoicerefunds.js.map +1 -0
- package/dist/commonjs/models/operations/voidinvoicerefund.d.ts +35 -0
- package/dist/commonjs/models/operations/voidinvoicerefund.d.ts.map +1 -0
- package/dist/commonjs/models/operations/voidinvoicerefund.js +65 -0
- package/dist/commonjs/models/operations/voidinvoicerefund.js.map +1 -0
- package/dist/commonjs/models/revenuesummaryresponse.d.ts +9 -1
- package/dist/commonjs/models/revenuesummaryresponse.d.ts.map +1 -1
- package/dist/commonjs/models/revenuesummaryresponse.js +2 -0
- package/dist/commonjs/models/revenuesummaryresponse.js.map +1 -1
- package/dist/commonjs/sdk/invoicesv2.d.ts +21 -0
- package/dist/commonjs/sdk/invoicesv2.d.ts.map +1 -1
- package/dist/commonjs/sdk/invoicesv2.js +30 -0
- package/dist/commonjs/sdk/invoicesv2.js.map +1 -1
- package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.d.ts +19 -0
- package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.js +89 -0
- package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.js.map +1 -0
- package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.d.ts +19 -0
- package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.js +88 -0
- package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.js.map +1 -0
- package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.d.ts +19 -0
- package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.js +93 -0
- package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoicerefund.d.ts +95 -0
- package/dist/esm/models/invoicerefund.d.ts.map +1 -0
- package/dist/esm/models/invoicerefund.js +44 -0
- package/dist/esm/models/invoicerefund.js.map +1 -0
- package/dist/esm/models/invoicerefundlist.d.ts +31 -0
- package/dist/esm/models/invoicerefundlist.d.ts.map +1 -0
- package/dist/esm/models/invoicerefundlist.js +23 -0
- package/dist/esm/models/invoicerefundlist.js.map +1 -0
- package/dist/esm/models/operations/createinvoicerefund.d.ts +30 -0
- package/dist/esm/models/operations/createinvoicerefund.d.ts.map +1 -0
- package/dist/esm/models/operations/createinvoicerefund.js +26 -0
- package/dist/esm/models/operations/createinvoicerefund.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listinvoicerefunds.d.ts +15 -0
- package/dist/esm/models/operations/listinvoicerefunds.d.ts.map +1 -0
- package/dist/esm/models/operations/listinvoicerefunds.js +12 -0
- package/dist/esm/models/operations/listinvoicerefunds.js.map +1 -0
- package/dist/esm/models/operations/voidinvoicerefund.d.ts +35 -0
- package/dist/esm/models/operations/voidinvoicerefund.d.ts.map +1 -0
- package/dist/esm/models/operations/voidinvoicerefund.js +27 -0
- package/dist/esm/models/operations/voidinvoicerefund.js.map +1 -0
- package/dist/esm/models/revenuesummaryresponse.d.ts +9 -1
- package/dist/esm/models/revenuesummaryresponse.d.ts.map +1 -1
- package/dist/esm/models/revenuesummaryresponse.js +2 -0
- package/dist/esm/models/revenuesummaryresponse.js.map +1 -1
- package/dist/esm/sdk/invoicesv2.d.ts +21 -0
- package/dist/esm/sdk/invoicesv2.d.ts.map +1 -1
- package/dist/esm/sdk/invoicesv2.js +30 -0
- package/dist/esm/sdk/invoicesv2.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/invoicesV2CreateInvoiceRefund.ts +182 -0
- package/src/funcs/invoicesV2ListInvoiceRefunds.ts +176 -0
- package/src/funcs/invoicesV2VoidInvoiceRefund.ts +187 -0
- package/src/lib/config.ts +2 -2
- package/src/models/index.ts +2 -0
- package/src/models/invoicerefund.ts +140 -0
- package/src/models/invoicerefundlist.ts +59 -0
- package/src/models/operations/createinvoicerefund.ts +74 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/listinvoicerefunds.ts +34 -0
- package/src/models/operations/voidinvoicerefund.ts +80 -0
- package/src/models/revenuesummaryresponse.ts +11 -1
- package/src/sdk/invoicesv2.ts +54 -0
|
@@ -0,0 +1,140 @@
|
|
|
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 { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The object type
|
|
13
|
+
*/
|
|
14
|
+
export const InvoiceRefundObject = {
|
|
15
|
+
InvoiceRefund: "invoice_refund",
|
|
16
|
+
} as const;
|
|
17
|
+
/**
|
|
18
|
+
* The object type
|
|
19
|
+
*/
|
|
20
|
+
export type InvoiceRefundObject = ClosedEnum<typeof InvoiceRefundObject>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Credit note status
|
|
24
|
+
*/
|
|
25
|
+
export const InvoiceRefundStatus = {
|
|
26
|
+
Issued: "ISSUED",
|
|
27
|
+
Voided: "VOIDED",
|
|
28
|
+
} as const;
|
|
29
|
+
/**
|
|
30
|
+
* Credit note status
|
|
31
|
+
*/
|
|
32
|
+
export type InvoiceRefundStatus = ClosedEnum<typeof InvoiceRefundStatus>;
|
|
33
|
+
|
|
34
|
+
export type InvoiceRefund = {
|
|
35
|
+
/**
|
|
36
|
+
* The object type
|
|
37
|
+
*/
|
|
38
|
+
object: InvoiceRefundObject;
|
|
39
|
+
/**
|
|
40
|
+
* The credit note ID (crn_*)
|
|
41
|
+
*/
|
|
42
|
+
id: string;
|
|
43
|
+
/**
|
|
44
|
+
* The invoice this refund credits
|
|
45
|
+
*/
|
|
46
|
+
invoiceId: string;
|
|
47
|
+
/**
|
|
48
|
+
* The merchant that owns the invoice
|
|
49
|
+
*/
|
|
50
|
+
merchantId: string;
|
|
51
|
+
/**
|
|
52
|
+
* Refunded subtotal (pre-tax) in decimal dollars
|
|
53
|
+
*/
|
|
54
|
+
amount: string;
|
|
55
|
+
/**
|
|
56
|
+
* Reversed tax in decimal dollars
|
|
57
|
+
*/
|
|
58
|
+
taxAmount: string;
|
|
59
|
+
/**
|
|
60
|
+
* Total refunded (amount + taxAmount) in decimal dollars
|
|
61
|
+
*/
|
|
62
|
+
total: string;
|
|
63
|
+
/**
|
|
64
|
+
* ISO 4217 currency code
|
|
65
|
+
*/
|
|
66
|
+
currency: string;
|
|
67
|
+
/**
|
|
68
|
+
* Credit note status
|
|
69
|
+
*/
|
|
70
|
+
status: InvoiceRefundStatus;
|
|
71
|
+
/**
|
|
72
|
+
* Credit note id in the tax provider
|
|
73
|
+
*/
|
|
74
|
+
externalCreditNoteId: string;
|
|
75
|
+
/**
|
|
76
|
+
* Public URL to view the credit note document
|
|
77
|
+
*/
|
|
78
|
+
permalink?: string | null | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Direct PDF download link
|
|
81
|
+
*/
|
|
82
|
+
pdfUrl?: string | null | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Optional refund reason
|
|
85
|
+
*/
|
|
86
|
+
reason?: string | null | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* When the refund was issued
|
|
89
|
+
*/
|
|
90
|
+
createdAt: Date;
|
|
91
|
+
/**
|
|
92
|
+
* When the refund was voided, if applicable
|
|
93
|
+
*/
|
|
94
|
+
voidedAt?: Date | null | undefined;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** @internal */
|
|
98
|
+
export const InvoiceRefundObject$inboundSchema: z.ZodNativeEnum<
|
|
99
|
+
typeof InvoiceRefundObject
|
|
100
|
+
> = z.nativeEnum(InvoiceRefundObject);
|
|
101
|
+
|
|
102
|
+
/** @internal */
|
|
103
|
+
export const InvoiceRefundStatus$inboundSchema: z.ZodNativeEnum<
|
|
104
|
+
typeof InvoiceRefundStatus
|
|
105
|
+
> = z.nativeEnum(InvoiceRefundStatus);
|
|
106
|
+
|
|
107
|
+
/** @internal */
|
|
108
|
+
export const InvoiceRefund$inboundSchema: z.ZodType<
|
|
109
|
+
InvoiceRefund,
|
|
110
|
+
z.ZodTypeDef,
|
|
111
|
+
unknown
|
|
112
|
+
> = z.object({
|
|
113
|
+
object: InvoiceRefundObject$inboundSchema,
|
|
114
|
+
id: z.string(),
|
|
115
|
+
invoiceId: z.string(),
|
|
116
|
+
merchantId: z.string(),
|
|
117
|
+
amount: z.string(),
|
|
118
|
+
taxAmount: z.string(),
|
|
119
|
+
total: z.string(),
|
|
120
|
+
currency: z.string(),
|
|
121
|
+
status: InvoiceRefundStatus$inboundSchema,
|
|
122
|
+
externalCreditNoteId: z.string(),
|
|
123
|
+
permalink: z.nullable(z.string()).optional(),
|
|
124
|
+
pdfUrl: z.nullable(z.string()).optional(),
|
|
125
|
+
reason: z.nullable(z.string()).optional(),
|
|
126
|
+
createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
127
|
+
voidedAt: z.nullable(
|
|
128
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
129
|
+
).optional(),
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export function invoiceRefundFromJSON(
|
|
133
|
+
jsonString: string,
|
|
134
|
+
): SafeParseResult<InvoiceRefund, SDKValidationError> {
|
|
135
|
+
return safeParse(
|
|
136
|
+
jsonString,
|
|
137
|
+
(x) => InvoiceRefund$inboundSchema.parse(JSON.parse(x)),
|
|
138
|
+
`Failed to parse 'InvoiceRefund' from JSON`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
import { InvoiceRefund, InvoiceRefund$inboundSchema } from "./invoicerefund.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The object type
|
|
14
|
+
*/
|
|
15
|
+
export const InvoiceRefundListObject = {
|
|
16
|
+
List: "list",
|
|
17
|
+
} as const;
|
|
18
|
+
/**
|
|
19
|
+
* The object type
|
|
20
|
+
*/
|
|
21
|
+
export type InvoiceRefundListObject = ClosedEnum<
|
|
22
|
+
typeof InvoiceRefundListObject
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export type InvoiceRefundList = {
|
|
26
|
+
/**
|
|
27
|
+
* The object type
|
|
28
|
+
*/
|
|
29
|
+
object: InvoiceRefundListObject;
|
|
30
|
+
/**
|
|
31
|
+
* The refunds for this invoice
|
|
32
|
+
*/
|
|
33
|
+
data: Array<InvoiceRefund>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const InvoiceRefundListObject$inboundSchema: z.ZodNativeEnum<
|
|
38
|
+
typeof InvoiceRefundListObject
|
|
39
|
+
> = z.nativeEnum(InvoiceRefundListObject);
|
|
40
|
+
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const InvoiceRefundList$inboundSchema: z.ZodType<
|
|
43
|
+
InvoiceRefundList,
|
|
44
|
+
z.ZodTypeDef,
|
|
45
|
+
unknown
|
|
46
|
+
> = z.object({
|
|
47
|
+
object: InvoiceRefundListObject$inboundSchema,
|
|
48
|
+
data: z.array(InvoiceRefund$inboundSchema),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export function invoiceRefundListFromJSON(
|
|
52
|
+
jsonString: string,
|
|
53
|
+
): SafeParseResult<InvoiceRefundList, SDKValidationError> {
|
|
54
|
+
return safeParse(
|
|
55
|
+
jsonString,
|
|
56
|
+
(x) => InvoiceRefundList$inboundSchema.parse(JSON.parse(x)),
|
|
57
|
+
`Failed to parse 'InvoiceRefundList' from JSON`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
|
|
8
|
+
export type CreateInvoiceRefundRequestBody = {
|
|
9
|
+
/**
|
|
10
|
+
* Optional reason for the refund (recorded on the credit note)
|
|
11
|
+
*/
|
|
12
|
+
reason?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type CreateInvoiceRefundRequest = {
|
|
16
|
+
/**
|
|
17
|
+
* The invoice ID
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
requestBody?: CreateInvoiceRefundRequestBody | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export type CreateInvoiceRefundRequestBody$Outbound = {
|
|
25
|
+
reason?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const CreateInvoiceRefundRequestBody$outboundSchema: z.ZodType<
|
|
30
|
+
CreateInvoiceRefundRequestBody$Outbound,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
CreateInvoiceRefundRequestBody
|
|
33
|
+
> = z.object({
|
|
34
|
+
reason: z.string().optional(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export function createInvoiceRefundRequestBodyToJSON(
|
|
38
|
+
createInvoiceRefundRequestBody: CreateInvoiceRefundRequestBody,
|
|
39
|
+
): string {
|
|
40
|
+
return JSON.stringify(
|
|
41
|
+
CreateInvoiceRefundRequestBody$outboundSchema.parse(
|
|
42
|
+
createInvoiceRefundRequestBody,
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export type CreateInvoiceRefundRequest$Outbound = {
|
|
49
|
+
id: string;
|
|
50
|
+
RequestBody?: CreateInvoiceRefundRequestBody$Outbound | undefined;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** @internal */
|
|
54
|
+
export const CreateInvoiceRefundRequest$outboundSchema: z.ZodType<
|
|
55
|
+
CreateInvoiceRefundRequest$Outbound,
|
|
56
|
+
z.ZodTypeDef,
|
|
57
|
+
CreateInvoiceRefundRequest
|
|
58
|
+
> = z.object({
|
|
59
|
+
id: z.string(),
|
|
60
|
+
requestBody: z.lazy(() => CreateInvoiceRefundRequestBody$outboundSchema)
|
|
61
|
+
.optional(),
|
|
62
|
+
}).transform((v) => {
|
|
63
|
+
return remap$(v, {
|
|
64
|
+
requestBody: "RequestBody",
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export function createInvoiceRefundRequestToJSON(
|
|
69
|
+
createInvoiceRefundRequest: CreateInvoiceRefundRequest,
|
|
70
|
+
): string {
|
|
71
|
+
return JSON.stringify(
|
|
72
|
+
CreateInvoiceRefundRequest$outboundSchema.parse(createInvoiceRefundRequest),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -14,6 +14,7 @@ export * from "./createentitlementgrant.js";
|
|
|
14
14
|
export * from "./createexternalreference.js";
|
|
15
15
|
export * from "./createfeature.js";
|
|
16
16
|
export * from "./createfee.js";
|
|
17
|
+
export * from "./createinvoicerefund.js";
|
|
17
18
|
export * from "./createitem.js";
|
|
18
19
|
export * from "./createlineitem.js";
|
|
19
20
|
export * from "./createpayment.js";
|
|
@@ -73,6 +74,7 @@ export * from "./listentitlements.js";
|
|
|
73
74
|
export * from "./listexternalreferences.js";
|
|
74
75
|
export * from "./listfeatures.js";
|
|
75
76
|
export * from "./listfees.js";
|
|
77
|
+
export * from "./listinvoicerefunds.js";
|
|
76
78
|
export * from "./listinvoices.js";
|
|
77
79
|
export * from "./listitems.js";
|
|
78
80
|
export * from "./listlineitems.js";
|
|
@@ -107,3 +109,4 @@ export * from "./updatesubscription.js";
|
|
|
107
109
|
export * from "./updateuser.js";
|
|
108
110
|
export * from "./upsertmerchantintegration.js";
|
|
109
111
|
export * from "./voidentitlementgrant.js";
|
|
112
|
+
export * from "./voidinvoicerefund.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type ListInvoiceRefundsRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* The invoice ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type ListInvoiceRefundsRequest$Outbound = {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const ListInvoiceRefundsRequest$outboundSchema: z.ZodType<
|
|
21
|
+
ListInvoiceRefundsRequest$Outbound,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
ListInvoiceRefundsRequest
|
|
24
|
+
> = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function listInvoiceRefundsRequestToJSON(
|
|
29
|
+
listInvoiceRefundsRequest: ListInvoiceRefundsRequest,
|
|
30
|
+
): string {
|
|
31
|
+
return JSON.stringify(
|
|
32
|
+
ListInvoiceRefundsRequest$outboundSchema.parse(listInvoiceRefundsRequest),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
|
|
8
|
+
export type VoidInvoiceRefundRequestBody = {
|
|
9
|
+
/**
|
|
10
|
+
* Optional reason for voiding the refund (recorded on the credit note)
|
|
11
|
+
*/
|
|
12
|
+
reason?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type VoidInvoiceRefundRequest = {
|
|
16
|
+
/**
|
|
17
|
+
* The invoice ID
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* The refund (credit note) ID
|
|
22
|
+
*/
|
|
23
|
+
refundId: string;
|
|
24
|
+
requestBody?: VoidInvoiceRefundRequestBody | undefined;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export type VoidInvoiceRefundRequestBody$Outbound = {
|
|
29
|
+
reason?: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const VoidInvoiceRefundRequestBody$outboundSchema: z.ZodType<
|
|
34
|
+
VoidInvoiceRefundRequestBody$Outbound,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
VoidInvoiceRefundRequestBody
|
|
37
|
+
> = z.object({
|
|
38
|
+
reason: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function voidInvoiceRefundRequestBodyToJSON(
|
|
42
|
+
voidInvoiceRefundRequestBody: VoidInvoiceRefundRequestBody,
|
|
43
|
+
): string {
|
|
44
|
+
return JSON.stringify(
|
|
45
|
+
VoidInvoiceRefundRequestBody$outboundSchema.parse(
|
|
46
|
+
voidInvoiceRefundRequestBody,
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
export type VoidInvoiceRefundRequest$Outbound = {
|
|
53
|
+
id: string;
|
|
54
|
+
refundId: string;
|
|
55
|
+
RequestBody?: VoidInvoiceRefundRequestBody$Outbound | undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const VoidInvoiceRefundRequest$outboundSchema: z.ZodType<
|
|
60
|
+
VoidInvoiceRefundRequest$Outbound,
|
|
61
|
+
z.ZodTypeDef,
|
|
62
|
+
VoidInvoiceRefundRequest
|
|
63
|
+
> = z.object({
|
|
64
|
+
id: z.string(),
|
|
65
|
+
refundId: z.string(),
|
|
66
|
+
requestBody: z.lazy(() => VoidInvoiceRefundRequestBody$outboundSchema)
|
|
67
|
+
.optional(),
|
|
68
|
+
}).transform((v) => {
|
|
69
|
+
return remap$(v, {
|
|
70
|
+
requestBody: "RequestBody",
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export function voidInvoiceRefundRequestToJSON(
|
|
75
|
+
voidInvoiceRefundRequest: VoidInvoiceRefundRequest,
|
|
76
|
+
): string {
|
|
77
|
+
return JSON.stringify(
|
|
78
|
+
VoidInvoiceRefundRequest$outboundSchema.parse(voidInvoiceRefundRequest),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -33,9 +33,17 @@ export type RevenueSummaryResponse = {
|
|
|
33
33
|
*/
|
|
34
34
|
object: "revenue_summary";
|
|
35
35
|
/**
|
|
36
|
-
* Net collected revenue in dollars (paid invoices + completed payments). Omitted when groupBy=currency is active.
|
|
36
|
+
* Net collected revenue in dollars (paid invoices + completed payments), already net of non-voided refunds. Omitted when groupBy=currency is active.
|
|
37
37
|
*/
|
|
38
38
|
netRevenue?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Gross total of non-voided refunds (credit notes) issued in the period, in dollars. Already subtracted from netRevenue and invoice totals. Omitted when groupBy=currency is active.
|
|
41
|
+
*/
|
|
42
|
+
totalRefunds?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Number of non-voided refunds (credit notes) issued in the period. Omitted when groupBy=currency is active.
|
|
45
|
+
*/
|
|
46
|
+
refundCount?: number | undefined;
|
|
39
47
|
invoices?: InvoiceSummary | undefined;
|
|
40
48
|
payments?: PaymentSummary | undefined;
|
|
41
49
|
/**
|
|
@@ -60,6 +68,8 @@ export const RevenueSummaryResponse$inboundSchema: z.ZodType<
|
|
|
60
68
|
> = z.object({
|
|
61
69
|
object: z.literal("revenue_summary"),
|
|
62
70
|
netRevenue: z.string().optional(),
|
|
71
|
+
totalRefunds: z.string().optional(),
|
|
72
|
+
refundCount: z.number().optional(),
|
|
63
73
|
invoices: InvoiceSummary$inboundSchema.optional(),
|
|
64
74
|
payments: PaymentSummary$inboundSchema.optional(),
|
|
65
75
|
trend: z.array(RevenueTrendBucket$inboundSchema).optional(),
|
package/src/sdk/invoicesv2.ts
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { invoicesV2CreateInvoiceRefund } from "../funcs/invoicesV2CreateInvoiceRefund.js";
|
|
5
6
|
import { invoicesV2CreateLineItem } from "../funcs/invoicesV2CreateLineItem.js";
|
|
6
7
|
import { invoicesV2Get } from "../funcs/invoicesV2Get.js";
|
|
7
8
|
import { invoicesV2GetLineItems } from "../funcs/invoicesV2GetLineItems.js";
|
|
8
9
|
import { invoicesV2List } from "../funcs/invoicesV2List.js";
|
|
10
|
+
import { invoicesV2ListInvoiceRefunds } from "../funcs/invoicesV2ListInvoiceRefunds.js";
|
|
9
11
|
import { invoicesV2ListLineItems } from "../funcs/invoicesV2ListLineItems.js";
|
|
12
|
+
import { invoicesV2VoidInvoiceRefund } from "../funcs/invoicesV2VoidInvoiceRefund.js";
|
|
10
13
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
11
14
|
import * as models from "../models/index.js";
|
|
12
15
|
import * as operations from "../models/operations/index.js";
|
|
@@ -97,4 +100,55 @@ export class InvoicesV2 extends ClientSDK {
|
|
|
97
100
|
options,
|
|
98
101
|
));
|
|
99
102
|
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Refund Invoice
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* Issue a full refund against a paid invoice by creating a credit note. The invoice stays PAID; the refund is recorded as a child credit note. Accessible to the owning merchant or platform operators. Only works for invoices in PAID status that have not already been refunded. Full refund only — the entire invoice (subtotal + tax) is credited.
|
|
109
|
+
*/
|
|
110
|
+
async createInvoiceRefund(
|
|
111
|
+
request: operations.CreateInvoiceRefundRequest,
|
|
112
|
+
options?: RequestOptions,
|
|
113
|
+
): Promise<models.InvoiceRefund> {
|
|
114
|
+
return unwrapAsync(invoicesV2CreateInvoiceRefund(
|
|
115
|
+
this,
|
|
116
|
+
request,
|
|
117
|
+
options,
|
|
118
|
+
));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* List Invoice Refunds
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
* List the credit notes (refunds) recorded against an invoice. Accessible to the owning merchant or platform operators.
|
|
126
|
+
*/
|
|
127
|
+
async listInvoiceRefunds(
|
|
128
|
+
request: operations.ListInvoiceRefundsRequest,
|
|
129
|
+
options?: RequestOptions,
|
|
130
|
+
): Promise<models.InvoiceRefundList> {
|
|
131
|
+
return unwrapAsync(invoicesV2ListInvoiceRefunds(
|
|
132
|
+
this,
|
|
133
|
+
request,
|
|
134
|
+
options,
|
|
135
|
+
));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Void Invoice Refund
|
|
140
|
+
*
|
|
141
|
+
* @remarks
|
|
142
|
+
* Void a previously-issued refund (credit note). Reverses the credit note in the tax provider and excludes it from revenue. Accessible to the owning merchant or platform operators.
|
|
143
|
+
*/
|
|
144
|
+
async voidInvoiceRefund(
|
|
145
|
+
request: operations.VoidInvoiceRefundRequest,
|
|
146
|
+
options?: RequestOptions,
|
|
147
|
+
): Promise<models.InvoiceRefund> {
|
|
148
|
+
return unwrapAsync(invoicesV2VoidInvoiceRefund(
|
|
149
|
+
this,
|
|
150
|
+
request,
|
|
151
|
+
options,
|
|
152
|
+
));
|
|
153
|
+
}
|
|
100
154
|
}
|