/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BillingDetails, BillingDetails$inboundSchema, } from "./billingdetails.js"; export type TransactionBuyer = { /** * Always `buyer`. */ type: "buyer"; /** * The ID for the buyer. */ id?: string | null | undefined; /** * The base62 encoded buyer ID. This represents a shorter version of this buyer's `id` which is sent to payment services, anti-fraud services, and other connectors. You can use this ID to reconcile a payment service's buyer against our system. */ reconciliationId?: string | null | undefined; /** * The display name for the buyer. */ displayName?: string | null | undefined; /** * The merchant identifier for this buyer. */ externalIdentifier?: string | null | undefined; /** * The billing name, address, email, and other fields for this buyer. */ billingDetails?: BillingDetails | null | undefined; /** * The buyer account number. */ accountNumber?: string | null | undefined; }; /** @internal */ export const TransactionBuyer$inboundSchema: z.ZodType< TransactionBuyer, z.ZodTypeDef, unknown > = z.object({ type: z.literal("buyer").default("buyer"), id: z.nullable(z.string()).optional(), reconciliation_id: z.nullable(z.string()).optional(), display_name: z.nullable(z.string()).optional(), external_identifier: z.nullable(z.string()).optional(), billing_details: z.nullable(BillingDetails$inboundSchema).optional(), account_number: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "reconciliation_id": "reconciliationId", "display_name": "displayName", "external_identifier": "externalIdentifier", "billing_details": "billingDetails", "account_number": "accountNumber", }); }); export function transactionBuyerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TransactionBuyer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransactionBuyer' from JSON`, ); }