/* * 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"; export type TransactionGiftCard = { /** * Always `gift-card`. */ type: "gift-card"; /** * The ID for the gift card. */ id?: string | null | undefined; /** * The first 6 digits of the full gift card number. */ bin: string; /** * The 3 digits after the `bin` of the full gift card number. */ subBin: string; /** * The last 4 digits for the gift card. */ last4: string; }; /** @internal */ export const TransactionGiftCard$inboundSchema: z.ZodType< TransactionGiftCard, z.ZodTypeDef, unknown > = z.object({ type: z.literal("gift-card").default("gift-card"), id: z.nullable(z.string()).optional(), bin: z.string(), sub_bin: z.string(), last4: z.string(), }).transform((v) => { return remap$(v, { "sub_bin": "subBin", }); }); export function transactionGiftCardFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TransactionGiftCard$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransactionGiftCard' from JSON`, ); }