This commit is contained in:
sairaj mote 2020-10-03 19:14:08 +05:30
parent 22a5d1806a
commit 1b98f4fffc
4 changed files with 71 additions and 55 deletions

View File

@ -254,7 +254,9 @@ border: none;
min-width: 0; min-width: 0;
} }
.input.readonly .clear{ .input.readonly .clear{
display: none; opacity: 0 !important;
margin-right: -2em;
pointer-events: none !important;
} }
.readonly{ .readonly{
pointer-events: none; pointer-events: none;

View File

@ -933,6 +933,7 @@
</section> </section>
<section id="settings_page" class="page hide-completely"> <section id="settings_page" class="page hide-completely">
<h3 class="bottom-margin">Settings<h3> <h3 class="bottom-margin">Settings<h3>
<div id="my_qr_code"></div>
<section> <section>
<h4>My FLO address</h4> <h4>My FLO address</h4>
<div class="copy-row"> <div class="copy-row">
@ -1977,24 +1978,19 @@
// Function for accepting payment request // Function for accepting payment request
document.getElementById('payment_request_tab').addEventListener('click', async (e) => { document.getElementById('payment_request_tab').addEventListener('click', async (e) => {
if (e.target.closest('.send-rupee')) { if (e.target.closest('.send-rupee')) {
let parent = e.target.closest('.request'), currentPaymentRequest = e.target.closest('.request')
senderAddress = parent.dataset.senderAddress, let senderAddress = currentPaymentRequest.dataset.senderAddress,
amount = parent.dataset.amount, amount = currentPaymentRequest.dataset.amount
paymentRequestId = parent.dataset.paymentRequestId;;
showPopup('send_rupee_popup');
payingRequested = true; payingRequested = true;
currentPaymentRequest = {
paymentRequest: parent,
requestId: paymentRequestId
}
tokenReceiver.value = senderAddress; tokenReceiver.value = senderAddress;
tokenAmount.value = amount; tokenAmount.value = amount;
tokenReceiver.readOnly = true tokenReceiver.readOnly = true
tokenAmount.readOnly = true tokenAmount.readOnly = true
showPopup('send_rupee_popup');
} }
if (e.target.closest('.decline-request')) { if (e.target.closest('.decline-request')) {
let parent = e.target.closest('.request'), currentPaymentRequest = e.target.closest('.request')
paymentRequestId = parent.dataset.paymentRequestId; let paymentRequestId = currentPaymentRequest.dataset.paymentRequestId;
if (await confirmation(`Do want to decline this request?`, 'No', 'Decline')) { if (await confirmation(`Do want to decline this request?`, 'No', 'Decline')) {
const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0").reverse()); .TYPE_REQUEST_PAYMENT, "0").reverse());
@ -2003,6 +1999,7 @@
.map(m => m.message)[0]; .map(m => m.message)[0];
payment_request_status(original_req, 'DECLINED') payment_request_status(original_req, 'DECLINED')
declinedPaymentRequestContainer.prepend(e.target.closest('.request'))
e.target.closest('.request').remove() e.target.closest('.request').remove()
} }
} }
@ -2387,6 +2384,8 @@
} }
} }
</script> </script>
<script src="qrcode.min.js"></script>
<script src="qrcode-scanner.min.js"></script>
<script id="init_lib"> <script id="init_lib">
//All util libraries required for Standard operations (DO NOT EDIT ANY) //All util libraries required for Standard operations (DO NOT EDIT ANY)
@ -12014,6 +12013,7 @@
defaultUPI = localStorage.getItem(`defaultUPI${myFloID}`) defaultUPI = localStorage.getItem(`defaultUPI${myFloID}`)
renderUserUPI() renderUserUPI()
renderAllContacts() renderAllContacts()
new QRCode(document.getElementById("my_qr_code"), myFloID);
showPage('home_page', 'home_page_btn') showPage('home_page', 'home_page_btn')
show_payment_requests() show_payment_requests()
@ -12483,21 +12483,23 @@
hidePopup() hidePopup()
return false; return false;
} else { } else {
hidePopup() if (payingRequested) {
showTransactionStatus('success', 'Rupee Sent', 'It may take upto 48 working hours for transaction to be completed.', flo_txid);
sentActivityContainer.prepend(render.activityCard({ type: 'sent', amount: token_amount, timeStamp: `${Date.now()}_${myFloID}`, token_txid: flo_txid, receiver: token_receiver }))
refresh_balance()
if (payingRequested === true) {
const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0").reverse()); .TYPE_REQUEST_PAYMENT, "0").reverse());
const original_req = all_reqs const original_req = all_reqs
.filter(f => f.message.pay_req_id === currentPaymentRequest.requestId) .filter(f => f.message.pay_req_id === currentPaymentRequest.dataset.paymentRequestId)
.map(m => m.message)[0]; .map(m => m.message)[0];
payment_request_status(original_req, 'APPROVED') payment_request_status(original_req, 'APPROVED')
showPayThruCashierRequests(); paidPaymentRequestContainer.prepend(currentPaymentRequest)
} else if (payingRequested === false) { for(child of pendingPaymentRequestContainer.children){
if(child.dataset.paymentRequestId === currentPaymentRequest.dataset.paymentRequestId){
child.remove()
}
}
show_payment_requests();
} else{
let receiverID = myFloID; let receiverID = myFloID;
floGlobals.appObjects[token_app.master_configurations.TYPE_SENT_TOKENS][flo_txid] = { floGlobals.appObjects[token_app.master_configurations.TYPE_SENT_TOKENS][flo_txid] = {
token_sender, token_receiver, token_amount, token_name_radio, token_sender, token_receiver, token_amount, token_name_radio,
@ -12505,6 +12507,10 @@
}; };
floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_SENT_TOKENS, options = { receiverID }); floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_SENT_TOKENS, options = { receiverID });
} }
hidePopup()
showTransactionStatus('success', 'Rupee Sent', 'It may take upto 48 working hours for transaction to be completed.', flo_txid);
sentActivityContainer.prepend(render.activityCard({ type: 'sent', amount: token_amount, timeStamp: `${Date.now()}_${myFloID}`, token_txid: flo_txid, receiver: token_receiver }))
refresh_balance()
return true; return true;
} }
} }
@ -13226,6 +13232,10 @@
} }
} }
const pendingPaymentRequestContainer = document.getElementById("pending_payment_request_container"),
paidPaymentRequestContainer = document.getElementById("paid_payment_request_container"),
declinedPaymentRequestContainer = document.getElementById("declined_payment_request_container");
async function show_payment_requests(requests_received = true, recvr_id = '') { async function show_payment_requests(requests_received = true, recvr_id = '') {
try { try {
@ -13253,12 +13263,8 @@
let processed_payments_requests = approved_reqs_list.map(m => m.message.pay_req_id).concat(declined_reqs_list let processed_payments_requests = approved_reqs_list.map(m => m.message.pay_req_id).concat(declined_reqs_list
.map(m => m.message.pay_req_id)); .map(m => m.message.pay_req_id));
let pendingPaymentRequestContainer = document.getElementById("pending_payment_request_container"),
approvedPaymentRequestContainer = document.getElementById("paid_payment_request_container"),
declinedPaymentRequestContainer = document.getElementById("declined_payment_request_container");
pendingPaymentRequestContainer.innerHTML = ``; pendingPaymentRequestContainer.innerHTML = ``;
approvedPaymentRequestContainer.innerHTML = ``; paidPaymentRequestContainer.innerHTML = ``;
declinedPaymentRequestContainer.innerHTML = ``; declinedPaymentRequestContainer.innerHTML = ``;
for (const m of general_msg) { for (const m of general_msg) {
@ -13286,7 +13292,7 @@
} = m.message; } = m.message;
frag.append(render.paymentRequest(datetime, sender_flo_id, amount, pay_req_id)) frag.append(render.paymentRequest(datetime, sender_flo_id, amount, pay_req_id))
} }
approvedPaymentRequestContainer.append(frag) paidPaymentRequestContainer.append(frag)
for (const m of declined_reqs_list) { for (const m of declined_reqs_list) {
let { let {

7
qrcode-scanner.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
qrcode.min.js vendored Normal file

File diff suppressed because one or more lines are too long