Document Status |
| ||||||
---|---|---|---|---|---|---|---|
Document Owner(s) | |||||||
Reviewers |
Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Paycomet Code | Error Code | Public Message (Logs/Amplitude) | Documentation |
---|---|---|---|
142 |
| Operation cancelled | Represents an error when the operation was cancelled.
|
1425 |
| Paypal transaction cancelled | Represents an error when the operation was cancelled with PAYPAL. |
1342 |
| Bizum transaction cancelled | Represents an error when the operation was cancelled with BIZUM. |
...
intl-packages
Create a new constants constant error:
path:
intl-packages/packages/psp-base/src/errors/psp-error-2/psp-error-2.ts
Code Block language typescript const GenericRbiPaymentErrorCodes = { ... OPERATION_CANCELLED_ERROR: '2.005', ... } as const; const SpecificRbiPaymentErrorCodes = { BIZUM_OPERATION_CANCELLED_ERROR: '2.005.001', ... PAYPAL_OPERATION_CANCELLED_ERROR: '2.005.002', ... } as const;
Create a new classesclass:
OperationCancelledError
generic class:path:
intl-packages/packages/psp-base/src/errors/psp-error-2/generic/operation-cancelled-error.ts
Code Block language typescript export class OperationCancelledError extends ExternalValidationError2 { ... constructor(params?: TPspError2) { const { httpStatus = HttpStatus.UNPROCESSABLE_ENTITY, message = 'Operation cannot be completed/continued as it has been cancelled.', metadata, responseBody, rbiErrorCode = RbiPaymentErrorCodes.OPERATION_CANCELLED_ERROR, } = params ?? {}; super({ ...params, httpStatus, message, metadata, rbiErrorCode, responseBody }); } }
BizumCancellationPaymentError
specialized class:path:
intl-packages/packages/psp-base/src/errors/psp-error-2/bizum-operation-cancelled-error.ts
Code Block language typescript export class BizumCancellationPaymentError extends OperationCancelledError { ... constructor(params?: TPspError2) { const { httpStatus = HttpStatus.UNPROCESSABLE_ENTITY, metadata, rbiErrorCode = RbiPaymentErrorCodes.BIZUM_OPERATION_CANCELLED_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
PaypalCancellationPaymentError
specialized class:path:
intl-packages/packages/psp-base/src/errors/psp-error-2/
paypal-operation-cancelled-error.ts
Code Block language typescript export class PaypalCancellationPaymentError extends OperationCancelledError { ... constructor(params?: TPspError2) { const { httpStatus = HttpStatus.UNPROCESSABLE_ENTITY, metadata, rbiErrorCode = RbiPaymentErrorCodes.PAYPAL_OPERATION_CANCELLED_ERROR, } = params ?? {}; super({ ...params, httpStatus, metadata, rbiErrorCode }); } }
intl-psp-paycomet-service
Mapper the errors on
PspErrorMap
path:
intl-psp-paycomet-service/src/errors/paycomet-error-map.ts
Code Block language typescript export const errorMap: PspErrorMap = new Map([ ... [ 142, { classNameRef: OperationCancelledError, info: 'Operation canceled.', }, ], ... [ 1342, { classNameRef: BizumCancellationPaymentErrorOperationCancelledError, info: 'Bizum. Transactiontransaction cancelled. The user does not wish to continue.', }, ], ... [ 1425, { classNameRef: PaypalCancellationPaymentErrorOperationCancelledError, info: 'PayPal.Paypal Transactiontransaction cancelled. The user does not wish to continue.', }, ], ]);
Frontend
After backend changes, will need to handle the error.
...
Create a new keys to translate the error message:
Code Block language json { ... "error.payment.2.005.title": "Purchase cancelled", "error.payment.2.005.cta": "Go Back to Checkout", "error.payment.2.005": "Your purchase has been successfully cancelled.", ... }
...
Change error validation
...
It will be created a temporary feature flag: enable-cancellation-error-modal-on-payment-link
After the stories activation in prod, the feature flags will be removed.
...
Jira Legacy | ||||||
---|---|---|---|---|---|---|
|
...
Change the validation on
isCanceledOperation
path:
intl-whitelabel-app/workspaces/frontend/src/hooks/use-paycomet-pay-link-popup/utils.ts
before:
Code Block language typescript export const isCanceledOperation = (e: MessageEvent) => { const isCanceledOperation = e.data && typeof e.data === 'object' && Object.values(CanceledCodeOperationType).includes(e.data?.body?.code); return !!(e.data === ClosedWindowType.CLOSED || isCancelation); };
after:
Code Block language typescript export const isCanceledOperation = (e: MessageEvent) => { const isCancelation = e.data && typeof e.data === 'object' && <FF_FLAG> && Object.values(CanceledCodeOperationType).includes(e.data?.body?.code); return !!(e.data === ClosedWindowType.CLOSED || isCancelation); };
...
Info |
---|
Describe any additional cost this solution may imply. |
🎛️ Configuration
Info |
---|
Include here any configuration required (Sanity, LaunchDarkly flags, etc.) required to enable the solution. |
📈 Metrics
...
It will be created a temporary feature flag: enable-cancellation-error-modal-on-payment-link After the stories activation in prod, the feature flags will be removed. For this feature works, need to enable this feature flag: enable-rbi-error-2 |
📈 Metrics
Info |
---|
Measure the number of cancellations made by the user. |
🗓️ Delivery Plan
Info |
---|
Link to the task or list of all the tasks required to deliver the solution, along with its progress. |
...