public static bool UpdateSFMCode(OnlineOrder order) { if (order.OrderSource == PayOrderSource.SFM) { SFMResult result = SFMInterfaceProcess.CarOrderPay(order.PayDetailID); if (result == null) { throw new MyException("提交支付失败【SFM】"); } if (!result.Success) { throw new MyException("下单失败【SFM】"); } if (string.IsNullOrWhiteSpace(result.Code)) { throw new MyException("交易订单号失败【SFM】"); } IOnlineOrder factory = OnlineOrderFactory.GetFactory(); bool updateResult = factory.UpdateSFMCode(result.Code, order.OrderID); if (!updateResult) { throw new MyException("修改外部订单编号失败【SFM】"); } return(updateResult); } return(true); }
/// <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); }
public static TempParkingFeeResult SFMTempParkingFeeResult(string ParkNo, string GateID) { TempParkingFeeResult result = new TempParkingFeeResult(); result.Result = APPResult.OtherException; result.ErrorDesc = "车场或通道编号未配置"; if (!string.IsNullOrWhiteSpace(SystemDefaultConfig.SFMPKID) && !string.IsNullOrWhiteSpace(ParkNo) && !string.IsNullOrWhiteSpace(GateID)) { try { BWYGateMapping gate = BWYGateMappingServices.QueryByGateID(1, ParkNo, GateID); if (gate == null) { result.Result = APPResult.OtherException; result.ErrorDesc = "获取车场信息失败"; TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,获取车场信息失败,通道编号:{0}", GateID)); return(result); } TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,SFMInterfaceUrl:{0},SFMSecretKey:{1},SFMPKID:{2}", SFMInterfaceUrl, SFMSecretKey, SFMPKID)); if (!string.IsNullOrWhiteSpace(SFMInterfaceUrl) && !string.IsNullOrWhiteSpace(SFMSecretKey) && !string.IsNullOrWhiteSpace(SFMPKID)) { OutCarInfoResult sfmResult = SFMInterfaceProcess.QueryOutCarOrder(gate.ParkNo, GateID); if (!sfmResult.Success) { result.Result = APPResult.OtherException; result.ErrorDesc = string.Format("{0}[{1}]", sfmResult.Message, sfmResult.Code); return(result); } if (sfmResult.Data == null) { result.Result = APPResult.NoCarInBox; result.ErrorDesc = string.Empty; return(result); } return(SFMTransforTempParkingFeeResult(result, sfmResult)); } } catch (Exception ex) { TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,异常:{0}", ex.Message)); } } else { TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,参数无效:{0},GateID:{1}", SystemDefaultConfig.SFMPKID, GateID)); } return(result); }
/// <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("同步类型不存在"); } }
public JsonResult ImportSFMParking() { try { SFMParkInfoResult result = SFMInterfaceProcess.GetParkInfo(); if (result == null || !result.Success) { throw new MyException("获取车场信息失败"); } if (result.Data == null || result.Data.TotalRecord == 0 || result.Data.ResultList == null || result.Data.ResultList.Count == 0) { throw new MyException("无车场信息"); } List <BWYGateMapping> models = new List <BWYGateMapping>(); foreach (var item in result.Data.ResultList) { BWYGateMapping model = new BWYGateMapping(); model.ParkingID = item.parkKey; model.ParkingName = item.parkName; model.DataSource = 1; List <ParkSentry> parkSentry = item.parkSentry; if (parkSentry != null && parkSentry.Count > 0) { foreach (var sentry in parkSentry) { model.ParkBoxID = sentry.sentryNo; model.ParkBoxName = sentry.sentryName; List <ParkLane> parkLanes = sentry.parkLane; if (parkLanes != null) { foreach (var lane in parkLanes) { if (lane.vehicleType != "1") { continue; } BWYGateMapping gateMap = new BWYGateMapping(); gateMap.ParkingID = model.ParkingID; gateMap.ParkingName = model.ParkingName; gateMap.DataSource = model.DataSource; gateMap.ParkBoxID = model.ParkBoxID; gateMap.ParkBoxName = model.ParkBoxName; gateMap.GateID = lane.vehicleNo; gateMap.GateName = lane.vehicleName; models.Add(gateMap); } } } } } if (models.Count == 0) { throw new MyException("请核实塞菲姆车场数据的完整性"); } bool addResult = BWYGateMappingServices.UpdateSFMParking(models); if (!addResult) { throw new MyException("导入塞菲姆车场信息失败"); } return(Json(MyResult.Success())); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "导入塞菲姆车场信息失败"); return(Json(MyResult.Error("导入塞菲姆车场信息失败"))); } }