Exemple #1
0
        public override void VerifyNotify(int timeout, string configXml)
        {
            Hashtable   hashtable = IPosMUtil.parseStringToMap(IPosMUtil.keyValueToString(this.parameters));
            XmlDocument document  = new XmlDocument();

            document.LoadXml(configXml);
            string innerText = document.FirstChild.SelectSingleNode("Key").InnerText;
            string str3      = (string)hashtable["merchantId"];
            string str4      = (string)hashtable["payNo"];
            string str5      = (string)hashtable["returnCode"];
            string str6      = (string)hashtable["message"];
            string str7      = (string)hashtable["signType"];
            string str8      = (string)hashtable["type"];
            string str9      = (string)hashtable["version"];
            string str10     = (string)hashtable["amount"];
            string str11     = (string)hashtable["amtItem"];
            string str12     = (string)hashtable["bankAbbr"];
            string str13     = (string)hashtable["mobile"];
            string str14     = (string)hashtable["orderId"];
            string str15     = (string)hashtable["payDate"];
            string str16     = (string)hashtable["accountDate"];
            string str17     = (string)hashtable["reserved1"];
            string str18     = (string)hashtable["reserved2"];
            string str19     = (string)hashtable["status"];
            string str20     = (string)hashtable["orderDate"];
            string str21     = (string)hashtable["fee"];
            string hmac      = (string)hashtable["hmac"];
            string source    = str3 + str4 + str5 + str6 + str7 + str8 + str9 + str10 + str11 + str12 + str13 + str14 + str15 + str16 + str17 + str18 + str19 + str20 + str21;

            if (!"000000".Equals(str5))
            {
                this.OnNotifyVerifyFaild();
            }
            else if ("MD5".Equals(GlobalParam.getInstance().signType) && !SignUtil.verifySign(source, innerText, hmac))
            {
                this.OnNotifyVerifyFaild();
            }
            else
            {
                this.OnFinished(false);
            }
        }
Exemple #2
0
        public override decimal GetOrderAmount()
        {
            string s = (string)IPosMUtil.parseStringToMap(IPosMUtil.keyValueToString(this.parameters))["amount"];

            return(decimal.Parse(s) / 100M);
        }
Exemple #3
0
 public override string GetOrderId()
 {
     return((string)IPosMUtil.parseStringToMap(IPosMUtil.keyValueToString(this.parameters))["orderId"]);
 }
Exemple #4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Request.ContentEncoding = Encoding.GetEncoding("GBK");
            //后台接收支付结果通知
            NameValueCollection param = Context.Request.Form;

            try
            {
                PerrMsg.Text = "";
                String reqData = IPosMUtil.keyValueToString(param);
                log.Info("reqData = " + reqData);
                Hashtable ht = IPosMUtil.parseStringToMap(reqData);

                // 取得singKey值
                String signKey = GlobalParam.getInstance().signKey;
                //支付结果通知
                String merchantId  = (String)ht["merchantId"];
                String payNo       = (String)ht["payNo"];
                String returnCode  = (String)ht["returnCode"];
                String message     = (String)ht["message"];
                String signType    = (String)ht["signType"];
                String type        = (String)ht["type"];
                String version     = (String)ht["version"];
                String amount      = (String)ht["amount"];
                String amtItem     = (String)ht["amtItem"];
                String bankAbbr    = (String)ht["bankAbbr"];
                String mobile      = (String)ht["mobile"];
                String orderId     = (String)ht["orderId"];
                String payDate     = (String)ht["payDate"];
                String accountDate = (String)ht["accountDate"];
                String reserved1   = (String)ht["reserved1"];
                String reserved2   = (String)ht["reserved2"];
                String status      = (String)ht["status"];
                String orderDate   = (String)ht["orderDate"];
                String fee         = (String)ht["fee"];
                String hmac        = (String)ht["hmac"];


                //进行验签的原文
                String signData = merchantId + payNo + returnCode + message + signType
                                  + type + version + amount + amtItem + bankAbbr + mobile
                                  + orderId + payDate + accountDate + reserved1 + reserved2 + status
                                  + orderDate + fee;


                if ("000000".Equals(returnCode))
                {
                    if ("MD5".Equals(GlobalParam.getInstance().signType))
                    {
                        if (SignUtil.verifySign(signData, signKey, hmac))
                        {
                            Pamount.Text    = amount;
                            PamtItem.Text   = amtItem;
                            PbankAbbr.Text  = bankAbbr;
                            Pmobile.Text    = mobile;
                            PorderId.Text   = orderId;
                            PpayDate.Text   = payDate;
                            Preserved1.Text = HttpUtility.UrlDecode(reserved1, Encoding.UTF8);
                            Preserved2.Text = HttpUtility.UrlDecode(reserved2, Encoding.UTF8);
                            Pstatus.Text    = status;

                            PorderDate.Text = orderDate;
                            Pfee.Text       = fee;
                        }
                        else
                        {
                            PerrMsg.Text     = "签约失败";
                            PreturnCode.Text = returnCode;
                            Pmessage.Text    = HttpUtility.UrlDecode(message, Encoding.UTF8);
                        }
                    }
                }
                else
                {
                    PerrMsg.Text     = "页面通知失败";
                    PreturnCode.Text = returnCode;
                    Pmessage.Text    = HttpUtility.UrlDecode(message, Encoding.UTF8);
                }
            }
            catch (Exception el)
            {
                log.Error("Received Notify failed:" + el.Message);
                PerrMsg.Text = HttpUtility.UrlDecode(el.Message, Encoding.UTF8);
            }
        }