/* * 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 { PazeClient, PazeClient$Outbound, PazeClient$outboundSchema, } from "./pazeclient.js"; import { PazeCobrandItem, PazeCobrandItem$Outbound, PazeCobrandItem$outboundSchema, } from "./pazecobranditem.js"; import { PazeTransactionValue, PazeTransactionValue$Outbound, PazeTransactionValue$outboundSchema, } from "./pazetransactionvalue.js"; /** * Primary intent of the checkout session. */ export const Intent = { ReviewAndPay: "REVIEW_AND_PAY", ExpressCheckout: "EXPRESS_CHECKOUT", AddCard: "ADD_CARD", } as const; /** * Primary intent of the checkout session. */ export type Intent = OpenEnum; export const TransactionType = { Purchase: "PURCHASE", CardOnFile: "CARD_ON_FILE", Both: "BOTH", } as const; export type TransactionType = OpenEnum; export const ShippingPreference = { All: "ALL", None: "NONE", } as const; export type ShippingPreference = OpenEnum; export const BillingPreference = { All: "ALL", ZipCountry: "ZIP_COUNTRY", None: "NONE", } as const; export type BillingPreference = OpenEnum; export const AcceptedPaymentCardNetworks = { Visa: "VISA", Mastercard: "MASTERCARD", } as const; export type AcceptedPaymentCardNetworks = OpenEnum< typeof AcceptedPaymentCardNetworks >; export type PazeMobileSessionCreateRequest = { client: PazeClient; /** * Session reference identifier generated by the merchant. Must be reused across all Paze APIs in a checkout session. */ sessionId: string; /** * Access token obtained from the Paze session endpoint with source=mobile. */ accessToken: string; /** * Merchant app's ID (iOS bundle identifier or Android application ID) used as the callback URL scheme. */ callbackURLScheme: string; /** * Primary intent of the checkout session. */ intent: Intent; /** * Currency and amount of the transaction. Required when intent is EXPRESS_CHECKOUT. */ transactionValue?: PazeTransactionValue | null | undefined; /** * Type of transaction. */ transactionType?: TransactionType | null | undefined; /** * Whether to collect a shipping address from the consumer. */ shippingPreference?: ShippingPreference | null | undefined; /** * Verbosity of billing address required. */ billingPreference?: BillingPreference | null | undefined; /** * Consumer email address for checkout flow optimization. */ emailAddress?: string | null | undefined; /** * Consumer phone number for checkout flow optimization. */ phoneNumber?: string | null | undefined; /** * Details for cobranded cards offered by the merchant. */ cobrand?: Array | null | undefined; /** * ISO 3166-1 alpha-2 country codes restricting eligible shipping addresses. Empty list or absence means all countries accepted. */ acceptedShippingCountries?: Array | null | undefined; /** * Accepted payment card networks. Empty list or absence means all networks accepted. */ acceptedPaymentCardNetworks?: | Array | null | undefined; /** * Set to true to enable Paze checkout even if the provided email address or phone number does not match a Paze wallet. */ alwaysEnableCheckout?: boolean | undefined; }; /** @internal */ export const Intent$outboundSchema: z.ZodType = openEnums.outboundSchema(Intent); /** @internal */ export const TransactionType$outboundSchema: z.ZodType< string, z.ZodTypeDef, TransactionType > = openEnums.outboundSchema(TransactionType); /** @internal */ export const ShippingPreference$outboundSchema: z.ZodType< string, z.ZodTypeDef, ShippingPreference > = openEnums.outboundSchema(ShippingPreference); /** @internal */ export const BillingPreference$outboundSchema: z.ZodType< string, z.ZodTypeDef, BillingPreference > = openEnums.outboundSchema(BillingPreference); /** @internal */ export const AcceptedPaymentCardNetworks$outboundSchema: z.ZodType< string, z.ZodTypeDef, AcceptedPaymentCardNetworks > = openEnums.outboundSchema(AcceptedPaymentCardNetworks); /** @internal */ export type PazeMobileSessionCreateRequest$Outbound = { client: PazeClient$Outbound; sessionId: string; accessToken: string; callbackURLScheme: string; intent: string; transactionValue?: PazeTransactionValue$Outbound | null | undefined; transactionType?: string | null | undefined; shippingPreference?: string | null | undefined; billingPreference?: string | null | undefined; emailAddress?: string | null | undefined; phoneNumber?: string | null | undefined; cobrand?: Array | null | undefined; acceptedShippingCountries?: Array | null | undefined; acceptedPaymentCardNetworks?: Array | null | undefined; alwaysEnableCheckout: boolean; }; /** @internal */ export const PazeMobileSessionCreateRequest$outboundSchema: z.ZodType< PazeMobileSessionCreateRequest$Outbound, z.ZodTypeDef, PazeMobileSessionCreateRequest > = z.object({ client: PazeClient$outboundSchema, sessionId: z.string(), accessToken: z.string(), callbackURLScheme: z.string(), intent: Intent$outboundSchema, transactionValue: z.nullable(PazeTransactionValue$outboundSchema).optional(), transactionType: z.nullable(TransactionType$outboundSchema).optional(), shippingPreference: z.nullable(ShippingPreference$outboundSchema).optional(), billingPreference: z.nullable(BillingPreference$outboundSchema).optional(), emailAddress: z.nullable(z.string()).optional(), phoneNumber: z.nullable(z.string()).optional(), cobrand: z.nullable(z.array(PazeCobrandItem$outboundSchema)).optional(), acceptedShippingCountries: z.nullable(z.array(z.string())).optional(), acceptedPaymentCardNetworks: z.nullable( z.array(AcceptedPaymentCardNetworks$outboundSchema), ).optional(), alwaysEnableCheckout: z.boolean().default(false), }); export function pazeMobileSessionCreateRequestToJSON( pazeMobileSessionCreateRequest: PazeMobileSessionCreateRequest, ): string { return JSON.stringify( PazeMobileSessionCreateRequest$outboundSchema.parse( pazeMobileSessionCreateRequest, ), ); }