public DTO.Common.ApiResult Index(string OrderNo, string SellerID = "", EnumPaySignType SignType = EnumPaySignType.App, string ReturnUrl = "") { //设置默认收款人 if (string.IsNullOrEmpty(SellerID)) { var Config = SysConfigService.Get <XuHos.Common.Config.Sections.Pay>(); SellerID = Config.AliPayDefaultSellerId; } var orderService = new OrderService(CurrentOperatorUserID); var orderEntity = orderService.GetOrder(OrderNo); if (orderService.SetTradeLog(OrderNo, EnumPayType.AliPay, EnumTradeState.WAIT_BUYER_PAY, "", orderEntity.TotalFee, SellerID)) { var bll = BLL.Platform.Cashier.CashierFactoryService.Create(EnumPayType.AliPay, CurrentOperatorUserID); return(bll.GetPaySign(OrderNo, SellerID, orderEntity.TotalFee, SignType, ReturnUrl).ToApiResultForObject()); } else { return(EnumApiStatus.BizError.ToApiResultForApiStatus()); } }
public DTO.Common.ApiResult Index(string OrderNo, string SellerID = "wxf1b0cceac4c331e3", EnumPaySignType SignType = EnumPaySignType.App, string ReturnUrl = "", string OpenId = "") { var orderService = new OrderService(CurrentOperatorUserID); var orderEntity = orderService.GetOrder(OrderNo); if (orderService.SetTradeLog(OrderNo, EnumPayType.WxPay, EnumTradeState.WAIT_BUYER_PAY, "", orderEntity.TotalFee, SellerID)) { var bll = BLL.Platform.Cashier.CashierFactoryService.Create(EnumPayType.WxPay, CurrentOperatorUserID); return(bll.GetPaySign(OrderNo, SellerID, orderEntity.TotalFee, SignType, ReturnUrl, OpenId).ToApiResultForObject()); } else { return(EnumApiStatus.BizError.ToApiResultForApiStatus()); } }
public abstract object GetPaySign(string OrderNo, string SellerID, decimal TotalPrice, EnumPaySignType SignType, string ReturnUrl, string OpenId);
/// <summary> /// 阿里支付 /// </summary> /// <param name="OrderNo"></param> /// <returns></returns> public override object GetPaySign(string OrderNo, string SellerID, decimal TotalPrice, EnumPaySignType SignType, string ReturnUrl = "", string OpenId = "") { BLL.OrderService bll = new BLL.OrderService(CurrentOperatorUserID); DTO.Platform.OrderDTO order = bll.GetOrder(OrderNo); if (order != null) { #region 获取订单说明和描述 string Subject = "-"; string Body = order.OrderType.GetEnumDescript(); if (order.Details != null && order.Details.Count == 1) { Subject = order.Details[0].Subject; } else if (order.Details != null) { Subject = string.Format("共{0}件商品", order.Details.Count); } else { Subject = string.Format("共{0}件商品", 0); } #endregion NavivePay pay = new NavivePay(SellerID); if (SignType == EnumPaySignType.App) { return(pay.GetMobilePayParams(OrderNo, Subject, Body, TotalPrice.ToString(), ReturnUrl)); } else { return(pay.GetWapPayParams(OrderNo, Subject, Body, TotalPrice.ToString(), ReturnUrl)); } } else { throw new System.ArgumentException("订单不存在"); } }
/// <summary> /// 微信支付 /// </summary> /// <param name="OrderNo"></param> /// <returns></returns> public override object GetPaySign(string OrderNo, string SellerID, decimal TotalPrice, EnumPaySignType SignType, string ReturnUrl = "", string OpenId = "") { BLL.OrderService orderService = new BLL.OrderService(CurrentOperatorUserID); DTO.Platform.OrderDTO order = orderService.GetOrder(OrderNo); if (order != null) { #region 获取订单说明和描述 string Subject = "-"; string Body = order.OrderType.GetEnumDescript(); if (order.Details != null && order.Details.Count == 1) { Subject = order.Details[0].Subject; } else if (order.Details != null) { Subject = string.Format("共{0}件商品", order.Details.Count); } else { Subject = string.Format("共{0}件商品", 0); } #endregion UnifiedOrder pay = new UnifiedOrder(); if (SignType == EnumPaySignType.Web) { return(pay.GetQRCodeUrlWhenWeb(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID)); } //H5支付方式 else if (SignType == EnumPaySignType.Wap) { return(pay.GetJumpUrlWhenMWeb(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID)); } //JS支付(公众号) else if (SignType == EnumPaySignType.Js) { var pre_payId = pay.GetPrepayIdWhenJsSdk(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID, OpenId, order.OrderOutID); return(GetJsApiParameters(pre_payId, SellerID)); } else if (SignType == EnumPaySignType.App) { var pre_payId = pay.GetPrepayIdWhenApp(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID); return(GetAppApiParamters(pre_payId, SellerID)); } else { return(pay.GetQRCodeUrlWhenWeb(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID)); } } else { throw new System.ArgumentException("订单不存在"); } }