added receipt printing functionality to the Dojo and Paybridge payment flow

This commit is contained in:
2026-07-17 15:02:11 +01:00
parent 8ecdfd8cf7
commit fa2c92c8ab
7 changed files with 86 additions and 8 deletions
+1 -1
View File
@@ -403,7 +403,7 @@ func (app *App) issueDoorCard(w http.ResponseWriter, r *http.Request) {
app.SetCardWellStatus(status)
}
doorReq.RoomField = "104"
// doorReq.RoomField = "104"
// build lock server command
app.lockserver.BuildCommand(doorReq, checkIn, checkOut)
+5
View File
@@ -14,6 +14,7 @@ import (
"gitea.futuresens.co.uk/futuresens/cmstypes"
"gitea.futuresens.co.uk/futuresens/hardlink/internal/mail"
"gitea.futuresens.co.uk/futuresens/hardlink/internal/paymentsvc"
"gitea.futuresens.co.uk/futuresens/hardlink/internal/printer"
"gitea.futuresens.co.uk/futuresens/hardlink/internal/types"
"gitea.futuresens.co.uk/futuresens/logging"
"github.com/google/uuid"
@@ -126,6 +127,8 @@ func (app *App) salePayment(w http.ResponseWriter, r *http.Request) {
response.Status.Code = http.StatusOK
if result.Success && strings.EqualFold(result.Status, "APPROVED") {
printer.PrintSaleReceipt(result.CustomerReceipt)
response.Status.Code = http.StatusOK
response.Status.Message = result.Message
response.Data = buildPaymentSuccessURL(result)
writeTransactionResult(w, http.StatusOK, response)
@@ -140,6 +143,8 @@ func (app *App) salePayment(w http.ResponseWriter, r *http.Request) {
description = result.Status
}
log.Printf("Transaction failed: %s", description)
printer.PrintSaleReceipt(result.CustomerReceipt)
response.Status.Message = "Payment unsuccessful"
response.Data = buildPaymentFailureURL(types.ResultError, description)
writeTransactionResult(w, http.StatusOK, response)