diff --git a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js index 2a196719..cb436fb8 100644 --- a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js +++ b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js @@ -91,21 +91,22 @@ const DetailsRow = ({ it: tx, timezone }) => { const [action, setAction] = useState({ command: null }) const [errorMessage, setErrorMessage] = useState('') + const isCashIn = tx.txClass === 'cashIn' + const zip = new JSZip() const [fetchSummary] = useLazyQuery(TX_SUMMARY, { onCompleted: data => createCsv(data) }) - const [cancelCashOutTransaction] = useMutation(CANCEL_CASH_OUT_TRANSACTION, { - onError: ({ message }) => setErrorMessage(message ?? 'An error occurred.'), - refetchQueries: () => ['transactions'] - }) - - const [cancelCashInTransaction] = useMutation(CANCEL_CASH_IN_TRANSACTION, { - onError: ({ message }) => setErrorMessage(message ?? 'An error occurred.'), - refetchQueries: () => ['transactions'] - }) + const [cancelTransaction] = useMutation( + isCashIn ? CANCEL_CASH_IN_TRANSACTION : CANCEL_CASH_OUT_TRANSACTION, + { + onError: ({ message }) => + setErrorMessage(message ?? 'An error occurred.'), + refetchQueries: () => ['transactions'] + } + ) const fiat = Number.parseFloat(tx.fiat) const crypto = coinUtils.toUnit(new BigNumber(tx.cryptoAtoms), tx.cryptoCode) @@ -155,6 +156,13 @@ const DetailsRow = ({ it: tx, timezone }) => { > ) + const getCancelMessage = () => { + const cashInMessage = `The user will not be able to redeem the inserted bills, even if they subsequently confirm the transaction. If they've already deposited bills, you'll need to reconcile this transaction with them manually.` + const cashOutMessage = `The user will not be able to redeem the cash, even if they subsequently send the required coins. If they've already sent you coins, you'll need to reconcile this transaction with them manually.` + + return isCashIn ? cashInMessage : cashOutMessage + } + return (