/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The subtotals for the contractor payment. */ export type ContractorPaymentReceiptTotals = { /** * The total company debit for the contractor payment. */ companyDebit?: string | undefined; }; /** * The payment method. */ export const ContractorPaymentReceiptPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", HistoricalPayment: "Historical Payment", CorrectionPayment: "Correction Payment", } as const; /** * The payment method. */ export type ContractorPaymentReceiptPaymentMethod = ClosedEnum< typeof ContractorPaymentReceiptPaymentMethod >; export type ContractorPayments = { /** * The UUID of the contractor. */ contractorUuid?: string | undefined; /** * The first name of the contractor. Applies when `contractor_type` is `Individual`. */ contractorFirstName?: string | undefined; /** * The last name of the contractor. Applies when `contractor_type` is `Individual`. */ contractorLastName?: string | undefined; /** * The business name of the contractor. Applies when `contractor_type` is `Business`. */ contractorBusinessName?: string | undefined; /** * The type of contractor. * * @remarks * * `Individual` `Business` */ contractorType?: string | undefined; /** * The payment method. */ paymentMethod?: ContractorPaymentReceiptPaymentMethod | undefined; /** * The fixed wage of the payment, regardless of hours worked. */ wage?: string | undefined; /** * The bonus amount in the payment. */ bonus?: string | undefined; /** * The reimbursement amount in the payment. */ reimbursement?: string | undefined; }; /** * The licensed payroll processor */ export type ContractorPaymentReceiptLicensee = { /** * Always the fixed string "Gusto, Zenpayroll Inc." */ name?: string | undefined; /** * Always the fixed string "525 20th St" */ address?: string | undefined; /** * Always the fixed string "San Francisco" */ city?: string | undefined; /** * Always the fixed string "CA" */ state?: string | undefined; /** * Always the fixed string "94107" */ postalCode?: string | undefined; /** * Always the fixed string "4157778888" */ phoneNumber?: string | undefined; }; export type ContractorPaymentReceipt = { /** * A unique identifier of the contractor payment receipt. */ contractorPaymentUuid?: string | undefined; /** * A unique identifier of the company making the contractor payment. */ companyUuid?: string | undefined; /** * The name of the company making the contractor payment. */ nameOfSender?: string | undefined; /** * The individual or company name of the contractor receiving payment. */ nameOfRecipient?: string | undefined; /** * The debit date for the contractor payment. */ debitDate?: RFCDate | undefined; /** * Always the fixed string "Your payroll provider partners with Gusto Inc. for payments processing. Gusto Inc. is a licensed money transmitter. Learn more on our license page." */ license?: string | undefined; /** * URL for the license information for the licensed payroll processor. Always the fixed string "https://gusto.com/about/licenses" */ licenseUri?: string | undefined; /** * URL for information related to right to refund. Always the fixed string "https://gusto.com/about/licenses" */ rightToRefund?: string | undefined; /** * URL for information related to right to liability of licensee. Always the fixed string "https://gusto.com/about/licenses" */ liabilityOfLicensee?: string | undefined; /** * The subtotals for the contractor payment. */ totals?: ContractorPaymentReceiptTotals | undefined; /** * An array of contractor payments for this contractor payment. */ contractorPayments?: Array | undefined; /** * The licensed payroll processor */ licensee?: ContractorPaymentReceiptLicensee | undefined; }; /** @internal */ export const ContractorPaymentReceiptTotals$inboundSchema: z.ZodType< ContractorPaymentReceiptTotals, z.ZodTypeDef, unknown > = z.object({ company_debit: z.string().optional(), }).transform((v) => { return remap$(v, { "company_debit": "companyDebit", }); }); export function contractorPaymentReceiptTotalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentReceiptTotals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentReceiptTotals' from JSON`, ); } /** @internal */ export const ContractorPaymentReceiptPaymentMethod$inboundSchema: z.ZodNativeEnum = z.nativeEnum( ContractorPaymentReceiptPaymentMethod, ); /** @internal */ export const ContractorPayments$inboundSchema: z.ZodType< ContractorPayments, z.ZodTypeDef, unknown > = z.object({ contractor_uuid: z.string().optional(), contractor_first_name: z.string().optional(), contractor_last_name: z.string().optional(), contractor_business_name: z.string().optional(), contractor_type: z.string().optional(), payment_method: ContractorPaymentReceiptPaymentMethod$inboundSchema .optional(), wage: z.string().optional(), bonus: z.string().optional(), reimbursement: z.string().optional(), }).transform((v) => { return remap$(v, { "contractor_uuid": "contractorUuid", "contractor_first_name": "contractorFirstName", "contractor_last_name": "contractorLastName", "contractor_business_name": "contractorBusinessName", "contractor_type": "contractorType", "payment_method": "paymentMethod", }); }); export function contractorPaymentsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPayments$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPayments' from JSON`, ); } /** @internal */ export const ContractorPaymentReceiptLicensee$inboundSchema: z.ZodType< ContractorPaymentReceiptLicensee, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), address: z.string().optional(), city: z.string().optional(), state: z.string().optional(), postal_code: z.string().optional(), phone_number: z.string().optional(), }).transform((v) => { return remap$(v, { "postal_code": "postalCode", "phone_number": "phoneNumber", }); }); export function contractorPaymentReceiptLicenseeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentReceiptLicensee$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentReceiptLicensee' from JSON`, ); } /** @internal */ export const ContractorPaymentReceipt$inboundSchema: z.ZodType< ContractorPaymentReceipt, z.ZodTypeDef, unknown > = z.object({ contractor_payment_uuid: z.string().optional(), company_uuid: z.string().optional(), name_of_sender: z.string().optional(), name_of_recipient: z.string().optional(), debit_date: z.string().transform(v => new RFCDate(v)).optional(), license: z.string().optional(), license_uri: z.string().optional(), right_to_refund: z.string().optional(), liability_of_licensee: z.string().optional(), totals: z.lazy(() => ContractorPaymentReceiptTotals$inboundSchema).optional(), contractor_payments: z.array(z.lazy(() => ContractorPayments$inboundSchema)) .optional(), licensee: z.lazy(() => ContractorPaymentReceiptLicensee$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "contractor_payment_uuid": "contractorPaymentUuid", "company_uuid": "companyUuid", "name_of_sender": "nameOfSender", "name_of_recipient": "nameOfRecipient", "debit_date": "debitDate", "license_uri": "licenseUri", "right_to_refund": "rightToRefund", "liability_of_licensee": "liabilityOfLicensee", "contractor_payments": "contractorPayments", }); }); export function contractorPaymentReceiptFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentReceipt$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentReceipt' from JSON`, ); }