diff --git a/locales/en.json b/locales/en.json index 680299ae3..b8e44f6c2 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1073,6 +1073,7 @@ "views.Settings.Help.github": "GitHub Issues", "views.Settings.Help.telegram": "Telegram (we will not DM you)", "views.Settings.Help.email": "Email support", + "views.Settings.POS": "ZEUS POS", "views.Settings.POS.enableSquare": "Enable Square POS integration", "views.Settings.POS.taxPercentage.global.info": "Global tax rate applied to all products. Individual product tax rates will override this setting when specified.", "views.Settings.POS.taxPercentage.info": "Individual tax rate for this product. When set, this will override the global tax rate. Leave empty to use the global tax rate.", @@ -1108,6 +1109,7 @@ "views.Settings.POS.0conf": "0 confirmations", "views.Settings.POS.1conf": "1 confirmation", "views.Settings.POS.lnOnly": "Lightning only", + "views.Settings.POS.poweredByZEUS": "POS powered by ZEUS", "views.Settings.Seed.title": "Back up wallet", "views.Settings.Seed.text1": "The following 24 words are your wallet backup.", "views.Settings.Seed.text2": "KEEP THEM SAFE as anyone who sees these words can steal your funds.", diff --git a/stores/PosStore.ts b/stores/PosStore.ts index f7cdb1dd3..8f16524a2 100644 --- a/stores/PosStore.ts +++ b/stores/PosStore.ts @@ -12,6 +12,7 @@ import Order from '../models/Order'; import { SATS_PER_BTC } from '../utils/UnitsUtils'; import { calculateTaxSats } from '../utils/PosUtils'; import BackendUtils from '../utils/BackendUtils'; +import { localeString } from '../utils/LocaleUtils'; import Storage from '../storage'; @@ -130,24 +131,29 @@ export default class PosStore { const lineItems = currentOrder.line_items; const memo = merchantName - ? `${merchantName} POS powered by ZEUS - Order ${currentOrder?.id}` - : `ZEUS POS - Order ${currentOrder?.id}`; + ? `${merchantName} ${localeString( + 'views.Settings.POS.poweredByZEUS' + )} - ${localeString('general.order')} ${currentOrder?.id}` + : `${localeString('views.Settings.POS')} - ${localeString( + 'general.order' + )} ${currentOrder?.id}`; const fiatEntry = fiat && fiatRates ? fiatRates.filter((entry: any) => entry.code === fiat)[0] : null; - const rate = - fiat && fiatRates && fiatEntry ? fiatEntry.rate.toFixed() : 0; + const rate = fiat && fiatRates && fiatEntry ? fiatEntry.rate : 0; const subTotalSats = (currentOrder?.total_money?.sats ?? 0) > 0 ? currentOrder.total_money.sats - : new BigNumber(currentOrder?.total_money?.amount) + : rate > 0 + ? new BigNumber(currentOrder?.total_money?.amount) .div(100) .div(rate) .multipliedBy(SATS_PER_BTC) - .toFixed(0); + .toFixed(0) + : '0'; const taxSats = Number( calculateTaxSats(lineItems, subTotalSats, rate, taxPercentage) diff --git a/views/Order.tsx b/views/Order.tsx index df9c5d088..2b7692eea 100644 --- a/views/Order.tsx +++ b/views/Order.tsx @@ -594,8 +594,12 @@ export default class OrderView extends React.Component { const lineItems = order?.line_items; const memo = merchantName - ? `${merchantName} POS powered by ZEUS - Order ${order?.id}` - : `ZEUS POS - Order ${order?.id}`; + ? `${merchantName} ${localeString( + 'views.Settings.POS.poweredByZEUS' + )} - ${localeString('general.order')} ${order?.id}` + : `${localeString('views.Settings.POS')} - ${localeString( + 'general.order' + )} ${order?.id}`; let subTotalSats: string; if (settings.pos.posEnabled === PosEnabled.Square) { diff --git a/views/POS/OrderList.tsx b/views/POS/OrderList.tsx index 3a438f982..158ecb7db 100644 --- a/views/POS/OrderList.tsx +++ b/views/POS/OrderList.tsx @@ -1,10 +1,15 @@ import * as React from 'react'; import { FlatList, Text, TouchableOpacity } from 'react-native'; import Swipeable from 'react-native-gesture-handler/Swipeable'; +import { StackNavigationProp } from '@react-navigation/stack'; import { Spacer } from '../../components/layout/Spacer'; import SwipeableOrderItem from '../Wallet/SwipeableOrderItem'; + import { themeColor } from '../../utils/ThemeUtils'; + +import FiatStore from '../../stores/FiatStore'; + import Order from '../../models/Order'; interface OrderListProps { @@ -13,8 +18,8 @@ interface OrderListProps { onRefresh: () => void; onHideOrder: (orderId: string) => void; onOrderClick: (order: Order) => void; - navigation: any; - fiatStore: any; + navigation: StackNavigationProp; + fiatStore: FiatStore; emptyText: string; } diff --git a/views/Wallet/SquarePosPane.tsx b/views/Wallet/SquarePosPane.tsx index 042c1de15..3fa6f1abd 100644 --- a/views/Wallet/SquarePosPane.tsx +++ b/views/Wallet/SquarePosPane.tsx @@ -167,7 +167,7 @@ export default class SquarePosPane extends React.PureComponent< loading={loading} onRefresh={() => getOrders()} navigation={navigation} - fiatStore={FiatStore} + fiatStore={FiatStore!} emptyText={ selectedIndex === 0 ? localeString( diff --git a/views/Wallet/StandalonePosKeypadPane.tsx b/views/Wallet/StandalonePosKeypadPane.tsx index 4bea98c63..41ac9ccc1 100644 --- a/views/Wallet/StandalonePosKeypadPane.tsx +++ b/views/Wallet/StandalonePosKeypadPane.tsx @@ -27,8 +27,6 @@ import { SATS_PER_BTC, getDecimalPlaceholder } from '../../utils/UnitsUtils'; import { PricedIn } from '../../models/Product'; -import BigNumber from 'bignumber.js'; - interface PosKeypadPaneProps { navigation: StackNavigationProp; FiatStore?: FiatStore; diff --git a/views/Wallet/StandalonePosPane.tsx b/views/Wallet/StandalonePosPane.tsx index 224e79695..aa4ff98be 100644 --- a/views/Wallet/StandalonePosPane.tsx +++ b/views/Wallet/StandalonePosPane.tsx @@ -596,7 +596,7 @@ export default class StandalonePosPane extends React.PureComponent< loading={loading} onRefresh={() => getOrders()} navigation={navigation} - fiatStore={FiatStore} + fiatStore={FiatStore!} emptyText={ selectedIndex === 1 ? localeString(