Exemplo n.º 1
0
        //public SingleOntimePayResponse SingleOntimePay(string Name, string BarkNumber, int Amount, string REQ_SN)
        //{
        //    SingleOntimePayRquest request = new SingleOntimePayRquest();

        //    request.INFO.REQ_SN = REQ_SN;

        //    request.TRANS.BUSINESS_CODE = "09900";
        //    request.TRANS.SUBMIT_TIME = DateTime.Now.ToString("yyyyMMddHHmmss");
        //    request.TRANS.ACCOUNT_NO = BarkNumber;
        //    request.TRANS.ACCOUNT_NAME = Name;
        //    request.TRANS.ACCOUNT_PROP = "0";
        //    request.TRANS.AMOUNT = Amount;
        //    request.TRANS.ACCOUNT_KIND = "01";


        //    var response = tltExec.Exec(request);

        //    return response as SingleOntimePayResponse;
        //}

        public SingleOntimePayResponse SingleOntimePay(OrderPaid orderPaid, PingAnOrderPaidRecharge pingAnOrderPaidRecharge)
        {
            SingleOntimePayRquest request = new SingleOntimePayRquest(this.tltExec);

            request.INFO.REQ_SN = pingAnOrderPaidRecharge.SerialNumber;

            request.TRANS.BUSINESS_CODE  = "09900";
            request.TRANS.SUBMIT_TIME    = DateTime.Now.ToString("yyyyMMddHHmmss");
            request.TRANS.ACCOUNT_NO     = orderPaid.Member.AccountPingAn.BankCardNumber; //银行卡号(平安二类户卡号)
            request.TRANS.ACCOUNT_NAME   = orderPaid.MemberName;
            request.TRANS.ACCOUNT_PROP   = "0";
            request.TRANS.AMOUNT         = decimal.ToInt32(orderPaid.TransactionAmount * 100);
            request.TRANS.FIRST_ACCTNO   = orderPaid.Member?.AccountPingAn.OutCardNo; //转入银行卡号(代付出金卡)
            request.TRANS.FIRST_ACCTNAME = orderPaid.Member?.AccountPingAn.CnName;
            request.TRANS.ACCOUNT_ATTRB  = "2";
            //--------------------------------------------------------------------
            request.TRANS.BANK_CODE    = pingAnOrderPaidRecharge?.BankCode;
            request.TRANS.BANK_NAME    = pingAnOrderPaidRecharge?.BankName;
            request.TRANS.ACCOUNT_TYPE = pingAnOrderPaidRecharge?.AccountType;
            request.TRANS.PROVINCE     = pingAnOrderPaidRecharge?.Province;
            request.TRANS.CITY         = pingAnOrderPaidRecharge?.City;
            request.TRANS.ACCOUNT_PROP = pingAnOrderPaidRecharge?.AccountProp ?? "0";
            request.TRANS.UNION_BANK   = pingAnOrderPaidRecharge?.UnionBank;

            var response = tltExec.Exec(request);

            return(response as SingleOntimePayResponse);
        }
