/* * 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 { CardScheme, CardScheme$outboundSchema } from "./cardscheme.js"; /** * Request body for updating a stored payment method. */ export type PaymentMethodUpdate = { /** * The new expiration date for the payment method. */ expirationDate?: string | null | undefined; /** * A scheme transaction identifier to associate with this payment method. Explicitly setting this field to `null` will also clear `scheme_transaction_id_scheme` as a side-effect. When setting a new value and `scheme_transaction_id_scheme` is both omitted from the payload and previously unset, `scheme_transaction_id_scheme` will be populated from the payment method's existing `scheme`. */ schemeTransactionId?: string | null | undefined; /** * The scheme associated with `scheme_transaction_id`. Only applies to card payments. When setting a new value for `scheme_transaction_id`, if `scheme_transaction_id_scheme` is both omitted from the payload and previously unset, `scheme_transaction_id_scheme` will be populated from the payment method's existing `scheme`. */ schemeTransactionIdScheme?: CardScheme | null | undefined; /** * A transaction link identifier to associate with this payment method. */ transactionLinkId?: string | null | undefined; }; /** @internal */ export type PaymentMethodUpdate$Outbound = { expiration_date?: string | null | undefined; scheme_transaction_id?: string | null | undefined; scheme_transaction_id_scheme?: string | null | undefined; transaction_link_id?: string | null | undefined; }; /** @internal */ export const PaymentMethodUpdate$outboundSchema: z.ZodType< PaymentMethodUpdate$Outbound, z.ZodTypeDef, PaymentMethodUpdate > = z.object({ expirationDate: z.nullable(z.string()).optional(), schemeTransactionId: z.nullable(z.string()).optional(), schemeTransactionIdScheme: z.nullable(CardScheme$outboundSchema).optional(), transactionLinkId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { expirationDate: "expiration_date", schemeTransactionId: "scheme_transaction_id", schemeTransactionIdScheme: "scheme_transaction_id_scheme", transactionLinkId: "transaction_link_id", }); }); export function paymentMethodUpdateToJSON( paymentMethodUpdate: PaymentMethodUpdate, ): string { return JSON.stringify( PaymentMethodUpdate$outboundSchema.parse(paymentMethodUpdate), ); }