From a6cfa36aa63ca630cd7e4672e7e3073a999ad710 Mon Sep 17 00:00:00 2001 From: Dwain Maralack Date: Tue, 22 Oct 2019 09:20:05 +0200 Subject: [PATCH] Negate the fees output on the transaction table (#227) Update output to have fees show as negative ($-99.99). If a fee is reversed it will show as positive. --- client/transactions/index.js | 3 ++- client/transactions/test/__snapshots__/index.js.snap | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/transactions/index.js b/client/transactions/index.js index 5dd800ca77f..efd1510aa28 100644 --- a/client/transactions/index.js +++ b/client/transactions/index.js @@ -76,7 +76,8 @@ export const TransactionsList = ( props ) => { email: billingDetails && { value: billingDetails.email, display: billingDetails.email }, country: address && { value: address.country, display: address.country }, amount: { value: txn.amount / 100, display: formatCurrency( txn.amount / 100 ) }, - fee: { value: txn.fee / 100, display: formatCurrency( txn.fee / 100 ) }, + // fees should display as negative. The format $-9.99 is determined by WC-Admin + fee: { value: txn.fee / 100, display: formatCurrency( ( txn.fee / 100 ) * -1 ) }, net: { value: ( txn.amount - txn.fee ) / 100, display: formatCurrency( ( txn.amount - txn.fee ) / 100 ) }, // TODO deposit: { value: available_on * 1000, display: dateI18n( 'Y-m-d H:i', moment( available_on * 1000 ) ) }, riskLevel: outcome && { value: outcome.risk_level, display: capitalize( outcome.risk_level ) }, diff --git a/client/transactions/test/__snapshots__/index.js.snap b/client/transactions/test/__snapshots__/index.js.snap index 9a40d0a453e..9457ab15e1d 100644 --- a/client/transactions/test/__snapshots__/index.js.snap +++ b/client/transactions/test/__snapshots__/index.js.snap @@ -107,7 +107,7 @@ exports[`Transactions list renders correctly 1`] = ` "value": 10, }, Object { - "display": "$0.50", + "display": "$-0.50", "value": 0.5, }, Object { @@ -168,7 +168,7 @@ exports[`Transactions list renders correctly 1`] = ` "value": 15, }, Object { - "display": "$0.50", + "display": "$-0.50", "value": 0.5, }, Object {