integrate-onpoint #54

Merged
sinhluu merged 15 commits from integrate-onpoint into master 2022-10-31 09:33:39 +00:00
3 changed files with 61 additions and 32 deletions
Showing only changes of commit 91d8ffe40f - Show all commits

View File

@ -3,6 +3,7 @@ package client
import (
"encoding/json"
"errors"
"fmt"
"git.selly.red/Selly-Modules/natsio"
"git.selly.red/Selly-Modules/natsio/model"
@ -163,3 +164,21 @@ func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWareho
}
return r.Data, nil
}
// UpdateORDeliveryStatus ...
func (w Warehouse) UpdateORDeliveryStatus(p model.WarehouseORUpdateDeliveryStatus) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.GetWarehouses, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return fmt.Errorf("nats: update_or_delivery_status %v", err)
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}

View File

@ -105,3 +105,11 @@ type GetWarehousesRequest struct {
Page int64 `json:"page"`
Limit int64 `json:"limit"`
}
// WarehouseORUpdateDeliveryStatus ...
type WarehouseORUpdateDeliveryStatus struct {
ORCode string `json:"orCode"`
OrderCode string `json:"orderCode"`
OrderID string `json:"orderId"`
DeliveryStatus string `json:"deliveryStatus"`
}

View File

@ -25,6 +25,7 @@ var Warehouse = struct {
AfterCreateWarehouse string
UpdateIsClosedSupplier string
GetWarehouses string
UpdateORDeliveryStatus string
}{
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
@ -44,4 +45,5 @@ var Warehouse = struct {
Count: getWarehouseValue("count"),
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
GetWarehouses: getWarehouseValue("get_warehouses"),
UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"),
}