Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Commit 3ad0a65

Browse files
committed
Make authorizations more obvious (#503)
1 parent 7e16871 commit 3ad0a65

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

src/react/Components/MoneyAmountLabel.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class MoneyAmountLabel extends React.Component {
116116
color: theme.palette.masterCardAction.authorized,
117117
...style
118118
};
119+
case "REVERSED":
119120
case "BLOCKED":
120121
return {
121122
color: theme.palette.masterCardAction.blocked,

src/react/Functions/EventStatusTexts.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ export const paymentTypeParser = (paymentType, t) => {
9292
};
9393

9494
export const masterCardActionText = (masterCardAction, t) => {
95+
const reversedText = t("The payment was reversed");
96+
9597
switch (masterCardAction.authorisation_status) {
9698
case "AUTHORISED":
9799
return `${t("Sent payment with ")}${masterCardActionParser(masterCardAction, t)}`;
@@ -103,23 +105,50 @@ export const masterCardActionText = (masterCardAction, t) => {
103105
}
104106
return t("Payment was refunded");
105107
case "REVERSED":
106-
return t("The payment was reversed");
108+
const authorisationTypeText = masterCardActionAuthorisationType(masterCardAction.authorisation_type, t);
109+
if (authorisationTypeText) {
110+
return `${reversedText}: ${authorisationTypeText}`;
111+
}
112+
return reversedText;
107113
default:
108114
return `${t("The payment currently has the status ")}${masterCardAction.authorisation_status} - ${
109115
masterCardAction.authorisation_type
110116
}`;
111117
}
112118
};
113119

120+
export const masterCardActionAuthorisationType = (authorisationType, t) => {
121+
const authorisationPayment = t("Authorisation payment");
122+
123+
switch (authorisationType) {
124+
case "ACCOUNT_STATUS":
125+
case "NORMAL_AUTHORISATION":
126+
return authorisationPayment;
127+
default:
128+
return "";
129+
}
130+
};
131+
114132
export const masterCardActionParser = (masterCardAction, t) => {
115133
const defaultMessage = t("Card payment");
116134
const paymentText = t("Payment");
117135
const refundText = t("Refund");
136+
const reversedText = t("Reversed");
137+
const authorisationPayment = t("Authorisation");
118138
const atmText = t("ATM Withdrawal");
119139

120140
let secondaryText = paymentText;
121141
if (masterCardAction.authorisation_status === "CLEARING_REFUND") {
122142
secondaryText = refundText;
143+
} else if (masterCardAction.authorisation_status === "REVERSED") {
144+
if (
145+
masterCardAction.authorisation_type === "NORMAL_AUTHORISATION" ||
146+
masterCardAction.authorisation_type === "ACCOUNT_STATUS"
147+
) {
148+
secondaryText = authorisationPayment;
149+
} else {
150+
secondaryText = reversedText;
151+
}
123152
}
124153

125154
if (masterCardAction.pan_entry_mode_user === "ATM") {

src/react/Locales/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
"Attempting to load your API key": "Attempting to load your API key",
4444
"Attention!": "Attention!",
4545
"Authenticate": "Authenticate",
46+
"Authorisation": "Authorisation",
4647
"Authorisation Status": "Authorisation Status",
4748
"Authorisation Type": "Authorisation Type",
49+
"Authorisation payment": "Authorisation payment",
4850
"Automatically switch theme based on the time": "Automatically switch theme based on the time",
4951
"Available": "Available",
5052
"Available merchants": "Available merchants",
@@ -433,6 +435,7 @@
433435
"Restart the application to start without Google Analytics!": "Restart the application to start without Google Analytics!",
434436
"Restart the application to view these changes!": "Restart the application to view these changes!",
435437
"Return to dashboard": "Return to dashboard",
438+
"Reversed": "Reversed",
436439
"Rule Dashboard": "Rule Dashboard",
437440
"Rule Editor": "Rule Editor",
438441
"Rules": "Rules",
@@ -694,4 +697,4 @@
694697
"weeks": "weeks",
695698
"year": "year",
696699
"years": "years"
697-
}
700+
}

0 commit comments

Comments
 (0)