Skip to content

Commit

Permalink
improve manual payment check
Browse files Browse the repository at this point in the history
  • Loading branch information
F-Node-Karlsruhe committed Jun 29, 2021
1 parent 5bfee75 commit 00f340d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ iota/
.DS_store
.env
db/*
__pycache__/
__pycache__/
env/
4 changes: 4 additions & 0 deletions iota.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ def manual_payment_check(self, address, user_token_hash):

self.unlock_content(user_token_hash, exp_time)

self.manual_payment_checks.remove(user_token_hash)

return

# prevent key errors
if user_token_hash in self.socket_session_ids.keys():

Expand Down
19 changes: 11 additions & 8 deletions templates/pay.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
});
socket.on('payment_not_found', function() {
console.log('Payment not found');
document.getElementById("loader_text").innerHTML = 'Waiting for payment ...'
});
$('#check_payment_button').on('click', function(){
socket.emit('check_payment', {user_token_hash: '{{ user_token_hash }}', iota_address: '{{ iota_address }}'});
document.getElementById("loader_text").innerHTML = 'Searching for payment ...'
});
// show manual payment check after 30 seconds time
setTimeout("showCheckPayment()", 30000);
// show manual payment check after 30 seconds
setTimeout("enableCheckPayment()", 30000);
});
function showCheckPayment() {
document.getElementById("check_payment").style.display = "inline";
function enableCheckPayment() {
document.getElementById("check_payment").style.display = 'inline';
}
</script>
<style>
Expand Down Expand Up @@ -84,7 +86,11 @@ <h5>Access until</h5>
<br>
<div>
<div class="loader"></div>
<p style="font-size: small;">Waiting for payment ...</p>
<p id="loader_text" style="font-size: small;">Waiting for payment ...</p>
<p id="check_payment" style="font-size: x-small; display:none;">
Already paid?
<button style="border-radius: 5px;" id="check_payment_button">Manual payment check</button>
</p>
<h5>
<a style="color: white;
text-decoration: none;
Expand All @@ -94,8 +100,5 @@ <h5>
Firefly wallet
</a>
</h5>
<div id="check_payment" style="display:none">
<button id="check_payment_button">Check for payment</button>
</div>
</div>
</div>

0 comments on commit 00f340d

Please sign in to comment.