/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { CardScheme, CardScheme$outboundSchema } from "./cardscheme.js"; export const CardSource = { ApplePay: "apple-pay", GooglePay: "google-pay", } as const; export type CardSource = OpenEnum; export type NetworkTokenPaymentMethodCreate = { /** * Always `network-token`. */ method: "network-token"; /** * The scheme token. */ token: string; /** * The expiration date of the token. */ expirationDate: string; /** * The payment cryptogram for the network token. */ cryptogram?: string | null | undefined; /** * The URL to redirect a user back to after the complete 3DS in browser. */ redirectUrl?: string | null | undefined; /** * The optional source of the decrypted device token. */ cardSource?: CardSource | null | undefined; /** * The original card scheme for which the token was generated. */ cardScheme?: CardScheme | null | undefined; /** * The last 4 digits of the original card used to generate the token. */ cardSuffix?: string | null | undefined; /** * The card holder name associated to the original card for the token. */ cardholderName?: string | null | undefined; /** * The ecommerce indicator for the token. */ eci?: string | null | undefined; }; /** @internal */ export const CardSource$outboundSchema: z.ZodType< string, z.ZodTypeDef, CardSource > = openEnums.outboundSchema(CardSource); /** @internal */ export type NetworkTokenPaymentMethodCreate$Outbound = { method: "network-token"; token: string; expiration_date: string; cryptogram?: string | null | undefined; redirect_url?: string | null | undefined; card_source?: string | null | undefined; card_scheme?: string | null | undefined; card_suffix?: string | null | undefined; cardholder_name?: string | null | undefined; eci?: string | null | undefined; }; /** @internal */ export const NetworkTokenPaymentMethodCreate$outboundSchema: z.ZodType< NetworkTokenPaymentMethodCreate$Outbound, z.ZodTypeDef, NetworkTokenPaymentMethodCreate > = z.object({ method: z.literal("network-token"), token: z.string(), expirationDate: z.string(), cryptogram: z.nullable(z.string()).optional(), redirectUrl: z.nullable(z.string()).optional(), cardSource: z.nullable(CardSource$outboundSchema).optional(), cardScheme: z.nullable(CardScheme$outboundSchema).optional(), cardSuffix: z.nullable(z.string()).optional(), cardholderName: z.nullable(z.string()).optional(), eci: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { expirationDate: "expiration_date", redirectUrl: "redirect_url", cardSource: "card_source", cardScheme: "card_scheme", cardSuffix: "card_suffix", cardholderName: "cardholder_name", }); }); export function networkTokenPaymentMethodCreateToJSON( networkTokenPaymentMethodCreate: NetworkTokenPaymentMethodCreate, ): string { return JSON.stringify( NetworkTokenPaymentMethodCreate$outboundSchema.parse( networkTokenPaymentMethodCreate, ), ); }