/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DigitalWalletAddress, DigitalWalletAddress$inboundSchema, } from "./digitalwalletaddress.js"; import { DigitalWalletProvider, DigitalWalletProvider$inboundSchema, } from "./digitalwalletprovider.js"; export type DigitalWallet = { /** * Always `digital-wallet`. */ type: "digital-wallet"; /** * The ID for the digital wallet. */ id: string; /** * The ID of the merchant account this digital wallet belongs to. */ merchantAccountId: string; provider: DigitalWalletProvider; /** * The name of the merchant the digital wallet is registered to. */ merchantName: string; /** * The consumer facing name of the merchant. */ merchantDisplayName?: string | null | undefined; /** * The main URL of the merchant. */ merchantUrl?: string | null | undefined; /** * The country code where the merchant is registered. */ merchantCountryCode?: string | null | undefined; /** * Merchant classification for the type of goods or services it provides. */ merchantCategoryCode?: string | null | undefined; /** * The merchant address associated with the digital wallet. */ address?: DigitalWalletAddress | null | undefined; /** * Provider-specific configuration. Currently only used by Paze. */ extraConfiguration?: { [k: string]: any } | null | undefined; /** * The list of domain names that a digital wallet can be used on (deprecated). */ domainNames: Array; /** * The number of active custom certificates registered for this digital wallet (Apple Pay only). */ activeCertificateCount: number; /** * The number of pending custom certificates registered for this digital wallet (Apple Pay only). */ pendingCertificateCount: number; /** * The number of expired custom certificates registered for this digital wallet (Apple Pay only). */ expiredCertificateCount: number; /** * Custom attributes for some digital wallets. Currently only used by Click to Pay. */ fields?: { [k: string]: any } | null | undefined; /** * The date this buyer was created at. */ createdAt: Date; /** * The date this buyer was last updated at. */ updatedAt: Date; }; /** @internal */ export const DigitalWallet$inboundSchema: z.ZodType< DigitalWallet, z.ZodTypeDef, unknown > = z.object({ type: z.literal("digital-wallet").default("digital-wallet"), id: z.string(), merchant_account_id: z.string(), provider: DigitalWalletProvider$inboundSchema, merchant_name: z.string(), merchant_display_name: z.nullable(z.string()).optional(), merchant_url: z.nullable(z.string()).optional(), merchant_country_code: z.nullable(z.string()).optional(), merchant_category_code: z.nullable(z.string()).optional(), address: z.nullable(DigitalWalletAddress$inboundSchema).optional(), extra_configuration: z.nullable(z.record(z.any())).optional(), domain_names: z.array(z.string()), active_certificate_count: z.number().int().default(0), pending_certificate_count: z.number().int().default(0), expired_certificate_count: z.number().int().default(0), fields: z.nullable(z.record(z.any())).optional(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), }).transform((v) => { return remap$(v, { "merchant_account_id": "merchantAccountId", "merchant_name": "merchantName", "merchant_display_name": "merchantDisplayName", "merchant_url": "merchantUrl", "merchant_country_code": "merchantCountryCode", "merchant_category_code": "merchantCategoryCode", "extra_configuration": "extraConfiguration", "domain_names": "domainNames", "active_certificate_count": "activeCertificateCount", "pending_certificate_count": "pendingCertificateCount", "expired_certificate_count": "expiredCertificateCount", "created_at": "createdAt", "updated_at": "updatedAt", }); }); export function digitalWalletFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DigitalWallet$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DigitalWallet' from JSON`, ); }