/* * 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 { GuestBuyer, GuestBuyer$Outbound, GuestBuyer$outboundSchema, } from "./guestbuyer.js"; import { PaymentMethodCard, PaymentMethodCard$Outbound, PaymentMethodCard$outboundSchema, } from "./paymentmethodcard.js"; import { PaymentMethodStoredCard, PaymentMethodStoredCard$Outbound, PaymentMethodStoredCard$outboundSchema, } from "./paymentmethodstoredcard.js"; import { PayoutCategory, PayoutCategory$outboundSchema, } from "./payoutcategory.js"; import { PayoutConnectionOptions, PayoutConnectionOptions$Outbound, PayoutConnectionOptions$outboundSchema, } from "./payoutconnectionoptions.js"; import { PayoutMerchant, PayoutMerchant$Outbound, PayoutMerchant$outboundSchema, } from "./payoutmerchant.js"; /** * The type of payment method to send funds too. */ export type PayoutCreatePaymentMethod = | PaymentMethodCard | PaymentMethodStoredCard; /** * PayoutCreate * * @remarks * * Represents the data required to create a new payout. */ export type PayoutCreate = { /** * The monetary amount for this payout, in the smallest currency unit for the given currency, for example `1299` cents to create an authorization for $12.99. */ amount: number; /** * The ISO-4217 currency code for this payout. */ currency: string; /** * The ID of the payment service to use for the payout. */ paymentServiceId: string; /** * The type of payment method to send funds too. */ paymentMethod: PaymentMethodCard | PaymentMethodStoredCard; /** * The type of payout to process. */ category?: PayoutCategory | null | undefined; /** * A value that can be used to match the payout against your own records. */ externalIdentifier?: string | null | undefined; /** * The `id` of a stored buyer to use for this payout Use this instead of the `buyer` or `buyer_external_identifier`. */ buyerId?: string | null | undefined; /** * Inline buyer details for the payout. Use this instead of the `buyer_id` or `buyer_external_identifier`. */ buyer?: GuestBuyer | null | undefined; /** * The `external_identifier` of a stored buyer to use for this payout. Use this instead of the `buyer_id` or `buyer`. */ buyerExternalIdentifier?: string | null | undefined; /** * Merchant information for the source of the payout. */ merchant?: PayoutMerchant | null | undefined; /** * Optional fields for processing payouts on specific payment services. */ connectionOptions?: PayoutConnectionOptions | null | undefined; }; /** @internal */ export type PayoutCreatePaymentMethod$Outbound = | PaymentMethodCard$Outbound | PaymentMethodStoredCard$Outbound; /** @internal */ export const PayoutCreatePaymentMethod$outboundSchema: z.ZodType< PayoutCreatePaymentMethod$Outbound, z.ZodTypeDef, PayoutCreatePaymentMethod > = z.union([ PaymentMethodCard$outboundSchema, PaymentMethodStoredCard$outboundSchema, ]); export function payoutCreatePaymentMethodToJSON( payoutCreatePaymentMethod: PayoutCreatePaymentMethod, ): string { return JSON.stringify( PayoutCreatePaymentMethod$outboundSchema.parse(payoutCreatePaymentMethod), ); } /** @internal */ export type PayoutCreate$Outbound = { amount: number; currency: string; payment_service_id: string; payment_method: PaymentMethodCard$Outbound | PaymentMethodStoredCard$Outbound; category?: string | null | undefined; external_identifier?: string | null | undefined; buyer_id?: string | null | undefined; buyer?: GuestBuyer$Outbound | null | undefined; buyer_external_identifier?: string | null | undefined; merchant?: PayoutMerchant$Outbound | null | undefined; connection_options?: PayoutConnectionOptions$Outbound | null | undefined; }; /** @internal */ export const PayoutCreate$outboundSchema: z.ZodType< PayoutCreate$Outbound, z.ZodTypeDef, PayoutCreate > = z.object({ amount: z.number().int(), currency: z.string(), paymentServiceId: z.string(), paymentMethod: z.union([ PaymentMethodCard$outboundSchema, PaymentMethodStoredCard$outboundSchema, ]), category: z.nullable(PayoutCategory$outboundSchema).optional(), externalIdentifier: z.nullable(z.string()).optional(), buyerId: z.nullable(z.string()).optional(), buyer: z.nullable(GuestBuyer$outboundSchema).optional(), buyerExternalIdentifier: z.nullable(z.string()).optional(), merchant: z.nullable(PayoutMerchant$outboundSchema).optional(), connectionOptions: z.nullable(PayoutConnectionOptions$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { paymentServiceId: "payment_service_id", paymentMethod: "payment_method", externalIdentifier: "external_identifier", buyerId: "buyer_id", buyerExternalIdentifier: "buyer_external_identifier", connectionOptions: "connection_options", }); }); export function payoutCreateToJSON(payoutCreate: PayoutCreate): string { return JSON.stringify(PayoutCreate$outboundSchema.parse(payoutCreate)); }