mirror of
https://github.com/valitydev/checkout.git
synced 2024-11-06 10:35:20 +00:00
FE-588: error mapping (#231)
This commit is contained in:
parent
ccc5a0c374
commit
1625ea68ec
@ -1,6 +1,6 @@
|
||||
import { InvoiceChange } from './invoice-change';
|
||||
import { LogicError } from '../logic-error';
|
||||
import { InvoiceChangeType } from './invoice-change-type';
|
||||
import { PaymentError } from 'checkout/backend';
|
||||
|
||||
export enum PaymentStatuses {
|
||||
processed = 'processed',
|
||||
@ -15,5 +15,5 @@ export class PaymentStatusChanged extends InvoiceChange {
|
||||
changeType = InvoiceChangeType.PaymentStatusChanged;
|
||||
status: PaymentStatuses;
|
||||
paymentID: string;
|
||||
error: LogicError;
|
||||
error: PaymentError;
|
||||
}
|
||||
|
@ -22,3 +22,4 @@ export * from './payment';
|
||||
export * from './payment-params';
|
||||
export * from './event/user-interaction';
|
||||
export * from './logic-error';
|
||||
export * from './payment-error';
|
||||
|
4
src/app/backend/model/payment-error.ts
Normal file
4
src/app/backend/model/payment-error.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export class PaymentError {
|
||||
code: string;
|
||||
subError?: PaymentError;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { PaymentFlow } from './payment-flow';
|
||||
import { Payer } from './payer';
|
||||
import { LogicError } from './logic-error';
|
||||
import { PaymentStatus } from './payment-status';
|
||||
import { PaymentError } from 'checkout/backend';
|
||||
|
||||
export class Payment {
|
||||
id: string;
|
||||
@ -12,5 +12,5 @@ export class Payment {
|
||||
flow: PaymentFlow;
|
||||
payer: Payer;
|
||||
status: PaymentStatus;
|
||||
error: LogicError;
|
||||
error: PaymentError;
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { Locale } from 'checkout/locale';
|
||||
import * as styles from '../result-form.scss';
|
||||
import { LogicError } from 'checkout/backend/model';
|
||||
import { PaymentError } from 'checkout/backend';
|
||||
|
||||
export const getFailedDescription = (l: Locale, e: LogicError): JSX.Element => {
|
||||
if (!e && !(e.code || e.message)) {
|
||||
export const getFailedDescription = (l: Locale, e: PaymentError): JSX.Element => {
|
||||
if (!e && !e.code) {
|
||||
return;
|
||||
}
|
||||
const localized = l[e.code];
|
||||
const message = e.message ? e.message : l['Unknown Failure'];
|
||||
return <p className={styles.text}>{localized ? localized : message}</p>;
|
||||
return <p className={styles.text}>{localized ? localized : e.code}</p>;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Locale } from 'checkout/locale';
|
||||
import { failed } from './make-from-payment-change';
|
||||
import { LogicError } from 'checkout/backend';
|
||||
import { PaymentError } from 'checkout/backend';
|
||||
import { ResultFormContent } from './result-form-content';
|
||||
|
||||
export const makeContentError = (l: Locale, error: LogicError): ResultFormContent => failed(l, error);
|
||||
export const makeContentError = (l: Locale, error: PaymentError): ResultFormContent => failed(l, error);
|
||||
|
@ -1,13 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import { Locale } from 'checkout/locale';
|
||||
import { Event, LogicError, PaymentStatusChanged, PaymentStatuses } from 'checkout/backend';
|
||||
import { Event, LogicError, PaymentError, PaymentStatusChanged, PaymentStatuses } from 'checkout/backend';
|
||||
import { ResultFormContent } from './result-form-content';
|
||||
import { getFailedDescription } from './get-failed-description';
|
||||
import { getSuccessDescription } from './get-success-description';
|
||||
import { Checkmark, Cross } from '../result-icons';
|
||||
import { getLastChange } from 'checkout/utils';
|
||||
|
||||
export const failed = (l: Locale, e: LogicError): ResultFormContent => ({
|
||||
export const failed = (l: Locale, e: PaymentError | LogicError): ResultFormContent => ({
|
||||
hasActions: true,
|
||||
hasDone: false,
|
||||
header: l['form.header.final.failed.label'],
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Locale } from 'checkout/locale';
|
||||
import { ModelState, ResultState, ResultFormInfo } from 'checkout/state';
|
||||
import { LogicError } from 'checkout/backend';
|
||||
import { LogicError, PaymentError } from 'checkout/backend';
|
||||
import { IntegrationType } from 'checkout/config';
|
||||
|
||||
export interface ResultFormProps {
|
||||
|
@ -86,5 +86,11 @@
|
||||
"form.pay.terminals.step.four.text": "Pay with cash",
|
||||
"form.pay.terminals.step.five.text": "Don’t forget the receipt",
|
||||
"form.pay.terminals.info.text": "An account number will be generated for payment through the payment kiosks",
|
||||
"brand.euroset": "Euroset"
|
||||
"brand.euroset": "Euroset",
|
||||
"InvalidPaymentTool": "Invalid payment tool",
|
||||
"AccountLimitsExceeded": "Account limits exceeded",
|
||||
"InsufficientFunds": "Insufficient funds",
|
||||
"PreauthorizationFailed": "Preauthorization failed",
|
||||
"RejectedByIssuer": "Rejected by issuer",
|
||||
"PaymentRejected": "Payment rejected"
|
||||
}
|
@ -86,5 +86,11 @@
|
||||
"form.pay.terminals.step.four.text": "Внесите наличные",
|
||||
"form.pay.terminals.step.five.text": "Обязательно возьмите чек",
|
||||
"form.pay.terminals.info.text": "Будет сформирован номер счета для оплаты через платежный терминал",
|
||||
"brand.euroset": "Евросеть"
|
||||
"brand.euroset": "Евросеть",
|
||||
"InvalidPaymentTool": "Недопустимое средство оплаты",
|
||||
"AccountLimitsExceeded": "Превышен лимит",
|
||||
"InsufficientFunds": "Недостаточно средств",
|
||||
"PreauthorizationFailed": "Неудачная преавторизиция",
|
||||
"RejectedByIssuer": "Отклонено эмитентом",
|
||||
"PaymentRejected": "Платёж отклонен"
|
||||
}
|
Loading…
Reference in New Issue
Block a user