|
|
@@ -162,6 +162,16 @@ type Extras struct {
|
|
|
CpOrderId string `json:"cpOrderId"`
|
|
|
}
|
|
|
|
|
|
+type ExtrasRu struct {
|
|
|
+ AccountId string `json:"accountId"`
|
|
|
+ Money string `json:"money"`
|
|
|
+ Addtime string `json:"addtime"`
|
|
|
+ OrderId string `json:"orderId"`
|
|
|
+ CustomorderId string `json:"customorderId"`
|
|
|
+ Paytype string `json:"paytype"`
|
|
|
+ Success string `json:"success"`
|
|
|
+}
|
|
|
+
|
|
|
// 海外版quick回调
|
|
|
func WebPayHwQuickNotify(c *gin.Context) {
|
|
|
//util.DebugF("支付回调信息:%v", c.Request.PostForm)
|
|
|
@@ -258,6 +268,94 @@ func WebPayHwQuickNotify(c *gin.Context) {
|
|
|
c.String(http.StatusOK, "SUCCESS")
|
|
|
}
|
|
|
|
|
|
+func WebPayHwRuNotify(c *gin.Context) {
|
|
|
+ //util.DebugF("支付回调信息:%v", c.Request.PostForm)
|
|
|
+ params := make(map[string]string)
|
|
|
+ if err := c.Request.ParseForm(); err != nil {
|
|
|
+ util.InfoF("parseForm falied")
|
|
|
+ c.String(http.StatusOK, "FAILED")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ util.DebugF("支付回调信息2:%v", c.Request.PostForm)
|
|
|
+ for key, value := range c.Request.PostForm {
|
|
|
+ params[key] = value[0] // 假设每个参数只有一个值
|
|
|
+ }
|
|
|
+ sign := params["sign"]
|
|
|
+ info2 := params["custominfo"]
|
|
|
+ info := strings.ReplaceAll(info2, "\\", "")
|
|
|
+ var extras Extras
|
|
|
+ err := json.Unmarshal([]byte(info), &extras)
|
|
|
+ if err != nil {
|
|
|
+ util.ErrorF("支付回调参数解析错误:%v", err)
|
|
|
+ }
|
|
|
+ util.InfoF("支付签名认证:%v params:%v", extras, params)
|
|
|
+ if extras.Platform == "ZT_IOS" || extras.Bima == "ZT_IOS" {
|
|
|
+ util.ErrorF("ios 支付签名认证:%v", info)
|
|
|
+ newSign := getMd5Sign("80c648e7df8aaa72", params)
|
|
|
+ if newSign != sign {
|
|
|
+ util.ErrorF("签名错误%v", sign)
|
|
|
+ c.String(http.StatusOK, "FAILED")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if extras.Platform == "SDKYOUYI_IOS_MyCard" || extras.Platform == "SDKHwQuick_MyCard" {
|
|
|
+ util.ErrorF("mycard 支付签名认证:%v", info)
|
|
|
+ newSign := getMd5Sign("03422134397322604272901806704074", params)
|
|
|
+ if newSign != sign {
|
|
|
+ util.ErrorF("签名错误%v", sign)
|
|
|
+ c.String(http.StatusOK, "FAILED")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ util.ErrorF("android 支付签名认证:%v", info)
|
|
|
+ newSign := getMd5Sign("80c648e7df8aaa72", params)
|
|
|
+ if newSign != sign {
|
|
|
+ util.ErrorF("签名错误%v", sign)
|
|
|
+ c.String(http.StatusOK, "FAILED")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ uid := c.PostForm("account")
|
|
|
+ cpOrderId := c.PostForm("customorderid")
|
|
|
+ orderNo := c.PostForm("orderid")
|
|
|
+ payAmount := c.PostForm("money")
|
|
|
+ payCurrency := c.PostForm("currency")
|
|
|
+ payType := c.PostForm("paytype")
|
|
|
+ usdAmount := c.PostForm("doller")
|
|
|
+ ntfData := &WebNotifyData{}
|
|
|
+ ntfData.CpOrderId = cpOrderId
|
|
|
+ ntfData.SdkOrderId = orderNo
|
|
|
+ ntfData.PayMethod = payType
|
|
|
+ ntfData.PayCurrency = payCurrency
|
|
|
+ ntfData.PayTime = uint64(util.GetTimeSeconds())
|
|
|
+ ntfData.PayChannel = "qk_hw"
|
|
|
+ util.WarnF("paycallback uid=%v cpOrderNo=%v orderNo=%v payAmount=%v payCurrency=%v payType=%v usdAmount=%v",
|
|
|
+ uid, cpOrderId, orderNo, payAmount, payCurrency, payType, usdAmount)
|
|
|
+ f64, err := strconv.ParseFloat(usdAmount, 32)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("Error:", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ webPayNotify(ntfData, float32(f64), c)
|
|
|
+
|
|
|
+ //// 简单粗暴,直接给其他服转发,不需要确认是哪个服
|
|
|
+ //payPostRouter := service.GetServiceConfig().SDKConfig.PayPostRouter
|
|
|
+ //util.WarnF("paycallback payPostRouter:%v\n", payPostRouter)
|
|
|
+ //// 组装转发body
|
|
|
+ //params["sign"] = sign
|
|
|
+ //var routerStr strings.Builder
|
|
|
+ //for key, value := range params {
|
|
|
+ // routerStr.WriteString(key)
|
|
|
+ // routerStr.WriteString("=")
|
|
|
+ // routerStr.WriteString(value)
|
|
|
+ // routerStr.WriteString("&")
|
|
|
+ //}
|
|
|
+ //routerString := routerStr.String()
|
|
|
+ //util.WarnF("paycallback routerString:%v\n", routerString)
|
|
|
+ //go sendPosts(payPostRouter, routerString)
|
|
|
+
|
|
|
+ c.String(http.StatusOK, "success")
|
|
|
+}
|
|
|
+
|
|
|
func sendPosts(urls []string, routerString string) {
|
|
|
for i := 0; i < len(urls); i++ {
|
|
|
sendPostToOtherServer(urls[i], []byte(routerString))
|