/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CardBrand, CardBrand$inboundSchema, CardBrand$outboundSchema, } from "./cardbrand.js"; import { CardExpiration, CardExpiration$inboundSchema, CardExpiration$Outbound, CardExpiration$outboundSchema, } from "./cardexpiration.js"; import { CardType, CardType$inboundSchema, CardType$outboundSchema, } from "./cardtype.js"; import { EntryMode, EntryMode$inboundSchema, EntryMode$outboundSchema, } from "./entrymode.js"; /** * Describes payment card details captured with tap or in-person payment. */ export type TerminalCard = { /** * How the card information was entered into the point of sale terminal. */ entryMode?: EntryMode | undefined; /** * The card brand. */ brand?: CardBrand | undefined; bin?: string | undefined; /** * The type of the card. */ cardType?: CardType | undefined; /** * The expiration date of the card or token. */ expiration?: CardExpiration | undefined; /** * Uniquely identifies a linked payment card or token. * * @remarks * For Apple Pay, the fingerprint is based on the tokenized card number and may vary based on the user's device. * This field can be used to identify specific payment methods across multiple accounts on your platform. */ fingerprint?: string | undefined; /** * The name of the cardholder as it appears on the card. */ holderName?: string | undefined; /** * Financial institution that issued the card. */ issuer?: string | undefined; /** * Country where the card was issued. */ issuerCountry?: string | undefined; /** * Last four digits of the card number */ lastFourCardNumber?: string | undefined; /** * Identifier for the point of sale terminal application. */ applicationID?: string | undefined; /** * Name label for the point of sale terminal application. */ applicationName?: string | undefined; }; /** @internal */ export const TerminalCard$inboundSchema: z.ZodType< TerminalCard, z.ZodTypeDef, unknown > = z.object({ entryMode: EntryMode$inboundSchema.optional(), brand: CardBrand$inboundSchema.optional(), bin: z.string().optional(), cardType: CardType$inboundSchema.optional(), expiration: CardExpiration$inboundSchema.optional(), fingerprint: z.string().optional(), holderName: z.string().optional(), issuer: z.string().optional(), issuerCountry: z.string().optional(), lastFourCardNumber: z.string().optional(), applicationID: z.string().optional(), applicationName: z.string().optional(), }); /** @internal */ export type TerminalCard$Outbound = { entryMode?: string | undefined; brand?: string | undefined; bin?: string | undefined; cardType?: string | undefined; expiration?: CardExpiration$Outbound | undefined; fingerprint?: string | undefined; holderName?: string | undefined; issuer?: string | undefined; issuerCountry?: string | undefined; lastFourCardNumber?: string | undefined; applicationID?: string | undefined; applicationName?: string | undefined; }; /** @internal */ export const TerminalCard$outboundSchema: z.ZodType< TerminalCard$Outbound, z.ZodTypeDef, TerminalCard > = z.object({ entryMode: EntryMode$outboundSchema.optional(), brand: CardBrand$outboundSchema.optional(), bin: z.string().optional(), cardType: CardType$outboundSchema.optional(), expiration: CardExpiration$outboundSchema.optional(), fingerprint: z.string().optional(), holderName: z.string().optional(), issuer: z.string().optional(), issuerCountry: z.string().optional(), lastFourCardNumber: z.string().optional(), applicationID: z.string().optional(), applicationName: z.string().optional(), }); export function terminalCardToJSON(terminalCard: TerminalCard): string { return JSON.stringify(TerminalCard$outboundSchema.parse(terminalCard)); } export function terminalCardFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TerminalCard$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TerminalCard' from JSON`, ); }