Compare commits

...
2 Commits
4 changed files with 22 additions and 9 deletions
+12 -5
View File
@@ -4,6 +4,7 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"time"
"gitea.futuresens.co.uk/futuresens/hardlink/bootstrap" "gitea.futuresens.co.uk/futuresens/hardlink/bootstrap"
"gitea.futuresens.co.uk/futuresens/hardlink/config" "gitea.futuresens.co.uk/futuresens/hardlink/config"
@@ -13,7 +14,7 @@ import (
) )
const ( const (
buildVersion = "1.0.0" buildVersion = "1.0.2"
serviceName = "preauth-release" serviceName = "preauth-release"
) )
@@ -32,11 +33,17 @@ func main() {
defer database.Close() defer database.Close()
if err := payment.ReleasePreauthorizations(database); err != nil { if err := payment.ReleasePreauthorizations(database); err != nil {
log.WithError(err).Fatal("Preauth release failed") log.Error(err)
fmt.Println(err)
} else {
log.Info("Task completed successfully")
fmt.Println("Task completed successfully")
} }
log.Info("Task completed successfully") for i := 20; i > 0; i-- {
fmt.Println(". Press Enter to exit...") fmt.Printf("\rExiting in %2d seconds... ", i)
fmt.Scanln() time.Sleep(time.Second)
}
fmt.Println("\rExiting now. ")
os.Exit(0) os.Exit(0)
} }
+1 -1
View File
@@ -25,7 +25,7 @@ import (
) )
const ( const (
buildVersion = "1.0.28" buildVersion = "1.0.30"
serviceName = "hardlink" serviceName = "hardlink"
) )
+3 -3
View File
@@ -21,7 +21,7 @@ const (
) )
/* ============================== /* ==============================
Public Entry Point (LEGACY) Public Entry Point
============================== */ ============================== */
func ReleasePreauthorizations(database *sql.DB) error { func ReleasePreauthorizations(database *sql.DB) error {
@@ -78,6 +78,7 @@ func handlePreauthRelease(
if err != nil { if err != nil {
return err return err
} }
log.Infof("res=%s state=%s", info.transactionRes, info.transactionState)
// If already voided or declined → mark released // If already voided or declined → mark released
if isAlreadyReleased(info) { if isAlreadyReleased(info) {
@@ -86,8 +87,7 @@ func handlePreauthRelease(
// Only void approved + uncommitted // Only void approved + uncommitted
if !isVoidable(info) { if !isVoidable(info) {
log.Infof("Preauth %s not eligible for void (res=%s state=%s)", log.Infof("Preauth %s not eligible for void (res=%s state=%s)", ref, info.transactionRes, info.transactionState)
ref, info.transactionRes, info.transactionState)
return nil return nil
} }
+6
View File
@@ -2,6 +2,12 @@
builtVersion is a const in main.go builtVersion is a const in main.go
#### 1.0.30 - 09 January 2026
improved logging for preauth releaser
#### 1.0.29 - 08 January 2026
added count down before exiting the preauth releaser 20 seconds
#### 1.0.28 - 10 December 2025 #### 1.0.28 - 10 December 2025
added preauth releaser added preauth releaser