/* * 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 { RefundTargetType, RefundTargetType$outboundSchema, } from "./refundtargettype.js"; export type TransactionRefundCreate = { /** * The amount to refund, in the smallest currency unit (e.g., cents). If omitted, a full refund will be requested. */ amount?: number | null | undefined; targetType?: RefundTargetType | undefined; /** * The optional ID of the instrument to refund for. This is only required when the `target_type` is set to `gift-card-redemption`. */ targetId?: string | null | undefined; /** * An optional reason to attach extra context to the refund request. */ reason?: string | null | undefined; /** * An external identifier that can be used to match the refund against your own records. */ externalIdentifier?: string | null | undefined; }; /** @internal */ export type TransactionRefundCreate$Outbound = { amount?: number | null | undefined; target_type?: string | undefined; target_id?: string | null | undefined; reason?: string | null | undefined; external_identifier?: string | null | undefined; }; /** @internal */ export const TransactionRefundCreate$outboundSchema: z.ZodType< TransactionRefundCreate$Outbound, z.ZodTypeDef, TransactionRefundCreate > = z.object({ amount: z.nullable(z.number().int()).optional(), targetType: RefundTargetType$outboundSchema.optional(), targetId: z.nullable(z.string()).optional(), reason: z.nullable(z.string()).optional(), externalIdentifier: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { targetType: "target_type", targetId: "target_id", externalIdentifier: "external_identifier", }); }); export function transactionRefundCreateToJSON( transactionRefundCreate: TransactionRefundCreate, ): string { return JSON.stringify( TransactionRefundCreate$outboundSchema.parse(transactionRefundCreate), ); }