- Created by de Sousa Santos, Rodrigo, last modified on Oct 10, 2024
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 44 Next »
Document Status | IN PROGRESS |
---|---|
Document Owner(s) | |
Reviewers |
Context
Iberia proposes the inclusion of new error messages in the error detailing flow, following the established processes in stories:
Story: IBFEC-2647
Story: IBFEC-2856
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
After the solution approval, will need to update the below documents with new classes, code errors, and any important things.
Paycomet errors: https://docs.paycomet.com/en/recursos/codigos-de-error
Iberia errors list: Sheet
Payment code errors: /wiki/spaces/RWLAPPwiki/pages/4858741214
Payment mappers: /wiki/spaces/RWLAPPwiki/pages/5001150489
Description errors
Payment method | Paycomet Code | Public Message (Logs/Amplitude) | Error Code | Lokalise key
title error modal: label button modal: | Severity | Class Error | Parent class | Documentation |
Card | 100 | Expired credit card |
|
| 2 | ExpiredCardError | CardError2 | Represents an error when the card has expired |
Card | 105 | Insufficient funds |
|
| 2 | NoFundsCardError | CardError2 | Represents an error when the card does not have enough funds in order to perform the payment |
Card | 127 | Invalid parameter |
|
| 2 | InvalidParameterError | ExternalValidationError2 | Represents an error when there is an invalid parameter |
Card | 137 | Credit card not valid |
|
| 2 | CardNotValidError | CardError2 | Represents an error when the card declined for various reasons |
Card | 141 | Amount zero or not valid |
|
| 2 | AmountNotValidError | NoFundsCardError | Represents an error when the amount is zero or not valid |
Card | 143 | Authentification error |
|
| 4 | AuthenticationError | AuthSecurityError2 | Represents errors related to security and authentication within the payment system. |
Card | 195 | Requires SCA authentication |
|
| 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 |
Card | 500 | General PSP error |
|
| 4 | PspError2 | RbiError2 | General, unspecified payment error. |
Card | 506 | Confirmation data not valid |
|
| 4 | ConfirmationDataNotValidError | ExternalError2 | Represents an error when confirmation data is not valid |
Card | 510 | Refund is not possible |
|
| 4 | RefundNotPossibleError | OperationDeniedError | Represents an error when the refund is not possible |
Card | 535 | General PSP error |
|
| 4 | PspError2 | RbiError2 | General, unspecified payment error. |
Card | 549 | General PSP error |
|
| 4 | PspError2 | RbiError2 | General, unspecified payment error. |
Card | 555 | Could not find the previous operation |
|
| 4 | CouldNotFindPreviousOperationError | DataExternalValidationError | Represents an error when could not find the previous operation |
Card | 569 | Denied operation |
|
| 4 | OperationDeniedError | ExternalValidationError2 | Represents an error when the operation cannot be performed |
Card | 1019 | Operation timeout exceeded |
|
| 4 | TimeOutConnectionError | ConnectionError2 | Represents an error when there is a timeout |
Card | 1026 | Duplicated external reference |
|
| 4 | DuplicatedExternalReferenceError | ExternalError2 | Represents an error when there is a duplicated external reference |
Card | 1038 | Field DS_MERCHANT_AMOUNT incorrect |
|
| 4 | FieldDsMerchantAmountIncorrectError | DataExternalValidationError | Represents an error when the field DS_MERCHANT_AMOUNT is incorrect |
Card | 1099 | General PSP error |
|
| 4 | PspError2 | RbiError2 | General, unspecified payment error. |
Card | 1186 | Maximum limit not allowed |
|
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the card amount/number of transaction limit has been exceeded |
Card | 1191 | Day / IP address limit (all cards) not allowed |
|
| 2 | CardLimitExceededError | PaymentRestrictionError2 | Represents an error when the card amount/number of transaction limit has been exceeded |
Card | 1194 | Card brands not allowed |
|
| 2 | CardTypeNotAllowedError | CardError2 | 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 |
|
| 2 | CardCountryNotAllowed | PaymentRestrictionError2 | 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 |
|
| 4 | CardholderSecurePurchaseKeyError | AuthSecurityError2 | 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 |
|
| 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 |
Card | 1327 | 3DS authentication process error |
|
| 2 | ThreeDsChallengeFailedError | PaymentProcessingError2 | Represents an error when the 3DS Challenge failed |
Payment Link | 1417 | PayPal - The instrument presented has been declined. Please select another one. |
|
| 2 | DeclinedCardError | CardError2 | 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
intl-packages
Will be created new classes in the path:
intl-packages/packages/psp-base/src/errors/psp-error-2/
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 }); } }
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 }); } }
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 }); } }
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 }); } }
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 }); } }
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 }); } }
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 }); } }
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 }); } }
import { HttpStatus } from '@nestjs/common'; import { RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2'; import { DataExternalValidationError } from './data-external-validation-error'; export class CouldNotFindPreviousOperationError extends DataExternalValidationError { /** * Represents an error when could not find the previous operation. * * @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_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
import { HttpStatus } from '@nestjs/common'; import { ExternalValidationError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2'; export class DataExternalValidationError extends ExternalValidationError2 { /** * Represents an error when the data sent to the PSP is not 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.DATA_EXTERNAL_VALIDATION_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
import { HttpStatus } from '@nestjs/common'; import { CardError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2'; export class DeclinedCardError 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.DECLINED_CARD_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
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 - 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.DUPLICATED_EXTERNAL_REFERENCE_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
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 }); } }
import { HttpStatus } from '@nestjs/common'; import { RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2'; import { DataExternalValidationError } from './data-external-validation-error'; export class FieldDsMerchantAmountIncorrectError extends DataExternalValidationError { /** * Represents an error when the field DS_MERCHANT_AMOUNT is incorrect. * * @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.FIELD_DS_MERCHANT_AMOUNT_INCORRECT_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
import { HttpStatus } from '@nestjs/common'; import { ExternalValidationError2, RbiPaymentErrorCodes, TPspError2 } from '../psp-error-2'; export class InvalidParameterError extends ExternalValidationError2 { /** * Represents an error when there is an invalid parameter. * * @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.INVALID_PARAMETER_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
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 }); } }
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 }); } }
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 }); } }
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 }); } }
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 }); } }
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:
path:
intl-packages/packages/psp-base/src/errors/psp-error-2/index.ts
Will create the new error codes:
path:
intl-packages/packages/psp-base/src/errors/psp-error-2/psp-error-2.ts
Code Errors:
const GenericRbiPaymentErrorCodes = { ... DATA_EXTERNAL_VALIDATION_ERROR: '4.009', OPERATION_DENIED_ERROR: '4.010', TIME_OUT_CONNECTION_ERROR: '4.011', } as const;
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
We will need to map the error code:
path:
intl-psp-paycomet-service/src/errors/paycomet-error-map.ts
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.', }, ], ]);
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
Describe any additional cost this solution may imply.
🎛️ Configuration
For this feature work, need to enable this feature flag: enable-rbi-error-2
📈 Metrics
Measure the number of cancellations made by the user.
🗓️ Delivery Plan
Link to the task or list of all the tasks required to deliver the solution, along with its progress.
🧑🚒 QA Plan
N/A
⚠️ Call-outs
Tip: Document here any improvement or discussion regarding the feature
- No labels
Add Comment