Merge pull request #991 from SiIky/refact/lam-108/dev/rbf-transactions
refactor: change RBF checkbox wording
This commit is contained in:
commit
d09fd3f98a
11 changed files with 52 additions and 48 deletions
|
|
@ -4,8 +4,8 @@ const _ = require('lodash/fp')
|
||||||
const uuid = require('uuid')
|
const uuid = require('uuid')
|
||||||
|
|
||||||
function createCashboxBatch (deviceId, cashboxCount) {
|
function createCashboxBatch (deviceId, cashboxCount) {
|
||||||
if (_.isEqual(0, cashboxCount)) throw new Error('Cashbox is empty. Cashbox batch could not be created.')
|
if (_.isEqual(0, cashboxCount)) throw new Error('Cash box is empty. Cash box batch could not be created.')
|
||||||
const sql = `INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-in-empty') RETURNING *`
|
const sql = `INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-box-empty') RETURNING *`
|
||||||
const sql2 = `
|
const sql2 = `
|
||||||
UPDATE bills SET cashbox_batch_id=$1
|
UPDATE bills SET cashbox_batch_id=$1
|
||||||
FROM cash_in_txs
|
FROM cash_in_txs
|
||||||
|
|
@ -24,12 +24,12 @@ function updateMachineWithBatch (machineContext, oldCashboxCount) {
|
||||||
const isCassetteAmountWithinRange = _.inRange(constants.CASH_OUT_MINIMUM_AMOUNT_OF_CASSETTES, constants.CASH_OUT_MAXIMUM_AMOUNT_OF_CASSETTES + 1, _.size(machineContext.cassettes))
|
const isCassetteAmountWithinRange = _.inRange(constants.CASH_OUT_MINIMUM_AMOUNT_OF_CASSETTES, constants.CASH_OUT_MAXIMUM_AMOUNT_OF_CASSETTES + 1, _.size(machineContext.cassettes))
|
||||||
if (!isValidContext && !isCassetteAmountWithinRange)
|
if (!isValidContext && !isCassetteAmountWithinRange)
|
||||||
throw new Error('Insufficient info to create a new cashbox batch')
|
throw new Error('Insufficient info to create a new cashbox batch')
|
||||||
if (_.isEqual(0, oldCashboxCount)) throw new Error('Cashbox is empty. Cashbox batch could not be created.')
|
if (_.isEqual(0, oldCashboxCount)) throw new Error('Cash box is empty. Cash box batch could not be created.')
|
||||||
|
|
||||||
return db.tx(t => {
|
return db.tx(t => {
|
||||||
const deviceId = machineContext.deviceId
|
const deviceId = machineContext.deviceId
|
||||||
const batchId = uuid.v4()
|
const batchId = uuid.v4()
|
||||||
const q1 = t.none(`INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-in-empty')`, [batchId, deviceId])
|
const q1 = t.none(`INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-box-empty')`, [batchId, deviceId])
|
||||||
const q2 = t.none(`UPDATE bills SET cashbox_batch_id=$1 FROM cash_in_txs
|
const q2 = t.none(`UPDATE bills SET cashbox_batch_id=$1 FROM cash_in_txs
|
||||||
WHERE bills.cash_in_txs_id = cash_in_txs.id AND
|
WHERE bills.cash_in_txs_id = cash_in_txs.id AND
|
||||||
cash_in_txs.device_id = $2 AND
|
cash_in_txs.device_id = $2 AND
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,15 @@ var db = require('./db')
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
var sqls = [
|
var sqls = [
|
||||||
`CREATE TYPE cashbox_batch_type AS ENUM(
|
`CREATE TYPE cashbox_batch_type AS ENUM(
|
||||||
'cash-in-empty',
|
'cash-box-empty',
|
||||||
'cash-out-1-refill',
|
'cash-cassette-1-refill',
|
||||||
'cash-out-1-empty',
|
'cash-cassette-1-empty',
|
||||||
'cash-out-2-refill',
|
'cash-cassette-2-refill',
|
||||||
'cash-out-2-empty',
|
'cash-cassette-2-empty',
|
||||||
'cash-out-3-refill',
|
'cash-cassette-3-refill',
|
||||||
'cash-out-3-empty',
|
'cash-cassette-3-empty',
|
||||||
'cash-out-4-refill',
|
'cash-cassette-4-refill',
|
||||||
'cash-out-4-empty'
|
'cash-cassette-4-empty'
|
||||||
)`,
|
)`,
|
||||||
`ALTER TABLE cashbox_batches ADD COLUMN operation_type cashbox_batch_type NOT NULL`,
|
`ALTER TABLE cashbox_batches ADD COLUMN operation_type cashbox_batch_type NOT NULL`,
|
||||||
`ALTER TABLE cashbox_batches ADD COLUMN bill_count_override SMALLINT`,
|
`ALTER TABLE cashbox_batches ADD COLUMN bill_count_override SMALLINT`,
|
||||||
|
|
|
||||||
|
|
@ -162,14 +162,14 @@ const WizardStep = ({
|
||||||
|
|
||||||
{lastStep && (
|
{lastStep && (
|
||||||
<div className={classes.disclaimer}>
|
<div className={classes.disclaimer}>
|
||||||
<Info2 className={classes.title}>Cash-out Bill Count</Info2>
|
<Info2 className={classes.title}>Cash Cassette Bill Count</Info2>
|
||||||
<P>
|
<P>
|
||||||
<WarningIcon className={classes.disclaimerIcon} />
|
<WarningIcon className={classes.disclaimerIcon} />
|
||||||
When enabling cash-out, your bill count will be automatically set to
|
When enabling cash-out, your bill count will be automatically set to
|
||||||
zero. Make sure you physically put cash inside the cash cassettes to
|
zero. Make sure you physically put cash inside the cash cassettes to
|
||||||
allow the machine to dispense it to your users. If you already did,
|
allow the machine to dispense it to your users. If you already did,
|
||||||
make sure you set the correct cash-out bill count for this machine
|
make sure you set the correct cash cassette bill count for this
|
||||||
on your Cash Cassettes tab under Maintenance.
|
machine on your Cash Boxes & Cassettes tab under Maintenance.
|
||||||
</P>
|
</P>
|
||||||
|
|
||||||
<Info2 className={classes.title}>Default Commissions</Info2>
|
<Info2 className={classes.title}>Default Commissions</Info2>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const widthsByNumberOfCassettes = {
|
||||||
const ValidationSchema = Yup.object().shape({
|
const ValidationSchema = Yup.object().shape({
|
||||||
name: Yup.string().required('Required'),
|
name: Yup.string().required('Required'),
|
||||||
cashbox: Yup.number()
|
cashbox: Yup.number()
|
||||||
.label('Cashbox')
|
.label('Cash box')
|
||||||
.required()
|
.required()
|
||||||
.integer()
|
.integer()
|
||||||
.min(0)
|
.min(0)
|
||||||
|
|
@ -101,7 +101,7 @@ const CashCassettes = ({ machine, config, refetchData }) => {
|
||||||
const elements = [
|
const elements = [
|
||||||
{
|
{
|
||||||
name: 'cashbox',
|
name: 'cashbox',
|
||||||
header: 'Cashbox',
|
header: 'Cash box',
|
||||||
width: widthsByNumberOfCassettes[numberOfCassettes].cashbox,
|
width: widthsByNumberOfCassettes[numberOfCassettes].cashbox,
|
||||||
stripe: false,
|
stripe: false,
|
||||||
view: value => (
|
view: value => (
|
||||||
|
|
@ -119,7 +119,7 @@ const CashCassettes = ({ machine, config, refetchData }) => {
|
||||||
it => {
|
it => {
|
||||||
elements.push({
|
elements.push({
|
||||||
name: `cassette${it}`,
|
name: `cassette${it}`,
|
||||||
header: `Cash-out ${it}`,
|
header: `Cash cassette ${it}`,
|
||||||
width: widthsByNumberOfCassettes[numberOfCassettes].cassette,
|
width: widthsByNumberOfCassettes[numberOfCassettes].cassette,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
doubleHeader: 'Cash-out',
|
doubleHeader: 'Cash-out',
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const Machines = () => {
|
||||||
<Details data={machine} timezone={timezone} />
|
<Details data={machine} timezone={timezone} />
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.detailItem}>
|
<div className={classes.detailItem}>
|
||||||
<TL1 className={classes.subtitle}>{'Cash cassettes'}</TL1>
|
<TL1 className={classes.subtitle}>{'Cash box & cassettes'}</TL1>
|
||||||
<Cassettes
|
<Cassettes
|
||||||
refetchData={refetch}
|
refetchData={refetch}
|
||||||
machine={machine}
|
machine={machine}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ const useStyles = makeStyles(styles)
|
||||||
const ValidationSchema = Yup.object().shape({
|
const ValidationSchema = Yup.object().shape({
|
||||||
name: Yup.string().required(),
|
name: Yup.string().required(),
|
||||||
cashbox: Yup.number()
|
cashbox: Yup.number()
|
||||||
.label('Cashbox')
|
.label('Cash box')
|
||||||
.required()
|
.required()
|
||||||
.integer()
|
.integer()
|
||||||
.min(0)
|
.min(0)
|
||||||
|
|
@ -204,7 +204,7 @@ const CashCassettes = () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cashbox',
|
name: 'cashbox',
|
||||||
header: 'Cash-in',
|
header: 'Cash box',
|
||||||
width: maxNumberOfCassettes > 2 ? 140 : 280,
|
width: maxNumberOfCassettes > 2 ? 140 : 280,
|
||||||
view: value => (
|
view: value => (
|
||||||
<CashIn currency={{ code: fiatCurrency }} notes={value} total={0} />
|
<CashIn currency={{ code: fiatCurrency }} notes={value} total={0} />
|
||||||
|
|
@ -270,9 +270,9 @@ const CashCassettes = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TitleSection
|
<TitleSection
|
||||||
title="Cash Cassettes"
|
title="Cash Boxes & Cassettes"
|
||||||
button={{
|
button={{
|
||||||
text: 'Cashbox history',
|
text: 'Cash box history',
|
||||||
icon: HistoryIcon,
|
icon: HistoryIcon,
|
||||||
inverseIcon: ReverseHistoryIcon,
|
inverseIcon: ReverseHistoryIcon,
|
||||||
toggle: setShowHistory
|
toggle: setShowHistory
|
||||||
|
|
@ -281,7 +281,7 @@ const CashCassettes = () => {
|
||||||
className={classes.tableWidth}>
|
className={classes.tableWidth}>
|
||||||
{!showHistory && (
|
{!showHistory && (
|
||||||
<Box alignItems="center" justifyContent="flex-end">
|
<Box alignItems="center" justifyContent="flex-end">
|
||||||
<Label1 className={classes.cashboxReset}>Cashbox reset</Label1>
|
<Label1 className={classes.cashboxReset}>Cash box resets</Label1>
|
||||||
<Box
|
<Box
|
||||||
display="flex"
|
display="flex"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
|
|
@ -344,13 +344,13 @@ const CashCassettes = () => {
|
||||||
)}
|
)}
|
||||||
{editingSchema && (
|
{editingSchema && (
|
||||||
<Modal
|
<Modal
|
||||||
title={'Cashbox reset'}
|
title={'Cash box resets'}
|
||||||
width={478}
|
width={478}
|
||||||
handleClose={() => setEditingSchema(null)}
|
handleClose={() => setEditingSchema(null)}
|
||||||
open={true}>
|
open={true}>
|
||||||
<P className={classes.descriptions}>
|
<P className={classes.descriptions}>
|
||||||
Specify if you want your cash-in counts to be reset automatically or
|
We can automatically assume you emptied a bill validator's cash box
|
||||||
manually.
|
when the machine detects that it has been removed.
|
||||||
</P>
|
</P>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
name="set-automatic-reset"
|
name="set-automatic-reset"
|
||||||
|
|
@ -360,8 +360,8 @@ const CashCassettes = () => {
|
||||||
className={classes.radioButtons}
|
className={classes.radioButtons}
|
||||||
/>
|
/>
|
||||||
<P className={classes.descriptions}>
|
<P className={classes.descriptions}>
|
||||||
Choose this option if you want your cash-in cashbox count to be
|
Assume the cash box is emptied whenever it's removed, creating a new
|
||||||
reset automatically when it is physically removed from the machine.
|
batch on the history screen and setting its current balance to zero.
|
||||||
</P>
|
</P>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
name="set-manual-reset"
|
name="set-manual-reset"
|
||||||
|
|
@ -371,9 +371,9 @@ const CashCassettes = () => {
|
||||||
className={classes.radioButtons}
|
className={classes.radioButtons}
|
||||||
/>
|
/>
|
||||||
<P className={classes.descriptions}>
|
<P className={classes.descriptions}>
|
||||||
Choose this option if you want to edit your cash-in counts manually
|
Cash boxes won't be assumed emptied when removed, nor their counts
|
||||||
on Lamassu Admin, after you physically remove the bills from the
|
modified. Instead, to update the count and create a new batch,
|
||||||
cashbox.
|
you'll click the 'Edit' button on this panel.
|
||||||
</P>
|
</P>
|
||||||
<DialogActions className={classes.actions}>
|
<DialogActions className={classes.actions}>
|
||||||
<Button onClick={() => saveCashboxOption(selectedRadio)}>
|
<Button onClick={() => saveCashboxOption(selectedRadio)}>
|
||||||
|
|
|
||||||
|
|
@ -94,25 +94,29 @@ const CashboxHistory = ({ machines, currency }) => {
|
||||||
(ret, i) =>
|
(ret, i) =>
|
||||||
R.pipe(
|
R.pipe(
|
||||||
R.assoc(
|
R.assoc(
|
||||||
`cash-out-${i}-refill`,
|
`cash-cassette-${i}-refill`,
|
||||||
<>
|
<>
|
||||||
<TxOutIcon />
|
<TxOutIcon />
|
||||||
<span className={classes.operationType}>Cash-out {i} refill</span>
|
<span className={classes.operationType}>
|
||||||
|
Cash cassette {i} refill
|
||||||
|
</span>
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
R.assoc(
|
R.assoc(
|
||||||
`cash-out-${i}-empty`,
|
`cash-cassette-${i}-empty`,
|
||||||
<>
|
<>
|
||||||
<TxOutIcon />
|
<TxOutIcon />
|
||||||
<span className={classes.operationType}>Cash-out {i} emptied</span>
|
<span className={classes.operationType}>
|
||||||
|
Cash cassette {i} emptied
|
||||||
|
</span>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
)(ret),
|
)(ret),
|
||||||
{
|
{
|
||||||
'cash-in-empty': (
|
'cash-box-empty': (
|
||||||
<>
|
<>
|
||||||
<TxInIcon />
|
<TxInIcon />
|
||||||
<span className={classes.operationType}>Cash-in emptied</span>
|
<span className={classes.operationType}>Cash box emptied</span>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ const WizardSplash = ({ name, onContinue }) => {
|
||||||
<div className={classes.warningInfo}>
|
<div className={classes.warningInfo}>
|
||||||
<WarningIcon className={classes.warningIcon} />
|
<WarningIcon className={classes.warningIcon} />
|
||||||
<P noMargin className={classes.warningText}>
|
<P noMargin className={classes.warningText}>
|
||||||
For cash-out cassettes, please make sure you've removed the remaining
|
For cash cassettes, please make sure you've removed the remaining
|
||||||
bills before adding the new ones.
|
bills before adding the new ones.
|
||||||
</P>
|
</P>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ const WizardStep = ({
|
||||||
classes.verticalAlign,
|
classes.verticalAlign,
|
||||||
classes.fullWidth
|
classes.fullWidth
|
||||||
)}>
|
)}>
|
||||||
<H4 noMargin>Did you empty the cash-in box?</H4>
|
<H4 noMargin>Did you empty the cash box?</H4>
|
||||||
<Field
|
<Field
|
||||||
component={RadioGroup}
|
component={RadioGroup}
|
||||||
name="wasCashboxEmptied"
|
name="wasCashboxEmptied"
|
||||||
|
|
@ -189,8 +189,8 @@ const WizardStep = ({
|
||||||
<P>Since previous update</P>
|
<P>Since previous update</P>
|
||||||
<Tooltip width={215}>
|
<Tooltip width={215}>
|
||||||
<P>
|
<P>
|
||||||
Number of bills inside the cashbox, since the last
|
Number of bills inside the cash box, since the last
|
||||||
cashbox changes.
|
cash box changes.
|
||||||
</P>
|
</P>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -251,7 +251,7 @@ const WizardStep = ({
|
||||||
<H4
|
<H4
|
||||||
className={classes.cassetteFormTitleContent}
|
className={classes.cassetteFormTitleContent}
|
||||||
noMargin>
|
noMargin>
|
||||||
Cash-out {step - 1} (dispenser)
|
Cash cassette {step - 1} (dispenser)
|
||||||
</H4>
|
</H4>
|
||||||
</div>
|
</div>
|
||||||
<Cashbox
|
<Cashbox
|
||||||
|
|
|
||||||
|
|
@ -131,10 +131,10 @@ const FiatBalanceOverrides = ({ section }) => {
|
||||||
it => {
|
it => {
|
||||||
elements.push({
|
elements.push({
|
||||||
name: `fillingPercentageCassette${it}`,
|
name: `fillingPercentageCassette${it}`,
|
||||||
display: `Cash-out ${it}`,
|
display: `Cash cassette ${it}`,
|
||||||
width: 155,
|
width: 155,
|
||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
doubleHeader: 'Cash-out (Cassette Empty)',
|
doubleHeader: 'Cash Cassette Empty',
|
||||||
bold: true,
|
bold: true,
|
||||||
input: NumberInput,
|
input: NumberInput,
|
||||||
suffix: '%',
|
suffix: '%',
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export default {
|
||||||
settings: {
|
settings: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
disabledMessage: 'RBF verification not available',
|
disabledMessage: 'RBF verification not available',
|
||||||
label: 'Enable RBF verification',
|
label: 'Lower the confidence of RBF transactions',
|
||||||
requirement: 'bitcoind'
|
requirement: 'bitcoind'
|
||||||
},
|
},
|
||||||
face: true
|
face: true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue