Compare commits
33 Commits
feature/se
...
master
Author | SHA1 | Date |
---|---|---|
Minh Nguyen | 9c48edf1e3 | |
Nguyen Minh | 78194a2d43 | |
sinhluu | 0f40121bf7 | |
Minh Nguyen | de84fdc2bf | |
Minh Nguyen | 72d45ed239 | |
Nguyen Minh | a4a6f31ec6 | |
Nguyen Minh | 7ab8f1f3a5 | |
Nguyen Minh | ff223e2b46 | |
Sinh | 2b0d33efc2 | |
Sinh | dfdccfa86a | |
sinhluu | 1384cae433 | |
sinhluu | c82bf48503 | |
Minh Nguyen | 2e5a5b5f0f | |
Nguyen Minh | 2d04611fee | |
Sinh | 1d0b13285a | |
Minh Nguyen | 2b9092ecbe | |
Sinh | fd41b1eadf | |
Sinh | 9004771704 | |
Sinh | 524db8391f | |
sinhluu | 546c45aad4 | |
Sinh | 3a5046f65d | |
Sinh | c6284f3200 | |
Nguyen Minh | 02b699f144 | |
Sinh | a409c0d17c | |
sinhluu | 5edec97ee3 | |
Sinh | 430e07b7d0 | |
Sinh | 7302b78f25 | |
Sinh | e84157281b | |
Sinh | 28178e0c31 | |
Sinh | b3bde5cd09 | |
kingphon | 2ba590a0a0 | |
kingphon | b240d7a9d1 | |
kingphon | ba8af50460 |
|
@ -146,6 +146,25 @@ func (w Warehouse) GetConfigByWarehouseID(warehouseID string) (*model.WarehouseC
|
|||
return r.Data, nil
|
||||
}
|
||||
|
||||
// GetListConfig ...
|
||||
func (w Warehouse) GetListConfig(req model.GetListWarehouseConfigReq) ([]*model.WarehouseConfiguration, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Warehouse.GetListWarehouseConfig, toBytes(req))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r struct {
|
||||
Data []*model.WarehouseConfiguration `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
|
||||
}
|
||||
|
||||
// GetWarehouses ...
|
||||
func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWarehousesResponse, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Warehouse.GetWarehouses, toBytes(p))
|
||||
|
|
|
@ -3,6 +3,7 @@ package client
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"git.selly.red/Selly-Modules/natsio"
|
||||
"git.selly.red/Selly-Modules/natsio/model"
|
||||
"git.selly.red/Selly-Modules/natsio/subject"
|
||||
|
@ -83,3 +84,39 @@ func (w Warehouse) FindByCondition(p model.FindWithCondition) ([]*model.Warehous
|
|||
}
|
||||
return r.Data, nil
|
||||
}
|
||||
|
||||
// UpdateWarehouseConfig ...
|
||||
func (w Warehouse) UpdateWarehouseConfig(p model.UpdatePayload) error {
|
||||
msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateWarehouseConfig, bsonToBytes(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
|
||||
}
|
||||
|
||||
// BulkWriteWarehouseConfig ...
|
||||
func (w Warehouse) BulkWriteWarehouseConfig(p model.UpdatePayload) error {
|
||||
msg, err := natsio.GetServer().Request(subject.Warehouse.BulkWriteWarehouseConfig, bsonToBytes(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
|
||||
}
|
||||
|
|
|
@ -43,3 +43,14 @@ type RequestCondition struct {
|
|||
Page int64 `json:"page"`
|
||||
Limit int64 `json:"limit"`
|
||||
}
|
||||
|
||||
type UpdatePayload struct {
|
||||
Conditions interface{} `json:"conditions"`
|
||||
Payload interface{} `json:"payload"`
|
||||
Opts []*options.UpdateOptions `json:"opts"`
|
||||
}
|
||||
|
||||
type WebhookPayloadV2 struct {
|
||||
Path string `json:"path"` // request URL path from external
|
||||
Data string `json:"data"` // request body
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ type CommunicationRequestHttp struct {
|
|||
ResponseImmediately bool `json:"responseImmediately"`
|
||||
Authentication string `json:"authentication"`
|
||||
Payload HttpRequest `json:"payload"`
|
||||
|
||||
// collection to store log data, will be prepended with log-, default it stored in logs collections
|
||||
LogTarget string `json:"logTarget"`
|
||||
}
|
||||
|
||||
// HttpRequest ...
|
||||
|
|
|
@ -28,10 +28,17 @@ type (
|
|||
|
||||
// LocationWard ...
|
||||
LocationWard struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code int `json:"code"`
|
||||
Slug string `json:"slug"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code int `json:"code"`
|
||||
Slug string `json:"slug"`
|
||||
Location *GEOLocation `json:"location"`
|
||||
}
|
||||
|
||||
// GEOLocation ...
|
||||
GEOLocation struct {
|
||||
Type string `bson:"type" json:"type"`
|
||||
Coordinates []float64 `bson:"coordinates" json:"coordinates"`
|
||||
}
|
||||
|
||||
// LocationProvinceResponse ...
|
||||
|
@ -76,12 +83,13 @@ type (
|
|||
|
||||
// LocationWardDetailResponse ...
|
||||
LocationWardDetailResponse struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
OldSlugs []string `json:"oldSlugs"`
|
||||
Slug string `json:"slug"`
|
||||
Code int `json:"code"`
|
||||
DistrictCode int `json:"districtCode"`
|
||||
ProvinceCode int `json:"provinceCode"`
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
OldSlugs []string `json:"oldSlugs"`
|
||||
Slug string `json:"slug"`
|
||||
Code int `json:"code"`
|
||||
DistrictCode int `json:"districtCode"`
|
||||
ProvinceCode int `json:"provinceCode"`
|
||||
Location *GEOLocation `json:"location"`
|
||||
}
|
||||
)
|
||||
|
|
|
@ -37,11 +37,12 @@ type InsuranceOpts struct {
|
|||
|
||||
// OutboundRequestItem ...
|
||||
type OutboundRequestItem struct {
|
||||
SupplierSKU string `json:"supplierSKU"`
|
||||
Quantity int64 `json:"quantity"`
|
||||
UnitCode string `json:"unitCode"`
|
||||
Price float64 `json:"price"`
|
||||
Name string `json:"name"`
|
||||
SupplierSKU string `json:"supplierSKU"`
|
||||
Quantity int64 `json:"quantity"`
|
||||
UnitCode string `json:"unitCode"`
|
||||
Price float64 `json:"price"`
|
||||
Name string `json:"name"`
|
||||
PartnerProductCode string `json:"partnerProductCode"`
|
||||
}
|
||||
|
||||
// CustomerInfo ...
|
||||
|
@ -63,11 +64,12 @@ type AddressDetail struct {
|
|||
|
||||
// UpdateOutboundRequestLogisticInfoPayload ...
|
||||
type UpdateOutboundRequestLogisticInfoPayload struct {
|
||||
ShippingLabel string `json:"shippingLabel"`
|
||||
TrackingCode string `json:"trackingCode"`
|
||||
ORCode string `json:"orCode"`
|
||||
TPLCode string `json:"tplCode"`
|
||||
OrderID string `json:"orderId"`
|
||||
ShippingLabel string `json:"shippingLabel,omitempty"`
|
||||
TrackingCode string `json:"trackingCode,omitempty"`
|
||||
ORCode string `json:"orCode,omitempty"`
|
||||
TPLCode string `json:"tplCode,omitempty"`
|
||||
OrderID string `json:"orderId"`
|
||||
DeliveryStatus string `json:"deliveryStatus,omitempty"`
|
||||
}
|
||||
|
||||
// CancelOutboundRequest ...
|
||||
|
@ -130,3 +132,8 @@ type UpdateStatusWarehousePendingInactive struct {
|
|||
WarehouseID string `json:"warehouse"`
|
||||
PendingInactive bool `json:"pendingInactive"`
|
||||
}
|
||||
|
||||
type GetListWarehouseConfigReq struct {
|
||||
PartnerCode string `json:"partnerCode"`
|
||||
PartnerIdentityCode string `json:"partnerIdentityCode"`
|
||||
}
|
||||
|
|
|
@ -61,11 +61,14 @@ type WarehouseSupplier struct {
|
|||
|
||||
// WarehouseOrder ...
|
||||
type WarehouseOrder struct {
|
||||
MinimumValue float64 `json:"minimumValue"`
|
||||
PaymentMethod WarehousePaymentMethod `json:"paymentMethod"`
|
||||
IsLimitNumberOfPurchases bool `json:"isLimitNumberOfPurchases"`
|
||||
LimitNumberOfPurchases int64 `json:"limitNumberOfPurchases"`
|
||||
NotifyOnNewOrder WarehouseConfigNotifyOnNewOrder `json:"notifyOnNewOrder"`
|
||||
MinimumValue float64 `json:"minimumValue"`
|
||||
PaymentMethod WarehousePaymentMethod `json:"paymentMethod"`
|
||||
IsLimitNumberOfPurchases bool `json:"isLimitNumberOfPurchases"`
|
||||
LimitNumberOfPurchases int64 `json:"limitNumberOfPurchases"`
|
||||
NotifyOnNewOrder WarehouseConfigNotifyOnNewOrder `json:"notifyOnNewOrder"`
|
||||
LabelSize string `json:"labelSize"`
|
||||
MaximumOrderValue float64 `json:"maximumOrderValue"`
|
||||
MaximumNumberPerBuyerEachMonth int64 `json:"maximumNumberPerBuyerEachMonth"`
|
||||
}
|
||||
|
||||
// WarehouseConfigNotifyOnNewOrder ...
|
||||
|
@ -153,6 +156,8 @@ type WarehouseNatsResponse struct {
|
|||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ReasonPendingInactive string `json:"reasonPendingInactive"`
|
||||
IsPendingInactive bool `json:"isPendingInactive"`
|
||||
IsFromInternational bool `json:"isFromInternational"`
|
||||
StoreCode string `json:"storeCode"`
|
||||
}
|
||||
|
||||
// WarehouseInfo ...
|
||||
|
@ -181,3 +186,9 @@ type GetWarehousesResponse struct {
|
|||
Limit int64 `json:"limit"`
|
||||
List []WarehouseInfo `json:"list"`
|
||||
}
|
||||
|
||||
type GetListWarehouseConfigRes struct {
|
||||
Total int64 `json:"total"`
|
||||
Limit int64 `json:"limit"`
|
||||
List []WarehouseConfiguration `json:"list"`
|
||||
}
|
||||
|
|
|
@ -8,13 +8,19 @@ func getProductValue(val string) string {
|
|||
}
|
||||
|
||||
var Product = struct {
|
||||
ApplyRequest string
|
||||
CreateRequestStep string
|
||||
ProcessApplyRequest string
|
||||
RequestChangeStatus string
|
||||
ApplyRequest string
|
||||
CreateRequestStep string
|
||||
ProcessApplyRequest string
|
||||
RequestChangeStatus string
|
||||
WebhookStockUpdate string // WebhookStockUpdate Kiotviet queue
|
||||
OPWebhookStockUpdate string // OPWebhookStockUpdate Onpoint queue
|
||||
OrderPaymentBankTransferWebhookCheckAndUpdateStatus string
|
||||
}{
|
||||
ApplyRequest: getProductValue("apply_request"),
|
||||
CreateRequestStep: getProductValue("create_request_step"),
|
||||
ProcessApplyRequest: getProductValue("process_apply_request"),
|
||||
RequestChangeStatus: getProductValue("request_change_status"),
|
||||
ApplyRequest: getProductValue("apply_request"),
|
||||
CreateRequestStep: getProductValue("create_request_step"),
|
||||
ProcessApplyRequest: getProductValue("process_apply_request"),
|
||||
RequestChangeStatus: getProductValue("request_change_status"),
|
||||
WebhookStockUpdate: getProductValue("webhook_stock_update"),
|
||||
OPWebhookStockUpdate: getProductValue("op_webhook_stock_update"),
|
||||
OrderPaymentBankTransferWebhookCheckAndUpdateStatus: getProductValue("order_payment_bank_transfer_webhook_check_and_update_status"),
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ var Warehouse = struct {
|
|||
WebhookTNC string
|
||||
WebhookGlobalCare string
|
||||
WebhookOnPoint string
|
||||
WebhookViettelFFM string
|
||||
FindOne string
|
||||
FindByCondition string
|
||||
Distinct string
|
||||
|
@ -30,6 +31,9 @@ var Warehouse = struct {
|
|||
UpdateORDeliveryStatus string
|
||||
UpdateStatusWarehousePendingInactive string
|
||||
UpdateIsSellyMall string
|
||||
UpdateWarehouseConfig string
|
||||
BulkWriteWarehouseConfig string
|
||||
GetListWarehouseConfig string
|
||||
}{
|
||||
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
|
||||
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
|
||||
|
@ -43,6 +47,7 @@ var Warehouse = struct {
|
|||
WebhookTNC: getWarehouseValue("webhook_tnc"),
|
||||
WebhookGlobalCare: getWarehouseValue("webhook_global_care"),
|
||||
WebhookOnPoint: getWarehouseValue("webhook_on_point"),
|
||||
WebhookViettelFFM: getWarehouseValue("webhook_viettel_ffm"),
|
||||
FindOne: getWarehouseValue("find_one"),
|
||||
FindByCondition: getWarehouseValue("find_all_by_condition"),
|
||||
Distinct: getWarehouseValue("distinct"),
|
||||
|
@ -52,4 +57,7 @@ var Warehouse = struct {
|
|||
UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"),
|
||||
UpdateStatusWarehousePendingInactive: getWarehouseValue("update_status_warehouse_pending_inactive"),
|
||||
UpdateIsSellyMall: getWarehouseValue("update_is_selly_mall"),
|
||||
UpdateWarehouseConfig: getWarehouseValue("update_warehouse_config"),
|
||||
BulkWriteWarehouseConfig: getWarehouseValue("bulk_write_warehouse_config"),
|
||||
GetListWarehouseConfig: getWarehouseValue("get_list_warehouse_config"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue