refactor/checkout (#8)
Co-authored-by: matst80 <mats.tornberg@gmail.com> Reviewed-on: #8 Co-authored-by: Mats Törnberg <mats@tornberg.me> Co-committed-by: Mats Törnberg <mats@tornberg.me>
This commit was merged in pull request #8.
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"slices"
|
||||
|
||||
"git.k6n.net/go-cart-actor/pkg/actor"
|
||||
"git.k6n.net/go-cart-actor/pkg/messages"
|
||||
messages "git.k6n.net/go-cart-actor/proto/cart"
|
||||
)
|
||||
|
||||
func RemoveVoucher(g *CartGrain, m *messages.RemoveVoucher) error {
|
||||
@@ -15,7 +15,7 @@ func RemoveVoucher(g *CartGrain, m *messages.RemoveVoucher) error {
|
||||
StatusCode: 400,
|
||||
}
|
||||
}
|
||||
if g.PaymentInProgress > 0 {
|
||||
if g.CheckoutStatus != nil {
|
||||
return ErrPaymentInProgress
|
||||
}
|
||||
|
||||
@@ -45,10 +45,6 @@ func AddVoucher(g *CartGrain, m *messages.AddVoucher) error {
|
||||
}
|
||||
}
|
||||
|
||||
if g.PaymentInProgress > 0 {
|
||||
return ErrPaymentInProgress
|
||||
}
|
||||
|
||||
if slices.ContainsFunc(g.Vouchers, func(v *Voucher) bool {
|
||||
return v.Code == m.Code
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user