Exemplo n.º 2
0
        private void TltSingleOntimePayFail(PingAnOrderPaidRecharge pingAnOrderPaidRecharge)
        {
            var iPingAnOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidRechargeService>();

            pingAnOrderPaidRecharge.OrderPaid.Status = OrderPaidStatusOption.SingleOntimePayFail.ToInt();

            pingAnOrderPaidRecharge.Status = PingAnOrderPaidRechargeStatusOption.SingleOntimePayFailed.ToInt();
            iPingAnOrderPaidRechargeService.Save(pingAnOrderPaidRecharge);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询单笔代付订单详情
        /// </summary>
        /// <param name="pingAnOrderPaidRecharge"></param>
        /// <returns></returns>
        public QueryTltTradingResultResponse QuerySingleOntimePayDetail(PingAnOrderPaidRecharge pingAnOrderPaidRecharge)
        {
            var iTltService            = DIFactory.GetContainer().Resolve <ITltService>();
            var iTLTPreferencesService = DIFactory.GetContainer().Resolve <ITLTPreferencesService>();

            var TLTPreferences = iTLTPreferencesService.Get(t => t.MerchantID == pingAnOrderPaidRecharge.OrderPaid.MerchantID);

            //初始化通联通参数
            if (!iTltService.isReady())
            {
                iTltService.Init(url, TLTPreferences.TltMerchantId, TLTPreferences.TltUserName, TLTPreferences.TltUserPassword, TLTPreferences.TltPrivateKeyPassword);
            }
            //查询订单代付状态
            var response = iTltService.QueryTltTradingResult(GuidHelper.GenUniqueId(), pingAnOrderPaidRecharge.SerialNumber, "200004");   //200004为通联通接口交易代码

            return(response);
        }
Exemplo n.º 4
0
        public void TltSingleOntimePaySuccess(PingAnOrderPaidRecharge pingAnOrderPaidRecharge, string TransNumber, string SettleDay)
        {
            var iPingAnOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidRechargeService>();
            var iMemberService = DIFactory.GetContainer().Resolve <IMemberService>();

            pingAnOrderPaidRecharge.OrderPaid.Status = OrderPaidStatusOption.SingleOntimePaySuccess.ToInt();
            // pingAnOrderPaidRecharge.OrderPaid.Project.ReceiveAmount += pingAnOrderPaidRecharge.Amount;
            Save(pingAnOrderPaidRecharge.OrderPaid);

            pingAnOrderPaidRecharge.Status         = PingAnOrderPaidRechargeStatusOption.SingleOntimePaySuccess.ToInt();
            pingAnOrderPaidRecharge.BankCardNumber = pingAnOrderPaidRecharge.OrderPaid.Member.AccountPingAn.BankCardNumber;
            pingAnOrderPaidRecharge.TransNumber    = TransNumber;
            pingAnOrderPaidRecharge.TransTime      = DateTime.ParseExact(SettleDay, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); // 清算日期--转为时间格式
            iPingAnOrderPaidRechargeService.Save(pingAnOrderPaidRecharge);

            iMemberService.BalanceChange(pingAnOrderPaidRecharge.OrderPaid.Member, pingAnOrderPaidRecharge.Amount, MemberBalanceHistoryTypeOption.Recharge, (AccountBankOption)pingAnOrderPaidRecharge.OrderPaid.Merchant.AccountBank, remark: pingAnOrderPaidRecharge.SerialNumber);    //修改金额
        }
Exemplo n.º 5
0
        private void TltSingleOntimePay(OrderPaid orderPaid)
        {
            var iTltService                     = DIFactory.GetContainer().Resolve <ITltService>();
            var iAccountPingAnService           = DIFactory.GetContainer().Resolve <IAccountPingAnService>();
            var iPingAnOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidRechargeService>();
            var iTLTPreferencesService          = DIFactory.GetContainer().Resolve <ITLTPreferencesService>();

            var TLTPreferences = iTLTPreferencesService.Get(t => t.MerchantID == orderPaid.MerchantID);
            var accountPingAn  = iAccountPingAnService.Get(t => t.MemberID == orderPaid.MemberID);

            PingAnOrderPaidRecharge pingAnOrderPaidRecharge = new PingAnOrderPaidRecharge();

            pingAnOrderPaidRecharge.OrderPaidID = orderPaid.ID;
            pingAnOrderPaidRecharge.Amount      = orderPaid.TransactionAmount;

            pingAnOrderPaidRecharge.BankCode    = accountPingAn.BankCode;
            pingAnOrderPaidRecharge.BankName    = accountPingAn.BankName;
            pingAnOrderPaidRecharge.AccountType = accountPingAn.AccountType;
            pingAnOrderPaidRecharge.Province    = accountPingAn.Province;
            pingAnOrderPaidRecharge.City        = accountPingAn.City;
            pingAnOrderPaidRecharge.AccountProp = accountPingAn.AccountProp;
            pingAnOrderPaidRecharge.UnionBank   = accountPingAn.UnionBank;

            iPingAnOrderPaidRechargeService.Save(pingAnOrderPaidRecharge);
            iPingAnOrderPaidRechargeService.Commit();

            //初始化TLT参数
            if (!iTltService.isReady())
            {
                iTltService.Init(url, TLTPreferences.TltMerchantId, TLTPreferences.TltUserName, TLTPreferences.TltUserPassword, TLTPreferences.TltPrivateKeyPassword);
            }
            //调通联通代付接口
            var singleOntimePayResponse = iTltService.SingleOntimePay(orderPaid, pingAnOrderPaidRecharge);


            pingAnOrderPaidRecharge.ResponseCode    = singleOntimePayResponse.INFO.RET_CODE;
            pingAnOrderPaidRecharge.ResponseMessage = singleOntimePayResponse.INFO.ERR_MSG;

            pingAnOrderPaidRecharge.BankCardNumber = pingAnOrderPaidRecharge.OrderPaid.Member.AccountPingAn.BankCardNumber;
            pingAnOrderPaidRecharge.TransNumber    = singleOntimePayResponse.INFO.REQ_SN;

            if (singleOntimePayResponse.Status == StatusOption.Success)
            {
                TltSingleOntimePaySuccess(pingAnOrderPaidRecharge, singleOntimePayResponse.INFO.REQ_SN, singleOntimePayResponse.TRANSRET.SETTLE_DAY);

                Commit();
            }
            else if (singleOntimePayResponse.Status == StatusOption.Wait)
            {
                orderPaid.Status = OrderPaidStatusOption.SingleOntimePayWait.ToInt();
                Save(orderPaid);

                pingAnOrderPaidRecharge.Status = PingAnOrderPaidRechargeStatusOption.SingleOntimePayWait.ToInt();
                iPingAnOrderPaidRechargeService.Save(pingAnOrderPaidRecharge);

                Commit();
            }
            else
            {
                TltSingleOntimePayFail(pingAnOrderPaidRecharge);

                Commit();

                throw new APIException("充值失败:" + singleOntimePayResponse.INFO.ERR_MSG);
            }
        }