/* * 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 { ClosedEnum, OpenEnum } from "../../types/enums.js"; export type ListBuyerPaymentMethodsGlobals = { merchantAccountId?: string | undefined; }; /** * The field to sort the payment methods by. */ export const SortBy = { LastUsedAt: "last_used_at", UsageCount: "usage_count", CitLastUsedAt: "cit_last_used_at", CitUsageCount: "cit_usage_count", } as const; /** * The field to sort the payment methods by. */ export type SortBy = ClosedEnum; /** * The direction to sort the payment methods in. */ export const OrderBy = { Asc: "asc", Desc: "desc", } as const; /** * The direction to sort the payment methods in. */ export type OrderBy = OpenEnum; export type ListBuyerPaymentMethodsRequest = { /** * The ID of the buyer to query payment methods for. */ buyerId?: string | null | undefined; /** * The external identifier of the buyer to query payment methods for. */ buyerExternalIdentifier?: string | null | undefined; /** * The field to sort the payment methods by. */ sortBy?: SortBy | null | undefined; /** * The direction to sort the payment methods in. */ orderBy?: OrderBy | undefined; /** * The country code to filter payment methods by. This only applies to payment methods with a `country` value. */ country?: string | null | undefined; /** * The currency code to filter payment methods by. This only applies to payment methods with a `currency` value. */ currency?: string | null | undefined; /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; }; /** @internal */ export const SortBy$outboundSchema: z.ZodNativeEnum = z .nativeEnum(SortBy); /** @internal */ export const OrderBy$outboundSchema: z.ZodType = openEnums.outboundSchema(OrderBy); /** @internal */ export type ListBuyerPaymentMethodsRequest$Outbound = { buyer_id?: string | null | undefined; buyer_external_identifier?: string | null | undefined; sort_by?: string | null | undefined; order_by: string; country?: string | null | undefined; currency?: string | null | undefined; merchantAccountId?: string | null | undefined; }; /** @internal */ export const ListBuyerPaymentMethodsRequest$outboundSchema: z.ZodType< ListBuyerPaymentMethodsRequest$Outbound, z.ZodTypeDef, ListBuyerPaymentMethodsRequest > = z.object({ buyerId: z.nullable(z.string()).optional(), buyerExternalIdentifier: z.nullable(z.string()).optional(), sortBy: z.nullable(SortBy$outboundSchema).optional(), orderBy: OrderBy$outboundSchema.default("desc"), country: z.nullable(z.string()).optional(), currency: z.nullable(z.string()).optional(), merchantAccountId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { buyerId: "buyer_id", buyerExternalIdentifier: "buyer_external_identifier", sortBy: "sort_by", orderBy: "order_by", }); }); export function listBuyerPaymentMethodsRequestToJSON( listBuyerPaymentMethodsRequest: ListBuyerPaymentMethodsRequest, ): string { return JSON.stringify( ListBuyerPaymentMethodsRequest$outboundSchema.parse( listBuyerPaymentMethodsRequest, ), ); }