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

@@ -131,13 +131,17 @@ actor.NewMutation(SubscriptionAdded, func() *messages.SubscriptionAdded {
### PaymentDeclined
**Purpose**: Marks the cart as having a declined payment, potentially updating status or flags.
**Purpose**: Marks the cart as having a declined payment, potentially updating status or flags, and appends a notice with timestamp, message, and optional code for user feedback.
**Handler Implementation**:
```go
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 = ""
@@ -153,7 +157,7 @@ actor.NewMutation(PaymentDeclined, func() *messages.PaymentDeclined {
}),
```
**Notes**: Assumes `PaymentStatus` and `PaymentDeclinedAt` fields. Add timestamps and status tracking to grain.
**Notes**: Assumes `PaymentStatus` and `PaymentDeclinedNotices` fields. Add status tracking and error notices list to grain. Notice struct has Timestamp, Message, and optional Code.
### ConfirmationViewed