diff --git a/client/order.go b/client/order.go index 5400f52..4379747 100644 --- a/client/order.go +++ b/client/order.go @@ -50,19 +50,3 @@ func (o Order) CancelDelivery(p model.OrderCancelDelivery) error { } return nil } - -// ChangeDeliveryStatus ... -func (o Order) ChangeDeliveryStatus(p model.OrderChangeDeliveryStatus) error { - msg, err := natsio.GetServer().Request(subject.Order.ChangeDeliveryStatus, toBytes(p)) - if err != nil { - return err - } - var r model.CommonResponseData - 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/supplier.go b/client/supplier.go index 700d714..5b4881a 100644 --- a/client/supplier.go +++ b/client/supplier.go @@ -58,24 +58,3 @@ func (s Supplier) GetSupplierContractBySupplierID(p model.GetSupplierContractReq return r.Data, nil } - -func (s Supplier) FindAll(supplierID model.SupplierRequestPayload) (*model.SupplierAll, error) { - msg, err := natsio.GetServer().Request(subject.Supplier.FindAll, toBytes(supplierID)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.SupplierAll `json:"data"` - Error string `json:"error"` - } - - 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 -} diff --git a/model/common_request.go b/model/common_request.go index 0ce5163..4d6a719 100644 --- a/model/common_request.go +++ b/model/common_request.go @@ -15,8 +15,3 @@ type DistinctWithField struct { Conditions interface{} `json:"conditions"` Filed string `json:"filed"` } - -type ActionBy struct { - ID string `json:"id"` - Name string `json:"name"` -} diff --git a/model/order_request.go b/model/order_request.go index 553d870..da9d4fe 100644 --- a/model/order_request.go +++ b/model/order_request.go @@ -2,21 +2,13 @@ package model // OrderUpdateORStatus ... type OrderUpdateORStatus struct { - OrderCode string `json:"orderCode"` - ORCode string `json:"orCode"` - Status string `json:"status"` - DeliveryStatus string `json:"deliveryStatus"` - Reason string `json:"reason"` + OrderCode string `json:"orderCode"` + ORCode string `json:"orCode"` + Status string `json:"status"` + Reason string `json:"reason"` } // OrderCancelDelivery ... type OrderCancelDelivery struct { OrderID string `json:"orderId"` } - -// OrderChangeDeliveryStatus ... -type OrderChangeDeliveryStatus struct { - OrderID string `json:"orderId"` - DeliveryStatus string `json:"deliveryStatus"` - ActionBy ActionBy `json:"actionBy"` -} diff --git a/model/supplier_request.go b/model/supplier_request.go index 04d15d5..8372569 100644 --- a/model/supplier_request.go +++ b/model/supplier_request.go @@ -12,13 +12,3 @@ type GetSupplierRequest struct { type GetSupplierContractRequest struct { SupplierID primitive.ObjectID `json:"supplierID"` } - -// SupplierRequestPayload ... -type SupplierRequestPayload struct { - Limit int - Page int - Keyword string - Status string - PIC string - ContractStatus string -} diff --git a/model/supplier_response.go b/model/supplier_response.go index a87a29e..da33a9f 100644 --- a/model/supplier_response.go +++ b/model/supplier_response.go @@ -13,17 +13,3 @@ type ResponseSupplierContract struct { Name string `json:"name"` Status string `json:"status"` } - -// SupplierBrief ... -type SupplierBrief struct { - ID string `json:"_id"` - Name string `json:"name"` - Status string `json:"status"` - CreatedAt string `json:"createdAt"` - UpdatedAt string `json:"updatedAt"` -} - -type SupplierAll struct { - Suppliers []SupplierBrief `json:"suppliers"` - Total int64 `json:"total"` -} diff --git a/model/warehouse_request.go b/model/warehouse_request.go index f63b135..5612532 100644 --- a/model/warehouse_request.go +++ b/model/warehouse_request.go @@ -12,19 +12,6 @@ type OutboundRequestPayload struct { TPLCode string `json:"tplCode"` Customer CustomerInfo `json:"customer"` Items []OutboundRequestItem `json:"items"` - Insurance *InsuranceOpts -} - -// InsuranceOpts ... -type InsuranceOpts struct { - VehicleTypeID string `json:"vehicleTypeId"` - VehicleTypeName string `json:"vehicleTypeName"` - InsuranceTypeID string `json:"insuranceTypeId"` - YearsOfInsurance int `json:"yearsOfInsurance"` - License string `json:"license"` - Chassis string `json:"chassis"` - Engine string `json:"engine"` - BeginDate string `json:"beginDate"` } // OutboundRequestItem ... @@ -38,7 +25,6 @@ type OutboundRequestItem struct { type CustomerInfo struct { Name string `json:"name"` PhoneNumber string `json:"phoneNumber"` - Email string `json:"email"` Address AddressDetail `json:"address"` } @@ -63,9 +49,3 @@ type CancelOutboundRequest struct { ORCode string `json:"orCode"` Note string `json:"note"` } - -// SyncORStatusRequest ... -type SyncORStatusRequest struct { - ORCode string `json:"orCode"` - OrderCode string `json:"orderCode"` -} diff --git a/model/warehouse_response.go b/model/warehouse_response.go index e7de165..b19ade9 100644 --- a/model/warehouse_response.go +++ b/model/warehouse_response.go @@ -24,6 +24,12 @@ type WarehouseConfiguration struct { Order WarehouseOrder `json:"order"` Partner WarehousePartner `json:"partner"` Delivery WarehouseDelivery `json:"delivery"` + Other WarehouseOther `json:"other"` +} + +// WarehouseOther ... +type WarehouseOther struct { + DoesSupportSellyExpress bool `json:"doesSupportSellyExpress"` } // WarehouseSupplier ... @@ -62,14 +68,6 @@ type WarehousePartner struct { Authentication string `json:"authentication"` } -// SyncORStatusResponse ... -type SyncORStatusResponse struct { - ORCode string `json:"orCode"` - OrderCode string `json:"orderCode"` - Status string `json:"status"` - DeliveryStatus string `json:"deliveryStatus"` -} - // ResponseWarehouseContact ... type ResponseWarehouseContact struct { Name string `json:"name"` diff --git a/server_reqres.go b/server_reqres.go index 8979ab0..841f9ef 100644 --- a/server_reqres.go +++ b/server_reqres.go @@ -18,11 +18,7 @@ func (sv Server) Request(subject string, payload []byte) (*nats.Msg, error) { if sv.Config.RequestTimeout > 0 { timeout = sv.Config.RequestTimeout } - msg, err := sv.instance.Request(subject, payload, timeout) - if errors.Is(err, nats.ErrNoResponders) { - log.Printf("[NATS SERVER]: request - no responders for subject: %s", subject) - } - return msg, err + return sv.instance.Request(subject, payload, timeout) } // Reply ... diff --git a/subject/communication.go b/subject/communication.go index 80926f2..bcbbe31 100644 --- a/subject/communication.go +++ b/subject/communication.go @@ -7,9 +7,13 @@ func getCommunicationValue(val string) string { } var Communication = struct { - RequestHTTP string - ResponseHTTP string + RequestHTTP string + ResponseHTTP string + WebhookTNC string + WebhookGlobalCare string }{ - RequestHTTP: getCommunicationValue("request_http"), - ResponseHTTP: getCommunicationValue("response_http"), + RequestHTTP: getCommunicationValue("request_http"), + ResponseHTTP: getCommunicationValue("response_http"), + WebhookTNC: getCommunicationValue("webhook_tnc"), + WebhookGlobalCare: getCommunicationValue("webhook_global_care"), } diff --git a/subject/order.go b/subject/order.go index 7ba7886..846cee5 100644 --- a/subject/order.go +++ b/subject/order.go @@ -7,11 +7,11 @@ func getOrderValue(val string) string { } var Order = struct { - UpdateORStatus string - CancelDelivery string - ChangeDeliveryStatus string + UpdateORStatus string + CancelDelivery string + WebhookTNC string + WebhookGlobalCare string }{ - UpdateORStatus: getOrderValue("update_outbound_request_status"), - CancelDelivery: getOrderValue("cancel_delivery"), - ChangeDeliveryStatus: getOrderValue("change_delivery_status"), + UpdateORStatus: getOrderValue("update_outbound_request_status"), + CancelDelivery: getOrderValue("cancel_delivery"), } diff --git a/subject/supplier.go b/subject/supplier.go index 17ca8d0..b2505cf 100644 --- a/subject/supplier.go +++ b/subject/supplier.go @@ -9,9 +9,7 @@ func getSupplierValue(val string) string { var Supplier = struct { GetListSupplierInfo string GetSupplierContractBySupplierID string - FindAll string }{ GetListSupplierInfo: getSupplierValue("get_list_supplier_info"), GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"), - FindAll: getSupplierValue("find_all"), } diff --git a/subject/warehouse.go b/subject/warehouse.go index 5d0a81c..73c5334 100644 --- a/subject/warehouse.go +++ b/subject/warehouse.go @@ -11,9 +11,6 @@ var Warehouse = struct { UpdateOutboundRequestLogistic string CancelOutboundRequest string GetConfiguration string - SyncORStatus string - WebhookTNC string - WebhookGlobalCare string FindOne string FindByCondition string Distinct string @@ -27,9 +24,6 @@ var Warehouse = struct { UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"), CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"), GetConfiguration: getWarehouseValue("get_configuration"), - SyncORStatus: getWarehouseValue("sync_or_status"), - WebhookTNC: getWarehouseValue("webhook_tnc"), - WebhookGlobalCare: getWarehouseValue("webhook_global_care"), FindOne: getWarehouseValue("find_one"), FindByCondition: getWarehouseValue("find_all_by_condition"), Distinct: getWarehouseValue("distinct"),