/* * 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 { GooglePayAssuranceDetails, GooglePayAssuranceDetails$Outbound, GooglePayAssuranceDetails$outboundSchema, } from "./googlepayassurancedetails.js"; /** * The opaque token as received from the Google Pay JS library. This format may change between JS library versions. */ export type Token = string | { [k: string]: any }; /** * Create a Google Pay transaction with a device token. */ export type GooglePayPaymentMethodCreate = { /** * The external identifier of the buyer to create a payment for. */ buyerExternalIdentifier?: string | null | undefined; /** * The ID of the buyer to retrieve billing details for. */ buyerId?: string | null | undefined; /** * The card holder name associated to the original card for the token. */ cardholderName?: string | null | undefined; /** * The URL to redirect a user back to after the complete 3DS in browser. */ redirectUrl?: string | null | undefined; /** * The last 4 digits of the original card used to generate the token. */ cardSuffix?: string | null | undefined; /** * The original card scheme for which the token was generated. */ cardScheme?: string | null | undefined; /** * The payment scheme of the card. */ cardType?: string | null | undefined; /** * Always `googlepay` */ method: "googlepay"; /** * The opaque token as received from the Google Pay JS library. This format may change between JS library versions. */ token: string | { [k: string]: any }; /** * The assurance details provided by Google Pay */ assuranceDetails?: GooglePayAssuranceDetails | null | undefined; }; /** @internal */ export type Token$Outbound = string | { [k: string]: any }; /** @internal */ export const Token$outboundSchema: z.ZodType< Token$Outbound, z.ZodTypeDef, Token > = z.union([z.string(), z.record(z.any())]); export function tokenToJSON(token: Token): string { return JSON.stringify(Token$outboundSchema.parse(token)); } /** @internal */ export type GooglePayPaymentMethodCreate$Outbound = { buyer_external_identifier?: string | null | undefined; buyer_id?: string | null | undefined; cardholder_name?: string | null | undefined; redirect_url?: string | null | undefined; card_suffix?: string | null | undefined; card_scheme?: string | null | undefined; card_type?: string | null | undefined; method: "googlepay"; token: string | { [k: string]: any }; assurance_details?: GooglePayAssuranceDetails$Outbound | null | undefined; }; /** @internal */ export const GooglePayPaymentMethodCreate$outboundSchema: z.ZodType< GooglePayPaymentMethodCreate$Outbound, z.ZodTypeDef, GooglePayPaymentMethodCreate > = z.object({ buyerExternalIdentifier: z.nullable(z.string()).optional(), buyerId: z.nullable(z.string()).optional(), cardholderName: z.nullable(z.string()).optional(), redirectUrl: z.nullable(z.string()).optional(), cardSuffix: z.nullable(z.string()).optional(), cardScheme: z.nullable(z.string()).optional(), cardType: z.nullable(z.string()).optional(), method: z.literal("googlepay"), token: z.union([z.string(), z.record(z.any())]), assuranceDetails: z.nullable(GooglePayAssuranceDetails$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { buyerExternalIdentifier: "buyer_external_identifier", buyerId: "buyer_id", cardholderName: "cardholder_name", redirectUrl: "redirect_url", cardSuffix: "card_suffix", cardScheme: "card_scheme", cardType: "card_type", assuranceDetails: "assurance_details", }); }); export function googlePayPaymentMethodCreateToJSON( googlePayPaymentMethodCreate: GooglePayPaymentMethodCreate, ): string { return JSON.stringify( GooglePayPaymentMethodCreate$outboundSchema.parse( googlePayPaymentMethodCreate, ), ); }