This commit is contained in:
sairaj mote 2020-10-05 03:03:12 +05:30
parent ab0e89e568
commit 90af3b0404
4 changed files with 400 additions and 224 deletions

View File

@ -452,7 +452,7 @@ sm-popup h5:not(.tag) {
.my-qr-code {
background: #fff;
border-radius: 1rem;
border-radius: 0.5rem;
padding: 1rem;
max-width: max-content;
}
@ -652,6 +652,12 @@ details p {
clip-path: circle(0 at 100% 0) !important;
}
#deposit {
padding-top: 1.5rem;
}
#deposit .flex sm-button {
margin-bottom: 1.5rem;
}
#deposit .user-panel {
padding: 0 1rem;
}
@ -855,27 +861,21 @@ sm-panel {
}
.request {
display: inline-flex;
flex-direction: column;
display: grid;
gap: 1rem;
padding: 1.5em;
border-radius: 0.4em;
border: solid 1px rgba(var(--text-color), 0.2);
border-radius: 0.6rem;
background: rgba(var(--text-color), 0.06);
}
.request h4 {
font-weight: 500;
font-weight: 400;
font-size: 0.9rem;
}
.request h5 {
margin-bottom: 0.2rem;
text-transform: capitalize;
font-weight: 500;
font-weight: 400;
opacity: 0.8;
}
.request h3,
.request h4 {
margin-bottom: 1rem;
}
.request h4:last-of-type {
margin-bottom: 0;
margin-bottom: 0.2rem;
}
.request .action {
align-self: flex-end;
@ -885,26 +885,46 @@ sm-panel {
}
.request button {
width: auto;
align-self: flex-end;
margin-top: 1.5rem;
margin-bottom: 0;
}
.request .copy-row {
margin-bottom: 1.5rem;
}
.request .flex {
align-items: center;
justify-content: flex-end;
margin-top: auto;
padding-top: 1.5rem;
justify-self: flex-end;
}
.request .flex h5 {
margin: 0;
}
.request .flex button {
margin: 0;
}
.request.placeholder {
animation: pulse infinite 0.6s alternate;
}
.request.placeholder h4, .request.placeholder h5 {
padding: 0.5rem 0;
background: rgba(var(--text-color), 0.06);
}
.request.placeholder .btns {
display: grid;
gap: 0.5rem;
grid-auto-flow: column;
justify-content: flex-end;
}
.request.placeholder .btns h4 {
width: 6rem;
}
.request.placeholder h5 {
width: 50%;
}
.request.placeholder .time {
width: 3rem;
}
.request.placeholder:nth-of-type(2) {
animation-delay: 0.1s;
}
.request.placeholder:nth-of-type(3) {
animation-delay: 0.2s;
}
.request.placeholder:nth-of-type(4) {
animation-delay: 0.3s;
}
.deposited {
color: #007732;
@ -922,7 +942,6 @@ sm-panel {
display: grid;
gap: 1em;
width: 100%;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.page {
@ -981,7 +1000,6 @@ sm-panel {
}
.time {
margin-bottom: 1.5rem !important;
font-weight: 500;
}
@ -1583,13 +1601,6 @@ sm-panel {
video {
height: 100vw;
}
#settings_page > h4:first-of-type {
text-align: center;
}
#settings_page .my-qr-code {
margin: 0 auto 3rem auto;
}
}
@media only screen and (min-width: 640px) {
.hide-on-desktop {
@ -1679,6 +1690,28 @@ sm-panel {
height: 9rem;
}
.request {
grid-template-columns: minmax(0, auto) auto;
grid-template-areas: "time time" " . ." " . .";
}
.request .time {
grid-area: time;
margin-bottom: 0 !important;
}
.request button {
width: max-content;
margin-left: auto;
}
.request .breakable {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#deposit .user-panel {
padding-right: 0;
}
#settings_page .copy-row {
display: inline-grid;
}
@ -1731,18 +1764,32 @@ sm-panel {
grid-template-columns: minmax(0, 1fr) 22rem;
}
#deposit {
grid-template-columns: minmax(0, 1fr) 18rem;
}
#deposit .user-panel {
padding-right: 0;
}
.activity {
width: 60ch;
}
}
@media only screen and (min-width: 1920px) {
body {
font-size: 24px;
.request {
grid-template-columns: minmax(0, auto) auto;
grid-template-areas: "time time" " . ." " . .";
}
}
@media only screen and (min-width: 2048px) {
body {
font-size: 24px;
@media only screen and (min-width: 1280px) {
.request {
grid-template-areas: "time time time" ". . .";
}
#deposit {
grid-template-columns: minmax(0, 1fr) 20rem;
}
#deposit .request {
grid-template-areas: "time time time time" ". . . .";
}
}
@media only screen and (max-width: 320px) {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -467,7 +467,7 @@ sm-popup{
}
.my-qr-code{
background: #fff;
border-radius: 1rem;
border-radius: 0.5rem;
padding: 1rem;
max-width: max-content;
}
@ -672,6 +672,12 @@ details{
}
}
#deposit{
padding-top: 1.5rem;
.flex{
sm-button{
margin-bottom: 1.5rem;
}
}
.user-panel{
padding: 0 1rem;
}
@ -872,64 +878,69 @@ sm-panel{
}
.request {
display: inline-flex;
flex-direction: column;
display: grid;
gap: 1rem;
padding: 1.5em;
border-radius: 0.4em;
border: solid 1px rgba(var(--text-color), 0.2);
border-radius: 0.6rem;
background: rgba(var(--text-color), 0.06);
h4{
font-weight: 500;
font-weight: 400;
font-size: 0.9rem;
}
h5 {
margin-bottom: 0.2rem;
text-transform: capitalize;
font-weight: 500;
font-weight: 400;
opacity: 0.8;
margin-bottom: 0.2rem;
}
h3,
h4 {
margin-bottom: 1rem;
}
h4:last-of-type {
margin-bottom: 0;
}
.action {
align-self: flex-end;
}
.amount {
font-family: 'Roboto', sans-serif;
}
button {
width: auto;
align-self: flex-end;
margin-top: 1.5rem;
margin-bottom: 0;
}
.copy-row {
margin-bottom: 1.5rem;
}
.flex {
align-items: center;
justify-content: flex-end;
margin-top: auto;
padding-top: 1.5rem;
justify-self: flex-end;
h5 {
margin: 0;
}
button {
margin: 0;
}
}
&.placeholder{
h4, h5{
padding: 0.5rem 0;
background: rgba(var(--text-color), 0.06);
}
.btns{
display: grid;
gap: 0.5rem;
grid-auto-flow: column;
justify-content: flex-end;
h4{
width: 6rem;
}
}
h5{
width: 50%;
}
.time{
width: 3rem;
}
animation: pulse infinite 0.6s alternate;
&:nth-of-type(2){
animation-delay: 0.1s;
}
&:nth-of-type(3){
animation-delay: 0.2s;
}
&:nth-of-type(4){
animation-delay: 0.3s;
}
}
}
.deposited {
@ -948,7 +959,6 @@ sm-panel{
display: grid;
gap: 1em;
width: 100%;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.page {
@ -1013,7 +1023,6 @@ sm-panel{
}
.time {
margin-bottom: 1.5rem !important;
font-weight: 500;
}
@ -1632,14 +1641,6 @@ sm-panel{
video{
height: 100vw;
}
#settings_page{
& > h4:first-of-type{
text-align: center;
}
.my-qr-code{
margin: 0 auto 3rem auto;
}
}
}
@media only screen and (min-width: 640px) {
@ -1725,6 +1726,28 @@ sm-panel{
height: 9rem;
}
}
.request{
grid-template-columns: minmax(0, auto) auto;
grid-template-areas: 'time time' ' . .' ' . .';
.time{
grid-area: time;
margin-bottom: 0 !important;
}
button{
width: max-content;
margin-left: auto;
}
.breakable{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
#deposit{
.user-panel{
padding-right: 0;
}
}
#settings_page{
.copy-row{
display: inline-grid;
@ -1784,20 +1807,30 @@ sm-panel{
gap: 1.5rem;
grid-template-columns: minmax(0, 1fr) 22rem;
}
#deposit{
grid-template-columns: minmax(0, 1fr) 18rem;
.user-panel{
padding-right: 0;
}
}
.activity{
width: 60ch;
}
}
@media only screen and (min-width: 1920px) {
body {
font-size: 24px;
.request{
grid-template-columns: minmax(0, auto) auto;
grid-template-areas: 'time time' ' . .' ' . .';
}
}
@media only screen and (min-width: 2048px) {
body {
font-size: 24px;
@media only screen and (min-width: 1280px) {
.request{
grid-template-areas: 'time time time' '. . .';
}
#deposit{
grid-template-columns: minmax(0, 1fr) 20rem;
.request{
grid-template-areas: 'time time time time' '. . . .';
}
}
}

View File

@ -671,17 +671,17 @@
</section>
<section id="deposit" class="page hide-completely">
<div class="left">
<h3>Transaction Requests</h3>
<h3>Requests</h3>
<sm-tab-header variant="tab" class="round" target="requests_to_cashier">
<sm-tab>Deposits</sm-tab>
<sm-tab>Withdrawals</sm-tab>
<sm-tab>Pay Through Cashier</sm-tab>
</sm-tab-header>
<sm-tab-panels id="requests_to_cashier">
<sm-panel>
<sm-button id="fetch_deposits" onclick="show_deposit_request()" class="bottom-margin">
Load pending
</sm-button>
<sm-panel>
<div class="flex">
<sm-button class="justify-right" onclick="showDepositRequests()">Load pending</sm-button>
</div>
<div id="pending_deposits_container" class="container"></div>
<div id="deposit_illustration" class="empty-state">
<svg viewBox="0 0 529.94 446.5">
@ -738,8 +738,9 @@
</div>
</sm-panel>
<sm-panel>
<sm-button id="fetch_withdraws" onclick="show_withdraw_request()" class="bottom-margin">Load
pending</sm-button>
<div class="flex">
<sm-button class="justify-right" onclick="showWithdrawRequests()">Load pending</sm-button>
</div>
<div id="pending_withdrawals_container" class="container"></div>
<div id="withdraw_illustration" class="empty-state">
<svg viewBox="0 0 529.94 446.5">
@ -796,9 +797,9 @@
</div>
</sm-panel>
<sm-panel>
<sm-button id="fetch_pay_requests" onclick="showPayThruCashierRequests()" class="bottom-margin">
Load pending
</sm-button>
<div class="flex">
<sm-button class="justify-right" onclick="showPayThruCashierRequests()">Load pending</sm-button>
</div>
<div id="pay_requests_container" class="container"></div>
<div id="pay_illustration" class="empty-state">
<svg viewBox="0 0 529.94 446.5">
@ -968,8 +969,6 @@
</section>
<section id="settings_page" class="page hide-completely">
<h3 class="bottom-margin">Settings<h3>
<h4>My QR Code</h4>
<div class="my-qr-code"></div>
<section>
<h4>My FLO address</h4>
<div class="copy-row">
@ -1064,25 +1063,33 @@
notificationSound = document.getElementById('notification_sound');
let defaultUPI
const render = {
depositRequest(txid, floId, amount) {
depositRequest(txid, floId, amount, vectorClock) {
let card = document.createElement('div');
card.classList.add('request')
setAttributes(card, {
'data-user-flo-id': floId,
'data-txid': txid
})
card.innerHTML = ` <h5>FLO address</h5>
<h4 class="breakable">${floId}</h4>
<h5>UPI TXID</h5>
<h4 class="breakable">${txid}</h4>
<h5>Amount</h5>
<h4 class="breakable">₹${amount}</h4>
<button id="" class="confirm-deposit-btn">
Confirm
</button>`;
card.innerHTML = `
<div>
<h5>FLO address</h5>
<h4 class="breakable">${floId}</h4>
</div>
<div>
<h5>UPI TXID</h5>
<h4 class="breakable">${txid}</h4>
</div>
<div>
<h5>Amount</h5>
<h4 class="breakable amount">₹${amount}</h4>
</div>
<h5 class="time">${formatedTime(vectorClock, true)}</h5>
<button id="" class="confirm-deposit-btn">
Confirm
</button>`;
return card;
},
withdrawRequest(txid, upiId, floId, amount) {
withdrawRequest(txid, upiId, floId, amount, vectorClock) {
let card = document.createElement('div');
card.classList.add('request')
setAttributes(card, {
@ -1090,18 +1097,26 @@
'data-user-flo-id': floId,
'data-upi': upiId
})
card.innerHTML = ` <h5>FLO address</h5>
<h4 class="breakable">${floId}</h4>
<h5>UPI ID</h5>
<h4 class="breakable">${upiId}</h4>
<h5>TAmount</h5>
<h4 class="breakable">₹${amount}</h4>
<button id="" class="confirm-withdraw-btn"">
Confirm
</button>`;
card.innerHTML = `
<div>
<h5>FLO address</h5>
<h4 class="breakable">${floId}</h4>
</div>
<div>
<h5>UPI ID</h5>
<h4 class="breakable">${upiId}</h4>
</div>
<div>
<h5>Amount</h5>
<h4 class="breakable amount">₹${amount}</h4>
</div>
<h5 class="time">${formatedTime(vectorClock, true)}</h5>
<button id="" class="confirm-withdraw-btn"">
Confirm
</button>`;
return card;
},
payRequest(sender, txid, floId, amount) {
payRequest(sender, txid, floId, amount, vectorClock) {
let card = document.createElement('div');
card.classList.add('request')
setAttributes(card, {
@ -1110,15 +1125,43 @@
'data-txid': txid,
'data-amount': amount
})
card.innerHTML = ` <h5>Transaction ID</h5>
<h4 class="breakable">${txid}</h4>
<h5>Receiver's FLO address</h5>
<h4 class="breakable">${floId}</h4>
<h5>Amount</h5>
<h4 class="breakable">₹${amount}</h4>
<button id="" class="confirm-pay-btn">
Transfer
</button>`;
card.innerHTML = `
<div>
<h5>Receiver's FLO address</h5>
<h4 class="breakable">${floId}</h4>
</div>
<div>
<h5>Transaction ID</h5>
<h4 class="breakable">${txid}</h4>
</div>
<div>
<h5>Amount</h5>
<h4 class="breakable amount">₹${amount}</h4>
</div>
<h5 class="time">${formatedTime(vectorClock, true)}</h5>
<button id="" class="confirm-pay-btn">
Transfer
</button>`;
return card;
},
requestPlaceholder(){
let card = document.createElement('div');
card.classList.add('request', 'placeholder')
card.innerHTML = `
<div>
<h5></h5>
<h4></h4>
</div>
<div>
<h5></h5>
<h4></h4>
</div>
<div>
<h5></h5>
<h4></h4>
</div>
<h5 class="time"></h5>
<h4></h4>`
return card;
},
activityCard(obj) {
@ -1260,12 +1303,17 @@
'data-amount': amount,
'data-payment-request-id': id
})
markup = ` <h5 class="time">${formatedTime(time)}</h5>
<h5>Request by</h5>
<h4 class="breakable">${allContacts[senderAddress] ? allContacts[senderAddress].name : senderAddress}</h4>
<h5 class="label">amount</h5>
<h4 class="amount">₹ ${amount}</h4>
`;
markup = `
<h5 class="time">${formatedTime(time)}</h5>
<div>
<h5>Request by</h5>
<h4 class="breakable">${allContacts[senderAddress] ? allContacts[senderAddress].name : senderAddress}</h4>
</div>
<div>
<h5 class="label">amount</h5>
<h4 class="amount">₹ ${amount}</h4>
</div>
`;
if (enableActions)
markup += `
<div class="flex">
@ -1279,6 +1327,25 @@
card.innerHTML = markup
return card;
},
paymentRequestPlaceholder(){
let card = document.createElement('div');
card.classList.add('request', 'placeholder')
card.innerHTML = `
<h5 class="time"></h5>
<div>
<h5></h5>
<h4></h4>
</div>
<div>
<h5></h5>
<h4></h4>
</div>
<div class="btns">
<h4></h4>
<h4></h4>
</div>`
return card;
},
cashierMessage(message) {
let card = document.createElement('div')
card.classList.add('cashier-message')
@ -2034,7 +2101,7 @@
let currentRequest = null;
document.getElementById('activity_page').addEventListener('click', (e) => {
if (e.target.closest('.activity')) {
if (e.target.closest('.activity:not(.placeholder)')) {
currentRequest = e.target.closest('.activity')
showTransactionDetails({
type: currentRequest.dataset.type,
@ -11961,6 +12028,9 @@
},
"FQ6udJuTbGDa2kWZAkmNpwgHaUEeYLPAtt": {
"upi_id": "krishraj1012-2@okicici"
},
"FPFeL5PXzW9bGosUjQYCxTHSMHidnygvvd": {
"upi_id": "7744023898@paytm"
}
}`
text = removeWhiteSpaces(text);
@ -12060,8 +12130,8 @@
allHelplineOptions.forEach(option => {
option.classList.add('hide-completely')
})
show_deposit_request()
show_withdraw_request()
showDepositRequests()
showWithdrawRequests()
showPayThruCashierRequests()
userType.forEach(user => user.textContent = 'Cashier')
showPage('deposit', 'deposit_page_btn')
@ -12272,7 +12342,6 @@
<!-- Cashier functions -->
<script>
async function reset_cloud_object(object_name, options) {
try {
if (typeof floGlobals.appObjects[object_name] !== 'object'
@ -12306,7 +12375,11 @@
return Promise.all(promises);
}
async function show_deposit_request() {
const depositsContainer = document.getElementById("pending_deposits_container"),
withdrawsContainer = document.getElementById("pending_withdrawals_container"),
payRequestsContainer = document.getElementById("pay_requests_container");
async function showDepositRequests() {
try {
if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
@ -12314,28 +12387,33 @@
receiverID: myFloID,
senderIDs: [myFloID]
});*/
depositsContainer.innerHTML = ``
for(let i= 0; i < 4; i++){
frag.append(render.requestPlaceholder())
}
depositsContainer.append(frag)
let finished_tasks = await floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_DEPOSITS,
receiverID: myFloID,
senderIDs: [myFloID]
});
let [finished_tasks] = await Promise.all([
floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_DEPOSITS,
receiverID: myFloID,
senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS, {
receiverID: myFloID
})
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
const processed_deposits = Object.values(finished_tasks).map(m => m.message.user_upi_txid);
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS, {
receiverID: myFloID
});
let cash_deposits = await compactIDB.readAllData('deposits_flo_txids');
let cash_deposits_upi_txid_list = Object.values(cash_deposits).map(m => m.user_upi_txid);
const general_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "0"));
const general_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "0").reverse());
let depositsContainer = document.getElementById("pending_deposits_container");
depositsContainer.innerHTML = ``;
for (const m of general_msg) {
if (cash_deposits_upi_txid_list.includes(m.message.upi_txid)) continue;
@ -12346,7 +12424,7 @@
upi_txid,
deposit_amount
} = m.message;
frag.append(render.depositRequest(upi_txid, user_flo_id, deposit_amount))
frag.append(render.depositRequest(upi_txid, user_flo_id, deposit_amount, m.vectorClock))
}
depositsContainer.append(frag)
@ -12356,26 +12434,33 @@
}
}
async function show_withdraw_request() {
async function showWithdrawRequests() {
try {
withdrawsContainer.innerHTML = ``
for(let i= 0; i < 4; i++){
frag.append(render.requestPlaceholder())
}
withdrawsContainer.append(frag)
if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
let finished_tasks = await floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS,
receiverID: myFloID,
senderIDs: [myFloID]
});
let [finished_tasks] = await Promise.all([
floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS,
receiverID: myFloID,
senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, {
receiverID: myFloID
})
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
const processed_withdraws = Object.values(finished_tasks).map(m => m.message.token_txid)
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, {
receiverID: myFloID
});
const general_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_WITHDRAWS,
"0"));
"0").reverse());
if (typeof general_msg !== "object") {
notify(`No data available in withdraws.`);
@ -12385,7 +12470,6 @@
let cash_withdraws = await compactIDB.readAllData('cash_sent_details');
let cash_withdraws_token_txid_list = Object.values(cash_withdraws).map(m => m.token_txid);
let withdrawsContainer = document.getElementById("pending_withdrawals_container");
withdrawsContainer.innerHTML = ``;
for (const m of general_msg) {
if (cash_withdraws_token_txid_list.includes(m.message.token_txid)) continue;
@ -12397,7 +12481,7 @@
withdrawer_upi,
withdraw_amount
} = m.message
frag.append(render.withdrawRequest(token_txid, withdrawer_upi, user_flo_id, withdraw_amount))
frag.append(render.withdrawRequest(token_txid, withdrawer_upi, user_flo_id, withdraw_amount, m.vectorClock))
}
withdrawsContainer.append(frag)
@ -12407,6 +12491,54 @@
}
}
async function showPayThruCashierRequests() {
try {
payRequestsContainer.innerHTML = ``
for(let i= 0; i < 4; i++){
frag.append(render.requestPlaceholder())
}
payRequestsContainer.append(frag)
//if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
let [finished_tasks] = await Promise.all([
floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER,
receiverID: myFloID,
senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, {
receiverID: myFloID
})
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
const processed_cashier_payments = Object.values(finished_tasks).map(m => m.message.upi_txid)
.filter(f => f !== undefined);
const user_requests = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_PAY_THROUGH_CASHIER, "0").reverse());
let pay_thru_cashier = await compactIDB.readAllData('pay_thru_cashier');
let pay_thru_cashier_list = Object.values(pay_thru_cashier).map(m => m.upi_txid);
payRequestsContainer.innerHTML = ``;
for (const m of user_requests) {
if (processed_cashier_payments.includes(m.message.upi_txid)) continue;
if (pay_thru_cashier_list.includes(m.message.upi_txid)) continue;
let {
upi_txid,
receiver_flo_id,
amount
} = m.message;
frag.append(render.payRequest(m.sender, upi_txid, receiver_flo_id, amount, m.vectorClock))
}
payRequestsContainer.append(frag)
} catch (error) {
throw new Error(error)
}
}
async function transfer_token(receiver_flo_id = '', user_upi_txid = '') {
try {
if (user_upi_txid.length < 1 || receiver_flo_id.length < 1) {
@ -12657,53 +12789,6 @@
}
}
async function showPayThruCashierRequests() {
try {
//if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
let finished_tasks = await floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER,
receiverID: myFloID,
senderIDs: [myFloID]
});
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
console.log(finished_tasks);
const processed_cashier_payments = Object.values(finished_tasks).map(m => m.message.upi_txid)
.filter(f => f !== undefined);
console.log(processed_cashier_payments);
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, {
receiverID: myFloID
});
const user_requests = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_PAY_THROUGH_CASHIER, "0"));
let pay_thru_cashier = await compactIDB.readAllData('pay_thru_cashier');
let pay_thru_cashier_list = Object.values(pay_thru_cashier).map(m => m.upi_txid);
let payRequestsContainer = document.getElementById("pay_requests_container");
payRequestsContainer.innerHTML = ``;
for (const m of user_requests) {
if (processed_cashier_payments.includes(m.message.upi_txid)) continue;
if (pay_thru_cashier_list.includes(m.message.upi_txid)) continue;
let {
upi_txid,
receiver_flo_id,
amount
} = m.message;
frag.append(render.payRequest(m.sender, upi_txid, receiver_flo_id, amount))
}
payRequestsContainer.append(frag)
} catch (error) {
throw new Error(error)
}
}
async function pay_as_cashier(sender_flo_id = '', vendor_flo_id = '', upi_txid = '', usr_amount_to_pay = 0) {
try {
if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
@ -13112,8 +13197,6 @@
let withdraw_request_processed = false;
if (processed_withdraws_token_txid.includes(usr_withdraws.message.token_txid))
withdraw_request_processed = true;
// SaiRajM: status for withdraw
console.log(usr_withdraws.message.token_txid, withdraw_request_processed);
let {
token_txid,
@ -13333,6 +13416,20 @@
async function show_payment_requests(requests_received = true, recvr_id = '') {
try {
pendingPaymentRequestContainer.innerHTML = ``;
paidPaymentRequestContainer.innerHTML = ``;
declinedPaymentRequestContainer.innerHTML = ``;
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)
let options = { receiverID: myFloID };
if (requests_received !== true) {
options = { receiverID: recvr_id, senderIDs: [myFloID] }
@ -13485,7 +13582,6 @@
let { tokenAmount, flodata } = transaction.parsedFloData,
receiver = flodata.match(/\b\w{34,34}\b/),
timeStamp = transaction.transactionDetails.time * 1000
if (receiver === '' || typeof receiver === 'undefined' || receiver === null || token_app.master_configurations.cashiers[receiver]) continue;
frag.append(render.activityCard({ type: 'sent', amount: tokenAmount, receiver, timeStamp }))
}