/* * 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 { PayoutCategory, PayoutCategory$inboundSchema, } from "./payoutcategory.js"; import { PayoutMerchantSummary, PayoutMerchantSummary$inboundSchema, } from "./payoutmerchantsummary.js"; import { PayoutPaymentService, PayoutPaymentService$inboundSchema, } from "./payoutpaymentservice.js"; import { PayoutStatus, PayoutStatus$inboundSchema } from "./payoutstatus.js"; import { TransactionBuyer, TransactionBuyer$inboundSchema, } from "./transactionbuyer.js"; import { TransactionPaymentMethod, TransactionPaymentMethod$inboundSchema, } from "./transactionpaymentmethod.js"; /** * PayoutSummary * * @remarks * * Represents a summary of a payout. */ export type PayoutSummary = { /** * Always `payout`. */ type: "payout"; /** * The ID for the payout. */ id?: string | null | undefined; /** * 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 buyer used for this payout. */ buyer?: TransactionBuyer | null | undefined; /** * The type of payout to process. */ category?: PayoutCategory | null | undefined; /** * The date this payout was created at. */ createdAt: Date; /** * A supported ISO-4217 currency code. */ currency: string; /** * The merchant identifier for this payout. */ externalIdentifier?: string | null | undefined; /** * The merchant details associated to this payout. */ merchant?: PayoutMerchantSummary | null | undefined; /** * The ID of the merchant account this payout was created for. */ merchantAccountId?: string | null | undefined; paymentMethod: TransactionPaymentMethod; paymentService: PayoutPaymentService; /** * The ID of the payout in the underlying payment service. */ paymentServicePayoutId?: string | null | undefined; status: PayoutStatus; /** * The date this payout was last updated at. */ updatedAt: Date; }; /** @internal */ export const PayoutSummary$inboundSchema: z.ZodType< PayoutSummary, z.ZodTypeDef, unknown > = z.object({ type: z.literal("payout").default("payout"), id: z.nullable(z.string()).optional(), amount: z.number().int(), buyer: z.nullable(TransactionBuyer$inboundSchema).optional(), category: z.nullable(PayoutCategory$inboundSchema).optional(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), currency: z.string(), external_identifier: z.nullable(z.string()).optional(), merchant: z.nullable(PayoutMerchantSummary$inboundSchema).optional(), merchant_account_id: z.nullable(z.string()).optional(), payment_method: TransactionPaymentMethod$inboundSchema, payment_service: PayoutPaymentService$inboundSchema, payment_service_payout_id: z.nullable(z.string()).optional(), status: PayoutStatus$inboundSchema, updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "external_identifier": "externalIdentifier", "merchant_account_id": "merchantAccountId", "payment_method": "paymentMethod", "payment_service": "paymentService", "payment_service_payout_id": "paymentServicePayoutId", "updated_at": "updatedAt", }); }); export function payoutSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayoutSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayoutSummary' from JSON`, ); }