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