コード例 #1
0
        /// <summary>
        /// 从rd节点获取支付信息
        /// </summary>
        /// <param name="bankVerInfo"></param>
        /// <param name="rdString"></param>
        /// <returns></returns>
        private PaymentInfo getPaymentInfofromRd(BankVersionInfo bankVerInfo, string rdString)
        {
            //获得支付信息
            PaymentInfo pInfo  = new PaymentInfo();
            XML_EASY    xmlPay = new XML_EASY(rdString);

            pInfo.response = rdString;

            pInfo.iSeqno    = xmlPay.GetXMLNode("iSeqno"); //支付序号
            pInfo.result    = xmlPay.GetXMLNode("Result");
            pInfo.payState  = (int)getPaymentStateByResultCode(pInfo.result);
            pInfo.resultMsg = getMsgByResultCode(pInfo.result);

            if (pInfo.result != "7")
            {
                string iRetCode = xmlPay.GetXMLNode("iRetCode");
                string iRetMsg  = xmlPay.GetXMLNode("iRetMsg");
                if (!string.IsNullOrEmpty(iRetCode) || !string.IsNullOrEmpty(iRetMsg))
                {
                    if (iRetCode != "0")
                    {
                        pInfo.resultMsg += ":" + iRetCode + " " + iRetMsg;
                    }
                    else
                    {
                        pInfo.resultMsg += ":" + xmlPay.GetXMLNode("instrRetCode") + " " + xmlPay.GetXMLNode("instrRetMsg");
                    }
                }
            }

            pInfo.amount     = this.getYuanMoney(xmlPay.GetXMLNode("PayAmt"));
            pInfo.postScript = xmlPay.GetXMLNode("PostScript");

            pInfo.currency   = xmlPay.GetXMLNode("CurrType");
            pInfo.explantion = xmlPay.GetXMLNode("Summary");
            pInfo.usage      = xmlPay.GetXMLNode("UseCN");
            pInfo.sameCity   = (int)(xmlPay.GetXMLNode("IsSameCity") == "1" ? enumYesNo.Yes : enumYesNo.No);
            pInfo.sameBank   = (int)(xmlPay.GetXMLNode("SysIOFlg") == "1" ? enumYesNo.Yes : enumYesNo.No);
            pInfo.isUrgent   = (int)(xmlPay.GetXMLNode("PayType") == "1" ? enumYesNo.Yes : enumYesNo.No);
            string retTime = xmlPay.GetXMLNode("BankRetTime");

            if (!string.IsNullOrEmpty(retTime))
            {
                pInfo.submitDate = this.convertToDateTime(retTime);
            }

            pInfo.bankAcnt                 = new BankAcnt();
            pInfo.bankAcnt.acntName        = xmlPay.GetXMLNode("PayAccNameCN");
            pInfo.bankAcnt.acntName        = xmlPay.GetXMLNode("PayAccNo");
            pInfo.bankAcnt.bankVersionInfo = bankVerInfo;

            pInfo.oppoBankAcnt          = new BankAcnt();
            pInfo.oppoBankAcnt.acntName = xmlPay.GetXMLNode("RecAccNameCN");
            pInfo.oppoBankAcnt.acntNo   = xmlPay.GetXMLNode("RecAccNo");

            return(pInfo);
        }
