diff --git a/lib/routes/pollingRoutes.js b/lib/routes/pollingRoutes.js index c13d88a3..1434220a 100644 --- a/lib/routes/pollingRoutes.js +++ b/lib/routes/pollingRoutes.js @@ -81,6 +81,7 @@ function poll (req, res, next) { const cashOutConfig = configManager.getCashOut(deviceId, settings.config) const receipt = configManager.getReceipt(settings.config) const terms = configManager.getTermsConditions(settings.config) + const enablePaperWalletOnly = configManager.getCompliance(settings.config).enablePaperWalletOnly state.pids[operatorId] = { [deviceId]: { pid, ts: Date.now() } } @@ -108,6 +109,7 @@ function poll (req, res, next) { version, receiptPrintingActive: receipt.active, smsReceiptActive: receipt.sms, + enablePaperWalletOnly, cassettes, twoWayMode: cashOutConfig.active, zeroConfLimits, diff --git a/new-lamassu-admin/src/components/buttons/Button.styles.js b/new-lamassu-admin/src/components/buttons/Button.styles.js index ad8e64a6..157c37a1 100644 --- a/new-lamassu-admin/src/components/buttons/Button.styles.js +++ b/new-lamassu-admin/src/components/buttons/Button.styles.js @@ -36,6 +36,7 @@ export default { const shadowSize = size === 'xl' ? 3 : height / 12 const padding = size === 'xl' ? 20 : height / 2 const isGrey = backgroundColor === 'grey' + return { extend: size === 'xl' ? h1 : h3, border: 'none', diff --git a/new-lamassu-admin/src/pages/Blacklist/Blacklist.js b/new-lamassu-admin/src/pages/Blacklist/Blacklist.js index 96b9b34d..b4c53047 100644 --- a/new-lamassu-admin/src/pages/Blacklist/Blacklist.js +++ b/new-lamassu-admin/src/pages/Blacklist/Blacklist.js @@ -1,5 +1,5 @@ import { useQuery, useMutation } from '@apollo/react-hooks' -import { Box } from '@material-ui/core' +import { Box, Dialog, DialogContent, DialogActions } from '@material-ui/core' import Grid from '@material-ui/core/Grid' import { makeStyles } from '@material-ui/core/styles' import gql from 'graphql-tag' @@ -8,11 +8,12 @@ import * as R from 'ramda' import React, { useState } from 'react' import { HoverableTooltip } from 'src/components/Tooltip' -import { Link } from 'src/components/buttons' +import { Link, Button, IconButton } from 'src/components/buttons' import { Switch } from 'src/components/inputs' import Sidebar from 'src/components/layout/Sidebar' import TitleSection from 'src/components/layout/TitleSection' -import { H4, Label2, P } from 'src/components/typography' +import { H4, H2, Label2, P, Info3, Info2 } from 'src/components/typography' +import { ReactComponent as CloseIcon } from 'src/styling/icons/action/close/zodiac.svg' import { fromNamespace, toNamespace } from 'src/utils/config' import styles from './Blacklist.styles' @@ -66,6 +67,48 @@ const ADD_ROW = gql` } ` +const PaperWalletDialog = ({ onConfirmed, onDissmised, open, props }) => { + const classes = useStyles() + + return ( + + + + + + + + {'Are you sure you want to enable this?'} + + + {`This mode means that only paper wallets will be printed for users, and they won't be permitted to scan an address from their own wallet.`} + {`This mode is only useful for countries like Switzerland which mandates such a feature.\n`} + {`Don't enable this if you want users to be able to scan an address of their choosing.`} + + + onDissmised()}> + Cancel + + onConfirmed(true)}>Confirm + + + ) +} + const Blacklist = () => { const { data: blacklistResponse } = useQuery(GET_BLACKLIST) const { data: configData } = useQuery(GET_INFO) @@ -76,6 +119,7 @@ const Blacklist = () => { }) const [errorMsg, setErrorMsg] = useState(null) const [deleteDialog, setDeleteDialog] = useState(false) + const [confirmDialog, setConfirmDialog] = useState(false) const [deleteEntry] = useMutation(DELETE_ROW, { onError: ({ message }) => { @@ -106,7 +150,9 @@ const Blacklist = () => { const complianceConfig = configData?.config && fromNamespace('compliance')(configData.config) - const rejectAddressReuse = complianceConfig?.rejectAddressReuse ?? false + const rejectAddressReuse = !!complianceConfig?.rejectAddressReuse + + const enablePaperWalletOnly = !!complianceConfig?.enablePaperWalletOnly const addressReuseSave = rawConfig => { const config = toNamespace('compliance')(rawConfig) @@ -121,6 +167,13 @@ const Blacklist = () => { deleteEntry({ variables: { cryptoCode, address } }) } + const handleConfirmDialog = confirm => { + addressReuseSave({ + enablePaperWalletOnly: confirm + }) + setConfirmDialog(false) + } + const validateAddress = (cryptoCode, address) => { try { return !R.isNil(coinUtils.parseUrl(cryptoCode, 'main', address)) @@ -151,6 +204,13 @@ const Blacklist = () => { return ( <> + { + setConfirmDialog(false) + }} + /> setShowModal(true)}> @@ -172,6 +232,32 @@ const Blacklist = () => { ? `${clickedItem.display} blacklisted addresses` : ''}{' '} + + Enable paper wallet (only) + + enablePaperWalletOnly + ? addressReuseSave({ + enablePaperWalletOnly: e.target.checked + }) + : setConfirmDialog(true) + } + value={enablePaperWalletOnly} + /> + {enablePaperWalletOnly ? 'On' : 'Off'} + + + The "Enable paper wallet (only)" option means that only paper + wallets will be printed for users, and they won't be permitted + to scan an address from their own wallet. + + +
Enable paper wallet (only)
+ The "Enable paper wallet (only)" option means that only paper + wallets will be printed for users, and they won't be permitted + to scan an address from their own wallet. +