Ejemplo n.º 1
0
        /// <summary>
        /// 2.1认证会员授权码获取接口
        /// /entry_memberfront/customerinfo/MFGetAuthMemberAuthCode.do
        /// </summary>
        public void AuthCode()
        {
            RsaPrivateCrtKeyParameters privateKeyParam = (RsaPrivateCrtKeyParameters)PrivateKeyFactory.CreateKey(Convert.FromBase64String(pr));
            RsaKeyParameters           publicKeyParam  = (RsaKeyParameters)PublicKeyFactory.CreateKey(Convert.FromBase64String(pu));

            //裸公钥
            BigInteger       mod1       = new BigInteger(lpu, 16);
            BigInteger       pub1       = new BigInteger("03", 16);
            RsaKeyParameters pulickKeyL = new RsaKeyParameters(false, mod1, pub1);

            StringBuilder sbData = new StringBuilder();

            sbData.Clear();
            sbData.Append("{'serviceCode':'").Append("031001002107061").Append("'"); //一级商户代码
            sbData.Append(",'protolCode':'").Append("").Append("'");                 //协议号
            sbData.Append(",'operType':'4'");                                        //操作类型 1:证件信息 3:卡号 4:会员编号
            //sbData.Append(",'certType':'01'");//证件类型 operType为1时必填
            //sbData.Append(",'certNo':'").Append("").Append("'");//证件号 operType为1时必填
            //sbData.Append(",'cardNo':'").Append("").Append("'");//卡号 operType为3时必填
            sbData.Append(",'userId':'").Append("").Append("'");//会员编号 operType为4时必填
            //sbData.Append(",'operId':'").Append("").Append("'");//操作员ID
            sbData.Append("}");

            //获取验证签名
            string sSign = Default.GetSign(sbData.ToString(), privateKeyParam);

            //拼接Form并Post数据
            PostService ps = new PostService();

            ps.Add("data", sbData.ToString().Trim());
            ps.Add("sign", sSign);
            ps.Url = "http://172.30.122.200:8099/entry_memberfront/customerinfo/MFGetAuthMemberAuthCode.do";
            //ps.Url = "https://222.44.42.5/paycashier/account/queryOrderStatus.do";
            string result = ps.SendHttpPost();

            //返回数据
            string returnPost = "";

            if (!string.IsNullOrEmpty(returnPost))
            {
                JsonData jdP = JsonMapper.ToObject(returnPost.Trim());
                if (jdP.Count > 0)
                {
                    JsonData jdData    = jdP[0];
                    JsonData jdSign    = jdP[1];
                    string   rRespCode = Convert.ToString(jdData["respCode"]); //响应结果
                    string   rRespMsg  = Convert.ToString(jdData["respMsg"]);  //响应描述
                    string   rAuthCode = "";
                    if (rRespCode == "0000")                                   //成功
                    {
                        bool isCheck = Cmn.ValitedSign(jdSign.ToString(), jdData.ToJson());
                        if (isCheck == true)
                        {
                            //取出授权码
                            rAuthCode = Convert.ToString(jdData["authCode"]);//授权码
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        // 支付回调 前台通知
        public void ModeWappayBackA()
        {
            StringBuilder sbParam = new StringBuilder();
            Dictionary <string, string> resData = new Dictionary <string, string>();
            NameValueCollection         coll    = Request.Form;

            string[] requestItem = coll.AllKeys;
            for (int i = 0; i < requestItem.Length; i++)
            {
                resData.Add(requestItem[i], Request.Form[requestItem[i]]);
                sbParam.Append(requestItem[i]).Append("=").Append(Request.Form[requestItem[i]]).Append("&");
            }
            sbParam = sbParam.Remove(sbParam.Length - 1, 1);


            //返回数据
            string returnPost = "";

            if (!string.IsNullOrEmpty(returnPost))
            {
                JsonData jdP = JsonMapper.ToObject(returnPost.Trim());
                if (jdP.Count > 0)
                {
                    JsonData jdData    = jdP[0];
                    JsonData jdSign    = jdP[1];
                    string   rRespCode = Convert.ToString(jdData["respCode"]); //响应结果
                    string   rRespMsg  = Convert.ToString(jdData["respMsg"]);  //响应描述
                    if (rRespCode == "0000")                                   //成功
                    {
                        bool isCheck = Cmn.ValitedSign(jdSign.ToString(), jdData.ToJson());
                        if (isCheck == true)
                        {
                            string   RbigOrderNo    = Convert.ToString(jdData["bigOrderNo"]);    //总订单号
                            string   RbigOrderReqNo = Convert.ToString(jdData["bigOrderReqNo"]); //总订单请求流水号
                            string   RbigOrderAmt   = Convert.ToString(jdData["bigOrderAmt"]);   //总订单金额 单位:分
                            string   RresDate       = Convert.ToString(jdData["resDate"]);       //响应日期 YYYYMMDD
                            string   RinnerTranSeq  = Convert.ToString(jdData["innerTranSeq"]);  //平台流水号
                            JsonData jdBankFields   = jdData["resBankFields"];                   //银行响应消息
                            if (jdBankFields.Count > 0)
                            {
                                foreach (JsonData jdBF in jdBankFields)
                                {
                                    string RbankCode       = Convert.ToString(jdBF["bankCode"]);       //银行代码 0001:虚拟账户 0002:浦发银行信用卡 9999:无支付
                                    string RpayType        = Convert.ToString(jdBF["payType"]);        //支付方式 1001:消费 1009:快捷消费
                                    string RpayAmt         = Convert.ToString(jdBF["payAmt"]);         //支付金额 单位:分
                                    string RisStaging      = Convert.ToString(jdBF["isStaging"]);      //是否分期 1:分期 2:不分期
                                    string RinstInfo       = Convert.ToString(jdBF["instInfo"]);       //分期信息
                                    string RisExchangeRate = Convert.ToString(jdBF["isExchangeRate"]); //是否积分抵现 1:积分抵现 2:非积分抵现
                                    string RexchangeRate   = Convert.ToString(jdBF["exchangeRate"]);   //积分抵现信息
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 2.3订单反交易接口
        /// /paycashier/refund/BFrefund.do
        /// </summary>
        public void OrderRefund()
        {
            StringBuilder sbData = new StringBuilder();

            sbData.Clear();
            sbData.Append("{'oldBigOrderNo':'").Append("2016062900000001").Append("'"); //原总订单号
            sbData.Append(",'oldBigReqNo':'").Append("2016062900000001").Append("'");   //原总订单请求流水号
            sbData.Append(",'serviceCode':'").Append("031001002107061").Append("'");    //一级商户代码
            sbData.Append(",'refundDate':'").Append("20160629").Append("'");            //反交易日期 YYYYMMDD
            sbData.Append(",'refundAmt':'").Append("12000").Append("'");                //反交易金额 单位:分
            sbData.Append(",'mchntCode':'").Append("").Append("'");                     //二级商户代码
            sbData.Append(",'transCode':'").Append("2002").Append("'");                 //反交易类型 2001:冲正 2002:退款 2003:消费撤销 2004:预授权撤销
            sbData.Append(",'refundNo':'").Append("2016062900000001").Append("'");      //反交易请求流水号
            sbData.Append("}");

            //获取验证签名
            string sSign = Cmn.GetSign(sbData.ToString());

            //拼接Form并Post数据

            //返回数据
            string returnPost = "";

            if (!string.IsNullOrEmpty(returnPost))
            {
                JsonData jdP = JsonMapper.ToObject(returnPost.Trim());
                if (jdP.Count > 0)
                {
                    JsonData jdData    = jdP[0];
                    JsonData jdSign    = jdP[1];
                    string   rRespCode = Convert.ToString(jdData["respCode"]); //响应结果
                    string   rRespMsg  = Convert.ToString(jdData["respMsg"]);  //响应描述
                    if (rRespCode == "0000")                                   //成功
                    {
                        bool isCheck = Cmn.ValitedSign(jdSign.ToString(), jdData.ToJson());
                        if (isCheck == true)
                        {
                            string RoldBigOrderNo = Convert.ToString(jdData["oldBigOrderNo"]); //原总订单号
                            string RoldBigReqNo   = Convert.ToString(jdData["oldBigReqNo"]);   //原总订单请求流水号
                            string RrefundNo      = Convert.ToString(jdData["refundNo"]);      //反交易请求流水号
                            string RrefundAmt     = Convert.ToString(jdData["refundAmt"]);     //反交易金额 单位:分
                            string RinnerTranSeq  = Convert.ToString(jdData["innerTranSeq"]);  //平台流水号
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 2.4订单状态查询接口
        /// paycashier/account/queryOrderStatus.do
        /// </summary>
        public void OrderStatus()
        {
            StringBuilder sbData = new StringBuilder();

            sbData.Clear();
            sbData.Append("{'serviceCode':'").Append("031001002107061").Append("'"); //一级商户代码
            sbData.Append(",'bigOrderNo':'").Append("2016062900000001").Append("'"); //总订单号
            sbData.Append(",'bigReqNo':'").Append("2016062900000001").Append("'");   //总订单请求流水号
            sbData.Append("}");

            //获取验证签名
            string sSign = Cmn.GetSign(sbData.ToString());

            //拼接Form并Post数据

            //返回数据
            string returnPost = "";

            if (!string.IsNullOrEmpty(returnPost))
            {
                JsonData jdP = JsonMapper.ToObject(returnPost.Trim());
                if (jdP.Count > 0)
                {
                    JsonData jdData    = jdP[0];
                    JsonData jdSign    = jdP[1];
                    string   rRespCode = Convert.ToString(jdData["respCode"]); //响应结果
                    string   rRespMsg  = Convert.ToString(jdData["respMsg"]);  //响应描述
                    if (rRespCode == "0000")                                   //成功
                    {
                        bool isCheck = Cmn.ValitedSign(jdSign.ToString(), jdData.ToJson());
                        if (isCheck == true)
                        {
                            string RbigOrderDate = Convert.ToString(jdData["bigOrderDate"]); //总订单日期 YYYYMMDD
                            string RbigOrderNo   = Convert.ToString(jdData["bigOrderNo"]);   //总订单号
                            string RbigReqNo     = Convert.ToString(jdData["bigReqNo"]);     //总订单请求流水号
                            string RorderStatus  = Convert.ToString(jdData["orderStatus"]);  //订单状态 A:请求 B:成功 C:失败 D:待支付
                            string RbigOrderAmt  = Convert.ToString(jdData["bigOrderAmt"]);  //总订单金额 单位:分
                            string RbigPayAmt    = Convert.ToString(jdData["bigPayAmt"]);    //总支付金额 单位:分
                            string RinnerTranSeq = Convert.ToString(jdData["innerTranSeq"]); //平台流水号
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        // 支付回调 后台通知
        public void ModeWappayBackB()
        {
            StringBuilder sbParam = new StringBuilder();
            Dictionary <string, string> resData = new Dictionary <string, string>();
            NameValueCollection         coll    = Request.Form;

            string[] requestItem = coll.AllKeys;
            for (int i = 0; i < requestItem.Length; i++)
            {
                resData.Add(requestItem[i], Request.Form[requestItem[i]]);
                sbParam.Append(requestItem[i]).Append("=").Append(Request.Form[requestItem[i]]).Append("&");
            }
            sbParam = sbParam.Remove(sbParam.Length - 1, 1);

            //返回数据
            string returnPost = "";

            if (!string.IsNullOrEmpty(returnPost))
            {
                JsonData jdP = JsonMapper.ToObject(returnPost.Trim());
                if (jdP.Count > 0)
                {
                    JsonData jdData    = jdP[0];
                    JsonData jdSign    = jdP[1];
                    string   rRespCode = Convert.ToString(jdData["respCode"]); //响应结果
                    string   rRespMsg  = Convert.ToString(jdData["respMsg"]);  //响应描述
                    if (rRespCode == "0000")                                   //成功
                    {
                        bool isCheck = Cmn.ValitedSign(jdSign.ToString(), jdData.ToJson());
                        if (isCheck == true)
                        {
                            string   RbigOrderNo    = Convert.ToString(jdData["bigOrderNo"]);    //总订单号
                            string   RbigOrderReqNo = Convert.ToString(jdData["bigOrderReqNo"]); //总订单请求流水号
                            string   RresDate       = Convert.ToString(jdData["resDate"]);       //响应日期 YYYYMMDD
                            string   RinnerTranSeq  = Convert.ToString(jdData["innerTranSeq"]);  //平台流水号
                            JsonData jdBankFields   = jdData["resBankFields"];                   //银行响应消息
                            if (jdBankFields.Count > 0)
                            {
                                foreach (JsonData jdBF in jdBankFields)
                                {
                                    string RbankCode       = Convert.ToString(jdBF["bankCode"]);       //银行代码 0001:虚拟账户 0002:浦发银行信用卡 9999:无支付
                                    string RpayType        = Convert.ToString(jdBF["payType"]);        //支付方式 1001:消费 1002:预授权 1009:快捷消费
                                    string RpayAmt         = Convert.ToString(jdBF["payAmt"]);         //支付金额 单位:分
                                    string RisStaging      = Convert.ToString(jdBF["isStaging"]);      //是否分期 1:分期 2:不分期
                                    string RstagingInfo    = Convert.ToString(jdBF["stagingInfo"]);    //分期信息
                                    string RisExchangeRate = Convert.ToString(jdBF["isExchangeRate"]); //是否积分抵现 1:积分抵现 2:非积分抵现
                                    string RexchangeRate   = Convert.ToString(jdBF["exchangeRate"]);   //积分抵现信息
                                    string RpayResult      = Convert.ToString(jdBF["payResult"]);      //支付结果 0000:表示成功
                                    string RbankResDate    = Convert.ToString(jdBF["bankResDate"]);    //银行响应日期
                                    string RbankResNo      = Convert.ToString(jdBF["bankResNo"]);      //银行响应流水号
                                }
                            }
                            JsonData jdOrderFields = jdData["resOrderFields"];//订单响应消息
                            if (jdOrderFields.Count > 0)
                            {
                                foreach (JsonData jdOF in jdOrderFields)
                                {
                                    string   RmchntCode     = Convert.ToString(jdOF["mchntCode"]);     //商户代码
                                    string   RinstId        = Convert.ToString(jdOF["instId"]);        //分支机构ID 暂不开放
                                    string   RtradeCode     = Convert.ToString(jdOF["tradeCode"]);     //交易代码 0001:普通订单 0004:积分众酬 0005:包刷卡金红包 0006:包积分红包
                                    string   RreqSeq        = Convert.ToString(jdOF["reqSeq"]);        //订单请求流水号
                                    string   RorderNo       = Convert.ToString(jdOF["orderNo"]);       //订单号
                                    string   RorderDate     = Convert.ToString(jdOF["orderDate"]);     //订单日期 YYYYMMDD
                                    string   RorderAmt      = Convert.ToString(jdOF["orderAmt"]);      //订单金额 单位:分
                                    string   RuserId        = Convert.ToString(jdOF["userId"]);        //客户ID 暂不开放
                                    string   RvalidateFlag  = Convert.ToString(jdOF["validateFlag"]);  //订单有效期标识 暂不开放
                                    string   Rvalidate      = Convert.ToString(jdOF["validate"]);      //订单有效期 暂不开放
                                    string   RoldOrderNo    = Convert.ToString(jdOF["oldOrderNo"]);    //原总订单号 暂不开放
                                    string   RoldOrderReqNo = Convert.ToString(jdOF["oldOrderReqNo"]); //原总订单请求流水号 暂不开放
                                    string   RfullDesc      = Convert.ToString(jdOF["fullDesc"]);      //详细描述 暂不开放
                                    string   RbusiResult    = Convert.ToString(jdOF["busiResult"]);    //业务结果 0000:表示成功
                                    string   RbusiResDate   = Convert.ToString(jdOF["busiResDate"]);   //业务响应日期
                                    string   RbusiResNo     = Convert.ToString(jdOF["busiResNo"]);     //业务响应流水号
                                    JsonData jdbizInfos     = jdData["bizInfo"];                       //业务信息 tradeCode不为0001时显示
                                    if (jdOrderFields.Count > 0)
                                    {
                                        string RinAccountNo = Convert.ToString(jdbizInfos[0]["inAccountNo"]);//转入主账号
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }