/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListPaymentMethodsGlobals = { merchantAccountId?: string | undefined; }; export type ListPaymentMethodsRequest = { /** * A pointer to the page of results to return. */ cursor?: string | null | undefined; /** * The maximum number of items that are at returned. */ limit?: number | undefined; /** * The ID of the buyer to filter payment methods by. */ buyerId?: string | null | undefined; /** * The external identifier of the buyer to filter payment methods by. */ buyerExternalIdentifier?: string | null | undefined; status?: Array | null | undefined; /** * The external identifier of the payment method to filter by. */ externalIdentifier?: string | null | undefined; /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; }; export type ListPaymentMethodsResponse = { result: components.PaymentMethods; }; /** @internal */ export type ListPaymentMethodsRequest$Outbound = { cursor?: string | null | undefined; limit: number; buyer_id?: string | null | undefined; buyer_external_identifier?: string | null | undefined; status?: Array | null | undefined; external_identifier?: string | null | undefined; merchantAccountId?: string | null | undefined; }; /** @internal */ export const ListPaymentMethodsRequest$outboundSchema: z.ZodType< ListPaymentMethodsRequest$Outbound, z.ZodTypeDef, ListPaymentMethodsRequest > = z.object({ cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), buyerId: z.nullable(z.string()).optional(), buyerExternalIdentifier: z.nullable(z.string()).optional(), status: z.nullable(z.array(components.PaymentMethodStatus$outboundSchema)) .optional(), externalIdentifier: z.nullable(z.string()).optional(), merchantAccountId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { buyerId: "buyer_id", buyerExternalIdentifier: "buyer_external_identifier", externalIdentifier: "external_identifier", }); }); export function listPaymentMethodsRequestToJSON( listPaymentMethodsRequest: ListPaymentMethodsRequest, ): string { return JSON.stringify( ListPaymentMethodsRequest$outboundSchema.parse(listPaymentMethodsRequest), ); } /** @internal */ export const ListPaymentMethodsResponse$inboundSchema: z.ZodType< ListPaymentMethodsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.PaymentMethods$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function listPaymentMethodsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListPaymentMethodsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListPaymentMethodsResponse' from JSON`, ); }