Merge branch 'product/notify-change-price' into develop

This commit is contained in:
Sinh 2023-03-01 11:20:51 +07:00
commit 2841d02165
3 changed files with 24 additions and 0 deletions

View File

@ -50,3 +50,20 @@ func (c Product) ProcessApplyRequest(p model.ProductApplyRequestPayload) error {
} }
return nil return nil
} }
func (c Product) RequestChangeStatus(p model.ProductRequestChangeStatus) error {
msg, err := natsio.GetServer().Request(subject.Product.RequestChangeStatus, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return err
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}

View File

@ -3,3 +3,8 @@ package model
type ProductApplyRequestPayload struct { type ProductApplyRequestPayload struct {
RequestID string `json:"requestId"` RequestID string `json:"requestId"`
} }
type ProductRequestChangeStatus struct {
RequestID string `json:"requestId"`
Status string `json:"status"`
}

View File

@ -10,7 +10,9 @@ func getProductValue(val string) string {
var Product = struct { var Product = struct {
ApplyRequest string ApplyRequest string
ProcessApplyRequest string ProcessApplyRequest string
RequestChangeStatus string
}{ }{
ApplyRequest: getProductValue("apply_request"), ApplyRequest: getProductValue("apply_request"),
ProcessApplyRequest: getProductValue("process_apply_request"), ProcessApplyRequest: getProductValue("process_apply_request"),
RequestChangeStatus: getProductValue("request_change_status"),
} }