Added blockchain transaction link for withdrawal

This commit is contained in:
sairaj mote 2022-05-24 17:17:05 +05:30
parent 4a2311f2ae
commit 7a4bd4ee7d
3 changed files with 7 additions and 2 deletions

View File

@ -952,6 +952,8 @@
</svg>
<h4>Sent transfer to bank request</h4>
<p>This may take upto 30 mins to complete</p>
<a href="" class="hide" target="_blank" id="withdrawal_blockchain_link">Check transaction on
blockchain</a>
</div>
<div class="grid gap-0-5 hide justify-center text-center">
<svg class="icon user-action-result__icon failed" xmlns="http://www.w3.org/2000/svg" height="24px"

View File

@ -85,11 +85,14 @@ function withdrawMoneyFromWallet() {
if (!upiId)
return notify("Please add an UPI ID to continue", 'error');
buttonLoader('withdraw_rupee_button', true);
getRef('withdrawal_blockchain_link').classList.add('hide');
User.sendToken(cashier, amount, 'for token-to-cash').then(txid => {
console.warn(`Withdraw ${amount} from cashier ${cashier}`, txid);
User.tokenToCash(cashier, amount, txid, upiId).then(result => {
showChildElement('withdraw_wallet_process', 1);
refreshBalance();
getRef('withdrawal_blockchain_link').classList.remove('hide');
getRef('withdrawal_blockchain_link').href = `https://flosight.duckdns.org/tx/${txid}`
console.log(result);
}).catch(error => {
getRef('withdrawal_failed_reason').textContent = error;

View File

@ -452,11 +452,11 @@ async function showPage(targetPage, options = {}) {
} else if (params.type === 'wallet') {
transactionDetails = User.cashierRequests[params.transactionId]
console.log(transactionDetails)
const { message: { amount, mode, upi_id, upi_txid }, note, tag } = transactionDetails
const { message: { amount, mode, upi_id, upi_txid, token_txid }, note, tag } = transactionDetails
status = tag ? tag : (note ? 'REJECTED' : "PENDING");
getRef('transaction__type').textContent = mode === 'cash-to-token' ? 'Wallet top-up' : 'Withdraw';
if (status === 'COMPLETED') {
getRef('transaction__link').href = `https://flosight.duckdns.org/tx/${note}`
getRef('transaction__link').href = `https://flosight.duckdns.org/tx/${mode === 'cash-to-token' ? note : token_txid}`
getRef('transaction__link').classList.remove('hide')
} else if (status === 'REJECTED') {
getRef('transaction__note').innerHTML = `<svg class="icon failed" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path></svg> ${note.split(':')[1]}`