From 2f7300db0f426b85b80b4138b08863997c5637f5 Mon Sep 17 00:00:00 2001 From: vinchent Date: Tue, 20 Aug 2024 14:13:35 +0200 Subject: [PATCH] Changing the vt to use fetch --- cmd/api/handlers-api.go | 2 + cmd/api/routes-api.go | 2 +- cmd/web/templates/terminal.page.gohtml | 18 ++++- static/js/terminal.js | 105 +++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 static/js/terminal.js diff --git a/cmd/api/handlers-api.go b/cmd/api/handlers-api.go index 52ffa09..922500a 100644 --- a/cmd/api/handlers-api.go +++ b/cmd/api/handlers-api.go @@ -393,6 +393,8 @@ func (app *application) VirtualTerminalPaymentSucceeded(w http.ResponseWriter, r ExpiryMonth: txnData.ExpiryMonth, ExpiryYear: txnData.ExpiryYear, BankReturnCode: pi.LatestCharge.ID, + PaymentIntent: txnData.PaymentIntent, + PaymentMethod: txnData.PaymentMethod, TransactionStatusID: 2, } diff --git a/cmd/api/routes-api.go b/cmd/api/routes-api.go index 24b8562..0752700 100644 --- a/cmd/api/routes-api.go +++ b/cmd/api/routes-api.go @@ -31,7 +31,7 @@ func (app *application) routes() http.Handler { w.Write([]byte("got in")) }) - mux.Post("/virtual-terminal-succedded", app.VirtualTerminalPaymentSucceeded) + mux.Post("/virtual-terminal-succeeded", app.VirtualTerminalPaymentSucceeded) }) return mux diff --git a/cmd/web/templates/terminal.page.gohtml b/cmd/web/templates/terminal.page.gohtml index 73f1212..566f19d 100644 --- a/cmd/web/templates/terminal.page.gohtml +++ b/cmd/web/templates/terminal.page.gohtml @@ -6,7 +6,7 @@ Virtual Terminal

Virtual Terminal


-
+
+
+

Receipt

+
+

+ Bank Return Code: +

+

+ + Charge another card + +

+
+
{{ end }} {{ define "js" }}