mergeDev/campaign #73
|
@ -3,6 +3,7 @@ package client
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.selly.red/Selly-Modules/natsio"
|
"git.selly.red/Selly-Modules/natsio"
|
||||||
"git.selly.red/Selly-Modules/natsio/model"
|
"git.selly.red/Selly-Modules/natsio/model"
|
||||||
|
@ -163,3 +164,21 @@ func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWareho
|
||||||
}
|
}
|
||||||
return r.Data, nil
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -105,3 +105,11 @@ type GetWarehousesRequest struct {
|
||||||
Page int64 `json:"page"`
|
Page int64 `json:"page"`
|
||||||
Limit int64 `json:"limit"`
|
Limit int64 `json:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WarehouseORUpdateDeliveryStatus ...
|
||||||
|
type WarehouseORUpdateDeliveryStatus struct {
|
||||||
|
ORCode string `json:"orCode"`
|
||||||
|
OrderCode string `json:"orderCode"`
|
||||||
|
OrderID string `json:"orderId"`
|
||||||
|
DeliveryStatus string `json:"deliveryStatus"`
|
||||||
|
}
|
||||||
|
|
|
@ -7,41 +7,43 @@ func getWarehouseValue(val string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var Warehouse = struct {
|
var Warehouse = struct {
|
||||||
WebhookOnPoint string
|
|
||||||
CreateWarehouseIntoServiceSupplier string
|
CreateWarehouseIntoServiceSupplier string
|
||||||
UpdateWarehouseIntoServiceSupplier string
|
UpdateWarehouseIntoServiceSupplier string
|
||||||
CreateOutboundRequest string
|
CreateOutboundRequest string
|
||||||
UpdateOutboundRequestLogistic string
|
UpdateOutboundRequestLogistic string
|
||||||
CancelOutboundRequest string
|
CancelOutboundRequest string
|
||||||
GetConfiguration string
|
GetConfiguration string
|
||||||
SyncORStatus string
|
SyncORStatus string
|
||||||
WebhookTNC string
|
WebhookTNC string
|
||||||
WebhookGlobalCare string
|
WebhookGlobalCare string
|
||||||
FindOne string
|
WebhookOnPoint string
|
||||||
FindByCondition string
|
FindOne string
|
||||||
Distinct string
|
FindByCondition string
|
||||||
Count string
|
Distinct string
|
||||||
AfterUpdateWarehouse string
|
Count string
|
||||||
AfterCreateWarehouse string
|
AfterUpdateWarehouse string
|
||||||
UpdateIsClosedSupplier string
|
AfterCreateWarehouse string
|
||||||
GetWarehouses string
|
UpdateIsClosedSupplier string
|
||||||
|
GetWarehouses string
|
||||||
|
UpdateORDeliveryStatus string
|
||||||
}{
|
}{
|
||||||
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
|
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
|
||||||
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
|
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
|
||||||
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
||||||
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
|
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
|
||||||
CreateOutboundRequest: getWarehouseValue("create_outbound_request"),
|
CreateOutboundRequest: getWarehouseValue("create_outbound_request"),
|
||||||
UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"),
|
UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"),
|
||||||
CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"),
|
CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"),
|
||||||
GetConfiguration: getWarehouseValue("get_configuration"),
|
GetConfiguration: getWarehouseValue("get_configuration"),
|
||||||
SyncORStatus: getWarehouseValue("sync_or_status"),
|
SyncORStatus: getWarehouseValue("sync_or_status"),
|
||||||
WebhookTNC: getWarehouseValue("webhook_tnc"),
|
WebhookTNC: getWarehouseValue("webhook_tnc"),
|
||||||
WebhookGlobalCare: getWarehouseValue("webhook_global_care"),
|
WebhookGlobalCare: getWarehouseValue("webhook_global_care"),
|
||||||
WebhookOnPoint: getWarehouseValue("webhook_on_point"),
|
WebhookOnPoint: getWarehouseValue("webhook_on_point"),
|
||||||
FindOne: getWarehouseValue("find_one"),
|
FindOne: getWarehouseValue("find_one"),
|
||||||
FindByCondition: getWarehouseValue("find_all_by_condition"),
|
FindByCondition: getWarehouseValue("find_all_by_condition"),
|
||||||
Distinct: getWarehouseValue("distinct"),
|
Distinct: getWarehouseValue("distinct"),
|
||||||
Count: getWarehouseValue("count"),
|
Count: getWarehouseValue("count"),
|
||||||
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
|
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
|
||||||
GetWarehouses: getWarehouseValue("get_warehouses"),
|
GetWarehouses: getWarehouseValue("get_warehouses"),
|
||||||
|
UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue