Files
go-cart-actor/pkg/cart/mutation_payment_declined.go
Mats Törnberg 374bd4272b
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Failing after 10s
Build and Publish / BuildAndDeployArm64 (push) Failing after 11s
update
2025-11-25 19:34:39 +01:00

22 lines
484 B
Go

package cart
import (
"time"
messages "git.k6n.net/go-cart-actor/pkg/messages"
)
func PaymentDeclined(grain *CartGrain, req *messages.PaymentDeclined) error {
grain.PaymentStatus = "declined"
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 = ""
}
return nil
}