From 42a6d04413dba52ae893ec51c97217cd080b9b22 Mon Sep 17 00:00:00 2001 From: Tue Date: Wed, 14 Sep 2022 17:33:18 +0700 Subject: [PATCH] bank info --- client/supplier.go | 18 ++++++++++++++++++ client/warehouse.go | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/client/supplier.go b/client/supplier.go index 02d2875..8c5a193 100644 --- a/client/supplier.go +++ b/client/supplier.go @@ -100,3 +100,21 @@ func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*mod return r.Data, nil } + +// CreateWarehouseIntoServiceSupplier ... +func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehouseResponse) error { + msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, 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 +} diff --git a/client/warehouse.go b/client/warehouse.go index 0b85b6d..6c04925 100644 --- a/client/warehouse.go +++ b/client/warehouse.go @@ -126,21 +126,3 @@ func (w Warehouse) GetConfigByWarehouseID(warehouseID string) (*model.WarehouseC } return r.Data, nil } - -// CreateWarehouseIntoServiceSupplier ... -func (w Warehouse) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehouseResponse) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, 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 -}