feat: add cash-out fixed fee to Admin UI

This commit is contained in:
siiky 2022-10-10 16:05:16 +01:00 committed by Rafael
parent 5b55ce89d8
commit d6d7753e07
3 changed files with 76 additions and 7 deletions

View file

@ -156,6 +156,20 @@ const getOverridesFields = (getData, currency, auxElements) => {
inputProps: {
decimalPlaces: 2
}
},
{
name: 'cashOutFixedFee',
display: 'Fixed fee',
width: 144,
doubleHeader: 'Cash-out only',
textAlign: 'center',
editingAlign: 'right',
input: NumberInput,
suffix: currency,
bold: bold,
inputProps: {
decimalPlaces: 2
}
}
]
}
@ -218,6 +232,20 @@ const mainFields = currency => [
inputProps: {
decimalPlaces: 2
}
},
{
name: 'cashOutFixedFee',
display: 'Fixed fee',
width: 169,
doubleHeader: 'Cash-out only',
textAlign: 'center',
editingAlign: 'right',
input: NumberInput,
suffix: currency,
bold: bold,
inputProps: {
decimalPlaces: 2
}
}
]
@ -245,7 +273,7 @@ const getSchema = locale => {
.max(percentMax)
.required(),
fixedFee: Yup.number()
.label('Fixed fee')
.label('Cash-in fixed fee')
.min(0)
.max(highestBill)
.required(),
@ -253,6 +281,11 @@ const getSchema = locale => {
.label('Minimum Tx')
.min(0)
.max(highestBill)
.required(),
cashOutFixedFee: Yup.number()
.label('Cash-out fixed fee')
.min(0)
.max(highestBill)
.required()
})
}
@ -340,7 +373,7 @@ const getOverridesSchema = (values, rawData, locale) => {
.max(percentMax)
.required(),
fixedFee: Yup.number()
.label('Fixed fee')
.label('Cash-in fixed fee')
.min(0)
.max(highestBill)
.required(),
@ -348,6 +381,11 @@ const getOverridesSchema = (values, rawData, locale) => {
.label('Minimum Tx')
.min(0)
.max(highestBill)
.required(),
cashOutFixedFee: Yup.number()
.label('Cash-out fixed fee')
.min(0)
.max(highestBill)
.required()
})
}
@ -356,7 +394,8 @@ const defaults = {
cashIn: '',
cashOut: '',
fixedFee: '',
minimumTx: ''
minimumTx: '',
cashOutFixedFee: ''
}
const overridesDefaults = {
@ -365,7 +404,8 @@ const overridesDefaults = {
cashIn: '',
cashOut: '',
fixedFee: '',
minimumTx: ''
minimumTx: '',
cashOutFixedFee: ''
}
const getOrder = ({ machine, cryptoCurrencies }) => {
@ -385,6 +425,7 @@ const createCommissions = (cryptoCode, deviceId, isDefault, config) => {
fixedFee: config.fixedFee,
cashOut: config.cashOut,
cashIn: config.cashIn,
cashOutFixedFee: config.cashOutFixedFee,
machine: deviceId,
cryptoCurrencies: [cryptoCode],
default: isDefault,
@ -451,7 +492,7 @@ const getListCommissionsSchema = locale => {
.max(percentMax)
.required(),
fixedFee: Yup.number()
.label('Fixed fee')
.label('Cash-in fixed fee')
.min(0)
.max(highestBill)
.required(),
@ -459,6 +500,11 @@ const getListCommissionsSchema = locale => {
.label('Minimum Tx')
.min(0)
.max(highestBill)
.required(),
cashOutFixedFee: Yup.number()
.label('Cash-out fixed fee')
.min(0)
.max(highestBill)
.required()
})
}
@ -544,6 +590,20 @@ const getListCommissionsFields = (getData, currency, defaults) => {
inputProps: {
decimalPlaces: 2
}
},
{
name: 'cashOutFixedFee',
display: 'Fixed fee',
width: 144,
doubleHeader: 'Cash-out only',
textAlign: 'center',
editingAlign: 'right',
input: NumberInput,
suffix: currency,
bold: bold,
inputProps: {
decimalPlaces: 2
}
}
]
}

View file

@ -64,10 +64,11 @@ const Commissions = ({ name: SCREEN_KEY, id: deviceId }) => {
cashIn: config.cashIn,
cashOut: config.cashOut,
fixedFee: config.fixedFee,
minimumTx: config.minimumTx
minimumTx: config.minimumTx,
cashOutFixedFee: config.cashOutFixedFee
},
R.project(
['cashIn', 'cashOut', 'fixedFee', 'minimumTx'],
['cashIn', 'cashOut', 'fixedFee', 'minimumTx', 'cashOutFixedFee'],
R.filter(
o =>
R.includes(coin.code, o.cryptoCurrencies) ||

View file

@ -61,6 +61,14 @@ const getOverridesFields = currency => {
doubleHeader: 'Cash-in only',
textAlign: 'right',
suffix: currency
},
{
name: 'cashOutFixedFee',
display: 'Fixed fee',
width: 155,
doubleHeader: 'Cash-out only',
textAlign: 'right',
suffix: currency
}
]
}