Skip to content

Commit

Permalink
Negate the fees output on the transaction table (#227)
Browse files Browse the repository at this point in the history
Update output to have fees show as negative ($-99.99). If a fee is reversed it will show as positive.
  • Loading branch information
dwainm authored Oct 22, 2019
1 parent c662450 commit a6cfa36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion client/transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) },
Expand Down
4 changes: 2 additions & 2 deletions client/transactions/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ exports[`Transactions list renders correctly 1`] = `
"value": 10,
},
Object {
"display": "$0.50",
"display": "$-0.50",
"value": 0.5,
},
Object {
Expand Down Expand Up @@ -168,7 +168,7 @@ exports[`Transactions list renders correctly 1`] = `
"value": 15,
},
Object {
"display": "$0.50",
"display": "$-0.50",
"value": 0.5,
},
Object {
Expand Down

0 comments on commit a6cfa36

Please sign in to comment.