Пример #1
0
        private ResultSetExpressDeposit XmlToObjectResult(string xmlResult)
        {
            XmlDocument dom = new XmlDocument();

            dom.LoadXml(xmlResult);
            XmlNodeList             root = dom.DocumentElement.ChildNodes;
            ResultSetExpressDeposit obj  = new ResultSetExpressDeposit();

            obj.Result_code        = root.Item(0).InnerText;
            obj.Token              = root.Item(1).InnerText;
            obj.Link_checkout      = root.Item(2).InnerText;
            obj.Timelimit          = root.Item(3).InnerText;
            obj.Result_description = root.Item(4).InnerText;

            return(obj);
        }
Пример #2
0
        public Hashtable setExpressCheckOutDeposit()
        {
            /*
             * <receiver>[email protected]</receiver><order_code>1320985549</order_code><return_url>http://sandbox.nganluong.vn/demo/payment_success.php</return_url><cancel_url>http://sandbox.nganluong.vn/demo/payment_cancel.php</cancel_url><language>vn</language>
             */
            string param = "<params>";

            param += "<receiver>" + _receiver + "</receiver>";
            param += "<order_code>" + order_id + "</order_code>";
            param += "<return_url>" + _return_url + "</return_url>";
            param += "<cancel_url>" + _cancel_url + "</cancel_url>";
            param += "<language>" + _language + "</language>";
            param += "</params>";

            //$checksum = MD5($receiver+$order_code+$return_url+$cancel_url+$password);

            //string checksum = _receiver + order_id + _amount + _currency_code + _tax_amount;
            //checksum += _discount_amount + _fee_shipping + _request_confirm_shipping + _no_shipping + _return_url;
            //checksum += _cancel_url + _language + _token + _Password;

            String StrcheckSum = _receiver + order_id + _return_url + _cancel_url + _language + _Password;


            String CheckSumCode = CreateMD5Hash(StrcheckSum);


            String rs = api.SetExpressCheckoutDeposit(_merchant_site_code, CheckSumCode, param);
            ResultSetExpressDeposit resu = XmlToObjectResult(rs);

            //Dung test
            //resu.Link_checkout = "https://www.nganluong.vn/micro_checkout.php?token=1447-b5e142db784be7076967b2b7dd70806c";

            //Thiết lập chuỗi test nhập tiền.
            string str = "<script language=\"javascript\">";

            str += "var mc_flow = new NGANLUONG.apps.MCFlow({trigger:'btn_deposit',url:'" + resu.Link_checkout + "&payment_option=card'});";
            str += "</script>";

            Hashtable ha = new Hashtable();

            ha.Add("token", resu.Token);
            ha.Add("linkcheckout", str);
            ha.Add("status", resu.Result_code);
            ha.Add("description", resu.Result_description);
            return(ha);
        }