allow some updates
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"git.k6n.net/go-cart-actor/pkg/cart"
|
||||
messages "git.k6n.net/go-cart-actor/proto/checkout"
|
||||
)
|
||||
|
||||
@@ -32,7 +33,12 @@ func HandleInitializeCheckout(g *CheckoutGrain, m *messages.InitializeCheckout)
|
||||
// return fmt.Errorf("InitializeCheckout: missing orderId")
|
||||
// }
|
||||
if g.CartState != nil {
|
||||
return fmt.Errorf("InitializeCheckout: checkout already initialized")
|
||||
if g.CartId != cart.CartId(m.CartId) {
|
||||
return fmt.Errorf("InitializeCheckout: cart ID mismatch")
|
||||
}
|
||||
if g.PaymentInProgress > 0 || g.OrderId != nil {
|
||||
return fmt.Errorf("InitializeCheckout: payment already in progress")
|
||||
}
|
||||
}
|
||||
|
||||
err := json.Unmarshal(m.CartState.Value, &g.CartState)
|
||||
|
||||
Reference in New Issue
Block a user