@moovio/sdk 0.0.0-dev.5 → 0.0.0-dev.6

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.
Files changed (108) hide show
  1. package/README.md +74 -54
  2. package/bin/mcp-server.js +815 -678
  3. package/bin/mcp-server.js.map +24 -24
  4. package/funcs/disputesUploadEvidenceFile.js +6 -0
  5. package/funcs/disputesUploadEvidenceFile.js.map +1 -1
  6. package/funcs/filesUpload.js +6 -0
  7. package/funcs/filesUpload.js.map +1 -1
  8. package/funcs/imagesUpdate.js +7 -0
  9. package/funcs/imagesUpdate.js.map +1 -1
  10. package/funcs/imagesUpload.js +7 -0
  11. package/funcs/imagesUpload.js.map +1 -1
  12. package/funcs/invoicesDelete.d.ts +24 -0
  13. package/funcs/invoicesDelete.d.ts.map +1 -0
  14. package/funcs/invoicesDelete.js +146 -0
  15. package/funcs/invoicesDelete.js.map +1 -0
  16. package/jsr.json +1 -1
  17. package/lib/config.d.ts +3 -3
  18. package/lib/config.js +3 -3
  19. package/lib/config.js.map +1 -1
  20. package/lib/matchers.d.ts.map +1 -1
  21. package/lib/matchers.js +0 -1
  22. package/lib/matchers.js.map +1 -1
  23. package/lib/security.d.ts.map +1 -1
  24. package/lib/security.js +1 -2
  25. package/lib/security.js.map +1 -1
  26. package/mcp-server/mcp-server.js +1 -1
  27. package/mcp-server/server.d.ts.map +1 -1
  28. package/mcp-server/server.js +3 -1
  29. package/mcp-server/server.js.map +1 -1
  30. package/mcp-server/shared.js +1 -1
  31. package/mcp-server/shared.js.map +1 -1
  32. package/mcp-server/tools/invoicesDelete.d.ts +8 -0
  33. package/mcp-server/tools/invoicesDelete.d.ts.map +1 -0
  34. package/{models/components/rtpfailurecode.js → mcp-server/tools/invoicesDelete.js} +31 -21
  35. package/mcp-server/tools/invoicesDelete.js.map +1 -0
  36. package/models/components/createinvoicelineitem.d.ts +2 -1
  37. package/models/components/createinvoicelineitem.d.ts.map +1 -1
  38. package/models/components/createinvoicelineitem.js.map +1 -1
  39. package/models/components/createpaymentlinklineitem.d.ts +2 -1
  40. package/models/components/createpaymentlinklineitem.d.ts.map +1 -1
  41. package/models/components/createpaymentlinklineitem.js.map +1 -1
  42. package/models/components/index.d.ts +0 -3
  43. package/models/components/index.d.ts.map +1 -1
  44. package/models/components/index.js +0 -3
  45. package/models/components/index.js.map +1 -1
  46. package/models/components/invoice.d.ts +12 -0
  47. package/models/components/invoice.d.ts.map +1 -1
  48. package/models/components/invoice.js +6 -0
  49. package/models/components/invoice.js.map +1 -1
  50. package/models/components/invoicelineitem.d.ts +2 -1
  51. package/models/components/invoicelineitem.d.ts.map +1 -1
  52. package/models/components/invoicelineitem.js.map +1 -1
  53. package/models/components/transferdestination.d.ts +0 -6
  54. package/models/components/transferdestination.d.ts.map +1 -1
  55. package/models/components/transferdestination.js +0 -3
  56. package/models/components/transferdestination.js.map +1 -1
  57. package/models/components/updateinvoice.d.ts +4 -1
  58. package/models/components/updateinvoice.d.ts.map +1 -1
  59. package/models/components/updateinvoice.js.map +1 -1
  60. package/models/operations/deleteinvoice.d.ts +63 -0
  61. package/models/operations/deleteinvoice.d.ts.map +1 -0
  62. package/models/operations/deleteinvoice.js +109 -0
  63. package/models/operations/deleteinvoice.js.map +1 -0
  64. package/models/operations/index.d.ts +1 -0
  65. package/models/operations/index.d.ts.map +1 -1
  66. package/models/operations/index.js +1 -0
  67. package/models/operations/index.js.map +1 -1
  68. package/package.json +1 -1
  69. package/sdk/invoices.d.ts +13 -0
  70. package/sdk/invoices.d.ts.map +1 -1
  71. package/sdk/invoices.js +16 -0
  72. package/sdk/invoices.js.map +1 -1
  73. package/src/funcs/disputesUploadEvidenceFile.ts +15 -0
  74. package/src/funcs/filesUpload.ts +15 -0
  75. package/src/funcs/imagesUpdate.ts +16 -0
  76. package/src/funcs/imagesUpload.ts +16 -0
  77. package/src/funcs/invoicesDelete.ts +206 -0
  78. package/src/lib/config.ts +3 -3
  79. package/src/lib/matchers.ts +3 -2
  80. package/src/lib/security.ts +1 -2
  81. package/src/mcp-server/mcp-server.ts +1 -1
  82. package/src/mcp-server/server.ts +3 -1
  83. package/src/mcp-server/shared.ts +2 -2
  84. package/src/mcp-server/tools/invoicesDelete.ts +43 -0
  85. package/src/models/components/createinvoicelineitem.ts +2 -1
  86. package/src/models/components/createpaymentlinklineitem.ts +2 -1
  87. package/src/models/components/index.ts +0 -3
  88. package/src/models/components/invoice.ts +20 -0
  89. package/src/models/components/invoicelineitem.ts +2 -1
  90. package/src/models/components/transferdestination.ts +0 -13
  91. package/src/models/components/updateinvoice.ts +4 -1
  92. package/src/models/operations/deleteinvoice.ts +172 -0
  93. package/src/models/operations/index.ts +1 -0
  94. package/src/sdk/invoices.ts +24 -0
  95. package/models/components/rtpfailurecode.d.ts +0 -26
  96. package/models/components/rtpfailurecode.d.ts.map +0 -1
  97. package/models/components/rtpfailurecode.js.map +0 -1
  98. package/models/components/rtptransactiondetails.d.ts +0 -43
  99. package/models/components/rtptransactiondetails.d.ts.map +0 -1
  100. package/models/components/rtptransactiondetails.js +0 -75
  101. package/models/components/rtptransactiondetails.js.map +0 -1
  102. package/models/components/rtptransactionstatus.d.ts +0 -20
  103. package/models/components/rtptransactionstatus.d.ts.map +0 -1
  104. package/models/components/rtptransactionstatus.js +0 -54
  105. package/models/components/rtptransactionstatus.js.map +0 -1
  106. package/src/models/components/rtpfailurecode.ts +0 -35
  107. package/src/models/components/rtptransactiondetails.ts +0 -102
  108. package/src/models/components/rtptransactionstatus.ts +0 -29
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "0.0.0-dev.5",
22
+ currentVersion: "0.0.0-dev.6",
23
23
  },
