@afriex/core
Version:
HTTP client, configuration and typed errors for the Afriex Business API SDK
84 lines • 5.05 kB
TypeScript
/**
* `code` values returned by the Afriex Business API's `ErrorResponse.code` field.
* Kept in sync with the values documented across the OpenAPI spec's error examples.
*
* The set is not closed: the API can return codes that are not listed here, so
* compare `ApiError.errorCode` against these constants rather than assuming
* every response carries one of them.
*/
export declare const AfriexErrorCode: {
/** 401. Also returned when the key lacks the permission the endpoint needs. */
readonly AUTHENTICATION_ERROR: "AUTHENTICATION_ERROR";
/**
* 403. Set by the SDK when an endpoint is not available in the current
* environment: those responses carry `{ message }` and no `code` of their own.
*/
readonly FORBIDDEN: "FORBIDDEN";
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
/** 400. Observed in the sandbox, e.g. for an unsupported `x-api-version`. */
readonly BAD_REQUEST_ERROR: "BAD_REQUEST_ERROR";
readonly INVALID_USER_DATA: "INVALID_USER_DATA";
readonly INVALID_BUSINESS_CUSTOMER_REQUEST: "INVALID_BUSINESS_CUSTOMER_REQUEST";
readonly INVALID_BUSINESS_CUSTOMER_ID: "INVALID_BUSINESS_CUSTOMER_ID";
readonly INVALID_BUSINESS_TRANSACTION_REQUEST: "INVALID_BUSINESS_TRANSACTION_REQUEST";
readonly INVALID_BUSINESS_TRANSACTION_ID: "INVALID_BUSINESS_TRANSACTION_ID";
/** 400. Observed in the sandbox on POST /payment-method. */
readonly INVALID_BUSINESS_PAYMENT_METHOD_REQUEST: "INVALID_BUSINESS_PAYMENT_METHOD_REQUEST";
readonly INVALID_BUSINESS_PAYMENT_METHOD_ID: "INVALID_BUSINESS_PAYMENT_METHOD_ID";
readonly INVALID_BUSINESS_POOL_ACCOUNT_REQUEST: "INVALID_BUSINESS_POOL_ACCOUNT_REQUEST";
/**
* 400. Observed in the sandbox on the payment batch endpoints, e.g. for a
* recipient or session that is not in the batch.
*/
readonly INVALID_BUSINESS_PAYMENT_BATCH_REQUEST: "INVALID_BUSINESS_PAYMENT_BATCH_REQUEST";
readonly INVALID_KYC_DOCUMENT_TYPE: "INVALID_KYC_DOCUMENT_TYPE";
/** 400. The channel is not supported by the endpoint, e.g. institution lookup. */
readonly INVALID_TRANSACTION_CHANNEL: "INVALID_TRANSACTION_CHANNEL";
/** The one-time password submitted to authorize a transaction was wrong. */
readonly OTP_INCORRECT: "OTP_INCORRECT";
/** 400. Observed in the sandbox when the amount is below the corridor minimum. */
readonly TRANSACTION_AMOUNT_TOO_SMALL: "TRANSACTION_AMOUNT_TOO_SMALL";
/**
* 409. A transaction with the same idempotency key or reference, or a
* checkout session with the same merchantReference, already exists. The
* original is not replayed: look it up instead of retrying.
*/
readonly DUPLICATE_REQUEST: "DUPLICATE_REQUEST";
/** 409. `details.data.customerId` carries the existing customer's id. */
readonly EMAIL_ALREADY_EXISTS: "EMAIL_ALREADY_EXISTS";
/** 409. `details.data.customerId` carries the existing customer's id. */
readonly PHONE_NUMBER_ALREADY_EXISTS: "PHONE_NUMBER_ALREADY_EXISTS";
/** 404. Observed in the sandbox for a payment batch that does not exist. */
readonly NOT_FOUND_ERROR: "NOT_FOUND_ERROR";
readonly BUSINESS_CUSTOMER_NOT_FOUND: "BUSINESS_CUSTOMER_NOT_FOUND";
readonly BUSINESS_TRANSACTION_NOT_FOUND: "BUSINESS_TRANSACTION_NOT_FOUND";
readonly BUSINESS_PAYMENT_METHOD_NOT_FOUND: "BUSINESS_PAYMENT_METHOD_NOT_FOUND";
readonly BUSINESS_NOT_FOUND: "BUSINESS_NOT_FOUND";
readonly USER_NOT_FOUND: "USER_NOT_FOUND";
readonly PAYMENT_METHOD_NOT_FOUND: "PAYMENT_METHOD_NOT_FOUND";
readonly TRANSACTION_PROCESSOR_NOT_FOUND: "TRANSACTION_PROCESSOR_NOT_FOUND";
/** 404. Observed in the sandbox when no processor serves the channel and country. */
readonly PROCESSOR_NOT_FOUND: "PROCESSOR_NOT_FOUND";
readonly VIRTUAL_ACCOUNT_LIMIT_REACHED: "VIRTUAL_ACCOUNT_LIMIT_REACHED";
/** 403. A virtual account for a customer can only be NGN. */
readonly UNSUPPORTED_VIRTUAL_ACCOUNT_CURRENCY: "UNSUPPORTED_VIRTUAL_ACCOUNT_CURRENCY";
/** 403. The currency needs a compliance-approved application first. */
readonly VIRTUAL_ACCOUNT_PENDING_COMPLIANCE_REVIEW: "VIRTUAL_ACCOUNT_PENDING_COMPLIANCE_REVIEW";
/** 429. The code the API sends when a rate limit is hit. */
readonly RATE_LIMIT_ERROR: "RATE_LIMIT_ERROR";
/**
* @deprecated The API sends `RATE_LIMIT_ERROR`. Kept so existing comparisons
* keep compiling; it never matches a response.
*/
readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
/**
* 503. An upstream processor failed or timed out, or the API is momentarily
* offline. Retry with backoff and honour `Retry-After`.
*/
readonly EXTERNAL_REQUEST_ERROR: "EXTERNAL_REQUEST_ERROR";
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
};
export type AfriexErrorCode = (typeof AfriexErrorCode)[keyof typeof AfriexErrorCode];
export declare const ERROR_CODE_MESSAGES: Record<AfriexErrorCode, string>;
//# sourceMappingURL=ErrorCodes.d.ts.map