forked from binary-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Set
active_symbols
on trade init()
+ Set formatResponse for all report pages to attach `display_name` + Added function to get display name of symbol + Modified test cases to test for new requirements
- Loading branch information
Showing
12 changed files
with
78 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
src/javascript/app/Stores/Modules/Portfolio/Helpers/format-response.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 19 additions & 11 deletions
30
src/javascript/app/Stores/Modules/Statement/Helpers/format-response.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
import { formatMoney } from '_common/base/currency_base'; | ||
import { localize } from '_common/localize'; | ||
import { toTitleCase } from '_common/string_util'; | ||
import { toMoment } from 'Utils/Date'; | ||
import { formatMoney } from '_common/base/currency_base'; | ||
import { localize } from '_common/localize'; | ||
import { toTitleCase } from '_common/string_util'; | ||
import { toMoment } from 'Utils/Date'; | ||
import { getSymbolDisplayName } from '../../Trading/Helpers/active-symbols'; | ||
import { getMarketInformation } from '../../../../Modules/Reports/Helpers/market-underyling'; | ||
|
||
export const formatStatementTransaction = (transaction, currency) => { | ||
const format_string = 'DD MMM YYYY - HH:mm:ss'; | ||
const transaction_time = toMoment(transaction.transaction_time).format(format_string); | ||
const payout = parseFloat(transaction.payout); | ||
const amount = parseFloat(transaction.amount); | ||
const balance = parseFloat(transaction.balance_after); | ||
export const formatStatementTransaction = (transaction, currency, active_symbols = []) => { | ||
const format_string = 'DD MMM YYYY - HH:mm:ss'; | ||
const transaction_time = toMoment(transaction.transaction_time).format(format_string); | ||
const payout = parseFloat(transaction.payout); | ||
const amount = parseFloat(transaction.amount); | ||
const balance = parseFloat(transaction.balance_after); | ||
const should_exclude_currency = true; | ||
const shortcode = ['buy', 'sell'].includes(transaction.action_type) ? transaction.shortcode : null; | ||
const display_name = shortcode ? getSymbolDisplayName( | ||
active_symbols, | ||
getMarketInformation(shortcode).underlying | ||
) : ''; | ||
|
||
return { | ||
action : localize(toTitleCase(transaction.action_type) /* localize-ignore */), // handled in static_strings_app.js: 'Buy', 'Sell', 'Deposit', 'Withdrawal' | ||
date : transaction_time, | ||
display_name, | ||
refid : transaction.transaction_id, | ||
payout : isNaN(payout) ? '-' : formatMoney(currency, payout, should_exclude_currency), | ||
amount : isNaN(amount) ? '-' : formatMoney(currency, amount, should_exclude_currency), | ||
balance : isNaN(balance) ? '-' : formatMoney(currency, balance, should_exclude_currency), | ||
desc : transaction.longcode.replace(/\n/g, '<br />'), | ||
id : transaction.contract_id, | ||
app_id : transaction.app_id, | ||
shortcode : ['buy', 'sell'].includes(transaction.action_type) ? transaction.shortcode : null, | ||
shortcode, | ||
action_type: transaction.action_type, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters