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>
21 lines
414 B
Go
21 lines
414 B
Go
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
|
|
}
|