update
This commit is contained in:
30
pkg/checkout/mutation_contact_details_updated.go
Normal file
30
pkg/checkout/mutation_contact_details_updated.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package checkout
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
checkout_messages "git.k6n.net/go-cart-actor/proto/checkout"
|
||||
)
|
||||
|
||||
// HandleContactDetailsUpdated mutation
|
||||
func HandleContactDetailsUpdated(g *CheckoutGrain, m *checkout_messages.ContactDetailsUpdated) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("HandleContactDetailsUpdated: nil payload")
|
||||
}
|
||||
|
||||
if g.ContactDetails == nil {
|
||||
g.ContactDetails = &ContactDetails{}
|
||||
}
|
||||
|
||||
if m.Email != nil {
|
||||
g.ContactDetails.Email = m.Email
|
||||
}
|
||||
if m.Phone != nil {
|
||||
g.ContactDetails.Phone = m.Phone
|
||||
}
|
||||
if m.Name != nil {
|
||||
g.ContactDetails.Name = m.Name
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user