Commit 69307215 authored by wangp's avatar wangp

「聚合主扫(支付宝)」支付开发

parent 23c95f8b
...@@ -34,8 +34,8 @@ WORKDIR /go/src/system_pay ...@@ -34,8 +34,8 @@ WORKDIR /go/src/system_pay
COPY --from=0 /go/src/system_pay/server ./ COPY --from=0 /go/src/system_pay/server ./
# 拷贝配置文件到当前工作目录 # 拷贝配置文件到当前工作目录
COPY --from=0 /go/src/system_pay/conf/dev ./conf # COPY --from=0 /go/src/system_pay/conf/dev ./conf
# COPY --from=0 /go/src/system_pay/conf/prod ./conf COPY --from=0 /go/src/system_pay/conf/prod ./conf
# 拷贝国际化文件夹到当前工作目录 # 拷贝国际化文件夹到当前工作目录
COPY --from=0 /go/src/system_pay/i18n ./i18n COPY --from=0 /go/src/system_pay/i18n ./i18n
......
...@@ -51,6 +51,7 @@ func (l *PayController) CashierNotice(c *gin.Context) { ...@@ -51,6 +51,7 @@ func (l *PayController) CashierNotice(c *gin.Context) {
ph := new(models.CashierNoticeInput) ph := new(models.CashierNoticeInput)
err := c.ShouldBindBodyWith(&ph, binding.JSON) err := c.ShouldBindBodyWith(&ph, binding.JSON)
if err != nil { if err != nil {
fmt.Println("拉卡拉回调(收银台)执行失败2")
response := new(base.ResponseDataWxNotice) response := new(base.ResponseDataWxNotice)
response.Code = "FAIL" response.Code = "FAIL"
response.Message = "执行失败2" response.Message = "执行失败2"
......
...@@ -113,7 +113,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -113,7 +113,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
//source_code 1: 微信 Native 2:微信小程序 3:微信内支付 4:h5 跳微信 //source_code 1: 微信 Native 2:微信小程序 3:微信内支付 4:h5 跳微信
//5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) //5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app)
//9: B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) //9: B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡)
//16:微信小程序-必康自营 17:微信JASPI-必康自营 //16:微信小程序-必康自营 17:微信JASPI-必康自营 18:支付宝
if input.SourceCode==4 || input.SourceCode==6 ||input.SourceCode==1 || if input.SourceCode==4 || input.SourceCode==6 ||input.SourceCode==1 ||
input.SourceCode==5 || input.SourceCode==15 || input.SourceCode==5 || input.SourceCode==15 ||
input.SourceCode==16 || input.SourceCode==17 { input.SourceCode==16 || input.SourceCode==17 {
...@@ -160,8 +160,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -160,8 +160,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
data["req_data"] = make(map[string]interface{}) data["req_data"] = make(map[string]interface{})
data["req_data"] = data2 data["req_data"] = data2
} else if input.SourceCode==2 || input.SourceCode==3 { } else if input.SourceCode==2 || input.SourceCode==3 || input.SourceCode==18 {
//聚合主扫(微信JSAPI、微信小程序) //聚合主扫(微信JSAPI、微信小程序、支付宝)
url = setting.Conf.Lakala.UrlPreorder //聚合主扫 url = setting.Conf.Lakala.UrlPreorder //聚合主扫
// 构造回调url // 构造回调url
...@@ -180,9 +180,11 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -180,9 +180,11 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
//data2["goods_mark"] = input.AttachInfo //商品信息标识 (1:含商品信息,不填默认不含商品信息) //data2["goods_mark"] = input.AttachInfo //商品信息标识 (1:含商品信息,不填默认不含商品信息)
//微信JSAPI、微信小程序 //微信JSAPI、微信小程序
data2["account_type"] = "WECHAT" //钱包类型
if input.SourceCode==2 { if input.SourceCode==2 {
data2["trans_type"] = "71" //接入方式:微信小程序 data2["trans_type"] = "71" //接入方式:微信小程序
} else if input.SourceCode==18 {
data2["trans_type"] = "41" //接入方式:ALIPAY
} else { } else {
data2["trans_type"] = "51" //接入方式:微信JSAPI data2["trans_type"] = "51" //接入方式:微信JSAPI
} }
...@@ -193,13 +195,19 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -193,13 +195,19 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
data2["location_info"] = make(map[string]interface{}) data2["location_info"] = make(map[string]interface{})
data2["location_info"] = data3 data2["location_info"] = data3
//地址位置信息 if input.SourceCode==18 {
data2["account_type"] = "ALIPAY" //钱包类型
} else {
data2["account_type"] = "WECHAT" //钱包类型
//账户端业务信息域
data4 := make(map[string]interface{}) data4 := make(map[string]interface{})
data4["sub_appid"] = input.AppID //子商户公众账号ID data4["sub_appid"] = input.AppID //子商户公众账号ID
data4["user_id"] = input.OpenID //用户标识(sub_openid) data4["user_id"] = input.OpenID //用户标识(sub_openid)
data2["acc_busi_fields"] = make(map[string]interface{}) data2["acc_busi_fields"] = make(map[string]interface{})
data2["acc_busi_fields"] = data4 data2["acc_busi_fields"] = data4
}
data["req_data"] = make(map[string]interface{}) data["req_data"] = make(map[string]interface{})
data["req_data"] = data2 data["req_data"] = data2
...@@ -272,7 +280,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -272,7 +280,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
tx.Rollback() tx.Rollback()
return nil, err return nil, err
} }
fmt.Println("谛宝多多拼接后返回值:")
fmt.Println(response)
// 插入下单成功后返回的参数 // 插入下单成功后返回的参数
err = InsertPayBillDetailResponseBody(tx, billID, lakala_rtn) err = InsertPayBillDetailResponseBody(tx, billID, lakala_rtn)
if err != nil { if err != nil {
...@@ -352,7 +361,7 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, dat ...@@ -352,7 +361,7 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, dat
} }
} else if source_code==2 || source_code==3 { } else if source_code==2 || source_code==3 {
//聚合主扫(微信JSAPI+微信小程序)(必康自营的微信小程序除外) //聚合主扫(微信JSAPI微信小程序)(必康自营的微信小程序除外)
temp2, _ := temp["resp_data"].(map[string]interface{}) temp2, _ := temp["resp_data"].(map[string]interface{})
temp3, _ := temp2["acc_resp_fields"].(map[string]interface{}) temp3, _ := temp2["acc_resp_fields"].(map[string]interface{})
if temp2["acc_resp_fields"]=="" { if temp2["acc_resp_fields"]=="" {
...@@ -365,6 +374,23 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, dat ...@@ -365,6 +374,23 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, dat
response["prepay_id"] = temp3["prepay_id"].(string) response["prepay_id"] = temp3["prepay_id"].(string)
response["sign_type"] = temp3["sign_type"].(string) response["sign_type"] = temp3["sign_type"].(string)
response["timeStamp"] = temp3["time_stamp"].(string) response["timeStamp"] = temp3["time_stamp"].(string)
} else if source_code==18 {
//聚合主扫(支付宝)
temp2, _ := temp["resp_data"].(map[string]interface{})
if temp2["out_trade_no"]=="" {
return errors.New("拉卡拉返回值「out_trade_no」为空错误"), "", temp
}
out_trade_no := temp2["out_trade_no"].(string)
if temp2["acc_resp_fields"]=="" {
return errors.New("拉卡拉返回值「acc_resp_fields」为空错误"), "", temp
}
temp3, _ := temp2["acc_resp_fields"].(map[string]interface{})
url := temp3["code"].(string)
//out_trade_no := temp3["out_trade_no"].(string)
response["url"] = url + "?biz_content={\"out_trade_no\":\"" + out_trade_no + "\"}"
return nil, response["url"], temp
} else if source_code==9 { } else if source_code==9 {
//扫码枪 //扫码枪
//mBody := map[string]string{ //mBody := map[string]string{
...@@ -477,7 +503,7 @@ func ReadParsePrivaterKey(filename string) (*rsa.PrivateKey, error) { ...@@ -477,7 +503,7 @@ func ReadParsePrivaterKey(filename string) (*rsa.PrivateKey, error) {
// GetNoticeURL is 获取回调地址 // GetNoticeURL is 获取回调地址
func GetNoticeURL(source_code uint8) string { func GetNoticeURL(source_code uint8) string {
domainName := setting.Conf.PayUrl.DomainName domainName := setting.Conf.PayUrl.DomainName
if source_code==2 || source_code==3 || source_code==9 { if source_code==2 || source_code==3 || source_code==9 || source_code==18 {
//聚合扫码+聚合被扫 //聚合扫码+聚合被扫
return domainName + "/api/v1/pay/scan_notice" return domainName + "/api/v1/pay/scan_notice"
} else { } else {
...@@ -671,7 +697,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro ...@@ -671,7 +697,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
source_code==16 || source_code==17 { source_code==16 || source_code==17 {
//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码) //聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
//聚合收银台(快捷支付(银行卡)) //聚合收银台(快捷支付(银行卡))
//聚合收银台(微信小程序-必康自营) //聚合收银台(微信小程序-必康自营、微信JASPI-必康自营)
//data2["merchant_no"] = "8221210701101SB" //data2["merchant_no"] = "8221210701101SB"
//data2["merchant_no"] = "8222900581201QB" //data2["merchant_no"] = "8222900581201QB"
if source_code==4 || source_code==6 { if source_code==4 || source_code==6 {
...@@ -683,7 +709,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro ...@@ -683,7 +709,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
data2["term_no"] = trans_term_no data2["term_no"] = trans_term_no
} else if source_code==2 || source_code==3 { } else if source_code==2 || source_code==3 {
//聚合主扫(微信JSAPI、微信小程序) //聚合主扫(微信JSAPI、微信小程序、支付宝)
//data2["merchant_no"] = "8222900701107M5" //data2["merchant_no"] = "8222900701107M5"
//data2["term_no"] = "A1062976" //data2["term_no"] = "A1062976"
//data2["merchant_no"] = "8221210701101SB" //data2["merchant_no"] = "8221210701101SB"
......
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