mergeDev/campaign #73
|
@ -136,3 +136,22 @@ func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWareh
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateCashflow ...
|
||||||
|
func (s Supplier) CreateCashflow(p model.SupplierCashflowCreatePayload) (*model.SupplierCashflowCreateResponse, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Supplier.CreateCashflow, toBytes(p))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var r struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
Data *model.SupplierCashflowCreateResponse `json:"data"`
|
||||||
|
}
|
||||||
|
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if r.Error != "" {
|
||||||
|
return nil, errors.New(r.Error)
|
||||||
|
}
|
||||||
|
return r.Data, nil
|
||||||
|
}
|
||||||
|
|
|
@ -20,3 +20,9 @@ type ActionBy struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClickAction ...
|
||||||
|
type ClickAction struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
|
@ -38,3 +38,13 @@ type UpdateSupplierWarehousePayload struct {
|
||||||
DistrictCode int `json:"districtCode"`
|
DistrictCode int `json:"districtCode"`
|
||||||
WardCode int `json:"wardCode"`
|
WardCode int `json:"wardCode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SupplierCashflowCreatePayload ...
|
||||||
|
type SupplierCashflowCreatePayload struct {
|
||||||
|
Supplier string `json:"supplier"`
|
||||||
|
Action string `json:"action"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
TargetID string `json:"targetId"`
|
||||||
|
Value float64 `json:"value"`
|
||||||
|
ClickAction *ClickAction `json:"clickAction"`
|
||||||
|
}
|
||||||
|
|
|
@ -29,3 +29,7 @@ type SupplierAll struct {
|
||||||
Suppliers []SupplierBrief `json:"suppliers"`
|
Suppliers []SupplierBrief `json:"suppliers"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SupplierCashflowCreateResponse struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
}
|
||||||
|
|
|
@ -10,8 +10,10 @@ var Supplier = struct {
|
||||||
GetListSupplierInfo string
|
GetListSupplierInfo string
|
||||||
GetSupplierContractBySupplierID string
|
GetSupplierContractBySupplierID string
|
||||||
FindAll string
|
FindAll string
|
||||||
|
CreateCashflow string
|
||||||
}{
|
}{
|
||||||
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
||||||
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
|
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
|
||||||
FindAll: getSupplierValue("find_all"),
|
FindAll: getSupplierValue("find_all"),
|
||||||
|
CreateCashflow: getSupplierValue("create_cashflow"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue