Files
go-cart-actor/pkg/cart/mutation_create_checkout_order.go
matst80 c227870f13
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 37s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m10s
add more payment related shit
2025-12-01 18:35:32 +01:00

22 lines
504 B
Go

package cart
import (
"errors"
messages "git.k6n.net/go-cart-actor/pkg/messages"
)
func CreateCheckoutOrder(grain *CartGrain, req *messages.CreateCheckoutOrder) error {
if len(grain.Items) == 0 {
return errors.New("cannot checkout empty cart")
}
if req.Terms != "accepted" {
return errors.New("terms must be accepted")
}
// Validate other fields as needed
//grain.CheckoutOrderId = uuid.New().String()
grain.CheckoutStatus = "pending"
//grain.CheckoutCountry = req.Country
return nil
}