voko-sdk
Version:
Process payments with ease
40 lines (39 loc) • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthenticationError = exports.NetworkError = exports.InsufficientFundsError = exports.PaymentDeclinedError = exports.PaymentValidationError = void 0;
const voko_error_1 = require("./voko-error");
const types_1 = require("../types");
class PaymentValidationError extends voko_error_1.VokoError {
constructor(message, field) {
super(message, types_1.VokoErrorCode.INVALID_AMOUNT, undefined, undefined, {
field,
});
}
}
exports.PaymentValidationError = PaymentValidationError;
class PaymentDeclinedError extends voko_error_1.VokoError {
constructor(message, reason) {
super(message, types_1.VokoErrorCode.PAYMENT_DECLINED, undefined, undefined, {
reason,
});
}
}
exports.PaymentDeclinedError = PaymentDeclinedError;
class InsufficientFundsError extends voko_error_1.VokoError {
constructor(message = 'Insufficient funds') {
super(message, types_1.VokoErrorCode.INSUFFICIENT_FUNDS);
}
}
exports.InsufficientFundsError = InsufficientFundsError;
class NetworkError extends voko_error_1.VokoError {
constructor(message = 'Network error occurred') {
super(message, types_1.VokoErrorCode.NETWORK_ERROR);
}
}
exports.NetworkError = NetworkError;
class AuthenticationError extends voko_error_1.VokoError {
constructor(message = 'Authentication failed') {
super(message, types_1.VokoErrorCode.AUTHENTICATION_FAILED);
}
}
exports.AuthenticationError = AuthenticationError;