From 4eb2bae4a83d5a51536df3f9d2d19dc8b6ad6d1b Mon Sep 17 00:00:00 2001 From: sairajzero Date: Tue, 24 May 2022 18:56:18 +0530 Subject: [PATCH] Bug fix --- index.html | 25 +------------------------ scripts/fn_pay.js | 4 ++-- scripts/fn_ui.js | 12 +++++++----- 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/index.html b/index.html index 639edbb..1c8d48e 100644 --- a/index.html +++ b/index.html @@ -14,33 +14,10 @@ diff --git a/scripts/fn_pay.js b/scripts/fn_pay.js index f446de3..72d89b4 100644 --- a/scripts/fn_pay.js +++ b/scripts/fn_pay.js @@ -140,7 +140,7 @@ User.tokenToCash = function(cashier, amount, blkTxID, upiID) { User.sendToken = function(receiverID, amount, remark = '', options = {}) { return new Promise((resolve, reject) => { - floTokenAPI.sendToken(myPrivKey, amount, receiverID, remark, options) + floTokenAPI.sendToken(myPrivKey, amount, receiverID, remark, floTokenAPI.currency, options) .then(result => resolve(result)) .catch(error => reject(error)) }) @@ -194,7 +194,7 @@ function startStatusInterval() { Cashier.init = function() { delegate(getRef('cashier_pending_request_list'), 'click', '.process-cashier-request', e => { - const requestID = e.delegateTarget.closest('.cashier-request').id; + const requestID = e.delegateTarget.closest('.cashier-request').dataset.vc; cashierUI.completeRequest(requestID) }) getRef('cashier_requests_selector').addEventListener('change', e => { diff --git a/scripts/fn_ui.js b/scripts/fn_ui.js index 8935c51..2a38c54 100644 --- a/scripts/fn_ui.js +++ b/scripts/fn_ui.js @@ -419,17 +419,19 @@ function declineTopUp() { function completeTokenToCashRequest(request) { - const { vectorClock, senderID, message: { token_txid, amount, upi_id } } = request - if (upi_id instanceof Object && "secret" in upi_id){ + const { vectorClock, senderID, message: { token_txid, amount, upi_id } } = request; + var upiID; + if(upi_id instanceof Object && "secret" in upi_id){ try { - upi_id = floCrypto.decryptData(upi_id, myPrivKey); + upiID = floCrypto.decryptData(upi_id, myPrivKey); } catch(error) { console.error("UPI ID is not encrypted with a proper key", error); return notify("Invalid UPI ID", 'error'); } - } + } else + upiID = upi_id; Cashier.checkIfTokenTxIsValid(token_txid, senderID, amount).then(result => { - getPromptInput('Process', `Token transfer is verified!\n Send ${formatAmount(amount)}\n to ${upi_id}\n Enter UPI transaction ID`, { + getPromptInput('Process', `Token transfer is verified!\n Send ${formatAmount(amount)}\n to ${upiID}\n Enter UPI transaction ID`, { placeholder: 'UPI transaction ID', }).then(upiTxID => { if (!upiTxID || upiTxID.length < 10)