/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { PazeEnhancedTransactionData, PazeEnhancedTransactionData$Outbound, PazeEnhancedTransactionData$outboundSchema, } from "./pazeenhancedtransactiondata.js"; import { PazeTransactionOptions, PazeTransactionOptions$Outbound, PazeTransactionOptions$outboundSchema, } from "./pazetransactionoptions.js"; import { PazeTransactionValue, PazeTransactionValue$Outbound, PazeTransactionValue$outboundSchema, } from "./pazetransactionvalue.js"; /** * The type of transaction being completed. PURCHASE for a one-off checkout, CARD_ON_FILE to retain the card for future use, or BOTH. */ export const PazeSessionCompleteRequestTransactiontype = { Purchase: "PURCHASE", CardOnFile: "CARD_ON_FILE", Both: "BOTH", } as const; /** * The type of transaction being completed. PURCHASE for a one-off checkout, CARD_ON_FILE to retain the card for future use, or BOTH. */ export type PazeSessionCompleteRequestTransactiontype = OpenEnum< typeof PazeSessionCompleteRequestTransactiontype >; export const ProcessingNetwork = { Visa: "VISA", Mastercard: "MASTERCARD", Discover: "DISCOVER", } as const; export type ProcessingNetwork = OpenEnum; export type PazeSessionCompleteRequest = { /** * Session reference identifier generated by the merchant. Must match the value sent in the Paze session create call. */ sessionId: string; /** * Opaque token issued by the Paze service in the response from the most recent Paze UX interaction. */ code: string; /** * The Paze OAuth access token returned by the Paze mobile session create call. Used to authenticate the request to Paze. */ accessToken: string; /** * The type of transaction being completed. PURCHASE for a one-off checkout, CARD_ON_FILE to retain the card for future use, or BOTH. */ transactionType: PazeSessionCompleteRequestTransactiontype; /** * Client configuration data overriding values configured during merchant onboarding. */ transactionOptions?: PazeTransactionOptions | null | undefined; /** * Required when `transactionType` is PURCHASE or BOTH. Must be omitted when `transactionType` is CARD_ON_FILE. */ transactionValue?: PazeTransactionValue | null | undefined; /** * Card network to process the transaction on. If not provided, Paze defaults to the network on the front of the card. */ processingNetwork?: ProcessingNetwork | null | undefined; /** * Additional purchase context used by Paze for risk scoring. */ enhancedTransactionData?: PazeEnhancedTransactionData | null | undefined; }; /** @internal */ export const PazeSessionCompleteRequestTransactiontype$outboundSchema: z.ZodType = openEnums.outboundSchema(PazeSessionCompleteRequestTransactiontype); /** @internal */ export const ProcessingNetwork$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProcessingNetwork > = openEnums.outboundSchema(ProcessingNetwork); /** @internal */ export type PazeSessionCompleteRequest$Outbound = { sessionId: string; code: string; accessToken: string; transactionType: string; transactionOptions?: PazeTransactionOptions$Outbound | null | undefined; transactionValue?: PazeTransactionValue$Outbound | null | undefined; processingNetwork?: string | null | undefined; enhancedTransactionData?: | PazeEnhancedTransactionData$Outbound | null | undefined; }; /** @internal */ export const PazeSessionCompleteRequest$outboundSchema: z.ZodType< PazeSessionCompleteRequest$Outbound, z.ZodTypeDef, PazeSessionCompleteRequest > = z.object({ sessionId: z.string(), code: z.string(), accessToken: z.string(), transactionType: PazeSessionCompleteRequestTransactiontype$outboundSchema, transactionOptions: z.nullable(PazeTransactionOptions$outboundSchema) .optional(), transactionValue: z.nullable(PazeTransactionValue$outboundSchema).optional(), processingNetwork: z.nullable(ProcessingNetwork$outboundSchema).optional(), enhancedTransactionData: z.nullable( PazeEnhancedTransactionData$outboundSchema, ).optional(), }); export function pazeSessionCompleteRequestToJSON( pazeSessionCompleteRequest: PazeSessionCompleteRequest, ): string { return JSON.stringify( PazeSessionCompleteRequest$outboundSchema.parse(pazeSessionCompleteRequest), ); }