add pluggable PayBridge and Dojo payment flow with CMS credentials

This commit is contained in:
2026-07-06 10:29:39 +01:00
parent f5ff78e60e
commit 8ecdfd8cf7
26 changed files with 1526 additions and 75 deletions
+13 -2
View File
@@ -9,7 +9,7 @@ import (
"time"
"gitea.futuresens.co.uk/futuresens/cmstypes"
"gitea.futuresens.co.uk/futuresens/hardlink/internal/payment"
"gitea.futuresens.co.uk/futuresens/hardlink/internal/creditcall"
"gitea.futuresens.co.uk/futuresens/hardlink/internal/types"
"gitea.futuresens.co.uk/futuresens/logging"
log "github.com/sirupsen/logrus"
@@ -34,7 +34,7 @@ func callChipDNA(client *http.Client, url string, payload []byte) ([]byte, error
return io.ReadAll(resp.Body)
}
func confirmWithRetry(client *http.Client, req payment.ConfirmTransactionRequest, attempts int) ([]byte, error) {
func confirmWithRetry(client *http.Client, req creditcall.ConfirmTransactionRequest, attempts int) ([]byte, error) {
payload, err := xml.Marshal(req)
if err != nil {
@@ -69,3 +69,14 @@ func confirmWithRetry(client *http.Client, req payment.ConfirmTransactionRequest
return nil, lastErr
}
func writeJSON(w http.ResponseWriter, status int, payload any) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(status)
if payload == nil {
return
}
_ = json.NewEncoder(w).Encode(payload)
}