22 lines
484 B
Go
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
|
|
}
|