Commit c9fa6d48 authored by wangp's avatar wangp

必康币

parent c2347ab6
......@@ -10,7 +10,7 @@ type PlaceAnOrderParamInput struct {
GoodsPrice float64 `json:"goods_price" description:"商品金额,个位为分"`
NoticeURL string `json:"notice_url" description:"客户端回调的url"`
PayType int `json:"pay_type" description:"支付渠道 1:微信 2:支付宝 3:拉卡拉 4:收钱吧"`
SourceCode uint8 `json:"source_code" description:"支付方式 1:微信Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9:B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡)"`
SourceCode uint8 `json:"source_code" description:"支付方式 1:微信Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9:B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) 16:微信小程序-必康自营 17:微信JASPI-必康自营"`
OpenID string `json:"open_id" description:"此参数 支付类型是 JS API 的时候 必传"`
WapURL string `json:"wap_url" description:"WAP网站URL地址, 支付方式为微信MWEB时 必传"`
WapName string `json:"wap_name" description:"WAP网站名称, 支付方式为微信MWEB时 必传"`
......
......@@ -111,9 +111,11 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
//source_code 1: 微信 Native 2:微信小程序 3:微信内支付 4:h5 跳微信
//5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app)
//9: B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) 16:微信小程序-必康自营
//9: B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡)
//16:微信小程序-必康自营 17:微信JASPI-必康自营
if input.SourceCode==4 || input.SourceCode==6 ||input.SourceCode==1 ||
input.SourceCode==5 || input.SourceCode==15 || input.SourceCode==16 {
input.SourceCode==5 || input.SourceCode==15 ||
input.SourceCode==16 || input.SourceCode==17 {
//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
//聚合收银台(快捷支付(银行卡))
//聚合收银台(微信小程序-必康自营)
......@@ -129,7 +131,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
if input.SourceCode==4 || input.SourceCode==6 {
data2["merchant_no"] = merchant_no1 //微信H5、支付宝H5
} else {
data2["merchant_no"] = merchant_no2 //微信扫码、支付宝扫码、快捷支付(银行卡)、微信小程序-必康自营
data2["merchant_no"] = merchant_no2 //其它
}
data2["total_amount"] = input.GoodsPrice*100
data2["out_order_no"] = orderID //随机生成的订单号 //商户订单号
......@@ -137,7 +139,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
if input.SourceCode==15 {
//快捷支付
data2["counter_param"] = "{\"pay_mode\":\"QUICK_PAY\"}"
} else if input.SourceCode < 5 || input.SourceCode==16 {
} else if input.SourceCode < 5 || input.SourceCode==16 || input.SourceCode==17 {
//微信
data2["counter_param"] = "{\"pay_mode\":\"WECHAT\"}"
} else {
......@@ -231,7 +233,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
data["req_data"] = data2
} else {
return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9,15,16]")
return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9,15-17]")
}
//数据重组 - end
fmt.Println("拉卡拉输入参数")
......@@ -322,24 +324,27 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url string, data_json []b
//return nil, temp["resp_data"]["counter_url"]
response := make(map[string]string)
if source_code==4 || source_code==6 || source_code==1 || source_code==5 || source_code==15 || input.SourceCode==16 {
if source_code==4 || source_code==6 || source_code==1 || source_code==5 || source_code==15 || input.SourceCode==16 || input.SourceCode==17 {
//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码、快捷支付(银行卡))
//聚合收银台(微信小程序-必康自营)
//聚合收银台(微信小程序-必康自营)、聚合JSAPI(微信小程序-必康自营)
temp2, _ := temp["resp_data"].(map[string]interface{})
if temp2["counter_url"]=="" {
return errors.New("拉卡拉返回值「counter_url」为空错误"), "", temp
}
if source_code==4 || source_code==6 || source_code==15 || input.SourceCode==16 {
if source_code==4 || source_code==6 || source_code==15 || source_code==17 {
//微信H5、支付宝H5、快捷支付(银行卡)
//聚合收银台(微信小程序-必康自营)
//聚合收银台(微信JSAPI-必康自营)
response["m_web_url"] = temp2["counter_url"].(string)
} else {
} else if source_code==1 || source_code==5 {
//微信扫码、支付宝扫码
response["qr_code_url"] = temp2["counter_url"].(string)
} else {
//聚合收银台(微信小程序-必康自营)
response["counter_url"] = temp2["counter_url"].(string)
}
} else if source_code==2 || source_code==3 {
//聚合主扫(微信JSAPI+微信小程序)
//聚合主扫(微信JSAPI+微信小程序)(必康自营除外)
temp2, _ := temp["resp_data"].(map[string]interface{})
temp3, _ := temp2["acc_resp_fields"].(map[string]interface{})
if temp2["acc_resp_fields"]=="" {
......@@ -692,7 +697,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
data["req_data"] = make(map[string]interface{})
data["req_data"] = data2
//return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9]")
//return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9,15-17]")
//数据重组 - end
fmt.Println("拉卡拉输入参数(退款)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment