<%@ Page Language="C#" StylesheetTheme="" EnableTheming="false" Inherits="PowerEasy.Foundation.Web.UI.BasePage"%>
<%@ Import Namespace="System.IO" %>

<script runat="server">
     protected void Page_Load(object sender, EventArgs e)
    {
        string payOnlineShopID;
        string PayOnlineKey;
        int payPlatformId = 1;  //网银在线
        PowerEasy.Module.General.Model.Accessories.PayPlatformInfo payPlatform = PowerEasy.Module.General.BusinessLogic.Accessories.PayPlatform.GetPayPlatformById(payPlatformId);
        if (payPlatform.IsDisabled || payPlatform.MD5 == "3069" || string.IsNullOrEmpty(payPlatform.MD5))
        {
            Response.Write(Resources.DynamicPageResources.PayOnline_PayResult99bill_ToPayNo);
            return;
        }
        payOnlineShopID = payPlatform.AccountsId;
        PayOnlineKey = payPlatform.MD5;
         
         
         string v_mid, v_oid, v_pmode, v_pstatus, v_pstring, v_amount, v_md5, v_moneytype;

        v_mid = payOnlineShopID;
        v_oid = Request["v_oid"] == null ? "" : Request["v_oid"].Trim();                //支付订单号
        v_md5 = Request["v_md5str"] == null ? "" : Request["v_md5str"].Trim();           //数字签名
        v_amount = Request["v_amount"] == null ? "" : Request["v_amount"].Trim();         //支付金额
        v_pstatus = Request["v_pstatus"] == null ? "" : Request["v_pstatus"].Trim();       //支付状态
        v_moneytype = Request["v_moneytype"] == null ? "" : Request["v_moneytype"].Trim();   //支付币种
        //v_pmode = Request["v_pmode"] == null ? "" : Request["v_pmode"].Trim();           //支付银行
        //v_pstring = Request["v_pstring"] == null ? "" : Request["v_pstring"].Trim(); ;       //支付结果说明

        Request.ContentEncoding = System.Text.Encoding.GetEncoding("GBK");
        StreamReader sr = new StreamReader(Request.InputStream, Encoding.GetEncoding(936));
        String query = sr.ReadToEnd();
        NameValueCollection reqResult = HttpUtility.ParseQueryString(query, Encoding.GetEncoding(936));
        v_pstring = reqResult["v_pstring"];
        v_pmode = reqResult["v_pmode"];

        string md5string = PowerEasy.Framework.Common.DataCrypto.MD5(v_oid + v_pstatus + v_amount + v_moneytype + PayOnlineKey);

        if (((md5string.ToUpper()) == (v_md5.ToUpper())) && v_pstatus == "20")
        {
            Response.Write("ok");
            try
            {
                PowerEasy.Module.Shop.BusinessLogic.PayOnline payOnline = new PowerEasy.Module.Shop.BusinessLogic.PayOnline();
                payOnline.UpdateOrder(v_oid, PowerEasy.Framework.Common.DataConverter.ToDecimal(v_amount), v_pmode, 3, v_pstring, true, true);
            }
            catch
            { }
        }
        else
        {
            Response.Write("error");
        }
        PowerEasy.Module.Shop.BusinessLogic.PayOnline.TestLog(false, Resources.DynamicPageResources.PayOnline_PayResultChinabankAutoRecieve_OnLineInterface, v_pstatus, v_md5.ToUpper(), md5string.ToUpper());
    }
</script>


