Commit 899536af authored by wangp's avatar wangp

拉卡拉

parent 17c0ab2a
......@@ -34,8 +34,8 @@ WORKDIR /go/src/system_pay
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/prod ./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/i18n ./i18n
......
......@@ -114,3 +114,4 @@ lakala:
url_preorder: 'https://test.wsmsd.cn/sit/api/v3/labs/trans/preorder' #聚合主扫(微信JSAPI、微信小程序)
url_micropay: 'https://test.wsmsd.cn/sit/api/v3/labs/trans/micropay' #聚合被扫(扫码枪)
url_refund: 'https://test.wsmsd.cn/sit/api/v3/labs/relation/refund' #聚合扫码-退款交易
url_trade_refund: 'https://test.wsmsd.cn/sit/api/v3/lams/trade/trade_refund' #统一退货接口
......@@ -114,3 +114,4 @@ lakala:
url_preorder: 'https://s2.lakala.com/api/v3/labs/trans/preorder' #聚合主扫(微信JSAPI、微信小程序)
url_micropay: 'https://s2.lakala.com/api/v3/labs/trans/micropay' #聚合被扫(扫码枪)
url_refund: 'https://s2.lakala.com/api/v3/labs/relation/refund' #聚合扫码-退款交易
url_trade_refund: 'https://s2.lakala.com/api/v3/lams/trade/trade_refund' #统一退货接口
......@@ -340,7 +340,6 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, dat
return errors.New("拉卡拉返回值「counter_url」为空错误"), "", temp
}
if source_code==4 || source_code==6 || source_code==15 || source_code==17 {
//微信H5、支付宝H5、快捷支付(银行卡)(包括微信小程序)
//聚合收银台(微信JSAPI-必康自营)
......@@ -642,8 +641,13 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
var url string
data := make(map[string]interface{})
//url = "https://test.wsmsd.cn/sit/api/v3/labs/relation/refund" //聚合扫码(退款交易)
url = setting.Conf.Lakala.UrlRefund //聚合扫码(退款交易)
if source_code==15 {
//快捷支付(银行卡)
url = setting.Conf.Lakala.UrlTradeRefund //统一退货接口
} else {
//其它
url = setting.Conf.Lakala.UrlRefund //聚合扫码(退款交易)
}
data["req_time"] = date_time1
data["version"] = version
......@@ -653,15 +657,20 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
//source_code 1: 微信 Native 2:微信小程序 3:微信内支付 4:h5 跳微信
//5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app)
//9: B2C 10:bk支付宝web 11:bk 支付宝手机
if source_code==4 || source_code==6 ||source_code==1 || source_code==5 || source_code==15 {
//9: B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡)
//16:微信小程序-必康自营 17:微信JASPI-必康自营
if source_code==4 || source_code==6 || source_code==1 ||
source_code==5 || source_code==15 ||
source_code==16 || source_code==17 {
//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
//聚合收银台(快捷支付(银行卡))
//聚合收银台(微信小程序-必康自营)
//data2["merchant_no"] = "8221210701101SB"
//data2["merchant_no"] = "8222900581201QB"
if source_code==4 || source_code==6 || source_code==15 {
data2["merchant_no"] = merchant_no1 //微信H5、支付宝H5、快捷支付(银行卡)
if source_code==4 || source_code==6 {
data2["merchant_no"] = merchant_no1 //微信H5、支付宝H5
} else {
data2["merchant_no"] = merchant_no2 //微信扫码、支付宝扫码
data2["merchant_no"] = merchant_no2 //其它
}
//收银台支付时,没有传「term_no」,所以需要取得支付返回值的「trans_term_no」
data2["term_no"] = trans_term_no
......@@ -680,7 +689,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
data2["term_no"] = term_no4
} else {
return nil, errors.New("「source_code」错误,有效值为[1-6,9]")
return nil, errors.New("「source_code」错误,有效值为[1-6,9,15-17]")
}
data2["out_trade_no"] = refundID //随机生成的订单号 //商户交易流水号
......@@ -695,8 +704,18 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
//data2["origin_out_trade_no"] = input.OrderId //原商户交易流水号
//data2["origin_trade_no"] = input.OrderId //原拉卡拉交易流水号
//data2["origin_log_no"] = input.OrderId //原对账单流水号
if source_code==15 {
//快捷支付(银行卡)
data2["origin_biz_type"] = "4" //原交易类型:1 银行卡,2 外卡,3 扫码,4 线上
data2["refund_type"] = "00" //当商户进件时退货模式配置的为 指定模式退货时,该字段有效。00:退货帐户,05:商户余额退货,06:终端余额退货
data2["origin_card_no"] = "621700*********0114" //原交易银行卡号,银行卡退款必填
//data2["origin_trade_no"] = //原交易拉卡拉交易订单号
}
data2["origin_log_no"] = log_no //原对账单流水号
data3 := make(map[string]interface{})
//data3["request_ip"] = "10.176.1.192"
data3["request_ip"] = ip
......@@ -728,8 +747,12 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
return nil, err
}
var input2 models.PlaceAnOrderParamInput
//input2.SourceCode = source_code
input2.PlatformType = platform_type
//调拉卡拉接口
err, _, lakala_rtn := lakala_post(nil, url, "", data_json)
err, _, lakala_rtn := lakala_post(&input2, url, "", data_json)
if err != nil {
InsertPayBillDetailResponseBody(tx, billID, lakala_rtn)
return nil, err
......@@ -772,6 +795,12 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
//fmt.Println(notice_request2)
//fmt.Println(notice_request)
fmt.Println("退款订单存在check返回值:")
fmt.Println(billID)
fmt.Println(status)
fmt.Println(source_code)
fmt.Println(platform_type)
//fmt.Println(notice_request2)
// 订单不存在
if billID <= 0 {
......@@ -784,7 +813,7 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
}
if source_code==0 {
return "", "", 0, 0, errors.New("「source_code」错误,有效值为[1-6,9,15,16]")
return "", "", 0, 0, errors.New("「source_code」错误,有效值为[1-6,9,15-17]")
}
// 获取「对账单流水号」和「交易终端号」,退款用
......
......@@ -119,6 +119,7 @@ type Lakala struct {
UrlPreorder string `mapstructure:"url_preorder"` //聚合主扫(微信JSAPI、微信小程序)
UrlMicropay string `mapstructure:"url_micropay"` //聚合被扫(扫码枪)
UrlRefund string `mapstructure:"url_refund"` //聚合扫码-退款交易
UrlTradeRefund string `mapstructure:"url_trade_refund"` //统一退货接口
}
// Init 支持热修改的viper设置
......
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