/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; /** * Create a Click to Pay payment with a decrypted token and cryptogram. This * * @remarks * is mainly used internally but can be used by anyone with their own C2P * integration. */ export type ClickToPayPaymentMethodCreate = { /** * Aways `click-to-pay`. */ method: "click-to-pay"; /** * The device token. */ token: string; /** * The payment cryptogram for the device token. */ cryptogram: string; /** * The expiration date of the device token. */ expirationDate: string; /** * The ID of the buyer to associate this transaction to. */ buyerId?: string | null | undefined; /** * The external identifier of the buyer to create a transaction for. */ buyerExternalIdentifier?: string | null | undefined; /** * The external identifier of the payment method to filter by. */ externalIdentifier?: string | null | undefined; /** * The URL to redirect a user back to after the complete 3DS in browser. */ redirectUrl?: string | null | undefined; }; /** @internal */ export type ClickToPayPaymentMethodCreate$Outbound = { method: "click-to-pay"; token: string; cryptogram: string; expiration_date: string; buyer_id?: string | null | undefined; buyer_external_identifier?: string | null | undefined; external_identifier?: string | null | undefined; redirect_url?: string | null | undefined; }; /** @internal */ export const ClickToPayPaymentMethodCreate$outboundSchema: z.ZodType< ClickToPayPaymentMethodCreate$Outbound, z.ZodTypeDef, ClickToPayPaymentMethodCreate > = z.object({ method: z.literal("click-to-pay"), token: z.string(), cryptogram: z.string(), expirationDate: z.string(), buyerId: z.nullable(z.string()).optional(), buyerExternalIdentifier: z.nullable(z.string()).optional(), externalIdentifier: z.nullable(z.string()).optional(), redirectUrl: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { expirationDate: "expiration_date", buyerId: "buyer_id", buyerExternalIdentifier: "buyer_external_identifier", externalIdentifier: "external_identifier", redirectUrl: "redirect_url", }); }); export function clickToPayPaymentMethodCreateToJSON( clickToPayPaymentMethodCreate: ClickToPayPaymentMethodCreate, ): string { return JSON.stringify( ClickToPayPaymentMethodCreate$outboundSchema.parse( clickToPayPaymentMethodCreate, ), ); }