@riocrypto/common 1.0.776 → 1.0.777
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/errors/active-sell-order-error.d.ts +2 -0
- package/build/errors/active-sell-order-error.js +2 -0
- package/build/errors/address-check-failed-error.d.ts +2 -0
- package/build/errors/address-check-failed-error.js +2 -1
- package/build/errors/admin-already-exists-error.d.ts +2 -0
- package/build/errors/admin-already-exists-error.js +7 -1
- package/build/errors/admin-not-found-error.d.ts +2 -0
- package/build/errors/admin-not-found-error.js +2 -1
- package/build/errors/admin-only-error.d.ts +2 -0
- package/build/errors/admin-only-error.js +7 -1
- package/build/errors/api-key-not-found-error.d.ts +2 -0
- package/build/errors/api-key-not-found-error.js +2 -1
- package/build/errors/auth-already-exists-error.d.ts +2 -0
- package/build/errors/auth-already-exists-error.js +7 -1
- package/build/errors/auth-not-found-error.d.ts +2 -0
- package/build/errors/auth-not-found-error.js +2 -1
- package/build/errors/authorization-failed-error.d.ts +2 -0
- package/build/errors/authorization-failed-error.js +2 -1
- package/build/errors/custom-error.d.ts +1 -0
- package/build/errors/database-connection-error.d.ts +2 -0
- package/build/errors/database-connection-error.js +2 -1
- package/build/errors/insufficient-liquidity-error.d.ts +2 -0
- package/build/errors/insufficient-liquidity-error.js +2 -0
- package/build/errors/invalid-order-size-error.d.ts +2 -0
- package/build/errors/invalid-order-size-error.js +2 -0
- package/build/errors/message-failed-error.d.ts +2 -0
- package/build/errors/message-failed-error.js +4 -1
- package/build/errors/missing-cpf-error.d.ts +2 -0
- package/build/errors/missing-cpf-error.js +2 -1
- package/build/errors/missing-kyc-approval-error.d.ts +2 -0
- package/build/errors/missing-kyc-approval-error.js +5 -1
- package/build/errors/missing-password-error.d.ts +2 -0
- package/build/errors/missing-password-error.js +2 -1
- package/build/errors/missing-security-question-error.d.ts +2 -0
- package/build/errors/missing-security-question-error.js +7 -1
- package/build/errors/missing-user-error.d.ts +2 -0
- package/build/errors/missing-user-error.js +4 -1
- package/build/errors/not-authorized-error.d.ts +2 -0
- package/build/errors/not-authorized-error.js +2 -1
- package/build/errors/not-broker-error.d.ts +2 -0
- package/build/errors/not-broker-error.js +5 -1
- package/build/errors/not-found-error.d.ts +2 -0
- package/build/errors/not-found-error.js +2 -1
- package/build/errors/partner-already-exists-error.d.ts +2 -0
- package/build/errors/partner-already-exists-error.js +2 -1
- package/build/errors/partner-auth-already-exists-error.d.ts +2 -0
- package/build/errors/partner-auth-already-exists-error.js +7 -1
- package/build/errors/partner-auth-not-found-error.d.ts +2 -0
- package/build/errors/partner-auth-not-found-error.js +2 -1
- package/build/errors/partner-not-found-error.d.ts +2 -0
- package/build/errors/partner-not-found-error.js +2 -1
- package/build/errors/password-already-used-error.d.ts +2 -0
- package/build/errors/password-already-used-error.js +2 -1
- package/build/errors/request-validation-error.d.ts +2 -0
- package/build/errors/request-validation-error.js +2 -1
- package/build/errors/rio-settings-already-exists-error.d.ts +2 -0
- package/build/errors/rio-settings-already-exists-error.js +4 -1
- package/build/errors/rio-settings-not-found-error.d.ts +2 -0
- package/build/errors/rio-settings-not-found-error.js +4 -1
- package/build/errors/user-already-exists-error.d.ts +2 -0
- package/build/errors/user-already-exists-error.js +2 -1
- package/build/errors/verification-failed-error.d.ts +2 -0
- package/build/errors/verification-failed-error.js +2 -1
- package/build/errors/wrong-order-state-error.d.ts +2 -0
- package/build/errors/wrong-order-state-error.js +5 -1
- package/build/errors/wrong-password-error.d.ts +2 -0
- package/build/errors/wrong-password-error.js +2 -1
- package/build/errors/wrong-processor-error.d.ts +2 -0
- package/build/errors/wrong-processor-error.js +7 -1
- package/build/errors/wrong-security-answer-error.d.ts +2 -0
- package/build/errors/wrong-security-answer-error.js +2 -1
- package/package.json +1 -1
|
@@ -2,8 +2,10 @@ import { CustomError } from "./custom-error";
|
|
|
2
2
|
export declare class ActiveSellOrderError extends CustomError {
|
|
3
3
|
private activeOrderId;
|
|
4
4
|
statusCode: number;
|
|
5
|
+
internalCode: number;
|
|
5
6
|
constructor(activeOrderId: string);
|
|
6
7
|
serializeErrors(): {
|
|
8
|
+
code: number;
|
|
7
9
|
message: string;
|
|
8
10
|
activeOrderId: string;
|
|
9
11
|
}[];
|
|
@@ -7,11 +7,13 @@ class ActiveSellOrderError extends custom_error_1.CustomError {
|
|
|
7
7
|
super("There is an active sell order for this user. Cannot create another one");
|
|
8
8
|
this.activeOrderId = activeOrderId;
|
|
9
9
|
this.statusCode = 409;
|
|
10
|
+
this.internalCode = 1;
|
|
10
11
|
Object.setPrototypeOf(this, ActiveSellOrderError.prototype);
|
|
11
12
|
}
|
|
12
13
|
serializeErrors() {
|
|
13
14
|
return [
|
|
14
15
|
{
|
|
16
|
+
code: this.internalCode,
|
|
15
17
|
message: "There is an active sell order for this user. Cannot create another one",
|
|
16
18
|
activeOrderId: this.activeOrderId,
|
|
17
19
|
},
|
|
@@ -6,10 +6,11 @@ class AddressCheckFailed extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Address check failed");
|
|
8
8
|
this.statusCode = 400;
|
|
9
|
+
this.internalCode = 2;
|
|
9
10
|
Object.setPrototypeOf(this, AddressCheckFailed.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Address check failed" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Address check failed" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.AddressCheckFailed = AddressCheckFailed;
|
|
@@ -6,10 +6,16 @@ class AdminAlreadyExistsError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Admin with provided email already exists");
|
|
8
8
|
this.statusCode = 409;
|
|
9
|
+
this.internalCode = 3;
|
|
9
10
|
Object.setPrototypeOf(this, AdminAlreadyExistsError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "Admin with provided email already exists",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
exports.AdminAlreadyExistsError = AdminAlreadyExistsError;
|
|
@@ -6,10 +6,11 @@ class AdminNotFoundError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Admin not found");
|
|
8
8
|
this.statusCode = 404;
|
|
9
|
+
this.internalCode = 4;
|
|
9
10
|
Object.setPrototypeOf(this, AdminNotFoundError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Admin not found" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Admin not found" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.AdminNotFoundError = AdminNotFoundError;
|
|
@@ -6,10 +6,16 @@ class AdminOnlyError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("This endpoint can only be called by admins");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 5;
|
|
9
10
|
Object.setPrototypeOf(this, AdminOnlyError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "This endpoint can only be called by admins",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
exports.AdminOnlyError = AdminOnlyError;
|
|
@@ -6,10 +6,11 @@ class APIKeyNotFoundError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("API key not found");
|
|
8
8
|
this.statusCode = 404;
|
|
9
|
+
this.internalCode = 6;
|
|
9
10
|
Object.setPrototypeOf(this, APIKeyNotFoundError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "API key not found" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "API key not found" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.APIKeyNotFoundError = APIKeyNotFoundError;
|
|
@@ -6,10 +6,16 @@ class AuthAlreadyExistsError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Auth with provided phone number already exists");
|
|
8
8
|
this.statusCode = 409;
|
|
9
|
+
this.internalCode = 7;
|
|
9
10
|
Object.setPrototypeOf(this, AuthAlreadyExistsError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "Auth with provided phone number already exists",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
exports.AuthAlreadyExistsError = AuthAlreadyExistsError;
|
|
@@ -6,10 +6,11 @@ class AuthNotFoundError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Auth not found");
|
|
8
8
|
this.statusCode = 404;
|
|
9
|
+
this.internalCode = 8;
|
|
9
10
|
Object.setPrototypeOf(this, AuthNotFoundError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Auth not found" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Auth not found" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.AuthNotFoundError = AuthNotFoundError;
|
|
@@ -6,10 +6,11 @@ class AuthorizationFailedError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Wyre authorization codes failed validation");
|
|
8
8
|
this.statusCode = 400;
|
|
9
|
+
this.internalCode = 9;
|
|
9
10
|
Object.setPrototypeOf(this, AuthorizationFailedError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Authorization failed" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Authorization failed" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.AuthorizationFailedError = AuthorizationFailedError;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CustomError } from "./custom-error";
|
|
2
2
|
export declare class DatabaseConnectionError extends CustomError {
|
|
3
3
|
statusCode: number;
|
|
4
|
+
internalCode: number;
|
|
4
5
|
reason: string;
|
|
5
6
|
constructor();
|
|
6
7
|
serializeErrors(): {
|
|
8
|
+
code: number;
|
|
7
9
|
message: string;
|
|
8
10
|
}[];
|
|
9
11
|
}
|
|
@@ -6,11 +6,12 @@ class DatabaseConnectionError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Error connecting to database");
|
|
8
8
|
this.statusCode = 500;
|
|
9
|
+
this.internalCode = 10;
|
|
9
10
|
this.reason = "Error connecting to database";
|
|
10
11
|
Object.setPrototypeOf(this, DatabaseConnectionError.prototype);
|
|
11
12
|
}
|
|
12
13
|
serializeErrors() {
|
|
13
|
-
return [{ message: this.reason }];
|
|
14
|
+
return [{ code: this.internalCode, message: this.reason }];
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
exports.DatabaseConnectionError = DatabaseConnectionError;
|
|
@@ -6,11 +6,13 @@ class InsufficientLiquidityError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Insufficient liquidity to process order");
|
|
8
8
|
this.statusCode = 400;
|
|
9
|
+
this.internalCode = 11;
|
|
9
10
|
Object.setPrototypeOf(this, InsufficientLiquidityError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
13
|
return [
|
|
13
14
|
{
|
|
15
|
+
code: this.internalCode,
|
|
14
16
|
message: "Insufficient liquidity to process order, please try again later",
|
|
15
17
|
},
|
|
16
18
|
];
|
|
@@ -4,8 +4,10 @@ export declare class InvalidOrderSizeError extends CustomError {
|
|
|
4
4
|
private minAmount;
|
|
5
5
|
private minAmountFiat;
|
|
6
6
|
statusCode: number;
|
|
7
|
+
internalCode: number;
|
|
7
8
|
constructor(minAmount: number, minAmountFiat: Fiat);
|
|
8
9
|
serializeErrors(): {
|
|
10
|
+
code: number;
|
|
9
11
|
message: string;
|
|
10
12
|
minAmount: number;
|
|
11
13
|
minAmountFiat: Fiat;
|
|
@@ -8,11 +8,13 @@ class InvalidOrderSizeError extends custom_error_1.CustomError {
|
|
|
8
8
|
this.minAmount = minAmount;
|
|
9
9
|
this.minAmountFiat = minAmountFiat;
|
|
10
10
|
this.statusCode = 400;
|
|
11
|
+
this.internalCode = 12;
|
|
11
12
|
Object.setPrototypeOf(this, InvalidOrderSizeError.prototype);
|
|
12
13
|
}
|
|
13
14
|
serializeErrors() {
|
|
14
15
|
return [
|
|
15
16
|
{
|
|
17
|
+
code: this.internalCode,
|
|
16
18
|
message: "Invalid order size",
|
|
17
19
|
minAmount: this.minAmount,
|
|
18
20
|
minAmountFiat: this.minAmountFiat,
|
|
@@ -6,10 +6,13 @@ class MessageFailedError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Failed to send verification code");
|
|
8
8
|
this.statusCode = 500;
|
|
9
|
+
this.internalCode = 13;
|
|
9
10
|
Object.setPrototypeOf(this, MessageFailedError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{ code: this.internalCode, message: "Failed to send verification code" },
|
|
15
|
+
];
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
exports.MessageFailedError = MessageFailedError;
|
|
@@ -6,10 +6,11 @@ class MissingCPFError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("User is missing CPF");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 14;
|
|
9
10
|
Object.setPrototypeOf(this, MissingCPFError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "User is missing CPF" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "User is missing CPF" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.MissingCPFError = MissingCPFError;
|
|
@@ -6,11 +6,15 @@ class MissingKYCApprovalError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("KYC status is not approved for this user");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 15;
|
|
9
10
|
Object.setPrototypeOf(this, MissingKYCApprovalError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
13
|
return [
|
|
13
|
-
{
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "KYC status is not approved is not approved for this user",
|
|
17
|
+
},
|
|
14
18
|
];
|
|
15
19
|
}
|
|
16
20
|
}
|
|
@@ -6,10 +6,11 @@ class MissingPasswordError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Password is not registered");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 16;
|
|
9
10
|
Object.setPrototypeOf(this, MissingPasswordError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Password is not registered" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Password is not registered" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.MissingPasswordError = MissingPasswordError;
|
|
@@ -6,10 +6,16 @@ class MissingSecurityQuestionError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Security question is not registered");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 17;
|
|
9
10
|
Object.setPrototypeOf(this, MissingSecurityQuestionError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "Security question is not registered",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
exports.MissingSecurityQuestionError = MissingSecurityQuestionError;
|
|
@@ -6,10 +6,13 @@ class MissingUserError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Auth is not registered to a user");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 18;
|
|
9
10
|
Object.setPrototypeOf(this, MissingUserError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{ code: this.internalCode, message: "Auth is not registered to a user" },
|
|
15
|
+
];
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
exports.MissingUserError = MissingUserError;
|
|
@@ -6,10 +6,11 @@ class NotAuthorizedError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Not authorized");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 19;
|
|
9
10
|
Object.setPrototypeOf(this, NotAuthorizedError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Not authorized" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Not authorized" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.NotAuthorizedError = NotAuthorizedError;
|
|
@@ -6,11 +6,15 @@ class NotBrokerError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("To call this endpoint as a user, you must be a broker");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 20;
|
|
9
10
|
Object.setPrototypeOf(this, NotBrokerError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
13
|
return [
|
|
13
|
-
{
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "To do this operation as a user, you must be a broker",
|
|
17
|
+
},
|
|
14
18
|
];
|
|
15
19
|
}
|
|
16
20
|
}
|
|
@@ -6,10 +6,11 @@ class NotFoundError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Route not found");
|
|
8
8
|
this.statusCode = 404;
|
|
9
|
+
this.internalCode = 21;
|
|
9
10
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Not found" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Not found" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.NotFoundError = NotFoundError;
|
|
@@ -6,10 +6,11 @@ class PartnerAlreadyExistsError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Partner already exists");
|
|
8
8
|
this.statusCode = 409;
|
|
9
|
+
this.internalCode = 22;
|
|
9
10
|
Object.setPrototypeOf(this, PartnerAlreadyExistsError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Partner already exists" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Partner already exists" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.PartnerAlreadyExistsError = PartnerAlreadyExistsError;
|
|
@@ -6,10 +6,16 @@ class PartnerAuthAlreadyExistsError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Partner auth with provided email already exists");
|
|
8
8
|
this.statusCode = 409;
|
|
9
|
+
this.internalCode = 23;
|
|
9
10
|
Object.setPrototypeOf(this, PartnerAuthAlreadyExistsError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "Partner auth with provided email already exists",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
exports.PartnerAuthAlreadyExistsError = PartnerAuthAlreadyExistsError;
|
|
@@ -6,10 +6,11 @@ class PartnerAuthNotFoundError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Partner auth not found");
|
|
8
8
|
this.statusCode = 404;
|
|
9
|
+
this.internalCode = 24;
|
|
9
10
|
Object.setPrototypeOf(this, PartnerAuthNotFoundError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Partner auth not found" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Partner auth not found" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.PartnerAuthNotFoundError = PartnerAuthNotFoundError;
|
|
@@ -6,10 +6,11 @@ class PartnerNotFoundError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Partner not found");
|
|
8
8
|
this.statusCode = 404;
|
|
9
|
+
this.internalCode = 25;
|
|
9
10
|
Object.setPrototypeOf(this, PartnerNotFoundError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Partner not found" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Partner not found" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.PartnerNotFoundError = PartnerNotFoundError;
|
|
@@ -6,10 +6,11 @@ class PasswordAlreadyUsedError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Password already used");
|
|
8
8
|
this.statusCode = 400;
|
|
9
|
+
this.internalCode = 26;
|
|
9
10
|
Object.setPrototypeOf(this, PasswordAlreadyUsedError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Password already used" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Password already used" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.PasswordAlreadyUsedError = PasswordAlreadyUsedError;
|
|
@@ -3,8 +3,10 @@ import { ValidationError } from "express-validator";
|
|
|
3
3
|
export declare class RequestValidationError extends CustomError {
|
|
4
4
|
errors: ValidationError[];
|
|
5
5
|
statusCode: number;
|
|
6
|
+
internalCode: number;
|
|
6
7
|
constructor(errors: ValidationError[]);
|
|
7
8
|
serializeErrors(): {
|
|
9
|
+
code: number;
|
|
8
10
|
message: any;
|
|
9
11
|
field: string;
|
|
10
12
|
}[];
|
|
@@ -7,11 +7,12 @@ class RequestValidationError extends custom_error_1.CustomError {
|
|
|
7
7
|
super("Invalid request parameters");
|
|
8
8
|
this.errors = errors;
|
|
9
9
|
this.statusCode = 400;
|
|
10
|
+
this.internalCode = 27;
|
|
10
11
|
Object.setPrototypeOf(this, RequestValidationError.prototype);
|
|
11
12
|
}
|
|
12
13
|
serializeErrors() {
|
|
13
14
|
return this.errors.map((err) => {
|
|
14
|
-
return { message: err.msg, field: err.param };
|
|
15
|
+
return { code: this.internalCode, message: err.msg, field: err.param };
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -6,10 +6,13 @@ class RioSettingsAlreadyExistsError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Rio settings already exists");
|
|
8
8
|
this.statusCode = 409;
|
|
9
|
+
this.internalCode = 28;
|
|
9
10
|
Object.setPrototypeOf(this, RioSettingsAlreadyExistsError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{ code: this.internalCode, message: "Rio settings already exists" },
|
|
15
|
+
];
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
exports.RioSettingsAlreadyExistsError = RioSettingsAlreadyExistsError;
|
|
@@ -6,10 +6,13 @@ class RioSettingsNotFoundError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Rio settings not found");
|
|
8
8
|
this.statusCode = 404;
|
|
9
|
+
this.internalCode = 29;
|
|
9
10
|
Object.setPrototypeOf(this, RioSettingsNotFoundError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{ code: this.internalCode, message: "Missing internal Rio settings" },
|
|
15
|
+
];
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
exports.RioSettingsNotFoundError = RioSettingsNotFoundError;
|
|
@@ -6,10 +6,11 @@ class UserAlreadyExistsError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("User already exists");
|
|
8
8
|
this.statusCode = 409;
|
|
9
|
+
this.internalCode = 30;
|
|
9
10
|
Object.setPrototypeOf(this, UserAlreadyExistsError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "User already exists" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "User already exists" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.UserAlreadyExistsError = UserAlreadyExistsError;
|
|
@@ -6,10 +6,11 @@ class VerificationFailedError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("SMS verification failed");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 31;
|
|
9
10
|
Object.setPrototypeOf(this, VerificationFailedError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Verification failed" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Verification failed" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.VerificationFailedError = VerificationFailedError;
|
|
@@ -6,11 +6,15 @@ class WrongOrderStateError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Order is not in the correct state to call this method");
|
|
8
8
|
this.statusCode = 400;
|
|
9
|
+
this.internalCode = 32;
|
|
9
10
|
Object.setPrototypeOf(this, WrongOrderStateError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
13
|
return [
|
|
13
|
-
{
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "Order is not in the correct state to call this method",
|
|
17
|
+
},
|
|
14
18
|
];
|
|
15
19
|
}
|
|
16
20
|
}
|
|
@@ -6,10 +6,11 @@ class WrongPasswordError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Wrong password");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 33;
|
|
9
10
|
Object.setPrototypeOf(this, WrongPasswordError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Wrong password" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Wrong password" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.WrongPasswordError = WrongPasswordError;
|
|
@@ -6,10 +6,16 @@ class WrongProcessorError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Order not assigned to this processor");
|
|
8
8
|
this.statusCode = 400;
|
|
9
|
+
this.internalCode = 34;
|
|
9
10
|
Object.setPrototypeOf(this, WrongProcessorError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
code: this.internalCode,
|
|
16
|
+
message: "Order not assigned to this processor",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
exports.WrongProcessorError = WrongProcessorError;
|
|
@@ -6,10 +6,11 @@ class WrongSecurityAnswerError extends custom_error_1.CustomError {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Wrong security answer");
|
|
8
8
|
this.statusCode = 401;
|
|
9
|
+
this.internalCode = 35;
|
|
9
10
|
Object.setPrototypeOf(this, WrongSecurityAnswerError.prototype);
|
|
10
11
|
}
|
|
11
12
|
serializeErrors() {
|
|
12
|
-
return [{ message: "Wrong security answer" }];
|
|
13
|
+
return [{ code: this.internalCode, message: "Wrong security answer" }];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.WrongSecurityAnswerError = WrongSecurityAnswerError;
|