mergeDev/campaign #73
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -138,3 +138,22 @@ func (s Supplier) GetWarehouseFreeship() (*model.ResponseListWarehouseIDByBusine
 | 
			
		|||
 | 
			
		||||
	return r.Data, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetFreeshipsBySupplierIDs ...
 | 
			
		||||
func (s Supplier) GetFreeshipsBySupplierIDs(p model.GetFreeshipsBySupplierIds) (*model.ResponseListFreeshipsBySupplierIds, error) {
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.Selly.GetFreeshipsBySupplierIds, toBytes(p))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	var r struct {
 | 
			
		||||
		Data  *model.ResponseListFreeshipsBySupplierIds `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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,3 +38,7 @@ type UpdateSupplierWarehousePayload struct {
 | 
			
		|||
	DistrictCode int    `json:"districtCode"`
 | 
			
		||||
	WardCode     int    `json:"wardCode"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetFreeshipsBySupplierIds struct {
 | 
			
		||||
	SupplierIDs []string `json:"supplierIds"`
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,3 +33,14 @@ type SupplierAll struct {
 | 
			
		|||
type ResponseListWarehouseIDByBusinessType struct {
 | 
			
		||||
	Warehouses []string `json:"warehouses"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Freeship struct {
 | 
			
		||||
	ID            string   `json:"_id"`
 | 
			
		||||
	ShortName     string   `json:"shortName"`
 | 
			
		||||
	MilestoneText []string `json:"milestoneText"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ResponseListFreeshipsBySupplierIds struct {
 | 
			
		||||
	SupplierID string     `json:"supplierId"`
 | 
			
		||||
	Freeships  []Freeship `json:"freeships"`
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@ var prefixes = struct {
 | 
			
		|||
	Supplier      string
 | 
			
		||||
	Seller        string
 | 
			
		||||
	AuthSMS       string
 | 
			
		||||
	Selly         string
 | 
			
		||||
}{
 | 
			
		||||
	Communication: "communication",
 | 
			
		||||
	Order:         "order",
 | 
			
		||||
| 
						 | 
				
			
			@ -20,4 +21,5 @@ var prefixes = struct {
 | 
			
		|||
	Bank:          "bank",
 | 
			
		||||
	Seller:        "seller",
 | 
			
		||||
	AuthSMS:       "auth_sms",
 | 
			
		||||
	Selly:         "selly",
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
package subject
 | 
			
		||||
 | 
			
		||||
import "fmt"
 | 
			
		||||
 | 
			
		||||
func getSellyValue(val string) string {
 | 
			
		||||
	return fmt.Sprintf("%s.%s", prefixes.Selly, val)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var Selly = struct {
 | 
			
		||||
	GetFreeshipsBySupplierIds string
 | 
			
		||||
}{
 | 
			
		||||
	GetFreeshipsBySupplierIds: getSellyValue("get_freeships_by_supplier_ids"),
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue