more functions
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user