Feature/get bank info #23

Closed
nguyenphamquangtue wants to merge 57 commits from feature/get-bank-info into master
3 changed files with 29 additions and 1 deletions
Showing only changes of commit fffcc281cc - Show all commits

View File

@ -102,7 +102,7 @@ func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*mod
}
// CreateWarehouseIntoServiceSupplier ...
func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehouseResponse) error {
func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehousePayload) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, toBytes(p))
if err != nil {
return err
@ -118,3 +118,21 @@ func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWareh
}
return nil
}
// UpdateWarehouseIntoServiceSupplier ...
func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWarehousePayload) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateWarehouseIntoServiceSupplier, 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

@ -30,3 +30,11 @@ type CreateSupplierWarehousePayload struct {
DistrictCode int `json:"districtCode"`
WardCode int `json:"wardCode"`
}
type UpdateSupplierWarehousePayload struct {
Supplier string `json:"supplier"`
Warehouse string `json:"warehouse"`
ProvinceCode int `json:"provinceCode"`
DistrictCode int `json:"districtCode"`
WardCode int `json:"wardCode"`
}

View File

@ -21,6 +21,7 @@ var Warehouse = struct {
AfterUpdateWarehouse string
AfterCreateWarehouse string
CreateWarehouseIntoServiceSupplier string
UpdateWarehouseIntoServiceSupplier string
}{
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
@ -36,4 +37,5 @@ var Warehouse = struct {
Distinct: getWarehouseValue("distinct"),
Count: getWarehouseValue("count"),
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
}