export type CreateEURDomesticVirtualAccountForCompany = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode?: string | undefined, country: string, nationality: string, registrationNumber?: string | undefined, isIndividual: boolean, iban: string, bicSwift: string}; export type CreateEURDomesticVirtualAccountForIndividual = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode?: string | undefined, country: string, nationality: string, dateOfBirth: string, isIndividual: boolean, iban: string, bicSwift: string}; export type CreateGBPDomesticVirtualAccountForCompany = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode?: string | undefined, country: string, nationality: string, registrationNumber?: string | undefined, isIndividual: boolean, iban?: string | undefined, bicSwift?: string | undefined, accountNumber: string, sortCode: string}; export type CreateGBPDomesticVirtualAccountForIndividual = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode?: string | undefined, country: string, nationality: string, dateOfBirth: string, isIndividual: boolean, iban?: string | undefined, bicSwift?: string | undefined, accountNumber: string, sortCode: string}; export type CreateInternationalVirtualAccountForCompany = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode: string, country: string, nationality: string, registrationNumber?: string | undefined, isIndividual: boolean, iban: string, bicSwift: string}; export type CreateInternationalVirtualAccountForIndividual = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode: string, country: string, nationality: string, dateOfBirth: string, isIndividual: boolean, iban: string, bicSwift: string}; export type CreateNoBankDetailsVirtualAccountForCompany = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode?: string | undefined, country: string, nationality: string, registrationNumber?: string | undefined, isIndividual: boolean}; export type CreateNoBankDetailsVirtualAccountForIndividual = {correlationId?: string | undefined, name: string, addressLine1: string, addressLine2?: string | undefined, addressLine3?: string | undefined, city: string, region?: string | undefined, postcode?: string | undefined, country: string, nationality: string, dateOfBirth: string, isIndividual: boolean}; export type CreateApiV2AccountsAccountIdVirtualArgs = {accountId: number, body: Array}; export type CreateApiV2AccountsAccountIdVirtualOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Virtual Account * * POST /v2/accounts/{accountId}/virtual */ export const createApiV2AccountsAccountIdVirtual = async (args: CreateApiV2AccountsAccountIdVirtualArgs, options?: CreateApiV2AccountsAccountIdVirtualOptions) => { const {baseUrl = "https://api.bcb.group", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/accounts/${encodeURIComponent(String(args.accountId))}/virtual${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 undefined };