diff --git a/package-lock.json b/package-lock.json index 3ae43ea..eaf8223 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "bs58": "6.0.0", "elliptic": "6.6.1", "lodash": "4.17.21", - "zod": "3.25.76" + "zod": "4.1.8" }, "bin": { "bitpay-sdk": "bin/index.js" @@ -9400,9 +9400,9 @@ } }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.8.tgz", + "integrity": "sha512-5R1P+WwQqmmMIEACyzSvo4JXHY5WiAFHRMg+zBZKgKS+Q1viRa0C1hmUKtHltoIFKtIdki3pRxkmpP74jnNYHQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index 97ac586..afad0dd 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "bs58": "6.0.0", "elliptic": "6.6.1", "lodash": "4.17.21", - "zod": "3.25.76" + "zod": "4.1.8" }, "devDependencies": { "@types/bs58": "4.0.4", diff --git a/src/Model/Invoice/Invoice.zod.ts b/src/Model/Invoice/Invoice.zod.ts index 9584caf..5a1c216 100644 --- a/src/Model/Invoice/Invoice.zod.ts +++ b/src/Model/Invoice/Invoice.zod.ts @@ -1,13 +1,13 @@ import { z } from 'zod'; import { buyerInterfaceSchema } from './Buyer.zod'; -import { invoiceTransactionSchema } from './InvoiceTransaction.zod'; import { invoiceBuyerProvidedInfoSchema } from './InvoiceBuyerProvidedInfo.zod'; +import { invoiceRefundAddressesSchema } from './InvoiceRefundAddresses.zod'; +import { invoiceTransactionSchema } from './InvoiceTransaction.zod'; import { invoiceUniversalCodesSchema } from './InvoiceUniversalCodes.zod'; +import { minerFeesItemSchema } from './MinerFeesItem.zod'; import { refundInfoSchema } from './RefundInfo.zod'; import { shopperSchema } from './Shopper.zod'; -import { minerFeesItemSchema } from './MinerFeesItem.zod'; import { supportedTransactionCurrencySchema } from './SupportedTransactionCurrency.zod'; -import { invoiceRefundAddressesSchema } from './InvoiceRefundAddresses.zod'; export const invoiceSchema = z.object({ buyer: buyerInterfaceSchema.optional(), @@ -18,7 +18,6 @@ export const invoiceSchema = z.object({ shopper: shopperSchema.optional(), refundInfo: refundInfoSchema.optional(), universalCodes: invoiceUniversalCodesSchema.optional(), - currency: z.string().optional(), guid: z.string().optional(), token: z.string().optional(), @@ -56,17 +55,17 @@ export const invoiceSchema = z.object({ transactionCurrency: z.string().optional(), amountPaid: z.number().optional(), displayAmountPaid: z.string().optional(), - exchangeRates: z.record(z.record(z.number())).nullable(), - paymentSubtotals: z.record(z.number()).nullable(), - paymentTotals: z.record(z.number()).nullable(), - paymentDisplayTotals: z.record(z.string()).nullable(), - paymentDisplaySubTotals: z.record(z.string()).nullable(), + exchangeRates: z.record(z.string(), z.record(z.string(), z.number())).nullable(), + paymentSubtotals: z.record(z.string(), z.number()).nullable(), + paymentTotals: z.record(z.string(), z.number()).nullable(), + paymentDisplayTotals: z.record(z.string(), z.string()).nullable(), + paymentDisplaySubTotals: z.record(z.string(), z.string()).nullable(), nonPayProPaymentReceived: z.boolean().optional(), jsonPayProRequired: z.boolean().optional(), merchantName: z.string().optional(), bitpayIdRequired: z.boolean().optional(), underpaidAmount: z.number().optional(), overpaidAmount: z.number().optional(), - paymentCodes: z.record(z.record(z.string())).nullable(), + paymentCodes: z.record(z.string(), z.record(z.string(), z.string())).nullable(), isCancelled: z.boolean().optional() }); diff --git a/src/Model/Invoice/RefundInfo.zod.ts b/src/Model/Invoice/RefundInfo.zod.ts index a68f7f1..d5dd538 100644 --- a/src/Model/Invoice/RefundInfo.zod.ts +++ b/src/Model/Invoice/RefundInfo.zod.ts @@ -3,5 +3,5 @@ import { z } from 'zod'; export const refundInfoSchema = z.object({ supportRequest: z.string(), currency: z.string(), - amounts: z.record(z.number()).optional() + amounts: z.record(z.string(), z.number()).optional() }); diff --git a/src/Model/Payout/Payout.zod.ts b/src/Model/Payout/Payout.zod.ts index 66bec12..3f88981 100644 --- a/src/Model/Payout/Payout.zod.ts +++ b/src/Model/Payout/Payout.zod.ts @@ -23,7 +23,7 @@ export const payoutInterfaceSchema = z.object({ status: z.string().optional(), groupId: z.string().optional(), requestDate: z.string().optional(), - exchangeRates: z.record(z.record(z.number())).optional(), + exchangeRates: z.record(z.string(), z.record(z.string(), z.number())).optional(), code: z.number().optional(), ignoreEmails: z.boolean().optional() }); diff --git a/src/Model/Settlement/InvoiceData.zod.ts b/src/Model/Settlement/InvoiceData.zod.ts index 3e77a33..3b50fe4 100644 --- a/src/Model/Settlement/InvoiceData.zod.ts +++ b/src/Model/Settlement/InvoiceData.zod.ts @@ -9,5 +9,5 @@ export const invoiceDataInterfaceSchema = z.object({ date: z.string().optional(), currency: z.string().optional(), transactionCurrency: z.string().optional(), - payoutPercentage: z.record(z.number()).optional() + payoutPercentage: z.record(z.string(), z.number()).optional() }); diff --git a/src/Model/Settlement/RefundInfo.zod.ts b/src/Model/Settlement/RefundInfo.zod.ts index cbabd55..981c9e5 100644 --- a/src/Model/Settlement/RefundInfo.zod.ts +++ b/src/Model/Settlement/RefundInfo.zod.ts @@ -4,5 +4,5 @@ export const refundInfoInterfaceSchema = z.object({ supportRequest: z.string().optional(), currency: z.string(), refundRequestEid: z.string().optional(), - amounts: z.record(z.number()).optional() + amounts: z.record(z.string(), z.number()).optional() }); diff --git a/src/Model/Webhook/InvoiceWebhook.zod.ts b/src/Model/Webhook/InvoiceWebhook.zod.ts index 7e90e75..4ece486 100644 --- a/src/Model/Webhook/InvoiceWebhook.zod.ts +++ b/src/Model/Webhook/InvoiceWebhook.zod.ts @@ -12,9 +12,9 @@ export const invoiceWebhookSchema = z.object({ currencyTime: z.string().optional(), exceptionStatus: z.string().optional(), buyerFields: invoiceWebhookBuyerFieldsInterfaceSchema.optional(), - paymentSubtotals: z.record(z.number()).nullable(), - paymentTotals: z.record(z.number()).nullable(), - exchangeRates: z.record(z.record(z.number())).nullable(), + paymentSubtotals: z.record(z.string(), z.number()).nullable(), + paymentTotals: z.record(z.string(), z.number()).nullable(), + exchangeRates: z.record(z.string(), z.record(z.string(), z.number())).nullable(), amountPaid: z.number().optional(), orderId: z.string().optional(), transactionCurrency: z.string().optional(), diff --git a/src/Model/Webhook/PayoutWebhook.zod.ts b/src/Model/Webhook/PayoutWebhook.zod.ts index d95c37a..88875d7 100644 --- a/src/Model/Webhook/PayoutWebhook.zod.ts +++ b/src/Model/Webhook/PayoutWebhook.zod.ts @@ -8,7 +8,7 @@ export const payoutWebhookSchema = z.object({ price: z.number().optional(), currency: z.string().optional(), ledgerCurrency: z.string().optional(), - exchangeRates: z.record(z.record(z.number())).optional(), + exchangeRates: z.record(z.string(), z.record(z.string(), z.number())).optional(), email: z.string().optional(), reference: z.string().optional(), label: z.string().optional(),