@@ -886,13 +951,16 @@
.a {
stroke-width: 9px;
}
+
.b,
.c {
stroke-width: 5px;
}
+
.c {
stroke-dasharray: 11.94 11.94;
}
+
.d {
stroke-width: 3px;
}
@@ -927,8 +995,7 @@
My Balances
-
+
Refresh Balance
@@ -1048,30 +1115,30 @@
Settings
-
- Sign out
- Theme
-
-
-
My UPIs
-
-
Add UPI address for easier access during various transactions.
-
+ Add UPI address
-
-
+
+ Sign out
+ Theme
+
+
+
My UPIs
+
+
Add UPI address for easier access during various transactions.
+
+ Add UPI address
+
+
@@ -1224,7 +1291,7 @@
},
unconfirmedRequest(obj) {
let card = document.createElement('div'),
- {datetime, flo_txid, new_flo_txid, receiver_flo_id, tokens_transferred: amount, user_upi_txid} = obj;
+ { datetime, flo_txid, new_flo_txid, receiver_flo_id, tokens_transferred: amount, user_upi_txid } = obj;
card.classList.add('request')
setAttributes(card, {
'data-vector-clock': `${datetime}_${receiver_flo_id}`
@@ -1256,7 +1323,7 @@
`;
return card;
},
- requestPlaceholder(){
+ requestPlaceholder() {
let card = document.createElement('div');
card.classList.add('request', 'placeholder')
card.innerHTML = `
@@ -1382,16 +1449,16 @@
`
}
- if(fromCashier)
+ if (fromCashier)
transaction = 'Received from RanchiMall Pay'
- if(toCashier)
+ if (toCashier)
transaction = 'Sent to RanchiMall Pay'
composition += `
${icon}
${transaction} ${status} `
if (receiver)
composition += `
- ${allContacts ? allContacts[receiver] ? allContacts[receiver].name : receiver: receiver}
+ ${allContacts ? allContacts[receiver] ? allContacts[receiver].name : receiver : receiver}
`
composition += `
${sign} ₹${amount}
@@ -1400,7 +1467,7 @@
card.innerHTML = composition;
return card;
},
- activityPlaceholder(){
+ activityPlaceholder() {
let card = document.createElement('div'),
composition = ``
card.classList.add('activity', 'placeholder')
@@ -1446,7 +1513,7 @@
card.innerHTML = markup
return card;
},
- paymentRequestPlaceholder(){
+ paymentRequestPlaceholder() {
let card = document.createElement('div');
card.classList.add('request', 'placeholder')
card.innerHTML = `
@@ -1790,14 +1857,14 @@
zIndex++
thisPopup.setAttribute('style', `z-index: ${zIndex}`)
popupStack = thisPopup.show(pinned, popupStack)
- if(popup === 'deposit_rupee' || popup === 'withdraw_rupee' || popup === 'pay_anyone'){
+ if (popup === 'deposit_rupee' || popup === 'withdraw_rupee' || popup === 'pay_anyone') {
liveCashier.floId = randomNoRepeats(await getLiveCashiers());
- if(liveCashier.floId && liveCashier.floId.length){
+ if (liveCashier.floId && liveCashier.floId.length) {
liveCashier.upi = token_app.master_configurations.cashiers[liveCashier.floId].upi_id;
document.getElementById('send_cash_to_deposit').textContent = liveCashier.upi;
document.getElementById('pay_cashier_info').textContent = liveCashier.upi;
}
- else{
+ else {
notify('No cashier is online currently, please try again later.', 'error')
document.getElementById('send_cash_to_deposit').textContent = 'No cashier found';
document.getElementById('pay_cashier_info').textContent = 'No cashier found';
@@ -1816,9 +1883,9 @@
let personPopupOpen = false,
scannedFloId,
scannerOn = false
- const qrScannerInstance = new Html5Qrcode("reader"),
- selectCamera = document.getElementById('select_camera'),
- liveCashier = {}
+ const qrScannerInstance = new Html5Qrcode("reader"),
+ selectCamera = document.getElementById('select_camera'),
+ liveCashier = {}
document.addEventListener('popupopened', async e => {
let thisPopup = e.detail.popup,
@@ -1848,9 +1915,9 @@
qrLink.href = document.querySelector('img').src
qrLink.download = ''
Html5Qrcode.getCameras().then(devices => {
- if (devices && devices.length) {
- startScanning(devices[devices.length-1].id)
- }
+ if (devices && devices.length) {
+ startScanning(devices[devices.length - 1].id)
+ }
}).catch(err => {
// handle err
});
@@ -1858,35 +1925,35 @@
}
})
- function startScanning(cameraId){
+ function startScanning(cameraId) {
qrScannerInstance.start(
cameraId,
{
- fps: 10,
- qrbox: 250
+ fps: 10,
+ qrbox: 250
},
qrCodeMessage => {
scannedFloId = qrCodeMessage
- if(floCrypto.validateAddr(scannedFloId))
- qrScannerInstance.stop().then(ignore => {
- // QR Code scanning is stopped.
- hidePopup()
- showPopup('send_rupee_popup')
- }).catch(err => {
- console.log("Unable to stop scanning.");
- });
+ if (floCrypto.validateAddr(scannedFloId))
+ qrScannerInstance.stop().then(ignore => {
+ // QR Code scanning is stopped.
+ hidePopup()
+ showPopup('send_rupee_popup')
+ }).catch(err => {
+ console.log("Unable to stop scanning.");
+ });
},
errorMessage => {
-
+
})
- .then(success => {
- scannerOn = true
- })
- .catch(err => {
- // Start failed, handle it. For example,
- scannerOn = false
- console.log(`Unable to start scanning, error: ${err}`);
- });
+ .then(success => {
+ scannerOn = true
+ })
+ .catch(err => {
+ // Start failed, handle it. For example,
+ scannerOn = false
+ console.log(`Unable to start scanning, error: ${err}`);
+ });
}
document.addEventListener('popupclosed', e => {
@@ -1943,7 +2010,7 @@
thisPopup.querySelector('.cancel-btn').click()
break
case 'qr_code_popup':
- if(scannerOn)
+ if (scannerOn)
qrScannerInstance.stop()
break
}
@@ -1955,10 +2022,10 @@
if (option === 'start') {
btn.classList.add('start-loading')
btn.children[1].classList.add('animate-loader')
- if(btn.classList.contains('refresh-balance')) return
+ if (btn.classList.contains('refresh-balance')) return
btn.children[0].textContent = btn.children[0].textContent.trim() + 'ing'
} else {
- if(btn.children[0].textContent.indexOf('ing'))
+ if (btn.children[0].textContent.indexOf('ing'))
btn.children[0].textContent = btn.children[0].textContent.trim().replace('ing', '')
btn.classList.remove('start-loading')
btn.children[1].classList.remove('animate-loader')
@@ -1984,7 +2051,7 @@
const mobileCheck = () => {
let check = false;
- (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
+ (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
@@ -2003,8 +2070,8 @@
return color;
}
- function clearElements(array = []){
- array.forEach(item =>{
+ function clearElements(array = []) {
+ array.forEach(item => {
document.getElementById(item).innerHTML = ``
})
}
@@ -2169,46 +2236,46 @@
if (e.target.closest('sm-input')) {
let input = e.target.closest('sm-input')
formValidation(input)
- if(input.value === '')
+ if (input.value === '')
input.setValidity('')
let validityState = input.validity
- if(input.hasAttribute('type') && input.getAttribute('type') === 'number'){
- if(validityState.rangeUnderflow){
+ if (input.hasAttribute('type') && input.getAttribute('type') === 'number') {
+ if (validityState.rangeUnderflow) {
input.setValidity('Minium ₹1 should be entered.')
}
- else if(validityState.typeMismatch){
+ else if (validityState.typeMismatch) {
input.setValidity('Only digits are allowed.')
}
- else{
+ else {
input.setValidity('')
}
}
else if (input.hasAttribute('floId')) {
if (floCrypto.validateAddr(input.value.trim()) || input.value.trim() === '')
- input.setValidity('')
+ input.setValidity('')
else
- input.setValidity('Invalid FLO address.')
+ input.setValidity('Invalid FLO address.')
}
else if (input.hasAttribute('privateKey')) {
if (floCrypto.getPubKeyHex(input.value.trim()) || input.value.trim() === '')
input.setValidity('')
else
- input.setValidity('Invalid FLO private key.')
+ input.setValidity('Invalid FLO private key.')
}
- else{
- if(validityState.patternMismatch)
- input.setValidity('Invalid UPI address.')
- if(validityState.tooShort || validityState.tooLong)
- input.setValidity('UPI transaction Id should be 12digits long.')
+ else {
+ if (validityState.patternMismatch)
+ input.setValidity('Invalid UPI address.')
+ if (validityState.tooShort || validityState.tooLong)
+ input.setValidity('UPI transaction Id should be 12digits long.')
else
- input.setValidity('')
+ input.setValidity('')
}
}
})
document.addEventListener('keyup', (e) => {
if (e.target.closest('sm-input')) {
if (e.key === 'Enter') {
- let parent = e.target.closest('sm-popup') || e.target.closest('form')
+ let parent = e.target.closest('sm-popup') || e.target.closest('form')
parent.querySelector("button[type='submit']")
.click();
}
@@ -2221,15 +2288,15 @@
}
})
- function createRipple(event, target){
+ function createRipple(event, target) {
const circle = document.createElement("span");
const diameter = Math.max(target.clientWidth, target.clientHeight);
const radius = diameter / 2;
circle.style.width = circle.style.height = `${diameter}px`;
circle.style.left = `${event.clientX - (target.getBoundingClientRect().left + radius)}px`;
circle.style.top = `${event.clientY - (target.getBoundingClientRect().top + radius)}px`;
- circle.classList.add("ripple");
- const rippleAnimation = circle.animate([
+ circle.classList.add("ripple");
+ const rippleAnimation = circle.animate([
{
transform: 'scale(3)',
@@ -2268,7 +2335,7 @@
if (!e.target.closest('#show_person_name') && !e.target.closest('#edit_person_name')) {
if (showPersonName.isContentEditable)
showPersonName.contentEditable = 'false'
- if(personName !== showPersonName.textContent)
+ if (personName !== showPersonName.textContent)
changePersonName()
}
})
@@ -2279,8 +2346,8 @@
if (await confirmation('Confirm this deposit request?')) {
let depositRequest = e.target.closest('.request'),
status = await transfer_token(depositRequest.dataset.userFloId,
- depositRequest.dataset.txid, parseInt(depositRequest.dataset
- .amount))
+ depositRequest.dataset.txid, parseInt(depositRequest.dataset
+ .amount))
console.log(depositRequest)
if (status) {
refreshBalance()
@@ -2294,7 +2361,7 @@
let withdrawRequest = e.target.closest('.request'),
status = await cash_sent(withdrawRequest.dataset.txid, withdrawRequest
.dataset.userFloId, withdrawRequest.dataset.upi, parseInt(withdrawRequest.dataset
- .amount))
+ .amount))
if (status) {
refreshBalance()
withdrawRequest.remove()
@@ -2317,7 +2384,7 @@
if (e.target.closest('.confirm-unconfirmed-btn'))
if (await confirmation('Confirm this deposit request?')) {
let payRequest = e.target.closest('.request')
- status = await process_unconfirmed_balance_claim_requests(unconfirmedRequestsStore[payRequest.dataset.vectorClock])
+ status = await process_unconfirmed_balance_claim_requests(unconfirmedRequestsStore[payRequest.dataset.vectorClock])
if (status) {
refreshBalance()
payRequest.remove()
@@ -2421,144 +2488,144 @@
})
const onBoarding = [
+ {
+ id: '',
+ title: 'Welcome',
+ details: 'We are glad that you chose our service. This service can be used throughout our ecosystem to pay/receive money.'
+ },
+ {
+ id: 'send_rupee_option',
+ title: 'Send money',
+ details: 'Send money to any FLO addres. This uses wallet balance to send money.'
+ },
+ {
+ id: 'deposit_rupee_option',
+ title: 'Deposit money',
+ details: 'Add balance to your RanchiMall pay wallet. This money can be used directly within our apps ecosystem.'
+ },
+ {
+ id: 'withdraw_rupee_option',
+ title: 'Withdraw money',
+ details: `Withdraw or redeem money back to your specified UPI address.`
+ },
+ {
+ id: 'request_rupee_option',
+ title: 'Request money',
+ details: `Request money from others using their FLO address. Requested money will be stored in wallet balance.`
+ },
+ {
+ id: 'pay_rupee_option',
+ title: 'Pay through cashier',
+ details: `Don't have enough wallet balance? Pay to our cashier through UPI and our cashier will complete that transaction on your behalf.`
+ },
+ {
+ id: 'request_page_btn',
+ title: `Request page`,
+ details: 'This will show all the payment requests you received from other users and shop keepers.'
+ },
+ {
+ id: 'activity_page_btn',
+ title: 'Activity page',
+ details: 'This page displays all the transactions such as sent, received money etc.'
+ },
+ {
+ id: 'profile_page_btn',
+ title: 'Profile page',
+ details: 'This page contains all the personal data as well as app settings.'
+ }
+ ]
+
+ const onBoardingPanel = document.getElementById('on_boarding'),
+ featureTitle = document.getElementById('feature_title'),
+ featureDetails = document.getElementById('feature_details'),
+ nextTutButton = document.getElementById('next_tut_button'),
+ prevTutButton = document.getElementById('prev_tut_button')
+
+
+ let currentFeatureIndex = 0;
+
+ function startOnBoarding() {
+ onBoardingPanel.classList.remove('hide')
+ currentFeatureIndex = 0
+ showTutorial(0)
+ }
+ function finishOnBoarding() {
+ onBoardingPanel.classList.add('hide')
+ currentFeatureIndex = 0
+ }
+ function nextTutorial() {
+ showTutorial(+1)
+ }
+ function previousTutorial() {
+ showTutorial(-1)
+ }
+ function showTutorial(index = 0) {
+ if (currentFeatureIndex === onBoarding.length - 1 && index > 0) {
+ finishOnBoarding()
+ }
+ index = Math.min(Math.max(index + currentFeatureIndex, 0), onBoarding.length - 1)
+ if (index === 0)
+ prevTutButton.classList.add('hide')
+ else
+ prevTutButton.classList.remove('hide')
+ if (index === onBoarding.length - 1) {
+ nextTutButton.textContent = `Got it`
+ }
+ else {
+ if (nextTutButton.textContent !== 'Next')
+ nextTutButton.textContent = 'Next'
+ }
+ const flyOut = [
{
- id: '',
- title: 'Welcome',
- details: 'We are glad that you chose our service. This service can be used throughout our ecosystem to pay/receive money.'
- },
- {
- id: 'send_rupee_option',
- title: 'Send money',
- details: 'Send money to any FLO addres. This uses wallet balance to send money.'
- },
- {
- id: 'deposit_rupee_option',
- title: 'Deposit money',
- details: 'Add balance to your RanchiMall pay wallet. This money can be used directly within our apps ecosystem.'
- },
- {
- id: 'withdraw_rupee_option',
- title: 'Withdraw money',
- details: `Withdraw or redeem money back to your specified UPI address.`
- },
- {
- id: 'request_rupee_option',
- title: 'Request money',
- details: `Request money from others using their FLO address. Requested money will be stored in wallet balance.`
- },
- {
- id: 'pay_rupee_option',
- title: 'Pay through cashier',
- details: `Don't have enough wallet balance? Pay to our cashier through UPI and our cashier will complete that transaction on your behalf.`
- },
- {
- id: 'request_page_btn',
- title: `Request page`,
- details: 'This will show all the payment requests you received from other users and shop keepers.'
- },
- {
- id: 'activity_page_btn',
- title: 'Activity page',
- details: 'This page displays all the transactions such as sent, received money etc.'
- },
- {
- id: 'profile_page_btn',
- title: 'Profile page',
- details: 'This page contains all the personal data as well as app settings.'
+ transform: 'translateX(-1rem)',
+ opacity: 0
}
]
-
- const onBoardingPanel = document.getElementById('on_boarding'),
- featureTitle = document.getElementById('feature_title'),
- featureDetails = document.getElementById('feature_details'),
- nextTutButton = document.getElementById('next_tut_button'),
- prevTutButton = document.getElementById('prev_tut_button')
-
-
- let currentFeatureIndex = 0;
-
- function startOnBoarding(){
- onBoardingPanel.classList.remove('hide')
- currentFeatureIndex = 0
- showTutorial(0)
+ const flyIn = [
+ {
+ transform: 'translateX(1rem)',
+ opacity: 0,
+ },
+ {
+ transform: 'translateX(0)',
+ opacity: 1
+ }
+ ]
+ const options = {
+ duration: 300,
+ fill: "forwards",
+ easing: 'ease'
}
- function finishOnBoarding(){
- onBoardingPanel.classList.add('hide')
- currentFeatureIndex = 0
+ let titleAnime
+ if (currentFeatureIndex > index) {
+ titleAnime = featureTitle.animate(flyIn, options)
+ featureDetails.animate(flyIn, options).reverse()
+ titleAnime.reverse()
}
- function nextTutorial(){
- showTutorial(+1)
+ else {
+ titleAnime = featureTitle.animate(flyOut, options)
+ featureDetails.animate(flyOut, options)
}
- function previousTutorial(){
- showTutorial(-1)
+ titleAnime.onfinish = () => {
+ featureTitle.textContent = onBoarding[index].title
+ featureDetails.innerHTML = onBoarding[index].details
+ if (onBoarding[index].id !== '') {
+ const targetOption = document.getElementById(onBoarding[index].id)
+ const targetPosition = targetOption.getBoundingClientRect()
+ onBoardingPanel.setAttribute('style', `transform: translate(${targetPosition.left + targetPosition.width}px, ${targetPosition.top}px)`)
+ }
+ if (currentFeatureIndex > index) {
+ featureTitle.animate(flyOut, options).reverse()
+ featureDetails.animate(flyOut, options).reverse()
+ }
+ else {
+ featureTitle.animate(flyIn, options)
+ featureDetails.animate(flyIn, options)
+ }
+ currentFeatureIndex = index
}
- function showTutorial(index = 0){
- if(currentFeatureIndex === onBoarding.length - 1 && index > 0){
- finishOnBoarding()
- }
- index = Math.min(Math.max(index + currentFeatureIndex,0), onBoarding.length-1)
- if(index === 0)
- prevTutButton.classList.add('hide')
- else
- prevTutButton.classList.remove('hide')
- if(index === onBoarding.length - 1){
- nextTutButton.textContent = `Got it`
- }
- else{
- if(nextTutButton.textContent !== 'Next')
- nextTutButton.textContent = 'Next'
- }
- const flyOut = [
- {
- transform: 'translateX(-1rem)',
- opacity: 0
- }
- ]
- const flyIn = [
- {
- transform: 'translateX(1rem)',
- opacity: 0,
- },
- {
- transform: 'translateX(0)',
- opacity: 1
- }
- ]
- const options = {
- duration: 300,
- fill: "forwards",
- easing: 'ease'
- }
- let titleAnime
- if(currentFeatureIndex > index){
- titleAnime = featureTitle.animate(flyIn, options)
- featureDetails.animate(flyIn, options).reverse()
- titleAnime.reverse()
- }
- else{
- titleAnime = featureTitle.animate(flyOut, options)
- featureDetails.animate(flyOut, options)
- }
- titleAnime.onfinish = () => {
- featureTitle.textContent = onBoarding[index].title
- featureDetails.innerHTML = onBoarding[index].details
- if(onBoarding[index].id !== ''){
- const targetOption = document.getElementById(onBoarding[index].id)
- const targetPosition = targetOption.getBoundingClientRect()
- onBoardingPanel.setAttribute('style', `transform: translate(${targetPosition.left + targetPosition.width}px, ${targetPosition.top}px)`)
- }
- if(currentFeatureIndex > index){
- featureTitle.animate(flyOut, options).reverse()
- featureDetails.animate(flyOut, options).reverse()
- }
- else{
- featureTitle.animate(flyIn, options)
- featureDetails.animate(flyIn, options)
- }
- currentFeatureIndex = index
- }
- }
- showTutorial(0)
+ }
+ showTutorial(0)
const transactionSuccessSection = document.getElementById('success_section'),
transactionFailedSection = document.getElementById('failure_section'),
@@ -2634,7 +2701,7 @@
completed, use Report button to report your issue.`
//showReportButton.classList.remove('hide')
}
- else{
+ else {
cautionMessage.innerHTML = ``
//showReportButton.classList.add('hide')
icon = `
@@ -2651,11 +2718,11 @@
₹ ${amount}
`
- if (receiver !== 'undefined'){
+ if (receiver !== 'undefined') {
transactionFloId = receiver
composition += `
-
${transaction} ${allContacts ? allContacts[receiver] ? allContacts[receiver].name : receiver: receiver} `
- if(!token_app.master_configurations.cashiers[myFloID] && floCrypto.validateAddr(receiver) && !allContacts[receiver])
+
${transaction} ${allContacts ? allContacts[receiver] ? allContacts[receiver].name : receiver : receiver} `
+ if (!token_app.master_configurations.cashiers[myFloID] && floCrypto.validateAddr(receiver) && !allContacts[receiver])
composition += `
Save this FLO address `
}
@@ -2670,21 +2737,21 @@
Sent to cashier UPI ID
${receiverUPI}
`
- if(tokenTxId !== 'undefined'){
+ if (tokenTxId !== 'undefined') {
composition += `
FLO transaction ID
${tokenTxId}
`
}
- if(fromCashier !== 'undefined'){
+ if (fromCashier !== 'undefined') {
composition += `
You have received ₹${amount} from RanchiMall Pay. Your deposit request was completed successfully.
- `
+ `
}
- if(toCashier !== 'undefined'){
+ if (toCashier !== 'undefined') {
composition += `
You sent ₹${amount} to our cashier.
- `
+ `
}
composition += `
${formatedTime(timeStamp)} `
transactionDetails.innerHTML = composition
@@ -2712,7 +2779,7 @@
if (page === 'request_page') {
show_payment_requests()
}
- if(page === 'activity_page'){
+ if (page === 'activity_page') {
showActivities()
}
if (page === 'transaction_page') {
@@ -2806,7 +2873,7 @@
})
}
- function addPersonFromTransaction(){
+ function addPersonFromTransaction() {
contactFlo.value = transactionFloId
showPopup('add_person_popup')
}
@@ -2834,7 +2901,7 @@
}
function setNameEditable() {
- if(!showPersonName.isContentEditable){
+ if (!showPersonName.isContentEditable) {
showPersonName.contentEditable = 'true'
showPersonName.focus()
document.execCommand('selectAll', false, null);
@@ -2872,15 +2939,15 @@
}
}
- const credentialsSection = document.getElementById('credentials_section'),
- generateFloId = document.getElementById('generate_flo_id'),
- generatedId = document.getElementById('generated_id'),
- generatedKey = document.getElementById('generated_key')
+ const credentialsSection = document.getElementById('credentials_section'),
+ generateFloId = document.getElementById('generate_flo_id'),
+ generatedId = document.getElementById('generated_id'),
+ generatedKey = document.getElementById('generated_key')
- function generateId(){
+ function generateId() {
generateFloId.classList.add('hide-completely')
credentialsSection.classList.remove('hide-completely')
- let {floID, privKey} = floCrypto.generateNewID()
+ let { floID, privKey } = floCrypto.generateNewID()
generatedId.textContent = floID
generatedKey.textContent = privKey
}
@@ -2901,28 +2968,28 @@
const signInPage = document.getElementById('sign_in_page')
- function showSignIn(){
+ function showSignIn() {
signInPage.classList.remove('hide-completely')
}
- function hideSignIn(){
+ function hideSignIn() {
signInPage.classList.add('hide-completely')
- signInPage.querySelector('sm-input').value= ''
+ signInPage.querySelector('sm-input').value = ''
}
- async function signOutSequence(){
+ async function signOutSequence() {
delete token_app.master_configurations;
await floDapps.clearCredentials()
document.querySelector('main').classList.add('hide-completely')
document.getElementById('navbar').classList.add('hide-completely')
document.getElementById('main_header').classList.add('hide-completely')
- setTimeout(() => {
+ setTimeout(() => {
onLoadStartUp()
notifications.clearAll()
}, 500);
}
async function signOut() {
- if(Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) {
+ if (Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) {
// Inform cloud you are signing off before signing off
update_cashier_status(false);
signOutSequence()
@@ -10662,52 +10729,100 @@
})
},
+ keep_broadcasting: function (raw_transaction_hash, flosight_url, url_index) {
+ return new Promise(async (resolve, reject) => {
+ let broadcast_response = await (await fetch(`${flosight_url[url_index]}/api/tx/send`, {
+ method: 'POST',
+ // Adding body or contents to send
+ body: JSON.stringify({
+ rawtx: raw_transaction_hash
+ }),
+
+ // Adding headers to the request
+ headers: {
+ "Content-type": "application/json; charset=UTF-8"
+ }
+ }).catch(error => {
+ console.error('Error:', error);
+ })).json()
+
+ console.log(broadcast_response.txid.result)
+ await new Promise(r => setTimeout(r, 2000));
+
+ // Checking if transaction has been succesfully broadcasted to flosight
+ let check_txid = await fetch(`${flosight_url[url_index]}/api/tx/${broadcast_response.txid.result}`)
+ .then((response) => {
+ if (response.status === 200) {
+ return response.json()
+ } else {
+ console.log('Transaction doesn\'t exist in flosight')
+ return false
+ }
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ })
+
+ console.log('tx response')
+ console.log(check_txid)
+ if (check_txid !== false) {
+ resolve(check_txid['txid'].trim())
+ } else {
+ resolve(false)
+ }
+ })
+ },
+
//Broadcast signed Tx in blockchain using API
broadcastTx: function (signedTxHash) {
- return new Promise((resolve, reject) => {
- var request = new XMLHttpRequest();
- console.log(url)
- if (signedTxHash.length < 1)
- reject("Empty Signature");
- else {
- var params = `{"rawtx":"${signedTxHash}"}`;
- console.log('TXhash before broadcast')
- var url = `https://teegatest.duckdns.org/broadcastTx/${signedTxHash}`;
- console.log('TXhash after broadcast', signedTxHash)
- request.open('GET', url, true);
- //Send the proper header information along with the request
- request.setRequestHeader('Content-type', 'application/json');
- request.onload = function () {
- if (request.readyState == 4 && request.status == 200) {
- console.log(request.response);
- resolve(JSON.parse(request.response).stdout);
- } else {
- console.log('error')
- reject(JSON.parse(request.response).stderr);
- }
- }
- request.send('');
+ return new Promise(async (resolve, reject) => {
- /*fetch(`https://teegatest.duckdns.org/broadcastTx/${signedTxHash}`)
- .then(
- async function (response) {
- response = JSON.parse(response)
- if (response.returncode == 0) {
- console.log('Broadcasted')
- console.log(response.stdout)
- resolve(response.stdout)
- }
- else{
- console.log('Broadcast failed')
- console.log(response.stderr)
- reject(response.stderr)
- }
- }
- )
- .catch(function (err) {
- console.log('Fetch Error :-S', err);
- }); */
+ // broadcast to FLO C++ node through RanchiMall FLO api
+ try {
+ let broadcast_response = await (await fetch(`https://ranchimallflo.duckdns.org/api/v1.0/broadcastTx/${signedTxHash}`)
+ .catch(error => {
+ console.log('Error:', error);
+ //broadcast_transaction(raw_transaction_hash)
+ }))
+ .json().catch(error => {
+ console.log('Error:', error);
+ //broadcast_transaction(raw_transaction_hash)
+ })
+
+ if (broadcast_response.returncode == 0) {
+ console.log('The accepted transaction hash(RMAPI) is : ' + broadcast_response['stdout'].trim())
+ resolve(broadcast_response['stdout'].trim())
+ }
}
+ catch (err) {
+ console.log('Error:', err);
+ }
+
+ // Since it failed in ranchimallfloAPI, broadcast to multiple flosights
+ let flosight_url = ['https://flosight.duckdns.org', 'https://explorer.mediciland.com'],
+ url_index = 0,
+ broadcast_status = false,
+ temp_counter = 1
+
+ while (!broadcast_status) {
+ broadcast_status = await this.keep_broadcasting(signedTxHash, flosight_url, url_index)
+ if (broadcast_status == false) {
+ console.log(`Transaction not present in ${flosight_url[url_index]}`)
+ console.log('Going to sleep state for 2 seconds')
+ await new Promise(r => setTimeout(r, 2000));
+ if (temp_counter % 3 === 0) {
+ if (url_index != len(flosight_url) - 1) {
+ url_index = url_index + 1
+ }
+ else {
+ url_index = 0
+ }
+ }
+ temp_counter += 1
+ }
+ }
+ console.log('The accepted transaction hash is : ' + broadcast_status)
+ resolve(broadcast_status)
})
},
@@ -12582,9 +12697,9 @@
refreshBalance()
userType.forEach(user => user.textContent = 'Me')
defaultUPI = localStorage.getItem(`defaultUPI${myFloID}`)
- if(mobileCheck())
+ if (mobileCheck())
document.getElementById('scanner_icon').classList.remove('hide-completely')
- else
+ else
document.getElementById('scanner_icon').classList.add('hide-completely')
renderUserUPI()
renderAllContacts()
@@ -12592,18 +12707,18 @@
new QRCode(document.getElementById('my_qr_code'), myFloID);
showPage('home_page', 'home_page_btn')
- if(localStorage.getItem(`${myFloID}IsNew`) === null || localStorage.getItem(`${myFloID}IsNew`) === 'true'){
+ if (localStorage.getItem(`${myFloID}IsNew`) === null || localStorage.getItem(`${myFloID}IsNew`) === 'true') {
startOnBoarding()
//localStorage.setItem(`${myFloID}IsNew`, false)
}
hideLoader()
-
+
request_rupee_token()
-
+
withdraw_token_to_get_cash();
-
+
transferTokensManually();
-
+
pay_through_cashier();
}
this.retrieveLatestContent();
@@ -12626,7 +12741,7 @@
await Promise.all([
- create_root_structure().then(()=>update_cashier_status(true)),
+ create_root_structure().then(() => update_cashier_status(true)),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS, {
receiverID: myFloID
@@ -12750,16 +12865,16 @@
}
},
-
+
// https://gist.github.com/gerard-kanters/2ce9daa5c23d8abe36c2
- idleTimer: function(maxTime=300000) {
+ idleTimer: function (maxTime = 300000) {
var t;
let take_action_on_inactivity = resetTimer;
function auto_shutdown() {
clearTimeout(t);
signOut();
- take_action_on_inactivity = ()=>false;
+ take_action_on_inactivity = () => false;
window.onload = take_action_on_inactivity;
window.onmousemove = take_action_on_inactivity; // catches mouse movements
window.onmousedown = take_action_on_inactivity; // catches mouse movements
@@ -12777,7 +12892,7 @@
function resetTimer() {
clearTimeout(t);
- t = setTimeout(auto_shutdown, maxTime);
+ t = setTimeout(auto_shutdown, maxTime);
}
@@ -12794,7 +12909,7 @@
take_action_on_inactivity()
return confirmationMessage; //Webkit, Safari, Chrome
}; //catches window close actions
-
+
},
}
@@ -12806,7 +12921,7 @@
if (typeof floGlobals.appObjects[object_name] !== 'object'
|| floGlobals.appObjects[object_name] == null) {
await floCloudAPI.requestObjectData(object_name, options)
-
+
if (typeof floGlobals.appObjects[object_name] !== 'object'
|| floGlobals.appObjects[object_name] == null) {
floGlobals.appObjects[object_name] = {};
@@ -12814,7 +12929,7 @@
await floCloudAPI.requestObjectData(object_name, options)
return true;
} else return false;
-
+
} else return false;
} catch (error) {
throw new Error(error);
@@ -12829,20 +12944,20 @@
promises.push(reset_cloud_object(token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS));
promises.push(reset_cloud_object(token_app.master_configurations.TYPE_SENT_TOKENS));
promises.push(reset_cloud_object(token_app.master_configurations.TYPE_CASHIER_LIVE_STATUS));
-
+
if (Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) {
promises.push(reset_cloud_object(token_app.master_configurations.TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS));
}
await Promise.all(promises);
-
+
return true;
}
- const depositsContainer = document.getElementById("pending_deposits_container"),
- withdrawsContainer = document.getElementById("pending_withdrawals_container"),
- payRequestsContainer = document.getElementById("pay_requests_container"),
- unconfirmedRequestsContainer = document.getElementById("unconfirmed_requests_container");
+ const depositsContainer = document.getElementById("pending_deposits_container"),
+ withdrawsContainer = document.getElementById("pending_withdrawals_container"),
+ payRequestsContainer = document.getElementById("pay_requests_container"),
+ unconfirmedRequestsContainer = document.getElementById("unconfirmed_requests_container");
async function showDepositRequests() {
try {
@@ -12853,7 +12968,7 @@
senderIDs: [myFloID]
});*/
depositsContainer.innerHTML = ``
- for(let i= 0; i < 4; i++){
+ for (let i = 0; i < 4; i++) {
frag.append(render.requestPlaceholder())
}
depositsContainer.append(frag)
@@ -12902,7 +13017,7 @@
async function showWithdrawRequests() {
try {
withdrawsContainer.innerHTML = ``
- for(let i= 0; i < 4; i++){
+ for (let i = 0; i < 4; i++) {
frag.append(render.requestPlaceholder())
}
withdrawsContainer.append(frag)
@@ -12916,8 +13031,8 @@
senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, {
- receiverID: myFloID
- })
+ receiverID: myFloID
+ })
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
@@ -12959,7 +13074,7 @@
async function showPayThruCashierRequests() {
try {
payRequestsContainer.innerHTML = ``
- for(let i= 0; i < 4; i++){
+ for (let i = 0; i < 4; i++) {
frag.append(render.requestPlaceholder())
}
payRequestsContainer.append(frag)
@@ -12972,8 +13087,8 @@
senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, {
- receiverID: myFloID
- })
+ receiverID: myFloID
+ })
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
@@ -13003,12 +13118,12 @@
throw new Error(error)
}
}
-
+
async function showUnconfirmedRequests() {
try {
unconfirmedRequestsStore = {}
unconfirmedRequestsContainer.innerHTML = ``
- for(let i= 0; i < 4; i++){
+ for (let i = 0; i < 4; i++) {
frag.append(render.requestPlaceholder())
}
unconfirmedRequestsContainer.append(frag)
@@ -13024,8 +13139,8 @@
const cashiersList = Object.keys(token_app.master_configurations.cashiers);
await floCloudAPI.requestObjectData(token_app.master_configurations.TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS,
{ receiverID: floGlobals.adminID, senderIDs: cashiersList });
- const processed_unconfirmed_balance_claim_requests_list =
- floGlobals.appObjects[token_app.master_configurations.TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS];
+ const processed_unconfirmed_balance_claim_requests_list =
+ floGlobals.appObjects[token_app.master_configurations.TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS];
const processed_unconfirmed_balance_claim_requests_txid_arr = Object.keys(processed_unconfirmed_balance_claim_requests_list);
console.log(unconfirmed_cash_deposit_claims);
@@ -13040,7 +13155,7 @@
console.log(fresh_requests);
unconfirmedRequestsContainer.innerHTML = ``
for (fresh_reqs of fresh_requests) {
- let {datetime, receiver_flo_id} = fresh_reqs.message
+ let { datetime, receiver_flo_id } = fresh_reqs.message
unconfirmedRequestsStore[`${datetime}_${receiver_flo_id}`] = fresh_reqs.message
frag.append(render.unconfirmedRequest(fresh_reqs.message))
}
@@ -13078,7 +13193,7 @@
return;
}
const amount_of_tokens_to_transfer = parseInt(await askPrompt('Enter the amount of rupee to transfer', amountToSend));
- if(!amount_of_tokens_to_transfer) return
+ if (!amount_of_tokens_to_transfer) return
if (amountToSend !== amount_of_tokens_to_transfer) {
let amount_mismatch = await confirmation(
"Amount mismatch: Your amount does not match what user entered. Continue?");
@@ -13162,8 +13277,8 @@
let token_tx = await ajaxGet('https://ranchimallflo.duckdns.org/api/v1.0/getTransactionDetails/' +
input_data["token_txid"])
if (typeof token_tx !== "object" || typeof token_tx.parsedFloData !== "object"
- || typeof token_tx.parsedFloData.flodata !== "string"
- || token_tx.parsedFloData.flodata.length<1) {
+ || typeof token_tx.parsedFloData.flodata !== "string"
+ || token_tx.parsedFloData.flodata.length < 1) {
notify("Transaction not found");
return false;
}
@@ -13180,10 +13295,10 @@
true, true);
let transfer_upi_txid = await askPrompt("Enter the UPI txid for transferred amount.", '');
- if(!transfer_upi_txid){
- notifications.clearAll()
+ if (!transfer_upi_txid) {
+ notifications.clearAll()
return
- }
+ }
if (transfer_upi_txid.length !== 12) {
notify("UPI Txid can't be less than 12 character long.");
return;
@@ -13256,20 +13371,20 @@
if (payingRequested) {
const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0"));
-
+
const original_req = all_reqs
.filter(f => f.message.pay_req_id === currentPaymentRequest.dataset.paymentRequestId)
.map(m => m.message)[0];
-
+
payment_request_status(original_req, 'APPROVED')
paidPaymentRequestContainer.prepend(currentPaymentRequest)
- for(child of pendingPaymentRequestContainer.children){
- if(child.dataset.paymentRequestId === currentPaymentRequest.dataset.paymentRequestId){
+ for (child of pendingPaymentRequestContainer.children) {
+ if (child.dataset.paymentRequestId === currentPaymentRequest.dataset.paymentRequestId) {
child.remove()
}
}
show_payment_requests();
- } else{
+ } else {
let receiverID = myFloID;
floGlobals.appObjects[token_app.master_configurations.TYPE_SENT_TOKENS[flo_txid]] = {
token_sender, token_receiver, token_amount, token_name_radio,
@@ -13341,7 +13456,7 @@
if (sender_flo_id.length < 1) throw new Error("Invalid Sender Id");
if (upi_txid.length < 1) throw new Error("Invalid UPI Txid");
const amount_to_pay = parseInt(await askPrompt('Enter amount to pay', usr_amount_to_pay));
- if(!amount_to_pay) return
+ if (!amount_to_pay) return
if (typeof amount_to_pay !== "number" || amount_to_pay <= 0)
return notify("Invalid amount.", 'error', '', true);
if (parseInt(usr_amount_to_pay) !== amount_to_pay) {
@@ -13464,20 +13579,20 @@
}
}
- async function update_cashier_status(status=false) {
+ async function update_cashier_status(status = false) {
try {
floGlobals.appObjects[token_app.master_configurations.TYPE_CASHIER_LIVE_STATUS][myFloID] = status;
let receiverID = floGlobals.adminID;
floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_CASHIER_LIVE_STATUS, { receiverID })
- .then(res=>notify(`Cashier is ${status ? 'online' : 'offline'}`, 'success'))
- .catch(e=>{
- console.error(e);
- notify('Failed to update Cashier status to '+status, 'error');
- });
- return true;
- } catch(e) {
+ .then(res => notify(`Cashier is ${status ? 'online' : 'offline'}`, 'success'))
+ .catch(e => {
+ console.error(e);
+ notify('Failed to update Cashier status to ' + status, 'error');
+ });
+ return true;
+ } catch (e) {
console.error(e);
- notify('Failed to update Cashier status to '+status, 'error');
+ notify('Failed to update Cashier status to ' + status, 'error');
return false;
}
}
@@ -13492,13 +13607,13 @@
const request_tokens_btn = document.getElementById('request_tokens_btn');
request_tokens_btn.onclick = async function () {
if (typeof myFloID !== "string" || myFloID.length < 1) return;
- if(typeof liveCashier.floId !== "string" || liveCashier.floId.length < 1) {
+ if (typeof liveCashier.floId !== "string" || liveCashier.floId.length < 1) {
notify('No cashier is live currently. Please try later.', 'error');
return false;
}
btnLoading('request_tokens_btn', 'start');
const token_amount_to_buy = document.getElementById('token_amount_to_buy');
-
+
let upi_txid = depositedRupeeTxId.value
let request_object = {
user_flo_id: myFloID,
@@ -13538,7 +13653,7 @@
notify('Add an UPI address to withdraw money.', 'error')
return
}
- if(typeof liveCashier.floId !== "string" || liveCashier.floId.length < 1) {
+ if (typeof liveCashier.floId !== "string" || liveCashier.floId.length < 1) {
notify('No cashier is live currently. Please try later.', 'error');
return false;
}
@@ -13604,19 +13719,19 @@
function pay_through_cashier() {
try {
const cnf_cash_payment_btn = document.getElementById('cnf_cash_payment')
-
+
cnf_cash_payment_btn.onclick = async function () {
let selectedUPI = payCashierPopup.querySelector('input[type="radio"]:checked');
if (!selectedUPI) {
notify('Add an UPI address to pay through cashier.', 'error')
return
}
- if(typeof liveCashier.floId !=="string" || liveCashier.floId.length < 1) {
+ if (typeof liveCashier.floId !== "string" || liveCashier.floId.length < 1) {
notify('No cashier is live currently. Please try later.', 'error');
return false;
}
btnLoading('withdraw_cash_btn', 'start')
-
+
const paying_amount_div = document.getElementById('recvr_amount_to_pay')
const recvr_id = document.getElementById('recvr_id').value;
let amount_to_pay = parseInt(paying_amount_div.value);
@@ -13652,16 +13767,16 @@
}
}
- function showActivities(showRefresh = false){
- if(activityLoaded && !showRefresh) return
- if(!activityLoaded || showRefresh){
+ function showActivities(showRefresh = false) {
+ if (activityLoaded && !showRefresh) return
+ if (!activityLoaded || showRefresh) {
depositActivityContainer.innerHTML = ''
withdrawActivityContainer.innerHTML = ''
payCashierActivityContainer.innerHTML = ''
sentActivityContainer.innerHTML = ''
receivedActivityContainer.innerHTML = ''
-
- for(let i = 0; i < 8; i++){
+
+ for (let i = 0; i < 8; i++) {
frag.append(render.activityPlaceholder())
}
let frag1 = frag.cloneNode(true),
@@ -13676,25 +13791,25 @@
}
getSentRupeeList()
getReceivedRupeeList()
- if(!token_app.master_configurations.cashiers[myFloID]){
+ if (!token_app.master_configurations.cashiers[myFloID]) {
showAllUserActivities()
}
activityLoaded = true
}
- const sentActivityContainer = document.getElementById('sent_activity_container'),
- receivedActivityContainer = document.getElementById('received_activity_container'),
- depositActivityContainer = document.getElementById('deposit_activity_container'),
- withdrawActivityContainer = document.getElementById('withdraw_activity_container'),
- payCashierActivityContainer = document.getElementById('pay_cashier_activity_container'),
- cashierMessageContainer = document.getElementById('cashier_message_container')
+ const sentActivityContainer = document.getElementById('sent_activity_container'),
+ receivedActivityContainer = document.getElementById('received_activity_container'),
+ depositActivityContainer = document.getElementById('deposit_activity_container'),
+ withdrawActivityContainer = document.getElementById('withdraw_activity_container'),
+ payCashierActivityContainer = document.getElementById('pay_cashier_activity_container'),
+ cashierMessageContainer = document.getElementById('cashier_message_container')
async function showAllUserActivities() {
try {
await token_app.actions.retrieveLatestContent();
let deposit_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "0"));
- const withdraw_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_WITHDRAWS,"0").reverse());
+ const withdraw_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, "0").reverse());
const user_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_MSGES, "0").reverse());
const pay_thru_cashier_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_PAY_THROUGH_CASHIER, "0").reverse());
@@ -13792,10 +13907,10 @@
}
}
- async function getReceiver(vout){
- for(v of vout){
- for(addr of v.scriptPubKey.addresses){
- if(addr !== myFloID)
+ async function getReceiver(vout) {
+ for (v of vout) {
+ for (addr of v.scriptPubKey.addresses) {
+ if (addr !== myFloID)
return addr
}
}
@@ -13804,24 +13919,24 @@
async function getSentRupeeList() {
try {
ajaxGet(`https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?token=rupee&senderFloAddress=${myFloID}`)
- .then(async data => {
- let transactions = data.transactions
- console.log(transactions, data)
- let sortedTransactions = Object.values(transactions).sort((a, b) => b.transactionDetails.time - a.transactionDetails.time)
- for (transaction of sortedTransactions) {
- let { tokenAmount, flodata } = transaction.parsedFloData,
- {time, txid, vout} = transaction.transactionDetails,
- receiver = flodata.match(/\b\w{34,34}\b/) ? flodata.match(/\b\w{34,34}\b/) : await getReceiver(vout),
- timeStamp = time * 1000,
- confirmations = await ajaxGet(`https://flosight.duckdns.org/api/tx/${txid}`),
- processed = confirmations.confirmations > 3 ? true : false
-
- if (receiver === '' || typeof receiver === 'undefined' || receiver === null) continue;
- frag.append(render.activityCard({ type: 'sent', amount: tokenAmount, tokenTxId: txid, receiver, timeStamp, processed, toCashier: token_app.master_configurations.cashiers[receiver] }))
- }
- sentActivityContainer.innerHTML = ''
- sentActivityContainer.append(frag)
- })
+ .then(async data => {
+ let transactions = data.transactions
+ console.log(transactions, data)
+ let sortedTransactions = Object.values(transactions).sort((a, b) => b.transactionDetails.time - a.transactionDetails.time)
+ for (transaction of sortedTransactions) {
+ let { tokenAmount, flodata } = transaction.parsedFloData,
+ { time, txid, vout } = transaction.transactionDetails,
+ receiver = flodata.match(/\b\w{34,34}\b/) ? flodata.match(/\b\w{34,34}\b/) : await getReceiver(vout),
+ timeStamp = time * 1000,
+ confirmations = await ajaxGet(`https://flosight.duckdns.org/api/tx/${txid}`),
+ processed = confirmations.confirmations > 3 ? true : false
+
+ if (receiver === '' || typeof receiver === 'undefined' || receiver === null) continue;
+ frag.append(render.activityCard({ type: 'sent', amount: tokenAmount, tokenTxId: txid, receiver, timeStamp, processed, toCashier: token_app.master_configurations.cashiers[receiver] }))
+ }
+ sentActivityContainer.innerHTML = ''
+ sentActivityContainer.append(frag)
+ })
} catch (error) {
throw new Error(error);
}
@@ -13835,7 +13950,7 @@
for (transaction of sortedTransactions) {
let { tokenAmount, flodata } = transaction.parsedFloData,
- {time, txid, vin} = transaction.transactionDetails,
+ { time, txid, vin } = transaction.transactionDetails,
sender = vin[0].addr,
timeStamp = time * 1000
@@ -14004,26 +14119,26 @@
return false;
}
}
-
- const pendingPaymentRequestContainer = document.getElementById("pending_payment_request_container"),
- paidPaymentRequestContainer = document.getElementById("paid_payment_request_container"),
- declinedPaymentRequestContainer = document.getElementById("declined_payment_request_container")
+
+ const pendingPaymentRequestContainer = document.getElementById("pending_payment_request_container"),
+ paidPaymentRequestContainer = document.getElementById("paid_payment_request_container"),
+ declinedPaymentRequestContainer = document.getElementById("declined_payment_request_container")
let paymentRequestAnimated = false;
async function show_payment_requests(requests_received = true, recvr_id = '') {
try {
- if(!paymentRequestAnimated){
+ if (!paymentRequestAnimated) {
pendingPaymentRequestContainer.innerHTML = ``;
paidPaymentRequestContainer.innerHTML = ``;
declinedPaymentRequestContainer.innerHTML = ``;
-
- for(let i= 0; i < 6; i++){
+
+ for (let i = 0; i < 6; i++) {
frag.append(render.paymentRequestPlaceholder())
}
let frag1 = frag.cloneNode(true)
let frag2 = frag.cloneNode(true)
-
+
pendingPaymentRequestContainer.append(frag)
paidPaymentRequestContainer.append(frag1)
declinedPaymentRequestContainer.append(frag2)
@@ -14176,9 +14291,9 @@
// Filter out non-cashiers, if any
const cashiers_status = floGlobals.appObjects[token_app.master_configurations.TYPE_CASHIER_LIVE_STATUS];
const valid_cashiers = Object.keys(cashiers_status)
- .filter(f=>Object.keys(token_app.master_configurations.cashiers).includes(f) && cashiers_status[f]===true);
+ .filter(f => Object.keys(token_app.master_configurations.cashiers).includes(f) && cashiers_status[f] === true);
return valid_cashiers;
- } catch(e) {
+ } catch (e) {
console.error(e);
notify('Failed to get cashier status', 'error');
return null;