1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
@@ -40,6 +41,56 @@ func (c *JxOrderController) CreateOrder() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 京西门店订单扫码枪扫码支付
|
||||
// @Description 京西门店订单扫码枪扫码支付
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrderID formData string true "订单ID"
|
||||
// @Param paymentLabel formData string true "支付身份标示"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /Pay4OrderByBarCodeScanner [post]
|
||||
func (c *JxOrderController) Pay4OrderByBarCodeScanner() {
|
||||
c.callPay4OrderByBarCodeScanner(func(params *tJxorderPay4OrderByBarCodeScannerParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = localjx.BarCodeScannerPay(params.VendorOrderID, params.PaymentLabel)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 手动刷新扫码枪扫码支付订单状态
|
||||
// @Description 手动刷新扫码枪扫码支付订单状态
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrderID formData string true "订单ID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /RefreshPayStatus [post]
|
||||
func (c *JxOrderController) RefreshPayStatus() {
|
||||
c.callRefreshPayStatus(func(params *tJxorderRefreshPayStatusParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = localjx.QueryBarCodeScannerStatus(params.VendorOrderID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 到店扫码支付订单退款
|
||||
// @Description 到店扫码支付订单退款
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrderID formData string true "订单ID"
|
||||
// @Param skuIds formData string true "[key:value]退款商品 skuId:count,int"
|
||||
// @Param Reason formData string false "退单原因"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /RefundOnlineOrder [post]
|
||||
func (c *JxOrderController) RefundOnlineOrder() {
|
||||
c.callRefundOnlineOrder(func(params *tJxorderRefundOnlineOrderParams) (retVal interface{}, errCode string, err error) {
|
||||
skuIds := make(map[int]int, 0)
|
||||
if err = json.Unmarshal([]byte(params.SkuIds), &skuIds); err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
err = localjx.RefundBarCodeScannerOrder(params.Ctx, params.VendorOrderID, skuIds, params.Reason)
|
||||
|
||||
return retVal, errCode, err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 请求支付京西商城订单
|
||||
// @Description 请求支付京西商城订单
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
@@ -2,6 +2,8 @@ package controllers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tonglianpayapi"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
@@ -29,6 +31,25 @@ func (c *TongLianController) Msg() {
|
||||
}
|
||||
}
|
||||
|
||||
//通联同一扫码支付回调接口
|
||||
func (c *TongLianController) OnLinePay() {
|
||||
globals.SugarLogger.Debug("-------method:= %s", c.Ctx.Input.Method())
|
||||
if c.Ctx.Input.Method() == http.MethodPost {
|
||||
call, err := api.TLpayAPI.GetCallbackOnlinePayMsg(getUsefulRequest2(c.Ctx))
|
||||
if err == nil {
|
||||
err = localjx.OnTLOnlinePayCallback(call)
|
||||
}
|
||||
if err == nil {
|
||||
c.Data["json"] = tonglianpayapi.OnlinePayStatusSuccess
|
||||
} else {
|
||||
c.Data["json"] = tonglianpayapi.OnlinePayStatusFail
|
||||
}
|
||||
c.ServeJSON()
|
||||
} else {
|
||||
c.Abort("404")
|
||||
}
|
||||
}
|
||||
|
||||
func getUsefulRequest2(ctx *context.Context) *http.Request {
|
||||
ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(ctx.Input.RequestBody))
|
||||
return ctx.Request
|
||||
|
||||
Reference in New Issue
Block a user