完善发货链接签名和作废恢复
This commit is contained in:
@@ -16,13 +16,15 @@ type MerchantHandler struct {
|
||||
merchantSvc *service.MerchantService
|
||||
fulfillmentSvc *service.FulfillmentService
|
||||
callbackSvc *service.CallbackService
|
||||
deliverySvc *service.DeliveryService
|
||||
}
|
||||
|
||||
func NewMerchantHandler(merchantSvc *service.MerchantService, fulfillmentSvc *service.FulfillmentService, callbackSvc *service.CallbackService) *MerchantHandler {
|
||||
func NewMerchantHandler(merchantSvc *service.MerchantService, fulfillmentSvc *service.FulfillmentService, callbackSvc *service.CallbackService, deliverySvc *service.DeliveryService) *MerchantHandler {
|
||||
return &MerchantHandler{
|
||||
merchantSvc: merchantSvc,
|
||||
fulfillmentSvc: fulfillmentSvc,
|
||||
callbackSvc: callbackSvc,
|
||||
deliverySvc: deliverySvc,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +167,32 @@ func (h *MerchantHandler) CreateTestOrder(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) GetDeliveryLink(c *gin.Context) {
|
||||
link, err := h.deliverySvc.GetOrCreateDeliveryLink(middleware.GetMerchantID(c), c.Param("order_no"))
|
||||
if err != nil {
|
||||
writeDeliveryError(c, err)
|
||||
return
|
||||
}
|
||||
response.OK(c, link)
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) RevokeDeliveryLink(c *gin.Context) {
|
||||
if err := h.deliverySvc.RevokeDeliveryLink(middleware.GetMerchantID(c), c.Param("order_no")); err != nil {
|
||||
writeDeliveryError(c, err)
|
||||
return
|
||||
}
|
||||
response.OK(c, nil)
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) RestoreDeliveryLink(c *gin.Context) {
|
||||
link, err := h.deliverySvc.RestoreDeliveryLink(middleware.GetMerchantID(c), c.Param("order_no"))
|
||||
if err != nil {
|
||||
writeDeliveryError(c, err)
|
||||
return
|
||||
}
|
||||
response.OK(c, link)
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) GetWallet(c *gin.Context) {
|
||||
wallet, err := h.fulfillmentSvc.GetWallet(middleware.GetMerchantID(c))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user