more flow
This commit is contained in:
@@ -163,6 +163,13 @@ type resetCompleteRequest struct {
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// EmailPreferencesResponse mirrors the UCP email preferences type for the
|
||||
// customer-facing API.
|
||||
type EmailPreferencesResponse struct {
|
||||
OrderEmails *bool `json:"orderEmails,omitempty"`
|
||||
MarketingEmails *bool `json:"marketingEmails,omitempty"`
|
||||
}
|
||||
|
||||
// CustomerResponse mirrors the UCP customer projection (kept local to avoid an
|
||||
// import cycle with internal/ucp). The password hash is never included.
|
||||
type CustomerResponse struct {
|
||||
@@ -176,6 +183,9 @@ type CustomerResponse struct {
|
||||
Addresses []AddressResponse `json:"addresses"`
|
||||
Orders []OrderRef `json:"orders"`
|
||||
|
||||
// EmailPreferences carries the customer's current email opt-in/out state.
|
||||
EmailPreferences *EmailPreferencesResponse `json:"emailPreferences,omitempty"`
|
||||
|
||||
// EmailVerified reflects whether the email-verification flow has completed.
|
||||
EmailVerified bool `json:"emailVerified"`
|
||||
}
|
||||
@@ -554,6 +564,12 @@ func grainToCustomer(id string, g *profile.ProfileGrain) CustomerResponse {
|
||||
for _, o := range g.Orders {
|
||||
resp.Orders = append(resp.Orders, OrderRef{OrderReference: o.OrderReference, Status: o.Status})
|
||||
}
|
||||
if g.EmailPreferences != nil {
|
||||
resp.EmailPreferences = &EmailPreferencesResponse{
|
||||
OrderEmails: g.EmailPreferences.OrderEmails,
|
||||
MarketingEmails: g.EmailPreferences.MarketingEmails,
|
||||
}
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user