Beispiel #1
0
        /// <summary>
        /// 车牌号缴费
        /// </summary>
        /// <param name="PlateNumber"></param>
        /// <param name="CardNo"></param>
        /// <param name="ParkingID"></param>
        /// <param name="SystemID"></param>
        /// <param name="AccountID"></param>
        /// <returns></returns>
        public static TempParkingFeeResult WXTempParkingFee(string PlateNumber, string ParkingID, string AccountID, DateTime CalculatDate)
        {
            WXServiceClient client = ServiceUtil <WXServiceClient> .GetServiceClient("WXService");

            string result = client.WXTempParkingFee(PlateNumber, ParkingID, CalculatDate, AccountID, 1);

            client.Close();
            client.Abort();
            TempParkingFeeResult model = JsonHelper.GetJson <TempParkingFeeResult>(result);

            try
            {
                if (!string.IsNullOrWhiteSpace(BWYInterfaceUrl) && !string.IsNullOrWhiteSpace(BWYSessionID) && !string.IsNullOrWhiteSpace(BWPKID))
                {
                    if (model.Result == APPResult.NotFindIn || model.Result == APPResult.ProxyException || model.Result == APPResult.NoTempCard ||
                        model.Result == APPResult.NotFindCard || model.Result == APPResult.OtherException)
                    {
                        BWYOrderQueryResult bwyResult = BWYInterfaceProcess.TempParkingFee(PlateNumber);
                        if (bwyResult != null)
                        {
                            //return TransforTempParkingFeeResult(model, bwyResult, PlateNumber);

                            model = BWYTransforTempParkingFeeResult(model, bwyResult, PlateNumber);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("WXTempParkingFee方法,异常:{0}", ex.Message));
            }

            try
            {
                if (model.Result == APPResult.NotFindIn || model.Result == APPResult.ProxyException || model.Result == APPResult.NoTempCard ||
                    model.Result == APPResult.NotFindCard || model.Result == APPResult.OtherException)
                {
                    if (!string.IsNullOrWhiteSpace(SFMInterfaceUrl) && !string.IsNullOrWhiteSpace(SFMSecretKey) && !string.IsNullOrWhiteSpace(SFMPKID))
                    {
                        PlateQueryResult sfmResult = SFMInterfaceProcess.GetCarPrice(PlateNumber);
                        if (sfmResult != null)
                        {
                            model = SFMTransforTempParkingFeeResult(model, sfmResult);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TxtLogServices.WriteTxtLogEx("SFMError", string.Format("WXTempParkingFee方法,异常:{0}", ex.Message));
            }

            return(model);
        }
Beispiel #2
0
        public static TempParkingFeeResult BWYTempParkingFeeResult(string GateID)
        {
            TempParkingFeeResult result = new TempParkingFeeResult();

            result.Result    = APPResult.NoCarInBox;
            result.ErrorDesc = "未知异常";

            int bwyGateId = 0;

            if (!string.IsNullOrWhiteSpace(SystemDefaultConfig.BWPKID) && int.TryParse(GateID, out bwyGateId))
            {
                try
                {
                    OutCarResult bwyResult = BWYInterfaceProcess.QueryOutCar(bwyGateId);
                    if (bwyResult.Result != 0)
                    {
                        result.Result    = APPResult.OtherException;
                        result.ErrorDesc = bwyResult.Desc;
                        return(result);
                    }
                    if (bwyResult.Reference == null || string.IsNullOrWhiteSpace(bwyResult.Reference.LPR))
                    {
                        result.Result    = APPResult.NoCarInBox;
                        result.ErrorDesc = bwyResult.Desc;
                        return(result);
                    }
                    TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("BWYTempParkingFeeResult方法,BWYInterfaceUrl:{0},BWYSessionID:{1},BWPKID:{2}", BWYInterfaceUrl, BWYSessionID, BWPKID));
                    if (!string.IsNullOrWhiteSpace(BWYInterfaceUrl) && !string.IsNullOrWhiteSpace(BWYSessionID) && !string.IsNullOrWhiteSpace(BWPKID))
                    {
                        BWYOrderQueryResult tempResult = BWYInterfaceProcess.TempParkingFee(bwyResult.Reference.LPR);
                        if (tempResult != null)
                        {
                            return(BWYTransforTempParkingFeeResult(result, tempResult, bwyResult.Reference.LPR));
                        }
                    }
                }
                catch (Exception ex)
                {
                    TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("BWYTempParkingFeeResult方法,异常:{0}", ex.Message));
                }
            }
            else
            {
                TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("BWYTempParkingFeeResult方法,参数无效:{0},GateID:{1}", SystemDefaultConfig.BWPKID, GateID));
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// 同步支付结果
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="payTime"></param>
        private static bool SyncNoticePayResult(decimal orderId, DateTime payTime, OnlineOrder order, out string payDetailId)
        {
            payDetailId = string.Empty;
            int payWay = GetServicePayWay(order.PaymentChannel);

            switch (order.OrderType)
            {
            case OnlineOrderType.MonthCardRecharge:
            {
                MonthlyRenewalResult renewalsResult = RechargeService.WXMonthlyRenewals(order.CardId, order.PKID, order.MonthNum, order.Amount, order.AccountID, payWay, OrderSource.WeiXin, order.OrderID.ToString(), payTime);
                if (renewalsResult.Result != APPResult.Normal)
                {
                    throw new MyException(SyncResultDescription(renewalsResult.Result));
                }
                payDetailId = renewalsResult.Pkorder != null?renewalsResult.Pkorder.OnlineOrderNo.ToString() : string.Empty;

                return(true);
            }

            case OnlineOrderType.ParkFee:
            {
                if (order.OrderSource == PayOrderSource.BWY)
                {
                    BWYOrderPaymentResult result = BWYInterfaceProcess.PayNotice((int)(order.Amount * 100), order.ExternalPKID, order.PayDetailID.ToString());
                    if (result.Result != 0)
                    {
                        throw new MyException(result.Desc);
                    }
                }
                else if (order.OrderSource == PayOrderSource.SFM)
                {
                    bool isPayScene = !string.IsNullOrWhiteSpace(order.TagID);
                    TxtLogServices.WriteTxtLogEx("SFMError", string.Format("isPayScene:{0}", isPayScene));
                    SFMResult result = SFMInterfaceProcess.PayNotify(order.InOutID, order.SerialNumber, order.Amount.ToString(), isPayScene);
                    if (result == null)
                    {
                        throw new MyException("请求赛菲姆支付通知失败");
                    }
                    if (!result.Success)
                    {
                        throw new MyException(string.Format("{0}【{1}】", result.Message, result.Code));
                    }
                }
                else
                {
                    TempStopPaymentResult result = RechargeService.WXTempStopPayment(order.PayDetailID, payWay, order.Amount, order.PKID, order.AccountID, order.OrderID.ToString(), payTime);
                    if (result.Result != APPResult.Normal)
                    {
                        throw new MyException(SyncResultDescription(result.Result));
                    }
                }
                return(true);
            }

            case OnlineOrderType.PkBitBooking:
            {
                return(PkBitBookingServices.WXReserveBitPay(order.CardId, order.PayDetailID, order.Amount, order.PKID, order.OrderID.ToString()));
            }

            case OnlineOrderType.SellerRecharge:
            {
                return(SyncSellerRecharge(order, (OrderPayWay)payWay));
            }

            case OnlineOrderType.APPRecharge:
            {
                return(1 == AppBalanceNotify.BalanceRechargeNotify(order.OrderID.ToString(), order.PlateNo, order.Amount));
            }

            default: throw new MyException("同步类型不存在");
            }
        }