export type InformationRequestAddress = {addressLine1: string, addressLine2?: string | undefined, city: string, region?: string | undefined, postCode: string, country: string}; export type InformationRequestIndividualEntity = {type: 'INDIVIDUAL', contactId?: string | undefined, customerId?: string | undefined, externalId: string, firstName: string, lastName: string, dateOfBirth: string, relationshipType: 'SELF_OWNED' | 'THIRD_PARTY', address: InformationRequestAddress}; export type InformationRequestCompanyEntity = {type: 'COMPANY', contactId?: string | undefined, customerId?: string | undefined, externalId?: string | undefined, legalName: string, registrationNumber?: string | undefined, relationshipType: 'SELF_OWNED' | 'THIRD_PARTY'}; export type InformationRequestActionDto = {type: 'PROVIDE_INFORMATION', entity: InformationRequestIndividualEntity | InformationRequestCompanyEntity}; export type CreateApiComplianceV1InformationRequestsExternalIdActionsArgs = {externalId: string, body: InformationRequestActionDto}; export type CreateApiComplianceV1InformationRequestsExternalIdActionsOptions = {baseUrl?: string | undefined, Hawk?: string | undefined, fetch?: typeof fetch | undefined}; /** * Submit originator data for Travel rule information request * * POST /compliance/v1/information-requests/{externalId}/actions */ export const createApiComplianceV1InformationRequestsExternalIdActions = async (args: CreateApiComplianceV1InformationRequestsExternalIdActionsArgs, options?: CreateApiComplianceV1InformationRequestsExternalIdActionsOptions) => { const {baseUrl = "https://api.sandbox.bvnk.com", fetch: fetchFn = fetch, Hawk} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Hawk !== undefined) headers.set("Authorization", Hawk) const url = `${baseUrl.replace(/\/+$/, '')}/compliance/v1/information-requests/${encodeURIComponent(String(args.externalId))}/actions${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 };