1
This commit is contained in:
@@ -123,7 +123,7 @@ func TestCloseOrder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueryOrder(t *testing.T) {
|
||||
api.QueryOrder("88491067682798", "141804158")
|
||||
api.QueryOrder("88491738418134", "822651059990E2S")
|
||||
}
|
||||
|
||||
func TestRefundOrderQuery(t *testing.T) {
|
||||
|
||||
@@ -100,6 +100,49 @@ func (a *API) PayStatusQuery(param *PayStatusQueryReq) (*PayStatusQueryResp, err
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ClosePay 关闭支付订单
|
||||
func (a *API) ClosePay(param *ClosePayMiniOrder) error {
|
||||
reqParameter := map[string]interface{}{
|
||||
"req_data": utils.Struct2Map(param, "", false),
|
||||
"version": Version3,
|
||||
"req_time": utils.Time2TimeStrByFormat(time.Now(), TimeFormat),
|
||||
}
|
||||
result, err := a.AccessAPISign(PayProdUrl, ClosePayActive, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if result["code"].(string) != PaySuccess {
|
||||
return fmt.Errorf(result["msg"].(string))
|
||||
}
|
||||
|
||||
return nil
|
||||
//
|
||||
//bodyResult, err := json.Marshal(result["resp_data"])
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//
|
||||
//resp := &PayStatusQueryResp{}
|
||||
//if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//
|
||||
//return resp, nil
|
||||
}
|
||||
|
||||
type ClosePayMiniOrder struct {
|
||||
MerchantNo string `json:"merchant_no"`
|
||||
TermNo string `json:"term_no"`
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no"`
|
||||
OriginTradeNo string `json:"origin_trade_no"`
|
||||
LocationInfo struct {
|
||||
RequestIp string `json:"request_ip"`
|
||||
BaseStation string `json:"base_station"`
|
||||
Location string `json:"location"`
|
||||
} `json:"location_info"`
|
||||
}
|
||||
|
||||
// ScannerPayMicroPay 扫码枪扫码支付
|
||||
func (a *API) ScannerPayMicroPay(param *PayMicroPayReq) (string, string, string, error) {
|
||||
reqParameter := map[string]interface{}{
|
||||
|
||||
@@ -8,6 +8,7 @@ const (
|
||||
PayMicropayActive = "labs/trans/micropay" // 聚合被扫
|
||||
RefundActive = "labs/relation/refund" // 主扫退款
|
||||
PayQueryActive = "labs/query/tradequery" // 支付查询
|
||||
ClosePayActive = "labs/relation/close" // 主扫关单
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -15,6 +15,22 @@ func TestPayStatusQuery(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestClosePay(t *testing.T) {
|
||||
api.ClosePay(&ClosePayMiniOrder{
|
||||
MerchantNo: "822651059990E2S",
|
||||
TermNo: "M3595962",
|
||||
OriginOutTradeNo: "88491738418134",
|
||||
OriginTradeNo: "",
|
||||
LocationInfo: struct {
|
||||
RequestIp string `json:"request_ip"`
|
||||
BaseStation string `json:"base_station"`
|
||||
Location string `json:"location"`
|
||||
}{
|
||||
RequestIp: "127.0.0.1",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestCardBin(t *testing.T) {
|
||||
result, err := api.QueryCarBin(GetOrderNumber(8), OrgCode, "4275711234554321")
|
||||
globals.SugarLogger.Debugf("result := %s", utils.Format4Output(result, false))
|
||||
|
||||
Reference in New Issue
Block a user