@@ -92,6 +92,8 @@ export const paymentTypeParser = (paymentType, t) => {
9292} ;
9393
9494export 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+
114132export 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" ) {
0 commit comments