From d46d7191f003385ad3fbb9006ebccbc1bbb2ff10 Mon Sep 17 00:00:00 2001 From: Mauricio Navarro Miranda Date: Thu, 20 Jun 2019 01:24:08 -0500 Subject: [PATCH] Displays MXN amounts; depends on MXN ticker to be included on API response --- src/action/index-mobile.js | 1 + src/computed/setting.js | 3 +++ src/config.js | 1 + src/view/setting-fiat.js | 6 ++++++ stories/screen-story.js | 1 + test/unit/action/wallet.spec.js | 5 +++++ test/unit/computed/setting.spec.js | 1 + 7 files changed, 18 insertions(+) diff --git a/src/action/index-mobile.js b/src/action/index-mobile.js index 5f55559ae..de6a935db 100644 --- a/src/action/index-mobile.js +++ b/src/action/index-mobile.js @@ -150,6 +150,7 @@ store.channelBalanceSatoshis = 598760; store.settings.exchangeRate.usd = 0.00016341; store.settings.exchangeRate.eur = 0.0001896; store.settings.exchangeRate.gbp = 0.00021405; +store.settings.exchangeRate.mxn = 0.00000566; store.invoice.amount = '0.45678'; store.invoice.note = 'For the love of bitcoin'; store.invoice.encoded = diff --git a/src/computed/setting.js b/src/computed/setting.js index ccb324ae5..ef37c4ea7 100644 --- a/src/computed/setting.js +++ b/src/computed/setting.js @@ -32,6 +32,9 @@ const ComputedSetting = store => { get gbpFiatLabel() { return FIATS['gbp'].displayLong; }, + get mxnFiatLabel() { + return FIATS['mxn'].displayLong; + }, }); }; diff --git a/src/config.js b/src/config.js index 180518483..c4433d104 100644 --- a/src/config.js +++ b/src/config.js @@ -39,6 +39,7 @@ module.exports.FIATS = { usd: { display: '$', displayLong: 'US Dollar' }, eur: { display: '€', displayLong: 'Euro' }, gbp: { display: '£', displayLong: 'British Pound' }, + mxn: { display: '$', displayLong: 'Mexican Peso' }, }; module.exports.DEFAULT_UNIT = 'sat'; module.exports.DEFAULT_FIAT = 'usd'; diff --git a/src/view/setting-fiat.js b/src/view/setting-fiat.js index d390ee1ee..2a9e6bd6b 100644 --- a/src/view/setting-fiat.js +++ b/src/view/setting-fiat.js @@ -39,6 +39,12 @@ const SettingFiatView = ({ store, nav, setting }) => { > + setting.setFiatCurrency({ fiat: 'mxn' })} + > + + diff --git a/stories/screen-story.js b/stories/screen-story.js index 795681f88..4bf448ab7 100644 --- a/stories/screen-story.js +++ b/stories/screen-story.js @@ -300,6 +300,7 @@ store.channelBalanceSatoshis = 598760; store.settings.exchangeRate.usd = 0.00016341; store.settings.exchangeRate.eur = 0.0001896; store.settings.exchangeRate.gbp = 0.00021405; +store.settings.exchangeRate.mxn = 0.00000566; store.invoice.amount = '0.45678'; store.invoice.note = 'For the love of bitcoin'; store.invoice.encoded = diff --git a/test/unit/action/wallet.spec.js b/test/unit/action/wallet.spec.js index 235e27d89..187f8ca85 100644 --- a/test/unit/action/wallet.spec.js +++ b/test/unit/action/wallet.spec.js @@ -628,6 +628,11 @@ describe('Action Wallet Unit Tests', () => { "date": "2019-04-04T03:30:05.000Z", "rate": 498467, "ticker": "USD" + }, + { + "date": "2019-04-04T03:30:05.000Z", + "rate": 9401718, + "ticker": "MXN" } ] }`; diff --git a/test/unit/computed/setting.spec.js b/test/unit/computed/setting.spec.js index 4d4adf9fe..5efbcd552 100644 --- a/test/unit/computed/setting.spec.js +++ b/test/unit/computed/setting.spec.js @@ -23,6 +23,7 @@ describe('Computed Settings Unit Tests', () => { expect(store.usdFiatLabel, 'to be ok'); expect(store.eurFiatLabel, 'to be ok'); expect(store.gbpFiatLabel, 'to be ok'); + expect(store.mxnFiatLabel, 'to be ok'); }); it('should display satoshis denominated in BTC', () => {