/* * 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 { IncrementalAuthorizationStatus, IncrementalAuthorizationStatus$inboundSchema, } from "./incrementalauthorizationstatus.js"; import { Transaction, Transaction$inboundSchema } from "./transaction.js"; export type TransactionAuthorizationIncrement = { /** * Always `transaction-authorization-increment`. */ type: "transaction-authorization-increment"; status: IncrementalAuthorizationStatus; /** * The standardized error code set by Gr4vy. */ code: string | null; /** * This is the response code received from the payment service. This can be set to any value and is not standardized across different payment services. */ rawResponseCode: string | null; /** * This is the response description received from the payment service. This can be set to any value and is not standardized across different payment services. */ rawResponseDescription: string | null; /** * A full transaction resource. */ transaction: Transaction; }; /** @internal */ export const TransactionAuthorizationIncrement$inboundSchema: z.ZodType< TransactionAuthorizationIncrement, z.ZodTypeDef, unknown > = z.object({ type: z.literal("transaction-authorization-increment").default( "transaction-authorization-increment", ), status: IncrementalAuthorizationStatus$inboundSchema, code: z.nullable(z.string()), raw_response_code: z.nullable(z.string()), raw_response_description: z.nullable(z.string()), transaction: Transaction$inboundSchema, }).transform((v) => { return remap$(v, { "raw_response_code": "rawResponseCode", "raw_response_description": "rawResponseDescription", }); }); export function transactionAuthorizationIncrementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TransactionAuthorizationIncrement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransactionAuthorizationIncrement' from JSON`, ); }