Revising virtual terminal

This commit is contained in:
2024-08-11 12:30:57 +02:00
parent 5ad4464b28
commit a564ecb342
5 changed files with 79 additions and 11 deletions

View File

@ -6,7 +6,7 @@ Virtual Terminal
<h2 class="mt-3 text-center">Virtual Terminal</h2>
<hr>
<div class="alert alert-danger text-center d-none" id="card-messages"></div>
<form action="/payment-succeeded"
<form action="/virtual-terminal-payment-succeeded"
method="post"
name="charge_form"
id="charge_form"
@ -52,7 +52,7 @@ Virtual Terminal
<a href="javascript:void(0)"
id="pay-button"
class="btn btn-primary"
onclick="termVal()">Charge Card</a>
onclick="val({{.API}})">Charge Card</a>
<div class="text-center d-none" id="processing-payment">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
@ -81,14 +81,20 @@ Virtual Terminal
<script src="/static/js/stripe.js"></script>
<script>
stripeInit('{{.StripePubKey}}');
function termVal() {
const chargeAmount = document.getElementById("charge_amount");
if (chargeAmount.value !== "") {
document.getElementById("amount").value = chargeAmount.value * 100;
document.getElementById("charge_amount").addEventListener("change", (evt) => {
if (evt.target.value !== "") {
document.getElementById("amount").value = parseInt((evt.target.value * 100), 10);
} else {
document.getElementById("amount").value = 0;
}
val({{.API}});
}
});
// function termVal() {
// const chargeAmount = document.getElementById("charge_amount");
// if (chargeAmount.value !== "") {
// document.getElementById("amount").value = parseInt((chargeAmount.value * 100), 10);
// } else {
// document.getElementById("amount").value = 0;
// }
// }
</script>
{{ end }}

View File

@ -0,0 +1,18 @@
{{ template "base" . }}
{{ define "title" }}
Payment Succedded!
{{ end }}
{{ define "content" }}
{{$txn := index .Data "txn"}}
<h2 class="mt-5">Virtual Terminal Payment Succeeded</h2>
<hr>
<p>Payment Intent: {{$txn.PaymentIntentID}}</p>
<p>Email: {{ $txn.Email }}</p>
<p>Payment Method: {{ $txn.PaymentMethodID }}</p>
<p>Payment Amount: {{ $txn.PaymentAmount }}</p>
<p>Currency: {{ $txn.PaymentCurrency }}</p>
<p>Last Four: {{ $txn.LastFour }}</p>
<p>Bank Return Code: {{ $txn.BankReturnCode }}</p>
<p>Expiry Date: {{ $txn.ExpiryMonth }}/{{$txn.ExpiryYear}}</p>
{{ end }}