export type GetApiIbanValidationV1Args = {iban: string}; export type GetApiIbanValidationV1Options = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Validate an IBAN and retrieve associated bank details, country, and check digits. * * GET /iban-validation/v1 */ export const getApiIbanValidationV1 = async (args: GetApiIbanValidationV1Args, options?: GetApiIbanValidationV1Options) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.iban != null) query.append("iban", String(args.iban)) const url = `${baseUrl.replace(/\/+$/, '')}/iban-validation/v1${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };