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="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("同步类型不存在"); } }