コード例 #2
0
        /// <summary>
        /// 获得支付指令序列号对应的支付状态信息
        /// </summary>
        /// <param name="caller">调用者</param>
        /// <param name="bankVerInfo">银行版本</param>
        /// <param name="paymentSeqNo">支付指令序列号(在调用支付指令后系统返回的序列号(fSeqNo))</param>
        /// <returns></returns>
        public BankReturnModel <PaymentInfo[]> getPaymentState(CallerInfo caller, BankVersionInfo bankVerInfo, String paymentSeqNo)
        {
            string   error       = string.Empty;
            string   xmlString   = ICBCNCHelper.GetXmlString("QPAYENT");
            XML_EASY xmlPayState = new XML_EASY(xmlString);

            //设置头部信息
            xmlPayState.SetXMLNode("BankCode", "102"); //工行为 "102"
            xmlPayState.SetXMLNode("CIS", ConfigurationManager.AppSettings["cis"]);
            xmlPayState.SetXMLNode("ID", ConfigurationManager.AppSettings["id"]);

            xmlPayState.SetXMLNode("QryfSeqno", paymentSeqNo); //使用fSeqno来查询
            xmlPayState.SetXMLNode("QrySerialNo", "");         //值为空,则使用fSeqno来查询

            ICBC_NetSafeClient iCBC_NetSafeClient = CreateOneNC();
            string             seqNo, seqResult;

            iCBC_NetSafeClient.Run(xmlPayState.GetXML(), out seqNo, out seqResult);
            iCBC_NetSafeClient = null;

            xmlPayState.SetXML(seqResult);
            if (xmlPayState.LocateString("<error>") >= 0)
            {
                error = xmlPayState.GetXMLNode("error");
                throw new Exception(error);
            }

            string retCode           = xmlPayState.GetXMLNode("RetCode");

            if (retCode != "0")
            {
                //error = "error=" + xmlPayState.GetXMLNode("RetMsg");
                //throw new Exception(error);

                BankReturnModel <PaymentInfo[]> retMo = new BankReturnModel <PaymentInfo[]>();
                retMo.retCode   = retCode;
                retMo.retMsg    = xmlPayState.GetXMLNode("RetMsg");
                retMo.bankCode  = "102";
                retMo.fSeqno    = seqNo;
                retMo.transCode = "QPAYENT";
                retMo.tranDate  = xmlPayState.GetXMLNode("TranDate");
                retMo.tranTime  = xmlPayState.GetXMLNode("TranTime");
                return(retMo);
            }

            //取支付明细信息
            List <PaymentInfo> states = null;
            PaymentInfo        pInfo = null;

            string rdString = xmlPayState.GetXMLNode("rd");
            int    rdIndex  = xmlPayState.Index();

            //string result = xmlPayState.GetXMLNode("Result", rdIndex);
            if (!string.IsNullOrEmpty(rdString))
            {
                states = new List <PaymentInfo>();
                //循环获取明细
                do
                {
                    pInfo = getPaymentInfofromRd(bankVerInfo, rdString);
                    if (pInfo.submitDate == DateTime.MinValue)
                    {
                        pInfo.submitDate = this.convertToDateTime(xmlPayState.GetXMLNode("TranDate") + xmlPayState.GetXMLNode("TranTime"));
                    }
                    pInfo.paymentSeqNo = paymentSeqNo;
                    states.Add(pInfo);

                    rdString = xmlPayState.GetXMLNode("rd", rdIndex);
                    rdIndex  = xmlPayState.Index();
                }while (!string.IsNullOrEmpty(rdString));

                BankReturnModel <PaymentInfo[]> retMo = new BankReturnModel <PaymentInfo[]>();
                retMo.retCode             = retCode;
                retMo.retMsg              = xmlPayState.GetXMLNode("RetMsg");
                retMo.bankCode            = "102";
                retMo.fSeqno              = seqNo;
                retMo.transCode           = "QPAYENT";
                retMo.tranDate            = xmlPayState.GetXMLNode("TranDate");
                retMo.tranTime            = xmlPayState.GetXMLNode("TranTime");
                retMo.detailData          = new BankReturnDetailModel <PaymentInfo[]>();
                retMo.detailData.infoData = states.ToArray();

                return(retMo);
            }

            return(null);
        }
コード例 #3
0
 public BankReturnModel <PaymentInfo[]> getPaymentState(CallerInfo caller, BankVersionInfo bankVerInfo, String paymentSeqNo)
 {
     throw new NotImplementedException();
 }