24
24
  });
25
25
 
@@ -104,6 +104,7 @@ import { tool$institutionsSearch } from "./tools/institutionsSearch.js";
104
104
  import { tool$institutionsSearchInstitutions } from "./tools/institutionsSearchInstitutions.js";
105
105
  import { tool$invoicesCreateInvoice } from "./tools/invoicesCreateInvoice.js";
106
106
  import { tool$invoicesCreateInvoicePayment } from "./tools/invoicesCreateInvoicePayment.js";
107
+ import { tool$invoicesDelete } from "./tools/invoicesDelete.js";
107
108
  import { tool$invoicesGetInvoice } from "./tools/invoicesGetInvoice.js";
108
109
  import { tool$invoicesListInvoicePayments } from "./tools/invoicesListInvoicePayments.js";
109
110
  import { tool$invoicesListInvoices } from "./tools/invoicesListInvoices.js";
@@ -202,7 +203,7 @@ export function createMCPServer(deps: {
202
203
  }) {
203
204
  const server = new McpServer({
204
205
  name: "Moov",
205
- version: "0.0.0-dev.5",
206
+ version: "0.0.0-dev.6",
206
207
  });
207
208
 
208
209
  const client = new MoovCore({
@@ -307,6 +308,7 @@ export function createMCPServer(deps: {
307
308
  tool(tool$invoicesListInvoices);
308
309
  tool(tool$invoicesGetInvoice);
309
310
  tool(tool$invoicesUpdateInvoice);
311
+ tool(tool$invoicesDelete);
310
312
  tool(tool$invoicesCreateInvoicePayment);
311
313
  tool(tool$invoicesListInvoicePayments);
312
314
  tool(tool$paymentLinksCreate);
@@ -16,12 +16,12 @@ export async function consumeStream(
16
16
  stream: ReadableStream<Uint8Array>,
17
17
  ): Promise<Uint8Array> {
18
18
  const reader = stream.getReader();
19
- const chunks: Uint8Array[] = [];
19
+ const chunks: ArrayBuffer[] = [];
20
20
 
21
21
  try {
22
22
  while (true) {
23
23
  const { done, value } = await reader.read();
24
- if (value != null) chunks.push(value);
24
+ if (value != null) chunks.push(new Uint8Array(value).buffer);
25
25
  if (done) break;
26
26
  }
27
27
  } finally {
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { invoicesDelete } from "../../funcs/invoicesDelete.js";
6
+ import * as operations from "../../models/operations/index.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: operations.DeleteInvoiceRequest$inboundSchema,
11
+ };
12
+
13
+ export const tool$invoicesDelete: ToolDefinition<typeof args> = {
14
+ name: "invoices-delete",
15
+ description:
16
+ `Delete an invoice. Only invoices in \`draft\` status can be deleted.
17
+
18
+ Deleting an invoice indicates it was created by mistake and should be completely disregarded.
19
+ Deleted invoices are hidden from list results by default, but can still be retrieved
20
+ individually through the get invoice endpoint. If you need to void an invoice that was
21
+ already sent or is otherwise part of the invoice history, cancel it instead by updating
22
+ its status to \`canceled\`.
23
+
24
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
25
+ you'll need to specify the \`/accounts/{accountID}/invoices.write\` scope.`,
26
+ args,
27
+ tool: async (client, args, ctx) => {
28
+ const [result, apiCall] = await invoicesDelete(
29
+ client,
30
+ args.request,
31
+ { fetchOptions: { signal: ctx.signal } },
32
+ ).$inspect();
33
+
34
+ if (!result.ok) {
35
+ return {
36
+ content: [{ type: "text", text: result.error.message }],
37
+ isError: true,
38
+ };
39
+ }
40
+
41
+ return formatResult(void 0, apiCall);
42
+ },
43
+ };
@@ -39,7 +39,8 @@ export type CreateInvoiceLineItem = {
39
39
  * Optional unique identifier associating the line item with a product.
40
40
  *
41
41
  * @remarks
42
- * This is for reporting or tracking purposes, and does not populate other details of the line item.
42
+ * When provided, images associated with the product will be included on the line item.
43
+ * This does not populate other details of the line item.
43
44
  */
44
45
  productID?: string | undefined;
45
46
  /**
@@ -52,7 +52,8 @@ export type CreatePaymentLinkLineItem = {
52
52
  * Optional unique identifier associating the line item with a product.
53
53
  *
54
54
  * @remarks
55
- * This is for reporting or tracking purposes, and does not populate other details of the line item.
55
+ * When provided, images associated with the product will be included on the line item.
56
+ * This does not populate other details of the line item.
56
57
  */
57
58
  productID?: string | undefined;
58
59
  };
@@ -422,12 +422,9 @@ export * from "./reversedwithrefund.js";
422
422
  export * from "./revoketokenrequest.js";
423
423
  export * from "./rtpcreditpaymentmethod.js";
424
424
  export * from "./rtpcredittransferpaymentmethod.js";
425
- export * from "./rtpfailurecode.js";
426
425
  export * from "./rtpinstitution.js";
427
426
  export * from "./rtprejectioncode.js";
428
427
  export * from "./rtpservices.js";
429
- export * from "./rtptransactiondetails.js";
430
- export * from "./rtptransactionstatus.js";
431
428
  export * from "./runtransfer.js";
432
429
  export * from "./scheduledtransferimagemetadata.js";
433
430
  export * from "./scheduledtransferlineitem.js";
@@ -41,6 +41,14 @@ export type Invoice = {
41
41
  * A unique identifier for a Moov resource. Supports UUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) or typed format with base32-encoded UUID and type suffix (e.g., kuoaydiojf7uszaokc2ggnaaaa_xfer).
42
42
  */
43
43
  customerAccountID: string;
44
+ /**
45
+ * Display name of the customer account.
46
+ */
47
+ customerDisplayName: string;
48
+ /**
49
+ * Email address of the customer account.
50
+ */
51
+ customerEmail: string;
44
52
  /**
45
53
  * A unique identifier for a Moov resource. Supports UUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) or typed format with base32-encoded UUID and type suffix (e.g., kuoaydiojf7uszaokc2ggnaaaa_xfer).
46
54
  */
@@ -83,6 +91,7 @@ export type Invoice = {
83
91
  sentOn?: Date | undefined;
84
92
  paidOn?: Date | undefined;
85
93
  canceledOn?: Date | undefined;
94
+ disabledOn?: Date | undefined;
86
95
  };
87
96
 
88
97
  /** @internal */
@@ -92,6 +101,8 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
92
101
  invoiceNumber: z.string(),
93
102
  description: z.string().optional(),
94
103
  customerAccountID: z.string(),
104
+ customerDisplayName: z.string(),
105
+ customerEmail: z.string(),
95
106
  partnerAccountID: z.string(),
96
107
  status: InvoiceStatus$inboundSchema,
97
108
  lineItems: InvoiceLineItems$inboundSchema,
@@ -119,6 +130,9 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
119
130
  canceledOn: z.string().datetime({ offset: true }).transform(v =>
120
131
  new Date(v)
121
132
  ).optional(),
133
+ disabledOn: z.string().datetime({ offset: true }).transform(v =>
134
+ new Date(v)
135
+ ).optional(),
122
136
  });
123
137
  /** @internal */
124
138
  export type Invoice$Outbound = {
@@ -126,6 +140,8 @@ export type Invoice$Outbound = {
126
140
  invoiceNumber: string;
127
141
  description?: string | undefined;
128
142
  customerAccountID: string;
143
+ customerDisplayName: string;
144
+ customerEmail: string;
129
145
  partnerAccountID: string;
130
146
  status: string;
131
147
  lineItems: InvoiceLineItems$Outbound;
@@ -144,6 +160,7 @@ export type Invoice$Outbound = {
144
160
  sentOn?: string | undefined;
145
161
  paidOn?: string | undefined;
146
162
  canceledOn?: string | undefined;
163
+ disabledOn?: string | undefined;
147
164
  };
148
165
 
149
166
  /** @internal */
@@ -156,6 +173,8 @@ export const Invoice$outboundSchema: z.ZodType<
156
173
  invoiceNumber: z.string(),
157
174
  description: z.string().optional(),
158
175
  customerAccountID: z.string(),
176
+ customerDisplayName: z.string(),
177
+ customerEmail: z.string(),
159
178
  partnerAccountID: z.string(),
160
179
  status: InvoiceStatus$outboundSchema,
161
180
  lineItems: InvoiceLineItems$outboundSchema,
@@ -174,6 +193,7 @@ export const Invoice$outboundSchema: z.ZodType<
174
193
  sentOn: z.date().transform(v => v.toISOString()).optional(),
175
194
  paidOn: z.date().transform(v => v.toISOString()).optional(),
176
195
  canceledOn: z.date().transform(v => v.toISOString()).optional(),
196
+ disabledOn: z.date().transform(v => v.toISOString()).optional(),
177
197
  });
178
198
 
179
199
  export function invoiceToJSON(invoice: Invoice): string {
@@ -45,7 +45,8 @@ export type InvoiceLineItem = {
45
45
  * Optional unique identifier associating the line item with a product.
46
46
  *
47
47
  * @remarks
48
- * This is for reporting or tracking purposes, and does not populate other details of the line item.
48
+ * When provided, images associated with the product will be included on the line item.
49
+ * This does not populate other details of the line item.
49
50
  */
50
51
  productID?: string | undefined;
51
52
  /**
@@ -30,12 +30,6 @@ import {
30
30
  InstantBankTransactionDetails$Outbound,
31
31
  InstantBankTransactionDetails$outboundSchema,
32
32
  } from "./instantbanktransactiondetails.js";
33
- import {
34
- RTPTransactionDetails,
35
- RTPTransactionDetails$inboundSchema,
36
- RTPTransactionDetails$Outbound,
37
- RTPTransactionDetails$outboundSchema,
38
- } from "./rtptransactiondetails.js";
39
33
  import {
40
34
  TransferAccount,
41
35
  TransferAccount$inboundSchema,
@@ -94,10 +88,6 @@ export type TransferDestination = {
94
88
  * Card-specific details about the transaction.
95
89
  */
96
90
  cardDetails?: CardTransactionDetails | undefined;
97
- /**
98
- * RTP specific details about the transaction.
99
- */
100
- rtpDetails?: RTPTransactionDetails | undefined;
101
91
  /**
102
92
  * Instant-bank specific details about the transaction.
103
93
  */
@@ -119,7 +109,6 @@ export const TransferDestination$inboundSchema: z.ZodType<
119
109
  achDetails: ACHTransactionDetails$inboundSchema.optional(),
120
110
  applePay: ApplePayResponse$inboundSchema.optional(),
121
111
  cardDetails: CardTransactionDetails$inboundSchema.optional(),
122
- rtpDetails: RTPTransactionDetails$inboundSchema.optional(),
123
112
  instantBankDetails: InstantBankTransactionDetails$inboundSchema.optional(),
124
113
  });
125
114
  /** @internal */
@@ -133,7 +122,6 @@ export type TransferDestination$Outbound = {
133
122
  achDetails?: ACHTransactionDetails$Outbound | undefined;
134
123
  applePay?: ApplePayResponse$Outbound | undefined;
135
124
  cardDetails?: CardTransactionDetails$Outbound | undefined;
136
- rtpDetails?: RTPTransactionDetails$Outbound | undefined;
137
125
  instantBankDetails?: InstantBankTransactionDetails$Outbound | undefined;
138
126
  };
139
127
 
@@ -152,7 +140,6 @@ export const TransferDestination$outboundSchema: z.ZodType<
152
140
  achDetails: ACHTransactionDetails$outboundSchema.optional(),
153
141
  applePay: ApplePayResponse$outboundSchema.optional(),
154
142
  cardDetails: CardTransactionDetails$outboundSchema.optional(),
155
- rtpDetails: RTPTransactionDetails$outboundSchema.optional(),
156
143
  instantBankDetails: InstantBankTransactionDetails$outboundSchema.optional(),
157
144
  });
158
145
 
@@ -36,7 +36,10 @@ export type UpdateInvoice = {
36
36
  * The status can be updated to one of the following values under specific conditions:
37
37
  *
38
38
  * @remarks
39
- * - `canceled`: Can only be set if the current status is `draft`, `unpaid`, or `overdue`.
39
+ * - `canceled`: Can only be set if the current status is `draft`, `unpaid`, or `overdue`. Canceling an invoice
40
+ * indicates the invoice is no longer expected to be paid (e.g., the charge was waived or terms changed).
41
+ * Canceled invoices still appear in list results by default and remain part of the invoice history.
42
+ * To completely discard an invoice created by mistake, use the delete endpoint instead.
40
43
  * - `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.
41
44
  */
42
45
  status?: InvoiceStatus | undefined;
@@ -0,0 +1,172 @@
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
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type DeleteInvoiceGlobals = {
12
+ /**
13
+ * Specify an API version.
14
+ *
15
+ * @remarks
16
+ *
17
+ * API versioning follows the format `vYYYY.QQ.BB`, where
18
+ * - `YYYY` is the year
19
+ * - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
20
+ * - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
21
+ * - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
22
+ *
23
+ * The `dev` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
24
+ * When no version is specified, the API defaults to `v2024.01.00`.
25
+ */
26
+ xMoovVersion?: string | undefined;
27
+ };
28
+
29
+ export type DeleteInvoiceRequest = {
30
+ accountID: string;
31
+ invoiceID: string;
32
+ };
33
+
34
+ export type DeleteInvoiceResponse = {
35
+ headers: { [k: string]: Array<string> };
36
+ };
37
+
38
+ /** @internal */
39
+ export const DeleteInvoiceGlobals$inboundSchema: z.ZodType<
40
+ DeleteInvoiceGlobals,
41
+ z.ZodTypeDef,
42
+ unknown
43
+ > = z.object({
44
+ "X-Moov-Version": z.string().optional(),
45
+ }).transform((v) => {
46
+ return remap$(v, {
47
+ "X-Moov-Version": "xMoovVersion",
48
+ });
49
+ });
50
+ /** @internal */
51
+ export type DeleteInvoiceGlobals$Outbound = {
52
+ "X-Moov-Version"?: string | undefined;
53
+ };
54
+
55
+ /** @internal */
56
+ export const DeleteInvoiceGlobals$outboundSchema: z.ZodType<
57
+ DeleteInvoiceGlobals$Outbound,
58
+ z.ZodTypeDef,
59
+ DeleteInvoiceGlobals
60
+ > = z.object({
61
+ xMoovVersion: z.string().optional(),
62
+ }).transform((v) => {
63
+ return remap$(v, {
64
+ xMoovVersion: "X-Moov-Version",
65
+ });
66
+ });
67
+
68
+ export function deleteInvoiceGlobalsToJSON(
69
+ deleteInvoiceGlobals: DeleteInvoiceGlobals,
70
+ ): string {
71
+ return JSON.stringify(
72
+ DeleteInvoiceGlobals$outboundSchema.parse(deleteInvoiceGlobals),
73
+ );
74
+ }
75
+ export function deleteInvoiceGlobalsFromJSON(
76
+ jsonString: string,
77
+ ): SafeParseResult<DeleteInvoiceGlobals, SDKValidationError> {
78
+ return safeParse(
79
+ jsonString,
80
+ (x) => DeleteInvoiceGlobals$inboundSchema.parse(JSON.parse(x)),
81
+ `Failed to parse 'DeleteInvoiceGlobals' from JSON`,
82
+ );
83
+ }
84
+
85
+ /** @internal */
86
+ export const DeleteInvoiceRequest$inboundSchema: z.ZodType<
87
+ DeleteInvoiceRequest,
88
+ z.ZodTypeDef,
89
+ unknown
90
+ > = z.object({
91
+ accountID: z.string(),
92
+ invoiceID: z.string(),
93
+ });
94
+ /** @internal */
95
+ export type DeleteInvoiceRequest$Outbound = {
96
+ accountID: string;
97
+ invoiceID: string;
98
+ };
99
+
100
+ /** @internal */
101
+ export const DeleteInvoiceRequest$outboundSchema: z.ZodType<
102
+ DeleteInvoiceRequest$Outbound,
103
+ z.ZodTypeDef,
104
+ DeleteInvoiceRequest
105
+ > = z.object({
106
+ accountID: z.string(),
107
+ invoiceID: z.string(),
108
+ });
109
+
110
+ export function deleteInvoiceRequestToJSON(
111
+ deleteInvoiceRequest: DeleteInvoiceRequest,
112
+ ): string {
113
+ return JSON.stringify(
114
+ DeleteInvoiceRequest$outboundSchema.parse(deleteInvoiceRequest),
115
+ );
116
+ }
117
+ export function deleteInvoiceRequestFromJSON(
118
+ jsonString: string,
119
+ ): SafeParseResult<DeleteInvoiceRequest, SDKValidationError> {
120
+ return safeParse(
121
+ jsonString,
122
+ (x) => DeleteInvoiceRequest$inboundSchema.parse(JSON.parse(x)),
123
+ `Failed to parse 'DeleteInvoiceRequest' from JSON`,
124
+ );
125
+ }
126
+
127
+ /** @internal */
128
+ export const DeleteInvoiceResponse$inboundSchema: z.ZodType<
129
+ DeleteInvoiceResponse,
130
+ z.ZodTypeDef,
131
+ unknown
132
+ > = z.object({
133
+ Headers: z.record(z.array(z.string())).default({}),
134
+ }).transform((v) => {
135
+ return remap$(v, {
136
+ "Headers": "headers",
137
+ });
138
+ });
139
+ /** @internal */
140
+ export type DeleteInvoiceResponse$Outbound = {
141
+ Headers: { [k: string]: Array<string> };
142
+ };
143
+
144
+ /** @internal */
145
+ export const DeleteInvoiceResponse$outboundSchema: z.ZodType<
146
+ DeleteInvoiceResponse$Outbound,
147
+ z.ZodTypeDef,
148
+ DeleteInvoiceResponse
149
+ > = z.object({
150
+ headers: z.record(z.array(z.string())),
151
+ }).transform((v) => {
152
+ return remap$(v, {
153
+ headers: "Headers",
154
+ });
155
+ });
156
+
157
+ export function deleteInvoiceResponseToJSON(
158
+ deleteInvoiceResponse: DeleteInvoiceResponse,
159
+ ): string {
160
+ return JSON.stringify(
161
+ DeleteInvoiceResponse$outboundSchema.parse(deleteInvoiceResponse),
162
+ );
163
+ }
164
+ export function deleteInvoiceResponseFromJSON(
165
+ jsonString: string,
166
+ ): SafeParseResult<DeleteInvoiceResponse, SDKValidationError> {
167
+ return safeParse(
168
+ jsonString,
169
+ (x) => DeleteInvoiceResponse$inboundSchema.parse(JSON.parse(x)),
170
+ `Failed to parse 'DeleteInvoiceResponse' from JSON`,
171
+ );
172
+ }
@@ -33,6 +33,7 @@ export * from "./createwallet.js";
33
33
  export * from "./createwebhook.js";
34
34
  export * from "./deletedisputeevidencefile.js";
35
35
  export * from "./deleteimage.js";
36
+ export * from "./deleteinvoice.js";
36
37
  export * from "./deleterepresentative.js";
37
38
  export * from "./deleteterminalapplication.js";
38
39
  export * from "./disablebankaccount.js";
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { invoicesCreateInvoice } from "../funcs/invoicesCreateInvoice.js";
6
6
  import { invoicesCreateInvoicePayment } from "../funcs/invoicesCreateInvoicePayment.js";
7
+ import { invoicesDelete } from "../funcs/invoicesDelete.js";
7
8
  import { invoicesGetInvoice } from "../funcs/invoicesGetInvoice.js";
8
9
  import { invoicesListInvoicePayments } from "../funcs/invoicesListInvoicePayments.js";
9
10
  import { invoicesListInvoices } from "../funcs/invoicesListInvoices.js";
@@ -81,6 +82,29 @@ export class Invoices extends ClientSDK {
81
82
  ));
82
83
  }
83
84
 
85
+ /**
86
+ * Delete an invoice. Only invoices in `draft` status can be deleted.
87
+ *
88
+ * Deleting an invoice indicates it was created by mistake and should be completely disregarded.
89
+ * Deleted invoices are hidden from list results by default, but can still be retrieved
90
+ * individually through the get invoice endpoint. If you need to void an invoice that was
91
+ * already sent or is otherwise part of the invoice history, cancel it instead by updating
92
+ * its status to `canceled`.
93
+ *
94
+ * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
95
+ * you'll need to specify the `/accounts/{accountID}/invoices.write` scope.
96
+ */
97
+ async delete(
98
+ request: operations.DeleteInvoiceRequest,
99
+ options?: RequestOptions,
100
+ ): Promise<operations.DeleteInvoiceResponse | undefined> {
101
+ return unwrapAsync(invoicesDelete(
102
+ this,
103
+ request,
104
+ options,
105
+ ));
106
+ }
107
+
84
108
  /**
85
109
  * Creates a payment resource to represent that an invoice was paid outside of the Moov platform.
86
110
  * If a payment link was created for the invoice, the corresponding payment link is canceled, but a receipt is still sent.
@@ -1,26 +0,0 @@
1
- import * as z from "zod/v3";
2
- import { ClosedEnum } from "../../types/enums.js";
3
- /**
4
- * Status codes for RTP failures.
5
- */
6
- export declare const RTPFailureCode: {
7
- readonly ProcessingError: "processing-error";
8
- readonly InvalidAccount: "invalid-account";
9
- readonly AccountClosed: "account-closed";
10
- readonly AccountBlocked: "account-blocked";
11
- readonly InvalidField: "invalid-field";
12
- readonly TransactionNotSupported: "transaction-not-supported";
13
- readonly LimitExceeded: "limit-exceeded";
14
- readonly InvalidAmount: "invalid-amount";
15
- readonly CustomerDeceased: "customer-deceased";
16
- readonly Other: "other";
17
- };
18
- /**
19
- * Status codes for RTP failures.
20
- */
21
- export type RTPFailureCode = ClosedEnum<typeof RTPFailureCode>;
22
- /** @internal */
23
- export declare const RTPFailureCode$inboundSchema: z.ZodNativeEnum<typeof RTPFailureCode>;
24
- /** @internal */
25
- export declare const RTPFailureCode$outboundSchema: z.ZodNativeEnum<typeof RTPFailureCode>;
26
- //# sourceMappingURL=rtpfailurecode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rtpfailurecode.d.ts","sourceRoot":"","sources":["../../src/models/components/rtpfailurecode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAE/D,gBAAgB;AAChB,eAAO,MAAM,4BAA4B,EAAE,CAAC,CAAC,aAAa,CACxD,OAAO,cAAc,CACS,CAAC;AACjC,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,EAAE,CAAC,CAAC,aAAa,CACzD,OAAO,cAAc,CACS,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"rtpfailurecode.js","sourceRoot":"","sources":["../../src/models/components/rtpfailurecode.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0CAA4B;AAG5B;;GAEG;AACU,QAAA,cAAc,GAAG;IAC5B,eAAe,EAAE,kBAAkB;IACnC,cAAc,EAAE,iBAAiB;IACjC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,YAAY,EAAE,eAAe;IAC7B,uBAAuB,EAAE,2BAA2B;IACpD,aAAa,EAAE,gBAAgB;IAC/B,aAAa,EAAE,gBAAgB;IAC/B,gBAAgB,EAAE,mBAAmB;IACrC,KAAK,EAAE,OAAO;CACN,CAAC;AAMX,gBAAgB;AACH,QAAA,4BAA4B,GAErC,CAAC,CAAC,UAAU,CAAC,sBAAc,CAAC,CAAC;AACjC,gBAAgB;AACH,QAAA,6BAA6B,GAEtC,oCAA4B,CAAC"}
@@ -1,43 +0,0 @@
1
- import * as z from "zod/v3";
2
- import { Result as SafeParseResult } from "../../types/fp.js";
3
- import { SDKValidationError } from "../errors/sdkvalidationerror.js";
4
- import { RTPFailureCode } from "./rtpfailurecode.js";
5
- import { RTPTransactionStatus } from "./rtptransactionstatus.js";
6
- /**
7
- * RTP specific details about the transaction.
8
- */
9
- export type RTPTransactionDetails = {
10
- /**
11
- * Status of a transaction within the RTP lifecycle.
12
- */
13
- status?: RTPTransactionStatus | undefined;
14
- /**
15
- * Response code returned by network on failure.
16
- */
17
- networkResponseCode?: string | undefined;
18
- /**
19
- * Status codes for RTP failures.
20
- */
21
- failureCode?: RTPFailureCode | undefined;
22
- initiatedOn?: Date | undefined;
23
- completedOn?: Date | undefined;
24
- failedOn?: Date | undefined;
25
- acceptedWithoutPostingOn?: Date | undefined;
26
- };
27
- /** @internal */
28
- export declare const RTPTransactionDetails$inboundSchema: z.ZodType<RTPTransactionDetails, z.ZodTypeDef, unknown>;
29
- /** @internal */
30
- export type RTPTransactionDetails$Outbound = {
31
- status?: string | undefined;
32
- networkResponseCode?: string | undefined;
33
- failureCode?: string | undefined;
34
- initiatedOn?: string | undefined;
35
- completedOn?: string | undefined;
36
- failedOn?: string | undefined;
37
- acceptedWithoutPostingOn?: string | undefined;
38
- };
39
- /** @internal */
40
- export declare const RTPTransactionDetails$outboundSchema: z.ZodType<RTPTransactionDetails$Outbound, z.ZodTypeDef, RTPTransactionDetails>;
41
- export declare function rtpTransactionDetailsToJSON(rtpTransactionDetails: RTPTransactionDetails): string;
42
- export declare function rtpTransactionDetailsFromJSON(jsonString: string): SafeParseResult<RTPTransactionDetails, SDKValidationError>;
43
- //# sourceMappingURL=rtptransactiondetails.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rtptransactiondetails.d.ts","sourceRoot":"","sources":["../../src/models/components/rtptransactiondetails.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,cAAc,EAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EAGrB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC1C;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC;;OAEG;IACH,WAAW,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACzC,WAAW,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,wBAAwB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,mCAAmC,EAAE,CAAC,CAAC,OAAO,CACzD,qBAAqB,EACrB,CAAC,CAAC,UAAU,EACZ,OAAO,CAcP,CAAC;AACH,gBAAgB;AAChB,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,oCAAoC,EAAE,CAAC,CAAC,OAAO,CAC1D,8BAA8B,EAC9B,CAAC,CAAC,UAAU,EACZ,qBAAqB,CASrB,CAAC;AAEH,wBAAgB,2BAA2B,CACzC,qBAAqB,EAAE,qBAAqB,GAC3C,MAAM,CAIR;AACD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAM5D"}
@@ -1,75 +0,0 @@
1
- "use strict";
2
- /*
3
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.RTPTransactionDetails$outboundSchema = exports.RTPTransactionDetails$inboundSchema = void 0;
40
- exports.rtpTransactionDetailsToJSON = rtpTransactionDetailsToJSON;
41
- exports.rtpTransactionDetailsFromJSON = rtpTransactionDetailsFromJSON;
42
- const z = __importStar(require("zod/v3"));
43
- const schemas_js_1 = require("../../lib/schemas.js");
44
- const rtpfailurecode_js_1 = require("./rtpfailurecode.js");
45
- const rtptransactionstatus_js_1 = require("./rtptransactionstatus.js");
46
- /** @internal */
47
- exports.RTPTransactionDetails$inboundSchema = z.object({
48
- status: rtptransactionstatus_js_1.RTPTransactionStatus$inboundSchema.optional(),
49
- networkResponseCode: z.string().optional(),
50
- failureCode: rtpfailurecode_js_1.RTPFailureCode$inboundSchema.optional(),
51
- initiatedOn: z.string().datetime({ offset: true }).transform(v => new Date(v))
52
- .optional(),
53
- completedOn: z.string().datetime({ offset: true }).transform(v => new Date(v))
54
- .optional(),
55
- failedOn: z.string().datetime({ offset: true }).transform(v => new Date(v))
56
- .optional(),
57
- acceptedWithoutPostingOn: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
58
- });
59
- /** @internal */
60
- exports.RTPTransactionDetails$outboundSchema = z.object({
61
- status: rtptransactionstatus_js_1.RTPTransactionStatus$outboundSchema.optional(),
62
- networkResponseCode: z.string().optional(),
63
- failureCode: rtpfailurecode_js_1.RTPFailureCode$outboundSchema.optional(),
64
- initiatedOn: z.date().transform(v => v.toISOString()).optional(),
65
- completedOn: z.date().transform(v => v.toISOString()).optional(),
66
- failedOn: z.date().transform(v => v.toISOString()).optional(),
67
- acceptedWithoutPostingOn: z.date().transform(v => v.toISOString()).optional(),
68
- });
69
- function rtpTransactionDetailsToJSON(rtpTransactionDetails) {
70
- return JSON.stringify(exports.RTPTransactionDetails$outboundSchema.parse(rtpTransactionDetails));
71
- }
72
- function rtpTransactionDetailsFromJSON(jsonString) {
73
- return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RTPTransactionDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RTPTransactionDetails' from JSON`);
74
- }
75
- //# sourceMappingURL=rtptransactiondetails.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rtptransactiondetails.js","sourceRoot":"","sources":["../../src/models/components/rtptransactiondetails.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFH,kEAMC;AACD,sEAQC;AAjGD,0CAA4B;AAC5B,qDAAiD;AAGjD,2DAI6B;AAC7B,uEAImC;AAwBnC,gBAAgB;AACH,QAAA,mCAAmC,GAI5C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,EAAE,4DAAkC,CAAC,QAAQ,EAAE;IACrD,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,gDAA4B,CAAC,QAAQ,EAAE;IACpD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;SAC3E,QAAQ,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;SAC3E,QAAQ,EAAE;IACb,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;SACxE,QAAQ,EAAE;IACb,wBAAwB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAC5E,IAAI,IAAI,CAAC,CAAC,CAAC,CACZ,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC;AAYH,gBAAgB;AACH,QAAA,oCAAoC,GAI7C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,EAAE,6DAAmC,CAAC,QAAQ,EAAE;IACtD,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,iDAA6B,CAAC,QAAQ,EAAE;IACrD,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChE,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChE,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC7D,wBAAwB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC9E,CAAC,CAAC;AAEH,SAAgB,2BAA2B,CACzC,qBAA4C;IAE5C,OAAO,IAAI,CAAC,SAAS,CACnB,4CAAoC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAClE,CAAC;AACJ,CAAC;AACD,SAAgB,6BAA6B,CAC3C,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,2CAAmC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC/D,mDAAmD,CACpD,CAAC;AACJ,CAAC"}