split cart and checkout and checkout vs payments
This commit is contained in:
20
pkg/checkout/mutation_payment_event.go
Normal file
20
pkg/checkout/mutation_payment_event.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package checkout
|
||||
|
||||
import (
|
||||
messages "git.k6n.net/go-cart-actor/proto/checkout"
|
||||
)
|
||||
|
||||
func HandlePaymentEvent(g *CheckoutGrain, m *messages.PaymentEvent) error {
|
||||
|
||||
payment, found := g.FindPayment(m.PaymentId)
|
||||
if !found {
|
||||
return ErrPaymentNotFound
|
||||
}
|
||||
metaBytes := m.Data.Value
|
||||
payment.Events = append(payment.Events, &PaymentEvent{
|
||||
Name: m.Name,
|
||||
Success: m.Success,
|
||||
Data: metaBytes,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user