/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { PaymentDestinationType, PaymentDestinationType$outboundSchema, } from "./payment-destination-type.js"; import { PaymentGatewayOptions, PaymentGatewayOptions$Outbound, PaymentGatewayOptions$outboundSchema, } from "./payment-gateway-options.js"; import { PaymentGatewayType, PaymentGatewayType$outboundSchema, } from "./payment-gateway-type.js"; import { PaymentMethodType, PaymentMethodType$outboundSchema, } from "./payment-method-type.js"; export type CreatePaymentRequest = { amount: string; cancelUrl?: string | undefined; currency: string; destinationId: string; destinationType: PaymentDestinationType; gatewayOptions?: PaymentGatewayOptions | undefined; idempotencyKey?: string | undefined; metadata?: { [k: string]: string } | undefined; paymentGateway?: PaymentGatewayType | undefined; paymentMethodId?: string | undefined; paymentMethodType: PaymentMethodType; processPayment?: boolean | undefined; saveCardAndMakeDefault?: boolean | undefined; successUrl?: string | undefined; }; /** @internal */ export type CreatePaymentRequest$Outbound = { amount: string; cancel_url?: string | undefined; currency: string; destination_id: string; destination_type: string; gateway_options?: PaymentGatewayOptions$Outbound | undefined; idempotency_key?: string | undefined; metadata?: { [k: string]: string } | undefined; payment_gateway?: string | undefined; payment_method_id?: string | undefined; payment_method_type: string; process_payment: boolean; save_card_and_make_default: boolean; success_url?: string | undefined; }; /** @internal */ export const CreatePaymentRequest$outboundSchema: z.ZodMiniType< CreatePaymentRequest$Outbound, CreatePaymentRequest > = z.pipe( z.object({ amount: z.string(), cancelUrl: z.optional(z.string()), currency: z.string(), destinationId: z.string(), destinationType: PaymentDestinationType$outboundSchema, gatewayOptions: z.optional(PaymentGatewayOptions$outboundSchema), idempotencyKey: z.optional(z.string()), metadata: z.optional(z.record(z.string(), z.string())), paymentGateway: z.optional(PaymentGatewayType$outboundSchema), paymentMethodId: z.optional(z.string()), paymentMethodType: PaymentMethodType$outboundSchema, processPayment: z._default(z.boolean(), true), saveCardAndMakeDefault: z._default(z.boolean(), false), successUrl: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { cancelUrl: "cancel_url", destinationId: "destination_id", destinationType: "destination_type", gatewayOptions: "gateway_options", idempotencyKey: "idempotency_key", paymentGateway: "payment_gateway", paymentMethodId: "payment_method_id", paymentMethodType: "payment_method_type", processPayment: "process_payment", saveCardAndMakeDefault: "save_card_and_make_default", successUrl: "success_url", }); }), ); export function createPaymentRequestToJSON( createPaymentRequest: CreatePaymentRequest, ): string { return JSON.stringify( CreatePaymentRequest$outboundSchema.parse(createPaymentRequest), ); }