Пример #1
0
        public IActionResult RemitRequestSubmit(string mer_no, string mer_remit_no, string apply_date, string bank_code, string province, string city, string card, string name, string amount, string remark)
        {
            string card_and_name_str = card + "|" + name;
            string card_and_name     = AesUtil.AESEncrypt(card_and_name_str, ConstantUtil.REMIT_KEY);
            string sign_type         = ConstantUtil.SIGN_TYPE;

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("card_and_name", card_and_name);
            dic.Add("mer_no", mer_no);
            dic.Add("mer_remit_no", mer_remit_no);
            dic.Add("apply_date", apply_date);
            dic.Add("bank_code", bank_code);
            dic.Add("province", province);
            dic.Add("city", city);
            dic.Add("amount", amount);
            dic.Add("remark", remark);
            String signStr = SignUtil.sortData(dic);
            String sign    = MD5.Md5Hash(signStr, ConstantUtil.REMIT_KEY);

            dic.Add("sign_type", sign_type);
            dic.Add("sign", sign);
            dic["card_and_name"] = System.Web.HttpUtility.UrlEncode(card_and_name);
            String result           = HttpClientUtil.Post(ConstantUtil.REMIT_URL, dic);
            var    obj              = JsonConvert.DeserializeObject <dynamic>(result);
            string ret_sign_type    = obj.sign_type;
            string ret_sign         = obj.sign;
            string ret_mer_no       = obj.mer_no;
            string ret_auth_result  = obj.auth_result;
            string ret_error_msg    = obj.error_msg;
            string ret_mer_remit_no = obj.ret_mer_remit_no;
            string ret_trade_result = obj.ret_trade_result;
            string ret_amount       = obj.amount;
            string ret_apply_date   = obj.apply_date;

            Dictionary <string, string> dic1 = new Dictionary <string, string>();

            SignUtil.putIfNotNull(dic1, "mer_no", ret_mer_no);
            SignUtil.putIfNotNull(dic1, "auth_result", ret_auth_result);
            SignUtil.putIfNotNull(dic1, "error_msg", ret_error_msg);
            SignUtil.putIfNotNull(dic1, "ret_mer_remit_no", ret_mer_remit_no);
            SignUtil.putIfNotNull(dic1, "ret_trade_result", ret_trade_result);
            SignUtil.putIfNotNull(dic1, "ret_amount", ret_amount);
            SignUtil.putIfNotNull(dic1, "apply_date", ret_apply_date);

            string retSignStr = SignUtil.sortData(dic1);
            string retSign    = MD5.Md5Hash(retSignStr, ConstantUtil.REMIT_KEY);

            if (!ConstantUtil.SIGN_TYPE.Equals(ret_sign_type) || !retSign.Equals(ret_sign))
            {
                Console.WriteLine("签名验证失败");
            }
            else
            {
                Console.WriteLine("签名验证成功");
            }


            return(View((object)result));
        }
Пример #2
0
        public IActionResult BalanceQuerySubmit(string mer_no)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("mer_no", mer_no);
            string sign_type = ConstantUtil.SIGN_TYPE;
            String signStr   = SignUtil.sortData(dic);
            String sign      = MD5.Md5Hash(signStr, ConstantUtil.REMIT_KEY);

            dic.Add("sign", sign);
            dic.Add("sign_type", sign_type);
            string result           = HttpClientUtil.Post(ConstantUtil.BALANCE_QUERY_URL, dic);
            var    obj              = JsonConvert.DeserializeObject <dynamic>(result);
            string ret_sign_type    = obj.sign_type;
            string ret_sign         = obj.sign;
            string ret_mer_no       = obj.mer_no;
            string ret_auth_result  = obj.auth_result;
            string ret_error_msg    = obj.error_msg;
            string amount           = obj.amount;
            string frozen_amount    = obj.frozen_amount;
            string available_amount = obj.available_amount;
            string status           = obj.status;
            string unsettle_amount  = obj.unsettle_amount;

            Dictionary <string, string> dic1 = new Dictionary <string, string>();

            SignUtil.putIfNotNull(dic1, "mer_no", ret_mer_no);
            SignUtil.putIfNotNull(dic1, "auth_result", ret_auth_result);
            SignUtil.putIfNotNull(dic1, "error_msg", ret_error_msg);
            SignUtil.putIfNotNull(dic1, "amount", amount);
            SignUtil.putIfNotNull(dic1, "frozen_amount", frozen_amount);
            SignUtil.putIfNotNull(dic1, "available_amount", available_amount);
            SignUtil.putIfNotNull(dic1, "status", status);
            SignUtil.putIfNotNull(dic1, "unsettle_amount", unsettle_amount);

            string retSignStr = SignUtil.sortData(dic1);
            string retSign    = MD5.Md5Hash(retSignStr, ConstantUtil.REMIT_KEY);

            if (!ConstantUtil.SIGN_TYPE.Equals(ret_sign_type) || !retSign.Equals(ret_sign))
            {
                Console.WriteLine("签名验证失败");
            }
            else
            {
                Console.WriteLine("签名验证成功");
            }
            return(View((object)result));
        }
Пример #3
0
        public IActionResult SelectOrderSubmit(string mer_no, string mer_order_no)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("mer_no", mer_no);
            dic.Add("mer_order_no", mer_order_no);
            string sign = getSign(dic);

            dic.Add("sign", sign);
            dic.Add("sign_type", ConstantUtil.SIGN_TYPE);
            string result          = HttpClientUtil.Post(ConstantUtil.SELECT_Order_URL, dic);
            var    obj             = JsonConvert.DeserializeObject <dynamic>(result);
            string ret_sign_type   = obj.sign_type;
            string ret_sign        = obj.sign;
            string ret_mer_no      = obj.mer_no;
            string ret_auth_result = obj.auth_result;
            string ret_error_msg   = obj.error_msg;
            string trade_amount    = obj.trade_amount;
            string trade_result    = obj.trade_result;
            string m_order_no      = obj.mer_order_no;
            string order_no        = obj.order_no;
            string pay_date        = obj.pay_date;

            Dictionary <string, string> dic1 = new Dictionary <string, string>();

            SignUtil.putIfNotNull(dic1, "mer_no", ret_mer_no);
            SignUtil.putIfNotNull(dic1, "auth_result", ret_auth_result);
            SignUtil.putIfNotNull(dic1, "error_msg", ret_error_msg);
            SignUtil.putIfNotNull(dic1, "trade_amount", trade_amount);
            SignUtil.putIfNotNull(dic1, "trade_result", trade_result);
            SignUtil.putIfNotNull(dic1, "mer_order_no", m_order_no);
            SignUtil.putIfNotNull(dic1, "order_no", order_no);
            SignUtil.putIfNotNull(dic1, "pay_date", pay_date);

            string retSignStr = SignUtil.sortData(dic1);
            string retSign    = MD5.Md5Hash(retSignStr, ConstantUtil.PAY_KEY);

            if (!ConstantUtil.SIGN_TYPE.Equals(ret_sign_type) || !retSign.Equals(ret_sign))
            {
                Console.WriteLine("签名验证失败");
            }
            else
            {
                Console.WriteLine("签名验证成功");
            }
            return(View((object)result));
        }