import {z} from 'zod' export type OBInternalLocalInstrument1Code = string; export type OBActiveCurrencyAndAmountSimpleType = string; export type ActiveOrHistoricCurrencyCode = string; export type OBInternalAccountIdentification4Code = string; export type Identification0 = string; export type SecondaryIdentification = string; export type ExternalProxyAccountType1Code = 'TELE' | 'EMAL' | 'DNAM' | 'CINC' | 'COTX' | 'COID' | 'CUST' | 'DRLC' | 'EIDN' | 'EWAL' | 'PVTX' | 'LEIC' | 'MBNO' | 'NIDN' | 'CCPT' | 'SHID' | 'SOSE' | 'TOKN' | 'UBIL' | 'VIPN' | 'BIID'; export type OBProxy1 = {Identification: string, Code: ExternalProxyAccountType1Code, Type?: string | undefined}; export type CountryCode = string; export type OBRegulatoryAuthority2 = {Name?: string | undefined, CountryCode?: CountryCode | undefined}; export type ISODateTime = string; export type OBActiveOrHistoricCurrencyAndAmount = {Amount: OBActiveCurrencyAndAmountSimpleType, Currency: ActiveOrHistoricCurrencyCode}; export type OBStructuredRegulatoryReporting3 = {Type?: string | undefined, Date?: ISODateTime | undefined, Country?: CountryCode | undefined, Amount?: OBActiveOrHistoricCurrencyAndAmount | undefined, Information?: Array | undefined}; export type OBRegulatoryReporting1 = {DebitCreditReportingIndicator?: ('CRED' | 'DEBT' | 'BOTH') | undefined, Authority?: OBRegulatoryAuthority2 | undefined, Details?: Array | undefined}; export type OBAddressType2Code = 'BIZZ' | 'DLVY' | 'MLTO' | 'PBOX' | 'ADDR' | 'HOME' | 'CORR' | 'STAT'; export type Department = string; export type SubDepartment = string; export type StreetName = string; export type BuildingNumber = string; export type BuildingName = string; export type Floor = string; export type UnitNumber = string; export type Room = string; export type PostBox = string; export type TownName = string; export type DistrictName = string; export type CareOf = string; export type PostCode = string; export type CountrySubDivision = string; export type OBPostalAddress7 = {AddressType?: OBAddressType2Code | undefined, Department?: Department | undefined, SubDepartment?: SubDepartment | undefined, StreetName?: StreetName | undefined, BuildingNumber?: BuildingNumber | undefined, BuildingName?: BuildingName | undefined, Floor?: Floor | undefined, UnitNumber?: UnitNumber | undefined, Room?: Room | undefined, PostBox?: PostBox | undefined, TownLocationName?: TownName | undefined, DistrictName?: DistrictName | undefined, CareOf?: CareOf | undefined, PostCode?: PostCode | undefined, TownName?: TownName | undefined, CountrySubDivision?: CountrySubDivision | undefined, Country?: CountryCode | undefined, AddressLine?: Array | undefined}; export type LEI = string; export type OBUltimateCreditor1 = {Name?: string | undefined, Identification?: string | undefined, LEI?: LEI | undefined, SchemeName?: OBInternalAccountIdentification4Code | undefined, PostalAddress?: OBPostalAddress7 | undefined}; export type OBUltimateDebtor1 = {Name?: string | undefined, Identification?: string | undefined, LEI?: LEI | undefined, SchemeName?: OBInternalAccountIdentification4Code | undefined, PostalAddress?: OBPostalAddress7 | undefined}; export type ExternalDocumentType1Code = 'CINV' | 'CNFA' | 'CONT' | 'CREN' | 'DEBN' | 'DISP' | 'DNFA' | 'HIRI' | 'INVS' | 'MSIN' | 'PROF' | 'PUOR' | 'QUOT' | 'SBIN' | 'SPRR' | 'TISH'; export type OBReferredDocumentInformation = {Code?: ExternalDocumentType1Code | undefined, Issuer?: string | undefined, Number?: string | undefined, RelatedDate?: string | undefined, LineDetails?: Array | undefined}; export type ExternalCreditorReferenceType1Code = 'DISP' | 'FXDR' | 'PUOR' | 'RPIN' | 'RADM' | 'SCOR'; export type Identification3 = string; export type Identification4 = string; export type OBRemittanceInformationStructured = {ReferredDocumentInformation?: Array | undefined, ReferredDocumentAmount?: OBActiveCurrencyAndAmountSimpleType | undefined, CreditorReferenceInformation?: ({Code?: ExternalCreditorReferenceType1Code | undefined, Issuer?: string | undefined, Reference?: string | undefined}) | undefined, Invoicer?: Identification3 | undefined, Invoicee?: Identification4 | undefined, TaxRemittance?: string | undefined, AdditionalRemittanceInformation?: Array | undefined}; export type OBRemittanceInformation2 = {Structured?: Array | undefined, Unstructured?: Array | undefined}; export type OBSupplementaryData1 = {[key: string]: unknown}; export type ExternalPurpose1Code = 'BKDF' | 'BKFE' | 'BKFM' | 'BKIP' | 'BKPP' | 'CBLK' | 'CDCB' | 'CDCD' | 'CDCS' | 'CDDP' | 'CDOC' | 'CDQC' | 'ETUP' | 'FCOL' | 'MTUP' | 'ACCT' | 'CASH' | 'COLL' | 'CSDB' | 'DEPT' | 'INTC' | 'INTP' | 'LIMA' | 'NETT' | 'BFWD' | 'CCIR' | 'CCPC' | 'CCPM' | 'CCSM' | 'CRDS' | 'CRPR' | 'CRSP' | 'CRTL' | 'EQPT' | 'EQUS' | 'EXPT' | 'EXTD' | 'FIXI' | 'FWBC' | 'FWCC' | 'FWSB' | 'FWSC' | 'MARG' | 'MBSB' | 'MBSC' | 'MGCC' | 'MGSC' | 'OCCC' | 'OPBC' | 'OPCC' | 'OPSB' | 'OPSC' | 'OPTN' | 'OTCD' | 'REPO' | 'RPBC' | 'RPCC' | 'RPSB' | 'RPSC' | 'RVPO' | 'SBSC' | 'SCIE' | 'SCIR' | 'SCRP' | 'SHBC' | 'SHCC' | 'SHSL' | 'SLEB' | 'SLOA' | 'SWBC' | 'SWCC' | 'SWPT' | 'SWSB' | 'SWSC' | 'TBAS' | 'TBBC' | 'TBCC' | 'TRCP' | 'AGRT' | 'AREN' | 'BEXP' | 'BOCE' | 'COMC' | 'CPYR' | 'GDDS' | 'GDSV' | 'GSCB' | 'LICF' | 'MP2B' | 'POPE' | 'ROYA' | 'SCVE' | 'SERV' | 'SUBS' | 'SUPP' | 'TRAD' | 'CHAR' | 'COMT' | 'MP2P' | 'ECPG' | 'ECPR' | 'ECPU' | 'EPAY' | 'CLPR' | 'COMP' | 'DBTC' | 'GOVI' | 'HLRP' | 'HLST' | 'INPC' | 'INPR' | 'INSC' | 'INSU' | 'INTE' | 'LBRI' | 'LIFI' | 'LOAN' | 'LOAR' | 'PENO' | 'PPTI' | 'RELG' | 'RINP' | 'TRFD' | 'FORW' | 'FXNT' | 'ADMG' | 'ADVA' | 'BCDM' | 'BCFG' | 'BLDM' | 'BNET' | 'CBFF' | 'CBFR' | 'CCRD' | 'CDBL' | 'CFEE' | 'CGDD' | 'CORT' | 'COST' | 'CPKC' | 'DCRD' | 'DSMT' | 'DVPM' | 'EDUC' | 'FACT' | 'FAND' | 'FCPM' | 'FEES' | 'GIFT' | 'GOVT' | 'ICCP' | 'IDCP' | 'IHRP' | 'INSM' | 'IVPT' | 'MCDM' | 'MCFG' | 'MSVC' | 'NOWS' | 'OCDM' | 'OCFG' | 'OFEE' | 'OTHR' | 'PADD' | 'PTSP' | 'RCKE' | 'RCPT' | 'REBT' | 'REFU' | 'RENT' | 'REOD' | 'RIMB' | 'RPNT' | 'RRBN' | 'RRCT' | 'RRTP' | 'RVPM' | 'SLPI' | 'SPLT' | 'STDY' | 'TBAN' | 'TBIL' | 'TCSC' | 'TELI' | 'TMPG' | 'TPRI' | 'TPRP' | 'TRNC' | 'TRVC' | 'WEBI' | 'IPAY' | 'IPCA' | 'IPDO' | 'IPEA' | 'IPEC' | 'IPEW' | 'IPPS' | 'IPRT' | 'IPU2' | 'IPUW' | 'ANNI' | 'CAFI' | 'CFDI' | 'CMDT' | 'DERI' | 'DIVD' | 'FREX' | 'HEDG' | 'INVS' | 'PRME' | 'SAVG' | 'SECU' | 'SEPI' | 'TREA' | 'UNIT' | 'FNET' | 'FUTR' | 'ANTS' | 'CVCF' | 'DMEQ' | 'DNTS' | 'HLTC' | 'HLTI' | 'HSPC' | 'ICRF' | 'LTCF' | 'MAFC' | 'MARF' | 'MDCS' | 'VIEW' | 'CDEP' | 'SWFP' | 'SWPP' | 'SWRS' | 'SWUF' | 'ADCS' | 'AEMP' | 'ALLW' | 'ALMY' | 'BBSC' | 'BECH' | 'BENE' | 'BONU' | 'CCHD' | 'COMM' | 'CSLP' | 'GFRP' | 'GVEA' | 'GVEB' | 'GVEC' | 'GVED' | 'GWLT' | 'HREC' | 'PAYR' | 'PEFC' | 'PENS' | 'PRCP' | 'RHBS' | 'SALA' | 'SPSP' | 'SSBE' | 'LBIN' | 'LCOL' | 'LFEE' | 'LMEQ' | 'LMFI' | 'LMRK' | 'LREB' | 'LREV' | 'LSFL' | 'ESTX' | 'FWLV' | 'GSTX' | 'HSTX' | 'INTX' | 'NITX' | 'PTXP' | 'RDTX' | 'TAXS' | 'VATX' | 'WHLD' | 'TAXR' | 'B112' | 'BR12' | 'TLRF' | 'TLRR' | 'AIRB' | 'BUSB' | 'FERB' | 'RLWY' | 'TRPT' | 'CBTV' | 'ELEC' | 'ENRG' | 'GASB' | 'NWCH' | 'NWCM' | 'OTLC' | 'PHON' | 'UBIL' | 'WTER' | 'BOND' | 'CABD' | 'CAEQ' | 'CBCR' | 'DBCR' | 'DICL' | 'EQTS' | 'FLCR' | 'EFTC' | 'EFTD' | 'MOMA' | 'RAPI' | 'GAMB' | 'LOTT' | 'AMEX' | 'SASW' | 'AUCO' | 'PCOM' | 'PDEP' | 'PLDS' | 'PLRF' | 'GAFA' | 'GAHO' | 'CPEN' | 'DEPD' | 'RETL' | 'DEBT' | 'CRYP'; export type ExternalCategoryPurpose1Code = 'BONU' | 'CASH' | 'CBLK' | 'CCRD' | 'CGWV' | 'CIPC' | 'CONC' | 'CORT' | 'DCRD' | 'DIVI' | 'DVPM' | 'EPAY' | 'FCDT' | 'FCIN' | 'FCOL' | 'GOVT' | 'GP2P' | 'HEDG' | 'ICCP' | 'IDCP' | 'INTC' | 'INTE' | 'LBOX' | 'LOAN' | 'MP2B' | 'MP2P' | 'OTHR' | 'PENS' | 'RPRE' | 'RRCT' | 'RVPM' | 'SALA' | 'SECU' | 'SSBE' | 'SUPP' | 'SWEP' | 'TAXS' | 'TOPG' | 'TRAD' | 'TREA' | 'VATX' | 'VOST' | 'WHLD' | 'ZABA'; export type OBInternalExtendedAccountType1Code = 'Business' | 'BusinessSavingsAccount' | 'Charity' | 'Collection' | 'Corporate' | 'Ewallet' | 'Government' | 'Investment' | 'ISA' | 'JointPersonal' | 'Pension' | 'Personal' | 'PersonalSavingsAccount' | 'Premier' | 'Wealth'; export type OBRisk1 = {PaymentContextCode?: ('BillingGoodsAndServicesInAdvance' | 'BillingGoodsAndServicesInArrears' | 'EcommerceMerchantInitiatedPayment' | 'FaceToFacePointOfSale' | 'TransferToSelf' | 'TransferToThirdParty' | 'BillPayment' | 'EcommerceGoods' | 'EcommerceServices' | 'PartyToParty' | 'PispPayee' | 'Other') | undefined, MerchantCategoryCode?: string | undefined, MerchantCustomerIdentification?: string | undefined, ContractPresentIndicator?: boolean | undefined, BeneficiaryPrepopulatedIndicator?: boolean | undefined, PaymentPurposeCode?: ExternalPurpose1Code | undefined, CategoryPurposeCode?: ExternalCategoryPurpose1Code | undefined, BeneficiaryAccountType?: OBInternalExtendedAccountType1Code | undefined, DeliveryAddress?: OBPostalAddress7 | undefined}; export type OBWriteDomesticScheduled2 = {Data: {ConsentId: string, Initiation: {InstructionIdentification: string, EndToEndIdentification?: string | undefined, LocalInstrument?: OBInternalLocalInstrument1Code | undefined, RequestedExecutionDateTime: string, InstructedAmount: {Amount: OBActiveCurrencyAndAmountSimpleType, Currency: ActiveOrHistoricCurrencyCode}, DebtorAccount?: ({SchemeName: OBInternalAccountIdentification4Code, Identification: Identification0, Name?: string | undefined, SecondaryIdentification?: SecondaryIdentification | undefined, Proxy?: OBProxy1 | undefined}) | undefined, CreditorAccount: {SchemeName: OBInternalAccountIdentification4Code, Identification: Identification0, Name: string, SecondaryIdentification?: SecondaryIdentification | undefined, Proxy?: OBProxy1 | undefined}, RegulatoryReporting?: Array | undefined, CreditorPostalAddress?: OBPostalAddress7 | undefined, UltimateCreditor?: OBUltimateCreditor1 | undefined, UltimateDebtor?: OBUltimateDebtor1 | undefined, RemittanceInformation?: OBRemittanceInformation2 | undefined, SupplementaryData?: OBSupplementaryData1 | undefined}}, Risk: OBRisk1}; export type CreateApiDomesticScheduledPaymentsArgs = {'x-fapi-auth-date'?: string | undefined, 'x-fapi-customer-ip-address'?: string | undefined, 'x-fapi-interaction-id'?: string | undefined, Authorization: string, 'x-idempotency-key': string, 'x-jws-signature': string, 'x-customer-user-agent'?: string | undefined, 'x-client-id'?: string | undefined, body: OBWriteDomesticScheduled2}; export type CreateApiDomesticScheduledPaymentsOptions = {baseUrl: string, PSUOAuth2Security?: string | undefined, fetch?: typeof fetch | undefined}; export const externalPaymentTransactionStatus2Code = z.enum(["CANC", "RCVD", "PDNG", "ACTC", "PATC", "ACCP", "ACFC", "ACSP", "ACWC", "ACSC", "BLCK", "ACCC", "ACWP", "RJCT"]); export const oBStatusReason = z.object({StatusReasonCode: z.string().min(1).max(4).optional(), StatusReasonDescription: z.string().min(1).max(500).optional(), Path: z.string().min(1).max(500).optional()}); export const oBInternalAccountIdentification4Code = z.string(); export const identification0 = z.string().min(1).max(256); export const secondaryIdentification = z.string().min(1).max(34); export const oBDomesticRefundAccount1 = z.object({Account: z.object({SchemeName: oBInternalAccountIdentification4Code, Identification: identification0, Name: z.string().min(1).max(350), SecondaryIdentification: secondaryIdentification.optional()})}); export const oBInternalChargeBearerType1Code = z.enum(["BorneByCreditor", "BorneByDebtor", "FollowingServiceLevel", "Shared"]); export const oBInternalPaymentChargeType1Code = z.string(); export const oBActiveCurrencyAndAmountSimpleType = z.string(); export const activeOrHistoricCurrencyCode = z.string(); export const oBActiveOrHistoricCurrencyAndAmount = z.object({Amount: oBActiveCurrencyAndAmountSimpleType, Currency: activeOrHistoricCurrencyCode}); export const oBInternalLocalInstrument1Code = z.string(); export const externalProxyAccountType1Code = z.enum(["TELE", "EMAL", "DNAM", "CINC", "COTX", "COID", "CUST", "DRLC", "EIDN", "EWAL", "PVTX", "LEIC", "MBNO", "NIDN", "CCPT", "SHID", "SOSE", "TOKN", "UBIL", "VIPN", "BIID"]); export const oBProxy1 = z.object({Identification: z.string().min(1).max(2048), Code: externalProxyAccountType1Code, Type: z.string().min(1).max(35).optional()}); export const oBAddressType2Code = z.enum(["BIZZ", "DLVY", "MLTO", "PBOX", "ADDR", "HOME", "CORR", "STAT"]); export const department = z.string().min(1).max(70); export const subDepartment = z.string().min(1).max(70); export const streetName = z.string().min(1).max(140); export const buildingNumber = z.string().min(1).max(16); export const buildingName = z.string().min(1).max(140); export const floor = z.string().min(1).max(70); export const unitNumber = z.string().min(1).max(16); export const room = z.string().min(1).max(70); export const postBox = z.string().min(1).max(16); export const townName = z.string().min(1).max(140); export const districtName = z.string().min(1).max(140); export const careOf = z.string().min(1).max(140); export const postCode = z.string().min(1).max(16); export const countrySubDivision = z.string().min(1).max(35); export const countryCode = z.string(); export const oBPostalAddress7 = z.object({AddressType: oBAddressType2Code.optional(), Department: department.optional(), SubDepartment: subDepartment.optional(), StreetName: streetName.optional(), BuildingNumber: buildingNumber.optional(), BuildingName: buildingName.optional(), Floor: floor.optional(), UnitNumber: unitNumber.optional(), Room: room.optional(), PostBox: postBox.optional(), TownLocationName: townName.optional(), DistrictName: districtName.optional(), CareOf: careOf.optional(), PostCode: postCode.optional(), TownName: townName.optional(), CountrySubDivision: countrySubDivision.optional(), Country: countryCode.optional(), AddressLine: z.array(z.string().min(1).max(70)).optional()}); export const lEI = z.string().min(1).max(20); export const oBUltimateCreditor1 = z.object({Name: z.string().min(1).max(140).optional(), Identification: z.string().min(1).max(256).optional(), LEI: lEI.optional(), SchemeName: oBInternalAccountIdentification4Code.optional(), PostalAddress: oBPostalAddress7.optional()}); export const oBUltimateDebtor1 = z.object({Name: z.string().min(1).max(140).optional(), Identification: z.string().min(1).max(256).optional(), LEI: lEI.optional(), SchemeName: oBInternalAccountIdentification4Code.optional(), PostalAddress: oBPostalAddress7.optional()}); export const oBRegulatoryAuthority2 = z.object({Name: z.string().min(1).max(140).optional(), CountryCode: countryCode.optional()}); export const iSODateTime = z.string(); export const oBStructuredRegulatoryReporting3 = z.object({Type: z.string().min(1).max(35).optional(), Date: iSODateTime.optional(), Country: countryCode.optional(), Amount: oBActiveOrHistoricCurrencyAndAmount.optional(), Information: z.array(z.string().min(1).max(35)).optional()}); export const oBRegulatoryReporting1 = z.object({DebitCreditReportingIndicator: z.enum(["CRED", "DEBT", "BOTH"]).optional(), Authority: oBRegulatoryAuthority2.optional(), Details: z.array(oBStructuredRegulatoryReporting3).optional()}); export const externalDocumentType1Code = z.enum(["CINV", "CNFA", "CONT", "CREN", "DEBN", "DISP", "DNFA", "HIRI", "INVS", "MSIN", "PROF", "PUOR", "QUOT", "SBIN", "SPRR", "TISH"]).min(1).max(4); export const oBReferredDocumentInformation = z.object({Code: externalDocumentType1Code.optional(), Issuer: z.string().min(1).max(35).optional(), Number: z.string().min(1).max(35).optional(), RelatedDate: z.string().optional(), LineDetails: z.array(z.string().min(1).max(2048)).optional()}); export const externalCreditorReferenceType1Code = z.enum(["DISP", "FXDR", "PUOR", "RPIN", "RADM", "SCOR"]).min(1).max(4); export const identification3 = z.string().min(1).max(256); export const identification4 = z.string().min(1).max(256); export const oBRemittanceInformationStructured = z.object({ReferredDocumentInformation: z.array(oBReferredDocumentInformation).optional(), ReferredDocumentAmount: oBActiveCurrencyAndAmountSimpleType.optional(), CreditorReferenceInformation: z.object({Code: externalCreditorReferenceType1Code.optional(), Issuer: z.string().min(1).max(35).optional(), Reference: z.string().min(1).max(35).optional()}).optional(), Invoicer: identification3.optional(), Invoicee: identification4.optional(), TaxRemittance: z.string().min(1).max(140).optional(), AdditionalRemittanceInformation: z.array(z.string().min(1).max(140)).optional()}); export const oBRemittanceInformation2 = z.object({Structured: z.array(oBRemittanceInformationStructured).optional(), Unstructured: z.array(z.string().min(1).max(140)).optional()}); export const oBSupplementaryData1 = z.record(z.string(), z.unknown()); export const oBCashAccountDebtor4 = z.object({SchemeName: z.string().optional(), Identification: z.string().optional(), Name: z.string().optional(), SecondaryIdentification: z.string().optional(), LEI: lEI.optional()}); export const links = z.object({Self: z.string(), First: z.string().optional(), Prev: z.string().optional(), Next: z.string().optional(), Last: z.string().optional()}); export const meta = z.object({TotalPages: z.number().int().optional(), FirstAvailableDateTime: iSODateTime.optional(), LastAvailableDateTime: iSODateTime.optional()}); export const oBWriteDomesticScheduledResponse5 = z.object({Data: z.object({DomesticScheduledPaymentId: z.string().min(1).max(40), ConsentId: z.string().min(1).max(128), CreationDateTime: z.string(), Status: externalPaymentTransactionStatus2Code, StatusUpdateDateTime: z.string(), StatusReason: z.array(oBStatusReason).optional(), ExpectedExecutionDateTime: z.string().optional(), ExpectedSettlementDateTime: z.string().optional(), Refund: oBDomesticRefundAccount1.optional(), Charges: z.array(z.object({ChargeBearer: oBInternalChargeBearerType1Code, Type: oBInternalPaymentChargeType1Code, Amount: oBActiveOrHistoricCurrencyAndAmount})).optional(), Initiation: z.object({InstructionIdentification: z.string().min(1).max(35), EndToEndIdentification: z.string().min(1).max(35).optional(), LocalInstrument: oBInternalLocalInstrument1Code.optional(), RequestedExecutionDateTime: z.string(), InstructedAmount: z.object({Amount: oBActiveCurrencyAndAmountSimpleType, Currency: activeOrHistoricCurrencyCode}), DebtorAccount: z.object({SchemeName: oBInternalAccountIdentification4Code, Identification: identification0, Name: z.string().min(1).max(350).optional(), SecondaryIdentification: secondaryIdentification.optional(), Proxy: oBProxy1.optional()}).optional(), CreditorAccount: z.object({SchemeName: oBInternalAccountIdentification4Code, Identification: identification0, Name: z.string().min(1).max(350), SecondaryIdentification: secondaryIdentification.optional(), Proxy: oBProxy1.optional()}), CreditorPostalAddress: oBPostalAddress7.optional(), UltimateCreditor: oBUltimateCreditor1.optional(), UltimateDebtor: oBUltimateDebtor1.optional(), RegulatoryReporting: z.array(oBRegulatoryReporting1).optional(), RemittanceInformation: oBRemittanceInformation2.optional(), SupplementaryData: oBSupplementaryData1.optional()}), MultiAuthorisation: z.object({Status: z.enum(["AUTH", "AWAF", "RJCT"]), NumberRequired: z.number().int().optional(), NumberReceived: z.number().int().optional(), LastUpdateDateTime: z.string().optional(), ExpirationDateTime: z.string().optional()}).optional(), Debtor: oBCashAccountDebtor4.optional()}), Links: links.optional(), Meta: meta.optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Initiate a Domestic Scheduled Payment * * POST /domestic-scheduled-payments */ export const createApiDomesticScheduledPayments = async (args: CreateApiDomesticScheduledPaymentsArgs, options: CreateApiDomesticScheduledPaymentsOptions) => { const {baseUrl, fetch: fetchFn = fetch, PSUOAuth2Security} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['x-fapi-auth-date'] != null) headers.set("x-fapi-auth-date", String(args['x-fapi-auth-date'])) if (args['x-fapi-customer-ip-address'] != null) headers.set("x-fapi-customer-ip-address", String(args['x-fapi-customer-ip-address'])) if (args['x-fapi-interaction-id'] != null) headers.set("x-fapi-interaction-id", String(args['x-fapi-interaction-id'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['x-idempotency-key'] != null) headers.set("x-idempotency-key", String(args['x-idempotency-key'])) if (args['x-jws-signature'] != null) headers.set("x-jws-signature", String(args['x-jws-signature'])) if (args['x-customer-user-agent'] != null) headers.set("x-customer-user-agent", String(args['x-customer-user-agent'])) if (args['x-client-id'] != null) headers.set("x-client-id", String(args['x-client-id'])) if (PSUOAuth2Security !== undefined) headers.set('authorization', `Bearer ${PSUOAuth2Security}`) const url = `${baseUrl.replace(/\/+$/, '')}/domestic-scheduled-payments${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(oBWriteDomesticScheduledResponse5, await res.json()) };