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:
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