...
The objective is to enhance error communication between the backend and frontend.
...
✅ Proposed Solution
To address these issues, we propose the creation of new error classes in the backend that will be sent to the frontend. This implementation will include specific error codes for different scenarios, such as payment cancellations, instead of using generic codes. This change will allow the frontend to display more informative and contextualized error messages, improving clarity and the overall user experience.
Backend
Info |
---|
After the solution approval, will need to update the below documents with new classes, code errors, and any important things. |
Description errors
Expand |
---|
|
QTD | Payment method | Paycomet Code | Public Message (Logs/Amplitude) | Error Code | Lokalise key description error modal: error.payment.X.XXX
title error modal: error.payment.X.XXX.title label button modal: error.payment.X.XXX.cta | Severity | Class Error | Parent class | Documentation | 1 | Card | 100 | Expired credit card | PAYMENT.2.100.003
| error.payment.2.100.103
error.payment.2.100.103.tilte
error.payment.2.100.103.cta
| 2 | ExpiredCardError | CardError2 | Represents an error when the card has expired | 2 | Card | 105 | Insufficient funds | PAYMENT.2.100.
|
|
...
NoFundsCardError
004
| error.payment.2.100.104
error.payment.2.100.104.title
error.payment.2.100.104.cta
| 2 | NoFundsCardError | CardError2 | Represents an error when the card does not have enough funds in order to perform the payment | 3 | Card | 127 | Invalid parameter | PAYMENT
|
|
...
.4.009
| error.payment.4.009
error.payment.4.009.title
error.payment.4.009.cta
| 4 | DataExternalValidationError | ExternalValidationError2 | Represents an error when there is an invalid parameter | 4 | Card | 137 | Credit card not valid | PAYMENT.2.100.
|
|
...
...
CardNotValidError
...
Represents an error when the card declined for various reasons
...
Card
...
141
...
Amount zero or not valid
...
Card
...
143
...
Authentification error
...
PAYMENT.4.001.001
...
AuthenticationError
...
Represents errors related to security and authentication within the payment system.
Invalid access tokens, and other related security and authentication problems.
...
Card
...
195
...
Requires SCA authentication
...
PAYMENT.4.001.002
...
ScaAuthenticationError
...
Represents an error a Strong Customer Authentication error.
SCA (Strong Customer Authentication) is a requirement of the European directive PSD2 (Revised Payment Services Directive) aimed at enhancing the security of online financial transactions
...
Card
...
500
...
...
Represents an error when the amount is zero or not valid
error.payment.2.100.106.title
error.payment.2.100.106.cta
| 2 | DeclinedCardError | CardError2 | Represents an error when the card declined for various reasons | 5 | Card | 141 | Invalid amount | PAYMENT.2.100.007
| error.payment.2.100.107
error.payment.2.100.107.title
error.payment.2.100.107.cta
| 2 | InvalidAmountError | NoFundsCardError | Represents an error when the amount is zero or not valid | 6 | Card | 143 | Authentification error | PAYMENT.4.
|
|
...
PspError2
...
General, unspecified payment error.
...
Card
...
506
...
Confirmation data not valid
...
PAYMENT.4.006.001
...
ConfirmationDataNotValidError
...
Represents an error when confirmation data is not valid
...
Card
...
510
...
Refund is not possible
...
PAYMENT.4.010.001
...
RefundNotPossibleError
...
Represents an error when the refund is not possible
...
Card
...
535
...
General PSP error
...
PAYMENT.4.000
...
PspError2
...
General, unspecified payment error.
...
Card
...
549
...
General PSP error
...
PAYMENT.4.000
...
PspError2
...
General, unspecified payment error.
...
Card
...
555
...
Could not find the previous operation
...
PAYMENT.4.009.001
...
CouldNotFindPreviousOperationError
...
Represents an error when could not find the previous operation
...
Card
...
569
...
Denied operation
...
PAYMENT.4.010
...
OperationDeniedError
...
Represents an error when the operation cannot be performed
...
Card
...
1019
...
Operation timeout exceeded
...
PAYMENT.4.011
...
TimeOutConnectionError
...
Represents an error when there is a timeout
...
Card
...
1026
...
001.001
| error.payment.4.001.001
error.payment.4.001.001.title
error.payment.4.001.001.cta
| 4 | AuthenticationError | AuthSecurityError2 | Represents errors related to security and authentication within the payment system. Invalid access tokens, and other related security and authentication problems. | 7 | Card | 195 | Requires SCA authentication | PAYMENT.4.001.002
| error.payment.4.001.002
error.payment.4.001.002.title
error.payment.4.001.002.cta
| 4 | ScaAuthenticationError | AuthSecurityError2 | Represents an error a Strong Customer Authentication error. SCA (Strong Customer Authentication) is a requirement of the European directive PSD2 (Revised Payment Services Directive) aimed at enhancing the security of online financial transactions | 8 | Card | 500 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 9 | Card | 506 | Confirmation data not valid | PAYMENT.4.006.
|
|
...
Card
...
1038
...
Field DS_MERCHANT_AMOUNT incorrect
...
PAYMENT.4.009.002
...
...
Represents an error when there is a duplicated external reference
error.payment.4.006.001
error.payment.4.006.001.title
error.payment.4.006.00.cta
| 4 | ConfirmationDataNotValidError | ExternalError2 | Represents an error when |
|
...
confirmation data is not valid | 10 | Card |
|
...
1099
510 | Refund is not possible | PAYMENT.4.010.
|
|
...
PspError2
...
General, unspecified payment error.
...
Card
...
1186
...
Maximum limit not allowed
...
PAYMENT.2.102.004
...
CardLimitExceededError
...
Represents an error when the card amount/number of transaction limit has been exceeded
...
Card
...
1191
...
Day / IP address limit (all cards) not allowed
...
PAYMENT.2.102.004
...
001
| error.payment.4.010.001
error.payment.4.010.001.title
error.payment.4.010.001.cta
| 4 | RefundNotPossibleError | OperationDeniedError | Represents an error when the |
|
...
refund is not possible | 11 | Card |
|
...
1194
513 | General external error | PAYMENT.
|
|
...
...
...
Something you know: such as a password or PIN.
Something you have: like a mobile phone, security token, or debit/credit card.
Something you are: such as biometrics, like fingerprints or facial recognition.
...
TimeOutConnectionError
...
ConnectionError
...
4
...
An error when the 3DS Challenge failed
...
ThreeDsChallengeFailedError
...
PaymentProcessingError
...
2
...
An error when there is a timeout
intl-packages
Will be created new classes in the path:
Expand |
---|
title | AmountNotValidError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
import { NoFundsCardError } from './no-founds-card-error';
export class AmountNotValidError extends NoFundsCardError {
/**
* Represents an error when the amount is zero or not valid.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.AMOUNT_NOT_VALID_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | AuthenticationError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { AuthSecurityError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class AuthenticationError extends AuthSecurityError2 {
/**
* Represents an error when the user cannot be authenticated.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.AUTHENTICATION_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | CardCountryNotAllowed details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { PaymentRestrictionError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class CardCountryNotAllowed extends PaymentRestrictionError2 {
/**
* Represents an error when the card / issuing bank country is not allowed for the transaction.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.CARD_COUNTRY_NOT_ALLOWED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | CardLimitExceededError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { PaymentRestrictionError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class CardLimitExceededError extends PaymentRestrictionError2 {
/**
* Represents an error when the card amount/number of transaction limit has been exceeded.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.CARD_LIMIT_EXCEEDED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | CardNotValidError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class CardNotValidError extends CardError2 {
/**
* Represents an error when the card declined for various reasons.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.CARD_NOT_VALID_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | CardTypeNotAllowedError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class CardTypeNotAllowedError extends CardError2 {
/**
* Represents an error when the card type (type/brand/etc.) is not allowed for this transaction.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.CARD_TYPE_NOT_ALLOWED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
} |
|
Expand |
---|
title | CardholderSecurePurchaseKeyError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { AuthSecurityError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class CardholderSecurePurchaseKeyError extends AuthSecurityError2 {
/**
* Represents an error when there is a commerce with secure
* cardholder and cardholder without secure purchase key.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.CARDHOLDER_SECURE_PURCHASE_KEY_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | ConfirmationDataNotValidError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class ConfirmationDataNotValidError extends ExternalError2 {
/**
* Represents an error when confirmation data not valid.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.CONFIRMATION_DATA_NOT_VALID_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | CouldNotFindPreviousOperationError details |
---|
|
Code Block |
---|
|
|
import
...
Represents an error when the card type (type/brand/etc.) is not allowed for this transaction
...
Card
...
1197
...
Denied. Filter: Card country issuer not allowed
...
PAYMENT.2.102.005
...
CardCountryNotAllowed
...
Represents an error when the card / issuing bank country is not allowed for the transaction
...
Card
...
1254
...
Commerce with secure cardholder and cardholder without secure purchase key
...
PAYMENT.4.001.004
...
CardholderSecurePurchaseKeyError
...
Represents an error when there is a commerce with secure cardholder and cardholder without secure purchase key
...
Card
...
1326
...
Denial by security controls on the processor
...
PAYMENT.2.002
...
FraudError
...
Represents errors generated when a transaction is suspected of being fraudulent. This class extends `ExternalError` to encapsulate fraud-related issues, including abnormal user behavior, suspicious transaction patterns, and other indicators of potential fraud. It is designed to aid in the identification and management of transactions that may pose a risk to the payment system
...
Card
...
1327
...
3DS authentication process error
...
PAYMENT.2.101.003
...
ThreeDsChallengeFailedError
...
Represents an error when the 3DS Challenge failed
...
Payment Link
...
1417
...
PayPal - The instrument presented has been declined. Please select another one.
...
PAYMENT.2.100.105
...
DeclinedCardError
...
Represents an error when the card declined for various reasons
Created classes:
AuthSecurityError
ExternalError
FraudError
PspError
ExternalValidationError
Classes will be created:
AmountNotValidError
AuthenticationError
CardCountryNotAllowed
CardLimitExceededError
CardNotValidError
CardTypeNotAllowedError
CardholderSecurePurchaseKeyError
ConfirmationDataNotValidError
CouldNotFindPreviousOperationError
DataExternalValidationError
DeclinedCardError
DuplicatedExternalReferenceError
ExpiredCardError
FieldDsMerchantAmountIncorrectError
InvalidParameterError
NoFundsCardError
OperationDeniedError
RefundNotPossibleError
ScaAuthenticationError
TimeOutConnectionError
ThreeDsChallengeFailedError
New classes to be created
...
Class name
...
Parent class
...
Severity
...
Description
...
AmountNotValidError
...
NoFundsCardError
...
2
...
The amount is zero or not valid
...
AuthenticationError
...
AuthSecurityError
...
4
...
The user cannot be authenticated
...
CardCountryNotAllowed
...
PaymentRestrictionError
...
2
...
The card / issuing bank country is not allowed for the transaction.
...
CardLimitExceededError
...
PaymentRestrictionError
...
2
...
The card amount/number of transaction limit has been exceeded
...
CardNotValidError
...
CardError
...
2
...
The card declined for various reasons
...
CardTypeNotAllowedError
...
CardError
...
2
...
The card type (type/brand/etc.) is not allowed for this transaction
...
CardholderSecurePurchaseKeyError
...
AuthSecurityError
...
4
...
There is a commerce with secure cardholder and cardholder without secure purchase key
...
ConfirmationDataNotValidError
...
ExternalError
...
4
...
Confirmation data not valid
...
CouldNotFindPreviousOperationError
...
DataExternalValidationError
...
4
...
Could not find the previous operation
...
DataExternalValidationError
...
ExternalValidationError
...
4
...
The data sent to the PSP is not correct. It might have missing or incorrect parameters
...
DeclinedCardError
...
CardError
...
2
...
The card declined for various reasons
...
DuplicatedExternalReferenceError
...
ExternalError
...
4
...
There is a duplicated external reference
...
ExpiredCardError
...
CardError
...
2
...
The card has expired
...
FieldDsMerchantAmountIncorrectError
...
DataExternalValidationError
...
4
...
The field DS_MERCHANT_AMOUNT is incorrect
...
InvalidParameterError
...
ExternalValidationError
...
2
...
There is an invalid parameter
...
NoFundsCardError
...
CardError
...
2
...
The card does not have enough funds in order to perform the payment
...
OperationDeniedError
...
ExternalValidationError
...
4
...
The operation cannot be performed
...
RefundNotPossibleError
...
OperationDeniedError
...
4
...
A refund is not possible
...
ScaAuthenticationError
...
AuthSecurityError
...
4
...
error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 12 | Card | 514 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 13 | Card | 515 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 14 | Card | 516 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 15 | Card | 517 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 16 | Card | 518 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 17 | Card | 519 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 18 | Card | 520 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 19 | Card | 521 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 20 | Card | 522 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 21 | Card | 523 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 22 | Card | 535 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 23 | Card | 524 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 24 | Card | 525 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 25 | Card | 526 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 26 | Card | 549 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 27 | Card | 555 | Could not find the previous operation | PAYMENT.4.009.001
| error.payment.4.009.001
error.payment.4.009.001.title
error.payment.4.009.001.cta
| 4 | CouldNotFindPreviousOperationError | DataExternalValidationError | Represents an error when could not find the previous operation | 28 | Card | 569 | Denied operation | PAYMENT.4.010
| error.payment.4.010
error.payment.4.010.title
error.payment.4.010.cta
| 4 | OperationDeniedError | ExternalValidationError2 | Represents an error when the operation cannot be performed | 29 | Card | 1019 | Operation timeout exceeded | PAYMENT.4.011
| error.payment.4.011
error.payment.4.011.title
error.payment.4.011.cta
| 4 | TimeOutConnectionError | ConnectionError2 | Represents an error when there is a timeout | 30 | Card | 1026 | Duplicated external reference | PAYMENT.4.006.002
| error.payment.4.006.002
error.payment.4.006.002.title
error.payment.4.006.002.cta
| 4 | DuplicatedExternalReferenceError | ExternalError2 | Represents an error when there is a duplicated external reference | 31 | Card | 1038 | Field DS_MERCHANT_AMOUNT incorrect | PAYMENT.4.009
| error.payment.4.009
error.payment.4.009.title
error.payment.4.009.cta
| 4 | DataExternalValidationError | ExternalValidationError2 | Represents an error when the field DS_MERCHANT_AMOUNT is incorrect | 32 | Card | 1099 | General external error | PAYMENT.4.006
| error.payment.4.006
error.payment.4.006.title
error.payment.4.006.cta
| 4 | ExternalError2 | PspError2 | General, unspecified payment error. | 33 | Card | 1185 | Minimun limit not allowed | PAYMENT.2.102.004
| error.payment.2.102.004
error.payment.2.102.004.title
error.payment.2.102.004.cta
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the Minimun limit not allowed | 34 | Card | 1186 | Maximum limit not allowed | PAYMENT.2.102.004
| error.payment.2.102.004
error.payment.2.102.004.title
error.payment.2.102.004.cta
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the card amount/number of transaction limit has been exceeded | 35 | Card | 1187 | Daily limit not allowed | PAYMENT.2.102.004
| error.payment.2.102.004
error.payment.2.102.004.title
error.payment.2.102.004.cta
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the Daily limit not allowed | 36 | Card | 1188 | Monthly limit not allowed | PAYMENT.2.102.004
| error.payment.2.102.004
error.payment.2.102.004.title
error.payment.2.102.004.cta
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the Monthly limit not allowed | 37 | Card | 1189 | Max amount (same card / last 24 h.) not allowed | PAYMENT.2.102.004
| error.payment.2.102.004
error.payment.2.102.004.title
error.payment.2.102.004.cta
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the Max amount (same card / last 24 h.) not allowed | 38 | Card | 1190 | Max amount (same card / last 24 h. / same IP address) not allowed | PAYMENT.2.102.004
| error.payment.2.102.004
error.payment.2.102.004.title
error.payment.2.102.004.cta
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the Max amount (same card / last 24 h. / same IP address) not allowed | 39 | Card | 1191 | Day / IP address limit (all cards) not allowed | PAYMENT.2.102.004
| error.payment.2.102.004
error.payment.2.102.004.title
error.payment.2.102.004.cta
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the card amount/number of transaction limit has been exceeded | 40 | Card | 1194 | Card brands not allowed | PAYMENT.2.100.002
| error.payment.2.100.002
error.payment.2.100.002.title
error.payment.2.100.002.cta
| 2 | CardTypeNotAllowedError | CardError2 | Represents an error when the card type (type/brand/etc.) is not allowed for this transaction | 41 | Card | 1197 | Card country issuer not allowed | PAYMENT.2.102.005
| error.payment.2.102.005
error.payment.2.102.005.title
error.payment.2.102.005.cta
| 2 | CardCountryNotAllowed | PaymentRestrictionError2 | Represents an error when the card / issuing bank country is not allowed for the transaction | 42 | Card | 1254 | Commerce with secure cardholder and cardholder without secure purchase key | PAYMENT.4.001.003
| error.payment.4.001.003
error.payment.4.001.003.title
error.payment.4.001.003.cta
| 4 | CardholderSecurePurchaseKeyError | AuthSecurityError2 | Represents an error when there is a commerce with secure cardholder and cardholder without secure purchase key | 43 | Card | 1326 | Denial by security controls on the processor | PAYMENT.2.002
| error.payment.2.002
error.payment.2.002.title
error.payment.2.002.cta
| 2 | FraudError | ExternalError2 | Represents errors generated when a transaction is suspected of being fraudulent. This class extends `ExternalError` to encapsulate fraud-related issues, including abnormal user behavior, suspicious transaction patterns, and other indicators of potential fraud. It is designed to aid in the identification and management of transactions that may pose a risk to the payment system | 44 | Card | 1327 | 3DS authentication process error | PAYMENT.2.101.003
| error.payment.2.101.003
error.payment.2.101.003.title
error.payment.2.101.003.cta
| 2 | ThreeDsChallengeFailedError | PaymentProcessingError2 | Represents an error when the 3DS Challenge failed | 45 | Payment Link | 1417 | PayPal - The instrument presented has been declined. Please select another one. | PAYMENT.2.100.005
| error.payment.2.100.105
error.payment.2.100.105.title
error.payment.2.100.105.cta
| 2 | DeclinedCardError | CardError2 | Represents an error when the card declined for various reasons |
|
Created classes:
AuthSecurityError
ExternalError
FraudError
PspError
ExternalValidationError
Classes will be created:
InvalidAmountError
AuthenticationError
CardCountryNotAllowed
CardLimitExceededError
DeclinedCardError
CardTypeNotAllowedError
CardholderSecurePurchaseKeyError
ConfirmationDataNotValidError
CouldNotFindPreviousOperationError
DataExternalValidationError
DeclinedCardError
DuplicatedExternalReferenceError
ExpiredCardError
NoFundsCardError
OperationDeniedError
RefundNotPossibleError
ScaAuthenticationError
TimeOutConnectionError
ThreeDsChallengeFailedError
intl-packages
Will be created new classes in the path:
Expand |
---|
title | InvalidAmountError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
import { DataExternalValidationErrorNoFundsCardError } from './datano-externalfounds-validationcard-error';
export class CouldNotFindPreviousOperationErrorInvalidAmountError extends DataExternalValidationErrorNoFundsCardError {
/**
* Represents an error when couldthe amount notis findzero theor previousnot operationvalid.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.COULDINVALID_NOT_FIND_PREVIOUS_OPERATION_AMOUNT_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | DataExternalValidationError AuthenticationError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalValidationError2AuthSecurityError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class DataExternalValidationErrorAuthenticationError extends ExternalValidationError2AuthSecurityError2 {
/**
* Represents an error when the datauser sentcannot to the PSP is not correctbe authenticated.
* It might
have missing or incorrect parameters.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.DATAAUTHENTICATION_EXTERNAL_VALIDATION_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | DeclinedCardError CardCountryNotAllowed details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2PaymentRestrictionError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class DeclinedCardErrorCardCountryNotAllowed extends CardError2PaymentRestrictionError2 {
/**
* Represents an error when the card declined / issuing bank country is not allowed for variousthe reasonstransaction.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.DECLINED_CARDCARD_COUNTRY_NOT_ALLOWED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | DuplicatedExternalReferenceError CardLimitExceededError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalError2PaymentRestrictionError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class DuplicatedExternalReferenceErrorCardLimitExceededError extends ExternalError2PaymentRestrictionError2 {
/**
* Represents an error when there is a duplicated external reference the card amount/number of transaction limit has been exceeded.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.DUPLICATEDCARD_EXTERNALLIMIT_REFERENCEEXCEEDED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | ExpiredCardError DeclinedCardError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class ExpiredCardErrorDeclinedCardError extends CardError2 {
/**
* Represents an error when the card has expireddeclined for various reasons.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.EXPIREDDECLINED_CARD_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | FieldDsMerchantAmountIncorrectError CardTypeNotAllowedError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
import { DataExternalValidationError }
from
'./data-external-validation-error';
export class FieldDsMerchantAmountIncorrectErrorCardTypeNotAllowedError extends DataExternalValidationErrorCardError2 {
/**
* Represents an error when the card field DS_MERCHANT_AMOUNT is incorrecttype (type/brand/etc.) is not allowed for this transaction.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.FIELDCARD_DSTYPE_MERCHANTNOT_AMOUNT_INCORRECTALLOWED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | InvalidParameterError CardholderSecurePurchaseKeyError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalValidationError2AuthSecurityError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class InvalidParameterErrorCardholderSecurePurchaseKeyError extends ExternalValidationError2AuthSecurityError2 {
/**
* Represents an error when there is an invalid parametera commerce with secure
* cardholder and cardholder without secure purchase key.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.INVALIDCARDHOLDER_PARAMETER_ERRORSECURE_PURCHASE_KEY_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | NoFundsCardError ConfirmationDataNotValidError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2ExternalError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class NoFundsCardErrorConfirmationDataNotValidError extends CardError2ExternalError2 {
/**
* Represents an error when theconfirmation card doesdata not have enough funds in order to perform the paymentvalid.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.NOCONFIRMATION_DATA_FUNDSNOT_CARDVALID_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | OperationDeniedError CouldNotFindPreviousOperationError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalValidationError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
import { DataExternalValidationError } from './data-external-validation-error';
export class OperationDeniedErrorCouldNotFindPreviousOperationError extends ExternalValidationError2DataExternalValidationError {
/**
* Represents an error when could thenot operationfind cannotthe beprevious performedoperation.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.COULD_NOT_FIND_PREVIOUS_OPERATION_DENIED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | RefundNotPossibleError DataExternalValidationError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalValidationError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
import { OperationDeniedError } from './operation-denied-error';
export class RefundNotPossibleError extends OperationDeniedError {
export class DataExternalValidationError extends ExternalValidationError2 {
/**
* Represents an error when the refunddata sent to the PSP is not possible correct.
* It might have missing or incorrect parameters.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.REFUNDDATA_NOTEXTERNAL_POSSIBLEVALIDATION_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | ScaAuthenticationError DeclinedCardError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { AuthSecurityError2CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class ScaAuthenticationErrorDeclinedCardError extends AuthSecurityError2CardError2 {
/**
* Represents an error when athe card Strongdeclined Customerfor Authenticationvarious errorreasons.
*
* SCA@param (Strongparams Customer- Authentication)The iserror aparameters.
requirement of the European* directive@param [params.httpStatus] - The *HTTP PSD2status (Revisedcode Paymentto Servicesbe Directive) aimed at enhancing the security ofreturned in the response.
* * online financial transactions. SCA mandates that, for authenticating a payment,@param [params.message] - A human-readable message that provides details about the payment processing issue.
* payment service providers must use at least
* two of the following three authentication factors:
* - Something you know: such as a password or PIN@param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
- Something you have constructor(params?: likeTPspError2) a{
mobile phone, security token, orconst debit/credit{
card. * - SomethinghttpStatus you are: such as biometrics, like fingerprints or facial recognition.
*= HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
* @paramrbiErrorCode params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.= RbiPaymentErrorCodes.DECLINED_CARD_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | DuplicatedExternalReferenceError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class DuplicatedExternalReferenceError extends ExternalError2 {
/**
* Represents an error when there is a duplicated external reference.
*
* @param [params.originalError] - The original error that caused this errorparameters.
*/ @param constructor(params?: TPspError2) {
const {
[params.httpStatus] - The HTTP status code to be returned in the response.
httpStatus* =@param HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.SCA_AUTHENTICATION_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | ThreeDsChallengeFailedError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { PaymentProcessingError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class ThreeDsChallengeFailedError extends PaymentProcessingError2 {
/**
* Represents an error when the 3DS Challenge failed.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.THREE_DS_CHALLENGE_FAILED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | TimeOutConnectionError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ConnectionError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class TimeOutConnectionError extends ConnectionError2 {
/**
* Represents an error when there is a timeout.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.TIME_OUT_CONNECTION_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Export the classes:
Will create the new error codes:
Expand |
---|
title | GenericRbiPaymentErrorCodes details |
---|
|
Code Block |
---|
| const GenericRbiPaymentErrorCodes = {
...
DATA_EXTERNAL_VALIDATION_ERROR: '4.009',
OPERATION_DENIED_ERROR: '4.010',
TIME_OUT_CONNECTION_ERROR: '4.011',
} as const;
|
|
Expand |
---|
title | SpecificRbiPaymentErrorCodes details |
---|
|
Code Block |
---|
| const SpecificRbiPaymentErrorCodes = {
...
AMOUNT_NOT_VALID_ERROR: '2.100.107',
AUTHENTICATION_ERROR: '4.001.001',
EXPIRED_CARD_ERROR: '2.100.103',
NO_FUNDS_CARD_ERROR: '2.100.104',
DECLINED_CARD_ERROR: '2.100.105',
CARD_NOT_VALID_ERROR: '2.100.106',
CARD_LIMIT_EXCEEDED_ERROR: '2.102.004',
CARD_TYPE_NOT_ALLOWED_ERROR: '2.100.006',
CARD_COUNTRY_NOT_ALLOWED_ERROR: '2.102.005',
SCA_AUTHENTICATION_ERROR: '4.001.002',
THREE_DS_CHALLENGE_FAILED_ERROR: '2.101.003',
INVALID_PARAMETER_ERROR: '2.001.001',
CONFIRMATION_DATA_NOT_VALID_ERROR: '4.006.001',
REFUND_NOT_POSSIBLE_ERROR: '4.010.001',
COULD_NOT_FIND_PREVIOUS_OPERATION_ERROR: '4.009.001',
DUPLICATED_EXTERNAL_REFERENCE_ERROR: '4.006.002',
FIELD_DS_MERCHANT_AMOUNT_INCORRECT_ERROR: '4.009.002',
CARDHOLDER_SECURE_PURCHASE_KEY_ERROR: '4.001.003',
} as const;
|
|
intl-psp-paycomet-service
Will need to map the errors code:
...
path: intl-psp-paycomet-service/src/errors/paycomet-error-map.ts
Expand |
---|
|
Code Block |
---|
| export const errorMap: PspErrorMap = new Map([
...
[
100,
{
classNameRef: ExpiredCardError,
info: 'Expired credit card',
},
],
[
105,
{
classNameRef: NoFundsCardError,
info: 'Insufficient funds',
},
],
[
127,
{
classNameRef: InvalidParameterError,
info: 'Invalid parameter',
},
],
[
137,
{
classNameRef: CardNotValidError,
info: 'Credit card not valid',
},
],
[
141,
{
classNameRef: AmountNotValidError,
info: 'Amount zero or not valid',
},
],
[
143,
{
classNameRef: AuthenticationError,
info: 'Authentification error',
},
],
[
195,
{
classNameRef: ScaAuthenticationError,
info: 'Requires SCA authentication',
},
],
[
500,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
506,
{
classNameRef: ConfirmationDataNotValidError,
info: 'Confirmation data not valid',
},
],
[
510,
{
classNameRef: RefundNotPossibleError,
info: 'Refund is not possible',
},
],
[
535,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
549,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
555,
{
classNameRef: CouldNotFindPreviousOperationError,
info: 'Could not find the previous operation',
},
],
[
569,
{
classNameRef: OperationDeniedError,
info: 'Denied operation',
},
],
[
1019,
{
classNameRef: TimeOutConnectionError,
info: 'Operation timeout exceeded',
},
],
[
1026,
{
classNameRef: DuplicatedExternalReferenceError,
info: 'Duplicated external reference',
},
],
[
1038,
{
classNameRef: FieldDsMerchantAmountIncorrectError,
info: 'Field DS_MERCHANT_AMOUNT incorrect',
},
],
[
1099,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
1186,
{
classNameRef: CardLimitExceededError,
info: 'Maximum limit not allowed',
},
],
[
1191,
{
classNameRef: CardLimitExceededError,
info: 'Day / IP address limit (all cards) not allowed',
},
],
[
1194,
{
classNameRef: CardTypeNotAllowedError,
info: 'Card brands not allowed',
},
],
[
1197,
{
classNameRef: CardCountryNotAllowed,
info: 'Denied. Filter: Card country issuer not allowed',
},
],
[
1254,
{
classNameRef: CardholderSecurePurchaseKeyError,
info: 'Commerce with secure cardholder and cardholder without secure purchase key',
},
],
[
1326,
{
classNameRef: FraudError2,
info: 'Denial by security controls on the processor',
},
],
[
1327,
{
classNameRef: ThreeDsChallengeFailedError,
info: '3DS authentication process error',
},
],
[
1417,
{
classNameRef: DeclinedCardError,
info: 'PayPal - The instrument presented has been declined. Please select another one.',
},
],
]);[params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.DUPLICATED_EXTERNAL_REFERENCE_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | ExpiredCardError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class ExpiredCardError extends CardError2 {
/**
* Represents an error when the card has expired.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.EXPIRED_CARD_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
} |
|
Expand |
---|
title | NoFundsCardError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class NoFundsCardError extends CardError2 {
/**
* Represents an error when the card does not have enough funds in order to perform the payment.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.NO_FUNDS_CARD_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | OperationDeniedError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ExternalValidationError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class OperationDeniedError extends ExternalValidationError2 {
/**
* Represents an error when the operation cannot be performed.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.OPERATION_DENIED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | RefundNotPossibleError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
import { OperationDeniedError } from './operation-denied-error';
export class RefundNotPossibleError extends OperationDeniedError {
/**
* Represents an error when the refund is not possible.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.REFUND_NOT_POSSIBLE_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | ScaAuthenticationError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { AuthSecurityError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class ScaAuthenticationError extends AuthSecurityError2 {
/**
* Represents an error a Strong Customer Authentication error.
*
* SCA (Strong Customer Authentication) is a requirement of the European directive
* PSD2 (Revised Payment Services Directive) aimed at enhancing the security of
* online financial transactions. SCA mandates that, for authenticating a payment,
* payment service providers must use at least
* two of the following three authentication factors:
* - Something you know: such as a password or PIN.
* - Something you have: like a mobile phone, security token, or debit/credit card.
* - Something you are: such as biometrics, like fingerprints or facial recognition.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.SCA_AUTHENTICATION_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | ThreeDsChallengeFailedError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { PaymentProcessingError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class ThreeDsChallengeFailedError extends PaymentProcessingError2 {
/**
* Represents an error when the 3DS Challenge failed.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.THREE_DS_CHALLENGE_FAILED_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Expand |
---|
title | TimeOutConnectionError details |
---|
|
Code Block |
---|
| import { HttpStatus } from '@nestjs/common';
import { ConnectionError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2';
export class TimeOutConnectionError extends ConnectionError2 {
/**
* Represents an error when there is a timeout.
*
* @param params - The error parameters.
* @param [params.httpStatus] - The HTTP status code to be returned in the response.
* @param [params.message] - A human-readable message that provides details about the payment processing issue.
* @param [params.metadata] - Optional metadata that may include additional context or details about the error.
* @param [params.originalError] - The original error that caused this error.
*/
constructor(params?: TPspError2) {
const {
httpStatus = HttpStatus.UNPROCESSABLE_ENTITY,
metadata,
rbiErrorCode = RbiPaymentErrorCodes.TIME_OUT_CONNECTION_ERROR,
} = params ?? {};
super({ ...params, httpStatus, metadata, rbiErrorCode });
}
}
|
|
Export the classes:
Will create the new error codes:
Expand |
---|
title | GenericRbiPaymentErrorCodes details |
---|
|
Code Block |
---|
| const GenericRbiPaymentErrorCodes = {
...
DATA_EXTERNAL_VALIDATION_ERROR: '4.009',
OPERATION_DENIED_ERROR: '4.010',
TIME_OUT_CONNECTION_ERROR: '4.011',
} as const;
|
|
Expand |
---|
title | SpecificRbiPaymentErrorCodes details |
---|
|
Code Block |
---|
| const SpecificRbiPaymentErrorCodes = {
...
INVALID_AMOUNT_ERROR: '2.100.107',
AUTHENTICATION_ERROR: '4.001.001',
EXPIRED_CARD_ERROR: '2.100.102',
NO_FUNDS_CARD_ERROR: '2.100.103',
DECLINED_CARD_ERROR: '2.100.104',
DECLINED_CARD_ERROR: '2.100.105',
CARD_LIMIT_EXCEEDED_ERROR: '2.102.004',
CARD_TYPE_NOT_ALLOWED_ERROR: '2.100.002',
CARD_COUNTRY_NOT_ALLOWED_ERROR: '2.102.005',
SCA_AUTHENTICATION_ERROR: '4.001.002',
THREE_DS_CHALLENGE_FAILED_ERROR: '2.101.003',
CONFIRMATION_DATA_NOT_VALID_ERROR: '4.006.001',
REFUND_NOT_POSSIBLE_ERROR: '4.010.001',
COULD_NOT_FIND_PREVIOUS_OPERATION_ERROR: '4.009.001',
DUPLICATED_EXTERNAL_REFERENCE_ERROR: '4.006.002',
CARDHOLDER_SECURE_PURCHASE_KEY_ERROR: '4.001.003',
} as const;
|
|
intl-psp-paycomet-service
We will need to map the error code:
Expand |
---|
|
Code Block |
---|
| export const errorMap: PspErrorMap = new Map([
...
[
100,
{
classNameRef: ExpiredCardError,
info: 'Expired credit card',
},
],
[
105,
{
classNameRef: NoFundsCardError,
info: 'Insufficient funds',
},
],
[
127,
{
classNameRef: InvalidParameterError,
info: 'Invalid parameter',
},
],
[
137,
{
classNameRef: DeclinedCardError,
info: 'Credit card not valid',
},
],
[
141,
{
classNameRef: AmountNotValidError,
info: 'Amount zero or not valid',
},
],
[
143,
{
classNameRef: AuthenticationError,
info: 'Authentification error',
},
],
[
195,
{
classNameRef: ScaAuthenticationError,
info: 'Requires SCA authentication',
},
],
[
500,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
506,
{
classNameRef: ConfirmationDataNotValidError,
info: 'Confirmation data not valid',
},
],
[
510,
{
classNameRef: RefundNotPossibleError,
info: 'Refund is not possible',
},
],
[
535,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
549,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
555,
{
classNameRef: CouldNotFindPreviousOperationError,
info: 'Could not find the previous operation',
},
],
[
569,
{
classNameRef: OperationDeniedError,
info: 'Denied operation',
},
],
[
1019,
{
classNameRef: TimeOutConnectionError,
info: 'Operation timeout exceeded',
},
],
[
1026,
{
classNameRef: DuplicatedExternalReferenceError,
info: 'Duplicated external reference',
},
],
[
1038,
{
classNameRef: DataExternalValidationError,
info: 'Field DS_MERCHANT_AMOUNT incorrect',
},
],
[
1099,
{
classNameRef: PspError2,
info: 'General PSP error',
},
],
[
1186,
{
classNameRef: CardLimitExceededError,
info: 'Maximum limit not allowed',
},
],
[
1191,
{
classNameRef: CardLimitExceededError,
info: 'Day / IP address limit (all cards) not allowed',
},
],
[
1194,
{
classNameRef: CardTypeNotAllowedError,
info: 'Card brands not allowed',
},
],
[
1197,
{
classNameRef: CardCountryNotAllowed,
info: 'Denied. Filter: Card country issuer not allowed',
},
],
[
1254,
{
classNameRef: CardholderSecurePurchaseKeyError,
info: 'Commerce with secure cardholder and cardholder without secure purchase key',
},
],
[
1326,
{
classNameRef: FraudError2,
info: 'Denial by security controls on the processor',
},
],
[
1327,
{
classNameRef: ThreeDsChallengeFailedError,
info: '3DS authentication process error',
},
],
[
1417,
{
classNameRef: DeclinedCardError,
info: 'PayPal - The instrument presented has been declined. Please select another one.',
},
],
]); |
|
Check the possibility of mapping errors where classes have already been created.
e.g.:
Image Added
Error Messages
Paycomet | Lokalise Key | Class Error | Description | Modal Title | Modal Message | Modal CTA | Screen |
---|
100 | error.payment.2.100.003
| ExpiredCardError | Expired Card - Represents an error when the card has expired | “Expired Card” | “Your card has expired. Please change your payment method in order to complete the transaction.” | “Change Payment Method” | Image Added |
105 | error.payment.2.100.004
| NoFundsCardError | Insufficient Credit to make charge - Represents an error when the card does not have enough funds in order to perform the payment
| “Payment Failed” | “Your payment couldn't be processed due to an issue with your payment method. Please review your payment method or choose a different one to complete your purchase.” | “Change Payment Method” | Image Added |
127, and 1038 | error.payment.4.009
| DataExternalValidationError | | “Payment Failed" | “Something went wrong with this
payment. Please go back and try again.” | “Go Back and Try Again” | Image Added |
137, 1417, and 1425 | error.payment.2.100.006
| DeclinedCardError | Invalid Card - Represents an error when the card declined for various reasons | “Payment Declined” | “You card was declined by the issuer. Please, change your payment method and try again.” | “Change Payment Method” | Image Added |
141 | error.payment.2.100.007
| InvalidAmountError | Zero or Invalid Quantity - Represents an error when the amount is zero or not valid | “Payment Failed” | “Something went wrong with this
payment. Please go back and try again.” | “Go Back and Try Again” | Image Added |
143 | error.payment.4.001.001
| AuthenticationError | Authentication error - Represents errors related to security and authentication within the payment system. Invalid access tokens, and other related security and authentication problems. | “Payment Failed” | “Something went wrong with this
payment. Please go back and try again.” | “Go Back and Try Again” | Image Added |
195 | error.payment.4.001.002
| ScaAuthenticationError | Requires SCA Authentication - Represents an error a Strong Customer Authentication error. SCA (Strong Customer Authentication) is a requirement of the European directive PSD2 (Revised Payment Services Directive) aimed at enhancing the security of online financial transactions | “Payment Declined" | “Something went wrong with this
payment. Please go back and try again.” | “Go Back” | Image Added |
500, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 535, 549 and 1099 | error.payment.4.006
| ExternalError2 | General, unspecified payment error. | “Payment Failed” | “Something went wrong with this
payment. Please go back and try again.” | “Go Back and Try Again” | Image Added |
506 | error.payment.4.006.001
| ConfirmationDataNotValidError | Invalid Confirmation Data - Represents an error when confirmation data is not valid | “Payment Failed” | “It seems the system could not validate the data entered. Please go back and try again.” | “Go Back and Try Again” | Image Added |
510 | error.payment.4.010.001
| RefundNotPossibleError | Return is not possible - Represents an error when the refund is not possible | “Payment Failed” | “Something went wrong with this
payment. Please go back and try again.” | “Go Back and Try Again” | Image Added |
555 | error.payment.4.009.001
| CouldNotFindPreviousOperationError | Represents an error when could not find the previous operation | “Payment Failed” | ““Something went wrong with this
payment. Please go back and try again.” | “Go Back and Try Again” | Image Added |
569 | error.payment.4.010
| OperationDeniedError | Operation Rejected
(Denied by the issuer) - Represents an error when the operation cannot be performed | “Payment Declined” | “Your payment was declined by your card issuer. Please select another payment method in order to proceed.” | "Change Payment Method” | Image Added |
1019 | error.payment.4.011
| TimeOutConnectionError | Request Timed Out - Represents an error when there is a timeout | “Request Timed Out” | “Looks like the server is taking to long to respond, please try again.” | “Go Back and Try Again” | Image Added |
1026 | error.payment.4.006.002
| DuplicatedExternalReferenceError | Duplicate external reference - Represents an error when there is a duplicated external reference | “Duplicated Payment” | “Duplicate transaction detected. It seems this payment has already been processed. Please check your order history or try again in a moment.” | “Go Back” | Image Added |
1185, 1186, 1187, 1188, 1189, 1190, 1191 | PAYMENT.2.102.004
| CardLimitExceededError | Minimun limit not allowed Maximum limit per transaction not allowed
(Default 1000 Euros) Daily limit not allowed Monthly limit not allowed Max amount (same card / last 24 h.) not allowed Max amount (same card / last 24 h. / same IP address) not allowed Day / IP address limit (all cards) not allowed
| “Payment Declined" | “Your payment was declined due to security reasons. Please review your order and try again.” | "Go Back” | Image Added |
1194 | PAYMENT.2.100.002
| CardTypeNotAllowedError | Card Brand not allowed - Represents an error when the card type (type/brand/etc.) is not allowed for this transaction | “Payment Failed” | “It seems the card type you're using is not supported. Please return and select a different payment method to complete your transaction.” | “Change Payment Method” | Image Added |
1197 | PAYMENT.2.102.005
| CardCountryNotAllowed | Represents an error when the card / issuing bank country is not allowed for the transaction | “Payment Declined” | “Unfortunately, payments from different country than card issuer are not allowed on this platform. Please use a card issued in the same country or change your payment method.” | “Change Payment Method” | Image Added |
1254 | PAYMENT.4.001.003
| CardholderSecurePurchaseKeyError | Attempt to process a secure payment, and the card does not allow it. - Represents an error when there is a commerce with secure cardholder and cardholder without secure purchase key | “Payment Failed” | “The payment couldn’t be processed because your card doesn’t support secure authentication methods. Please go back and try another payment method.” | “Change Payment Method” | Image Added |
1326 | PAYMENT.2.002
| FraudError | Represents errors generated when a transaction is suspected of being fraudulent. This class extends `ExternalError` to encapsulate fraud-related issues, including abnormal user behavior, suspicious transaction patterns, and other indicators of potential fraud. It is designed to aid in the identification and management of transactions that may pose a risk to the payment system | “Payment Declined” | “Your payment was declined due to security reasons. Please select a new payment method and try again.” | "Change Payment Method” | Image Added |
1327 | PAYMENT.2.101.003
| ThreeDsChallengeFailedError | Denied by security reasons - Represents an error when the 3DS Challenge failed | “Payment Declined" | “Your payment was declined due to security reasons. Please select a new payment method and try again.” | "Change Payment Method” | Image Added |
Out-of-scope
It is out of the scope to create the Lokalise key, since the key can be added directly to the Lokalise portal.
For help, there is a list of keys that can be created in the Lokalise portal in the description error table (Lokalise key column).
Potential Challenges
N/A
💰 Cost
...