Esempio n. 1
0
        public Hashtable SetExpressCheckoutPayment(DataTable request, String tax, String feeship)
        {
            _amount = GetTotalAmount(request, tax, feeship);
            string checksum = _receiver + order_id + _amount + _currency_code + tax;

            checksum += _discount_amount + feeship + _request_confirm_shipping + _no_shipping + _return_url;
            checksum += _cancel_url + _language + _token + _Password;



            String param = GetParams(request, tax, feeship);

            String urlCheckout = api.SetExpressCheckoutPayment(_merchant_site_code, getCheckSum(checksum), param);

            ResultExpressSetCheckOut resu = XmlToObjectResult(urlCheckout);


            //Dung test
            // resu.Link_checkout = "https://www.nganluong.vn/micro_checkout.php?token=1462-35b98139626089a7aa9c16c98b194b99&[email protected]&mobile=0904515105";

            //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_payment',url:'" + resu.Link_checkout +
                   "&payment_option=bank'});";
            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);
        }
Esempio n. 2
0
        private ResultExpressSetCheckOut XmlToObjectResult(string xmlResult)
        {
            XmlDocument dom = new XmlDocument();

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

            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);
        }