more functions

This commit is contained in:
matst80
2025-11-20 21:34:39 +01:00
parent 60cd6cfd51
commit 729c67f992
6 changed files with 122 additions and 75 deletions

View File

@@ -2,12 +2,17 @@ package cart
import (
"time"
messages "git.tornberg.me/go-cart-actor/pkg/messages"
)
func PaymentDeclined(grain *CartGrain, req *messages.PaymentDeclined) error {
grain.PaymentStatus = "declined"
grain.PaymentDeclinedAt = time.Now()
grain.PaymentDeclinedNotices = append(grain.PaymentDeclinedNotices, Notice{
Timestamp: time.Now(),
Message: req.Message,
Code: req.Code,
})
// Optionally clear checkout order if in progress
if grain.CheckoutOrderId != "" {
grain.CheckoutOrderId = ""