public object GetEnablePaymentList() { var mobilePayments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).OrderByDescending(d => d.PluginInfo.PluginId).Where(item => item.Biz.SupportPlatforms.Contains(Core.PlatformType.Android)); string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); string urlPre = webRoot + "/m-" + Core.PlatformType.Android + "/Payment/"; var model = mobilePayments.ToArray().Select(item => { string url = string.Empty; return(new { id = item.PluginInfo.PluginId, name = PaymentApplication.GetForeGroundPaymentName(item.PluginInfo.DisplayName), logo = item.Biz.Logo, url = url }); }).OrderByDescending(d => d.id); return(new { success = true, data = model }); }
//private void InintData() //{ // string methodName = "InintData"; // Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN); // try // { // InitFormData(); // if (instructionOfPkurg != null) // { // tbDepartName.Text = instructionOfPkurg.DeptName; // WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(instructionOfPkurg.FormId); // AddSign1.ProcId = workFlowInstance.InstanceId; // #region 审批意见框 // ApproveOpinionUCDeptleader.InstanceId = workFlowInstance.InstanceId; // ApproveOpinionUCRealateDept.InstanceId = workFlowInstance.InstanceId; // ApproveOpinionUCLeader.InstanceId = workFlowInstance.InstanceId; // ApproveOpinionUCCEO.InstanceId = workFlowInstance.InstanceId; // if (ApproveOpinionUCDeptleader.CurrentNodeName == nodeName.Value) // { // ApproveOpinionUCDeptleader.CurrentNode = true; // } // if (ApproveOpinionUCRealateDept.CurrentNodeName == nodeName.Value) // { // ApproveOpinionUCRealateDept.CurrentNode = true; // } // if (ApproveOpinionUCLeader.CurrentNodeName == nodeName.Value) // { // ApproveOpinionUCLeader.CurrentNode = true; // } // if (ApproveOpinionUCCEO.CurrentNodeName == nodeName.Value) // { // ApproveOpinionUCCEO.CurrentNode = true; // } // #endregion // //查询已经添加的附件 // //UploadFilesUC1.BindAttachmentListByCode(ViewState["FormID"].ToString()); // UploadAttachments1.ProcId = workFlowInstance.InstanceId; // } // } // catch (Exception ex) // { // Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex)); // throw ex; // } // Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT); //} /// <summary> /// 加载表单 /// </summary> private void InitFormData() { try { PaymentApplicationInfo formDataInfo = PaymentApplication.GetPaymentApplicationInfo(FormId); if (formDataInfo.IsOverContract == 1) { cblisoverCotract.Checked = true; } else { cblisoverCotract.Checked = false; } Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(formDataInfo.StartDeptId); tbDepartName.Text = deptInfo.Remark; cbChairman.Checked = formDataInfo.IsCheckedChairman == 1; if (formDataInfo.StartDeptId.Contains("S972")) { lbPresident.Text = "总经理意见:"; } else { lbPresident.Text = "总裁意见:"; } //LoadRelationPerson(formDataInfo.StartDeptId); //cbRelatonUsers.Visible = cbPayer.Checked; //if (!string.IsNullOrEmpty(formDataInfo.LeadersSelected)) //{ // string[] cbDatas = formDataInfo.LeadersSelected.Split(','); // foreach (var cbItem in cbDatas) // { // ListItem listItem = cbRelatonUsers.Items.FindByValue(cbItem); // listItem.Selected = true; // } //} } catch (Exception ex) { throw ex; } }
public static string GetErpUrl() { string erpFormId = HttpContext.Current.Request["erpFormId"]; string erpFormType = HttpContext.Current.Request["erpFormType"]; string startDeptId = HttpContext.Current.Request["startDeptId"]; string id = HttpContext.Current.Request["Id"]; if (string.IsNullOrEmpty(id)) {//新建页面 if (string.IsNullOrEmpty(erpFormId) || string.IsNullOrEmpty(erpFormType) ) { //参数错误 ExceptionHander.GoToErrorPage(); return(null); } } else { PaymentApplicationInfo info = PaymentApplication.GetPaymentApplicationInfoByInstanceId(id); if (info == null) { ExceptionHander.GoToErrorPage(); return(null); } erpFormId = info.ErpFormId; erpFormType = info.ErpFormType; } Dictionary <string, string> pageNames = IFrameHelper.GetUrlDatas(); if (!pageNames.Keys.Contains(erpFormType)) { ExceptionHander.GoToErrorPage(); return(null); } string pageName = pageNames[erpFormType]; return(string.Format("{0}{1}", pageName, erpFormId)); }
public ActionResult QRPay(string url, string id) { ViewBag.Logo = SiteSettings.Logo;//获取Logo var payment = Core.PluginsManagement.GetPlugin <IPaymentPlugin>(id); //ViewBag.Title = payment.PluginInfo.DisplayName + "支付"; //ViewBag.Name = payment.PluginInfo.DisplayName; ViewBag.Title = PaymentApplication.GetForeGroundPaymentName(payment.PluginInfo.DisplayName) + "支付"; ViewBag.Name = PaymentApplication.GetForeGroundPaymentName(payment.PluginInfo.DisplayName); //生成二维码 var qrCode = Core.Helper.QRCodeHelper.Create(url); string fileName = DateTime.Now.ToString("yyMMddHHmmssffffff") + ".jpg"; var qrCodeImagePath = "/temp/" + fileName; //qrCode.Save(Server.MapPath("~/temp/") + fileName); MemoryStream ms = new MemoryStream(); qrCode.Save(ms, ImageFormat.Gif); ms.Flush(); MemoryStream mem = new MemoryStream(ms.ToArray()); //通过IO策略来保存图片 Core.HimallIO.CreateFile(qrCodeImagePath, mem, FileCreateType.Create); ms.Dispose(); mem.Dispose(); //通过IO策略返回图片绝对地址 ViewBag.QRCode = Core.HimallIO.GetFilePath(qrCodeImagePath); ViewBag.HelpImage = "/Plugins/Payment/" + payment.PluginInfo.ClassFullName.Split(',')[1] + "/" + payment.Biz.HelpImage; ViewBag.Step = 2;//支付第二步 ViewBag.Keyword = SiteSettings.Keyword; return(View()); }
public ActionResult ProceedTDC(PaymentViewModel model) { //Setear variables del conector PaymentApplication paymentApp = _paymentService.GetPaymentApplicationByKey(model.AppKey); paymentProviderService.MerchantId = paymentApp.MerchantId; paymentProviderService.PublicKey = paymentApp.PublicKey; paymentProviderService.PrivateKey = paymentApp.PrivateKey; //Crear modelo PaymentModel payment = new PaymentModel() { ClientId = paymentApp.ClientId, OrderId = model.OrderId, Amount = model.Amount, Description = model.Description, TokenId = model.TokenId, DeviceSessionId = model.DeviceSessionId, RedirectUrl = SecureVerificationURL, //Use3DSecure = true }; //Primero en BD Payment paymentBO = new Payment(); paymentBO.CreationDate = DateUtil.GetDateTimeNow(); paymentBO.User = paymentApp.User; paymentBO.Amount = model.Amount; paymentBO.OrderId = model.OrderId; paymentBO.ConfirmationEmail = model.ConfirmationEmail; paymentBO.Status = PaymentStatus.IN_PROGRESS; paymentBO.Method = PaymentMethod.CARD; paymentBO.TransactionType = PaymentType.CHARGE; paymentBO.ConfirmationDate = null; _paymentService.Create(paymentBO); //Luego cobrar model.PaymentMethod = PaymentMethod.CARD; payment = paymentProviderService.CreateTDCPayment(payment); //Si hubiera reintento, probar Antifraude if (UseSelective3DSecure && !payment.ChargeSuccess & payment.ResultCode == PaymentError.ANTI_FRAUD) { payment.Use3DSecure = true; payment = paymentProviderService.CreateTDCPayment(payment); } model.ChargeSuccess = payment.ChargeSuccess; if (payment.ChargeSuccess) { //Luego actualizar paymentBO.ProviderId = payment.Id; paymentBO.Status = payment.Status; paymentBO.DueDate = payment.DueDate; paymentBO.LogData = payment.ResultData; _paymentService.Update(paymentBO); model.Id = payment.Id; model.Description = payment.Description; model.JsonData = payment.ResultData; model.DueDate = payment.DueDate; model.PaymentCardURL = payment.PaymentCardURL; } else { paymentBO.Status = PaymentStatus.ERROR; paymentBO.LogData = payment.ResultData; _paymentService.Update(paymentBO); model.Description = payment.ResultData; } // Session.Add("Payments.PaymentModel", model); //if (payment.PaymentMethod != null && !string.IsNullOrEmpty(payment.PaymentMethod.RedirectUrl)) //{ // return Redirect(payment.PaymentMethod.RedirectUrl); //} if (paymentApp.ReturnURL != null && !string.IsNullOrEmpty(paymentApp.ReturnURL)) { FormCollection formCollection = new FormCollection { { "payment_id", paymentBO.ProviderId }, { "status", paymentBO.Status } }; //SendPostRequest(paymentApp.ReturnURL, formCollection); return(Content("<form action='" + paymentApp.ReturnURL + "' id='frmReturnURL' method='POST'>" + "<input type='hidden' name='Id' value='" + paymentBO.Id + "' />" + "<input type='hidden' name='ProviderId' value='" + paymentBO.ProviderId + "' />" + "<input type='hidden' name='CreationDate' value='" + paymentBO.CreationDate + "' />" + "<input type='hidden' name='Status' value='" + paymentBO.Status + "' />" + "<input type='hidden' name='Amount' value='" + paymentBO.Amount + "' />" + "<input type='hidden' name='OrderId' value='" + paymentBO.OrderId + "' />" + "<input type='hidden' name='Method' value='" + paymentBO.Method + "' />" + "<input type='hidden' name='TransactionType' value='" + paymentBO.TransactionType + "' />" + "</form>" + "<script>document.getElementById('frmReturnURL').submit();</script>")); } return(View("Test")); }
/// <summary> /// 设置流程参数 /// </summary> /// <returns></returns> private NameValueCollection SetWFParams() { //存储过程的四个参数 string startDeptId = ddlDepartName.SelectedItem.Value; //部门【条件1】 string startDeptName = ddlDepartName.SelectedItem.Text; //定义合同类型的取值 // string erpFormType = HttpContext.Current.Request["erpFormType"]; //根据formTitle中的第七位取两位得到合同类型【条件2】 string type = PaymentApplication_Common.GetErpFormTitle(this).Substring(5, 2); //得到金额amount,需要先判断改单子是打开拟稿的还是新打开的,根据ID来判断是哪一类【条件3】 string amounts = null; //用info和_BPMContext.ProcID是否为空来判断是打开的拟稿还是新打开的有什么区别 //如果为null或者为空时,则为新打开的页面,新打开页面的amount值 if (_BPMContext.ProcID == null || _BPMContext.ProcID == "") { amounts = HttpContext.Current.Request["amount"]; } //如果不为null,则为打开的拟稿 else { PaymentApplicationInfo info = PaymentApplication.GetPaymentApplicationInfo(FormId); amounts = info.Amount; } //是否在计划内【条件4】 string isInPlan = cblIsInPan.SelectedItem.Value; NameValueCollection dataFields = new NameValueCollection(); Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId); string CompanyCode = BPMHelp.GetCompanyCodeByDeptID(StartDeptId); StringBuilder firstFieldBuilder = new StringBuilder(); foreach (ListItem item in cbRelatonUsers.Items) { if (item.Selected) { firstFieldBuilder.AppendFormat("K2:Founder\\{0},", item.Value); } } string firstField = firstFieldBuilder.ToString().Trim(','); dataFields.Add("RelatedPersonnel", !string.IsNullOrEmpty(firstField) ? firstField : "noapprovers"); bool flag = true;//标记datafields内的变量是否均赋值 //验证部分步骤的审批人是否尚未配置 if (string.IsNullOrEmpty(GetRoleUsers(deptInfo.DepartCode, "部门负责人"))) { flag = false; Alert(Page, "发起部门负责人尚未配置!"); } List <string> countersigns = Countersign1.Result.Split(',').ToList(); foreach (var item in countersigns) { if (!string.IsNullOrEmpty(item)) { if (string.IsNullOrEmpty(GetRoleUsers(item, "部门负责人"))) { flag = false; Alert(Page, item + "会签部门负责人尚未配置!"); } } } string financialManagementDepartmentCode = BPMHelp.GetDeptIDByOtherIDAndName(deptInfo.DepartCode, "财务管理部"); if (string.IsNullOrEmpty(financialManagementDepartmentCode)) { flag = false; Alert(Page, "财务管理部尚未设置!"); } else { string financialManagementDepartmentInfoManager = GetRoleUsers(financialManagementDepartmentCode, "部门负责人"); if (string.IsNullOrEmpty(financialManagementDepartmentInfoManager)) { flag = false; Alert(Page, "财务管理部门负责人尚未配置!"); } //else //{ // if (string.IsNullOrEmpty(GetRoleUsers(financialManagementDepartmentInfo.DepartCode, "主管副总裁"))) // { // flag = false; // Alert(Page, "财务管理部门主管副总裁尚未配置!"); // } //} } if (string.IsNullOrEmpty(GetRoleUsers(CompanyCode, "总裁"))) { flag = false; Alert(Page, "公司总裁尚未配置!"); } if (string.IsNullOrEmpty(GetRoleUsers(PKURGICode, "总裁"))) { flag = false; Alert(Page, "集团总裁尚未配置!"); } StringBuilder leaders = new StringBuilder(); StringBuilder Viceleaders = new StringBuilder(); StringBuilder deptsofGroup = new StringBuilder(); StringBuilder leaderofgroup = new StringBuilder(); StringBuilder AssistantPresident = new StringBuilder(); StringBuilder VicePresident = new StringBuilder(); countersigns.Add(startDeptId); foreach (var item in countersigns) { string leadersTmp = GetRoleUsers(item, "主管助理总裁"); if (!leaders.ToString().Contains(leadersTmp)) { leaders.AppendFormat("{0},", leadersTmp); } string ViceleadersTmp = GetRoleUsers(item, "主管副总裁"); if (!Viceleaders.ToString().Contains(ViceleadersTmp)) { Viceleaders.AppendFormat("{0},", ViceleadersTmp); } string deptsofGroupTmp = GetRoleDepts(item, "集团主管部门"); if (!deptsofGroup.ToString().Contains(deptsofGroupTmp)) { deptsofGroup.AppendFormat("{0},", deptsofGroupTmp); } } //集团审批人员 if (cblisoverCotract.Checked) { foreach (var item in deptsofGroup.ToString().Trim(',').Split(',')) { string leaderofgroupTmp = GetRoleUsers(item, "部门负责人"); if (!leaderofgroup.ToString().Contains(leaderofgroupTmp)) { leaderofgroup.AppendFormat("{0},", leaderofgroupTmp); } string AssistantPresidentTmp = GetRoleUsers(item, "主管助理总裁"); if (!AssistantPresident.ToString().Contains(AssistantPresidentTmp)) { AssistantPresident.AppendFormat("{0},", AssistantPresidentTmp); } string VicePresidentTmp = GetRoleUsers(item, "主管副总裁"); if (!VicePresident.ToString().Contains(VicePresidentTmp)) { VicePresident.AppendFormat("{0},", VicePresidentTmp); } } dataFields.Add("CEOGroup", FilterDataField2(GetRoleUsers(PKURGICode, "总裁"))); dataFields.Add("VicePresident", FilterDataField2(VicePresident)); dataFields.Add("AssistantPresident", FilterDataField2(AssistantPresident)); dataFields.Add("leadersofgroup", FilterDataField2(leaderofgroup)); } if (cbChairman.Checked) { dataFields.Add("chairman", FilterDataField2(GetRoleUsers(CompanyCode, "董事长"))); } else { dataFields.Add("chairman", "noapprovers"); } string CQCompanyCode = "S374"; string CPDeptCode = "S366-S976-S219"; string JSDeptCode = "S366-S976-S782"; string SCKFDeptCode = "S366-S976-S860"; //如果是重庆公司或者是北京北大资源物业公司,则进行判断 if (StartDeptId.Contains(CQCompanyCode) || StartDeptId.Contains(CPDeptCode) || StartDeptId.Contains(JSDeptCode) || StartDeptId.Contains(SCKFDeptCode)) { //判断“分管副总裁”“分管财务副总裁”“总裁”需要审批还是不需要审批 int grade = ERP_PaymentApplication_Grade.GetERP_PaymentApplication_GradeInfo(type, startDeptName, isInPlan, amounts); //如果grade为别的值,则抛出异常 if (grade == -1) { //throw new InvalidDataException("输入的参数不正确!"); grade = 111; } //分管财务副总裁审批 dataFields.Add("financialManagementViceleaders", (grade - (grade / 100 * 100)) / 10 == 1 ? this.FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "主管副总裁")) : "noapprovers"); //分管副总裁审批【因为总是会审批,所以不需要进行grade的判断】 if ((grade / 100) == 1) { dataFields.Add("Viceleaders", this.FilterDataField2(Viceleaders)); dataFields.Add("leaders", this.FilterDataField2(leaders)); } //总裁审批 dataFields.Add("CEO", (grade - (grade / 100 * 100) - ((grade - grade / 100 * 100) / 10 * 10)) == 1 ? this.FilterDataField2(GetRoleUsers(CompanyCode, "总裁")) : "noapprovers"); } else { //分管财务副总裁审批 dataFields.Add("financialManagementViceleaders", FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "主管副总裁"))); //分管副总裁审批 dataFields.Add("Viceleaders", this.FilterDataField2(Viceleaders)); dataFields.Add("leaders", this.FilterDataField2(leaders)); //总裁审批 dataFields.Add("CEO", FilterDataField2(GetRoleUsers(CompanyCode, "总裁"))); } dataFields.Add("StandingViceCEO", FilterDataField2(GetRoleUsers(CompanyCode, "常务副总裁"))); dataFields.Add("financialManagement", FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "部门负责人"))); dataFields.Add("CounterSignUsers", Countersign1.GetCounterSignUsers()); dataFields.Add("DeptManager", GetRoleUsers(deptInfo.DepartCode, "部门负责人")); dataFields.Add("IsOverContract", cblisoverCotract.Checked ? "1" : "0"); dataFields.Add("IsPass", "1"); if (!flag) { dataFields = null; } return(dataFields); }
public object GetOrderDetail(long id) { CheckUserLogin(); long shopid = CurrentShopBranch.ShopId; long sbid = CurrentUser.ShopBranchId; var ordser = ServiceProvider.Instance <IOrderService> .Create; Entities.OrderInfo order = ordser.GetOrder(id); if (order == null || order.ShopBranchId != sbid) { throw new HimallApiException("错误的订单编号"); } var bonusService = ServiceProvider.Instance <IShopBonusService> .Create; var orderRefundService = ServiceProvider.Instance <IRefundService> .Create; var shopService = ServiceProvider.Instance <IShopService> .Create; var productService = ServiceProvider.Instance <IProductService> .Create; var vshop = ServiceProvider.Instance <IVShopService> .Create.GetVShopByShopId(order.ShopId); var orderitems = OrderApplication.GetOrderItems(order.Id); bool isCanApply = false; //获取订单商品项数据 var orderDetail = new { ShopName = shopService.GetShop(order.ShopId).ShopName, ShopId = order.ShopId, OrderItems = orderitems.Select(item => { var productinfo = productService.GetProduct(item.ProductId); if (order.OrderStatus == Entities.OrderInfo.OrderOperateStatus.WaitDelivery) { isCanApply = orderRefundService.CanApplyRefund(id, item.Id); } else { isCanApply = orderRefundService.CanApplyRefund(id, item.Id, false); } Entities.TypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetType(productinfo.TypeId); string colorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; string sizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; string versionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; if (productinfo != null) { colorAlias = !string.IsNullOrWhiteSpace(productinfo.ColorAlias) ? productinfo.ColorAlias : colorAlias; sizeAlias = !string.IsNullOrWhiteSpace(productinfo.SizeAlias) ? productinfo.SizeAlias : sizeAlias; versionAlias = !string.IsNullOrWhiteSpace(productinfo.VersionAlias) ? productinfo.VersionAlias : versionAlias; } return(new { ItemId = item.Id, ProductId = item.ProductId, ProductName = item.ProductName, Count = item.Quantity, Price = item.SalePrice, //ProductImage = "http://" + Url.Request.RequestUri.Host + productService.GetProduct(item.ProductId).GetImage(ProductInfo.ImageSize.Size_100), ProductImage = Core.HimallIO.GetRomoteProductSizeImage(productService.GetProduct(item.ProductId).RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_100), color = item.Color, size = item.Size, version = item.Version, IsCanRefund = isCanApply, ColorAlias = colorAlias, SizeAlias = sizeAlias, VersionAlias = versionAlias }); }) }; VirtualProductInfo virtualProductInfo = null; List <dynamic> codes = null; List <dynamic> virtualItems = null; int validityType = 0; string startDate = string.Empty, endDate = string.Empty; if (order.OrderType == OrderInfo.OrderTypes.Virtual && orderDetail.OrderItems != null) { virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderDetail.OrderItems.FirstOrDefault().ProductId); if (virtualProductInfo != null) { validityType = virtualProductInfo.ValidityType ? 1 : 0; if (validityType == 1) { startDate = virtualProductInfo.StartDate.Value.ToString("yyyy-MM-dd"); endDate = virtualProductInfo.EndDate.Value.ToString("yyyy-MM-dd"); } } var verificationCodes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { order.Id }); if (verificationCodes != null) { verificationCodes.ForEach(a => { if (a.Status == OrderInfo.VerificationCodeStatus.WaitVerification || a.Status == OrderInfo.VerificationCodeStatus.Refund) { a.VerificationCode = System.Text.RegularExpressions.Regex.Replace(a.VerificationCode, "(\\d{4})\\d{4}(\\d{4})", "$1****$2"); } a.VerificationCode = System.Text.RegularExpressions.Regex.Replace(a.VerificationCode, @"(\d{4})", "$1 "); }); } codes = verificationCodes.Select(p => { return(new { VerificationCode = p.VerificationCode, Status = p.Status, StatusText = p.Status.ToDescription() }); }).ToList <dynamic>(); var virtualOrderItems = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id); virtualItems = virtualOrderItems.Select(p => { return(new { VirtualProductItemName = p.VirtualProductItemName, VirtualProductItemType = p.VirtualProductItemType, Content = ReplaceImage(p.Content, p.VirtualProductItemType) }); }).ToList <dynamic>(); } var orderModel = new { Id = order.Id, OrderType = order.OrderType, OrderTypeName = order.OrderType.ToDescription(), Status = order.OrderStatus.ToDescription(), ShipTo = order.ShipTo, Phone = order.CellPhone, Address = order.RegionFullName + " " + order.Address, HasExpressStatus = !string.IsNullOrWhiteSpace(order.ShipOrderNumber), ExpressCompanyName = order.ExpressCompanyName, Freight = order.Freight, Tax = order.Tax, IntegralDiscount = order.IntegralDiscount, RealTotalAmount = order.OrderTotalAmount - order.RefundTotalAmount, CapitalAmount = order.CapitalAmount, RefundTotalAmount = order.RefundTotalAmount, ProductTotalAmount = order.ProductTotalAmount, OrderDate = order.OrderDate.ToString("yyyy-MM-dd HH:mm:ss"), ShopName = order.ShopName, ShopBranchName = CurrentShopBranch.ShopBranchName, VShopId = vshop == null ? 0 : vshop.Id, commentCount = OrderApplication.GetOrderCommentCount(order.Id), ShopId = order.ShopId, orderStatus = (int)order.OrderStatus, //Invoice = order.InvoiceType.ToDescription(), //InvoiceValue = (int)order.InvoiceType, //InvoiceContext = order.InvoiceContext, //InvoiceTitle = order.InvoiceTitle, PaymentType = order.PaymentType.ToDescription(), PaymentTypeValue = (int)order.PaymentType, PaymentTypeDesc = order.PaymentTypeDesc, OrderPayAmount = order.OrderPayAmount, PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName, FullDiscount = order.FullDiscount, DiscountAmount = order.DiscountAmount, OrderRemarks = order.OrderRemarks, DeliveryType = order.DeliveryType, //InvoiceCode = order.InvoiceCode, OrderInvoice = OrderApplication.GetOrderInvoiceInfo(order.Id) }; return(new { success = true, Order = orderModel, OrderItem = orderDetail.OrderItems, VerificationCodes = codes, VirtualOrderItems = virtualItems, StartDate = startDate, EndDate = endDate, ValidityType = validityType }); }
public ActionResult Detail(long id) { var order = _iOrderService.GetOrder(id); if (order == null) { throw new MallException("错误的订单信息"); } if (order.OrderType == Entities.OrderInfo.OrderTypes.FightGroup) { var fgord = _iFightGroupService.GetFightGroupOrderStatusByOrderId(order.Id); order.FightGroupOrderJoinStatus = fgord.GetJoinStatus; order.FightGroupCanRefund = fgord.CanRefund; } var orderItems = _iOrderService.GetOrderItemsByOrderId(order.Id); //处理平台佣金 var orderRefunds = RefundApplication.GetOrderRefundList(id); foreach (var item in orderItems) { var refund = orderRefunds.Where(e => e.OrderItemId == item.Id).Sum(e => e.ReturnPlatCommission); item.PlatCommission = Math.Round(item.CommisRate * (item.RealTotalPrice - item.FullDiscount - item.CouponDiscount), 2); if (refund > 0) { item.PlatCommission = item.PlatCommission - refund; } item.PlatCommission = (item.PlatCommission < 0) ? 0 : item.PlatCommission; } ViewBag.OrderItems = orderItems; ViewBag.Logs = _iOrderService.GetOrderLogs(order.Id); ViewBag.Coupon = 0; string shipperAddress = string.Empty, shipperTelPhone = string.Empty; #region 门店信息 if (order.ShopBranchId > 0) { var shopBranchInfo = ShopBranchApplication.GetShopBranchById(order.ShopBranchId); if (shopBranchInfo != null) { ViewBag.ShopBranchInfo = shopBranchInfo; if (order.OrderStatus == Entities.OrderInfo.OrderOperateStatus.Finish) { ViewBag.ShopBranchContactUser = shopBranchInfo.UserName; } if (order.OrderType == OrderInfo.OrderTypes.Virtual) { shipperAddress = RegionApplication.GetFullName(shopBranchInfo.AddressId) + " " + shopBranchInfo.AddressDetail; shipperTelPhone = shopBranchInfo.ContactPhone; } } } #endregion if (order.OrderType == OrderInfo.OrderTypes.Virtual) { ViewBag.VirtualOrderItemInfos = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id); ViewBag.OrderVerificationCodeInfos = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { order.Id }); if (order.ShopBranchId == 0) { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(order.ShopId); if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } ViewBag.ShipperAddress = shipperAddress; ViewBag.ShipperTelPhone = shipperTelPhone; //发票信息 ViewBag.OrderInvoiceInfo = OrderApplication.GetOrderInvoiceInfo(order.Id); //统一显示支付方式名称 order.PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName; return(View(order)); }
private void InintData() { string methodName = "InintData"; try { WorkFlowInstance Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString()); PaymentApplicationInfo item = PaymentApplication.GetPaymentApplicationInfoByInstanceId(ViewState["InstanceID"].ToString()); if (item != null) { PaymentApplicationInfo info = PaymentApplication.GetPaymentApplicationInfo(Instance.FormId); Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId); ddlDepartName.Text = deptInfo.Remark; cblisoverCotract.Checked = info.IsOverContract == 1; cbChairman.Checked = info.IsCheckedChairman == 1; if (info.StartDeptId.Contains("S972")) { lbPresident.Text = "总经理意见:"; } else { lbPresident.Text = "总裁意见:"; } //LoadRelationPerson(info.StartDeptId); //cbRelatonUsers.Visible = cbPayer.Checked; //cbRelatonUsers.Enabled = false; //if (!string.IsNullOrEmpty(info.LeadersSelected)) //{ // string[] cbDatas = info.LeadersSelected.Split(','); // foreach (var cbItem in cbDatas) // { // ListItem listItem = cbRelatonUsers.Items.FindByValue(cbItem); // listItem.Selected = true; // } //} } FlowRelated1.ProcId = ViewState["InstanceID"].ToString(); Countersign1.ProcId = ViewState["InstanceID"].ToString(); UploadAttachments1.ProcId = ViewState["InstanceID"].ToString(); ApproveOpinionUCDeptleader.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUCRealateDept.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUCLeader.InstanceId = ViewState["InstanceID"].ToString(); Option_4.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC1.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC2.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC22.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC3.InstanceId = ViewState["InstanceID"].ToString(); Option_0.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC4.InstanceId = ViewState["InstanceID"].ToString(); Option_10.InstanceId = ViewState["InstanceID"].ToString(); Option_11.InstanceId = ViewState["InstanceID"].ToString(); Option_12.InstanceId = ViewState["InstanceID"].ToString(); Option_13.InstanceId = ViewState["InstanceID"].ToString(); } catch (Exception ex) { Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex)); throw ex; } Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT); }
/// <summary> /// 根据提货码取订单 /// </summary> /// <param name="pickcode"></param> /// <returns></returns> public object GetShopBranchOrder(string pickcode) { CheckUserLogin(); var codeInfo = OrderApplication.GetOrderVerificationCodeInfoByCode(pickcode); if (codeInfo != null) { var order = OrderApplication.GetOrderInfo(codeInfo.OrderId); if (order == null) { return new { success = false, msg = "该核销码无效" } } ; if (order.OrderType != OrderInfo.OrderTypes.Virtual) { return new { success = false, msg = "核销订单无效" } } ; if (order.ShopBranchId != CurrentShopBranch.Id) { return new { success = false, msg = "非本店核销码,请买家核对信息" } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.AlreadyVerification) { return new { success = false, msg = string.Format("该核销码于{0}已核销", codeInfo.VerificationTime.Value.ToString("yyyy-MM-dd HH:mm")) } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.Expired) { return new { success = false, msg = "此核销码已过期,无法核销" } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.Refund) { return new { success = false, msg = "此核销码正处于退款中,无法核销" } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.RefundComplete) { return new { success = false, msg = "此核销码已经退款成功,无法核销" } } ; var orderItem = Application.OrderApplication.GetOrderItemsByOrderId(order.Id); var orderItemInfo = orderItem.FirstOrDefault(); var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderItemInfo.ProductId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now < virtualProductInfo.StartDate.Value) { return(new { success = false, msg = "该核销码暂时不能核销,请留意生效时间!" }); } if (orderItemInfo.EffectiveDate.HasValue) { if (DateTime.Now < orderItemInfo.EffectiveDate.Value) { return new { success = false, msg = "该核销码暂时不能核销,请留意生效时间!" } } ; } foreach (var item in orderItem) { item.ThumbnailsUrl = Core.HimallIO.GetRomoteProductSizeImage(item.ThumbnailsUrl, 1, (int)Himall.CommonModel.ImageSize.Size_100); Entities.TypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetTypeByProductId(item.ProductId); item.ColorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; item.SizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; item.VersionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; var productInfo = ProductManagerApplication.GetProduct(item.ProductId); if (productInfo != null) { item.ColorAlias = !string.IsNullOrWhiteSpace(productInfo.ColorAlias) ? productInfo.ColorAlias : item.ColorAlias; item.SizeAlias = !string.IsNullOrWhiteSpace(productInfo.SizeAlias) ? productInfo.SizeAlias : item.SizeAlias; item.VersionAlias = !string.IsNullOrWhiteSpace(productInfo.VersionAlias) ? productInfo.VersionAlias : item.VersionAlias; } } var verifications = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { order.Id }).Where(a => a.Status == OrderInfo.VerificationCodeStatus.WaitVerification); var codes = verifications.ToList();//待消费的核销码 if (codes != null) { codes.ForEach(a => { a.SourceCode = a.VerificationCode; a.VerificationCode = System.Text.RegularExpressions.Regex.Replace(a.VerificationCode, "(\\d{4})\\d{4}(\\d{4})", "$1****$2"); }); } var virtualOrderItemInfos = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id).Select(p => { return(new { VirtualProductItemType = p.VirtualProductItemType, VirtualProductItemName = p.VirtualProductItemName, Content = ReplaceImage(p.Content, p.VirtualProductItemType) }); }); order.OrderStatusText = order.OrderStatus.ToDescription(); order.PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName;//统一显示支付方式名称 return(new { success = true, order = order, orderItem = orderItem, virtualProductInfo = virtualProductInfo, virtualOrderItemInfos = virtualOrderItemInfos, verificationCodes = codes }); } else { var order = Application.OrderApplication.GetOrderByPickCode(pickcode); if (order == null) { return new { success = false, msg = "该核销码无效" } } ; if (order.ShopBranchId != CurrentShopBranch.Id) { return new { success = false, msg = "非本门店核销码,请买家核对提货信息" } } ; if (order.OrderStatus == Entities.OrderInfo.OrderOperateStatus.Finish && order.DeliveryType == CommonModel.DeliveryType.SelfTake) { return new { success = false, msg = "该核销码于" + order.FinishDate.ToString() + "已核销" } } ; var orderRefundInfo = RefundApplication.GetOrderRefundByOrderId(order.Id); if (orderRefundInfo != null && orderRefundInfo.ManagerConfirmStatus == OrderRefundInfo.OrderRefundConfirmStatus.Confirmed) { return(new { success = false, msg = "该订单已退款,不能再核销" }); } var orderItem = Application.OrderApplication.GetOrderItemsByOrderId(order.Id); foreach (var item in orderItem) { item.ThumbnailsUrl = Core.HimallIO.GetRomoteProductSizeImage(item.ThumbnailsUrl, 1, (int)Himall.CommonModel.ImageSize.Size_100); Entities.TypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetTypeByProductId(item.ProductId); item.ColorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; item.SizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; item.VersionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; var productInfo = ProductManagerApplication.GetProduct(item.ProductId); if (productInfo != null) { item.ColorAlias = !string.IsNullOrWhiteSpace(productInfo.ColorAlias) ? productInfo.ColorAlias : item.ColorAlias; item.SizeAlias = !string.IsNullOrWhiteSpace(productInfo.SizeAlias) ? productInfo.SizeAlias : item.SizeAlias; item.VersionAlias = !string.IsNullOrWhiteSpace(productInfo.VersionAlias) ? productInfo.VersionAlias : item.VersionAlias; } } //退款状态 var refundobjs = OrderApplication.GetOrderRefunds(orderItem.Select(e => e.Id)); //小于4表示商家未确认;与平台未审核,都算退款、退货中 var refundProcessing = refundobjs.Where(e => (int)e.SellerAuditStatus > 4 && ((int)e.SellerAuditStatus < 4 || e.ManagerConfirmStatus == OrderRefundInfo.OrderRefundConfirmStatus.UnConfirm)); if (refundProcessing.Count() > 0) { order.RefundStats = 1; } order.OrderStatusText = order.OrderStatus.ToDescription(); return(new { success = true, order = order, orderItem = orderItem }); } }
private static decimal SaveLoanPayment(DateTime entryDate, decimal LoanPayment, LoanAccount loanAccount, Payment ParentPayment) { if (LoanPayment > 0) { decimal amountapplied = 0; if (loanAccount.LoanBalance <= LoanPayment) amountapplied = loanAccount.LoanBalance; else amountapplied = LoanPayment; PaymentApplication loanpaymentApplication = new PaymentApplication(); loanpaymentApplication.Payment = ParentPayment; loanpaymentApplication.FinancialAccountId = loanAccount.FinancialAccountId; loanpaymentApplication.AmountApplied = amountapplied; Context.PaymentApplications.AddObject(loanpaymentApplication); loanAccount.LoanBalance -= amountapplied; LoanPayment -= amountapplied; LoanAccount.UpdateLoanStatus(entryDate, loanAccount, loanAccount.LoanBalance); } return LoanPayment; }
/// <summary> /// 根据核销码取订单 /// </summary> /// <param name="pickcode"></param> /// <returns></returns> public object GetShopOrder(string pickcode) { CheckUserLogin(); var codeInfo = OrderApplication.GetOrderVerificationCodeInfoByCode(pickcode); if (codeInfo == null) { return new { success = false, msg = "该核销码无效" } } ; var order = OrderApplication.GetOrderInfo(codeInfo.OrderId); if (order == null) { return new { success = false, msg = "该核销码无效" } } ; if (order.OrderType != OrderInfo.OrderTypes.Virtual) { return new { success = false, msg = "核销订单无效" } } ; if (order.ShopId != this.CurrentShop.Id) { return new { success = false, msg = "非本店核销码,请买家核对信息" } } ; if (order.ShopBranchId > 0)//商家只能核销本商家,而非下面门店的 { return new { success = false, msg = "非本店核销码,请买家核对信息" } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.AlreadyVerification) { return new { success = false, msg = string.Format("该核销码于{0}已核销", codeInfo.VerificationTime.Value.ToString("yyyy-MM-dd HH:mm")) } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.Expired) { return new { success = false, msg = "此核销码已过期,无法核销" } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.Refund) { return new { success = false, msg = "此核销码正处于退款中,无法核销" } } ; if (codeInfo.Status == OrderInfo.VerificationCodeStatus.RefundComplete) { return new { success = false, msg = "此核销码已经退款成功,无法核销" } } ; var orderItem = Application.OrderApplication.GetOrderItemsByOrderId(order.Id); var orderItemInfo = orderItem.FirstOrDefault(); var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderItemInfo.ProductId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now < virtualProductInfo.StartDate.Value) { return(new { success = false, msg = "该核销码暂时不能核销,请留意生效时间!" }); } if (orderItemInfo.EffectiveDate.HasValue) { if (DateTime.Now < orderItemInfo.EffectiveDate.Value) { return new { success = false, msg = "该核销码暂时不能核销,请留意生效时间!" } } ; } foreach (var item in orderItem) { item.ThumbnailsUrl = Core.HimallIO.GetRomoteProductSizeImage(item.ThumbnailsUrl, 1, (int)Himall.CommonModel.ImageSize.Size_100); Entities.TypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetTypeByProductId(item.ProductId); item.ColorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; item.SizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; item.VersionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; var productInfo = ProductManagerApplication.GetProduct(item.ProductId); if (productInfo != null) { item.ColorAlias = !string.IsNullOrWhiteSpace(productInfo.ColorAlias) ? productInfo.ColorAlias : item.ColorAlias; item.SizeAlias = !string.IsNullOrWhiteSpace(productInfo.SizeAlias) ? productInfo.SizeAlias : item.SizeAlias; item.VersionAlias = !string.IsNullOrWhiteSpace(productInfo.VersionAlias) ? productInfo.VersionAlias : item.VersionAlias; } } int validityType = 0; string startDate = string.Empty, endDate = string.Empty; if (virtualProductInfo != null) { validityType = virtualProductInfo.ValidityType ? 1 : 0; if (validityType == 1) { startDate = virtualProductInfo.StartDate.Value.ToString("yyyy-MM-dd"); endDate = virtualProductInfo.EndDate.Value.ToString("yyyy-MM-dd"); } } var verifications = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { order.Id }).Where(a => a.Status == OrderInfo.VerificationCodeStatus.WaitVerification); var codes = verifications.ToList();//待消费的核销码 if (codes != null) { codes.ForEach(a => { a.SourceCode = a.VerificationCode; a.VerificationCode = System.Text.RegularExpressions.Regex.Replace(a.VerificationCode, "(\\d{4})\\d{4}(\\d{4})", "$1****$2"); }); } var verificationCode = codes.Select(p => { return(new { Status = p.Status, VerificationCode = p.VerificationCode, SourceCode = p.SourceCode }); }); var virtualOrderItemInfos = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id).Select(p => { return(new { VirtualProductItemType = p.VirtualProductItemType, VirtualProductItemName = p.VirtualProductItemName, Content = ReplaceImage(p.Content, p.VirtualProductItemType) }); }); order.OrderStatusText = order.OrderStatus.ToDescription(); order.PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName;//统一显示支付方式名称 return(new { success = true, order = order, orderItem = orderItem, virtualOrderItemInfos = virtualOrderItemInfos, verificationCodes = verificationCode, validityType = validityType, startDate = startDate, endDate = endDate }); }
/// <summary> /// 预账户充值接口 /// </summary> /// <param name="pluginId">支付插件Id</param> /// <param name="amount">充值金额</param> /// <returns></returns> public object Charge(PaymentChargeModel para) { para.amount = Math.Round(para.amount, 2); if (para.amount <= 0) { return(ErrorResult("请输入正确的金额")); } try { //获取支付插件 var mobilePayments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).OrderByDescending(d => d.PluginInfo.PluginId).Where(item => item.Biz.SupportPlatforms.Contains(Core.PlatformType.Android)); var plugin = mobilePayments.Where(x => x.PluginInfo.PluginId.Contains(para.typeid)).FirstOrDefault(); //添加充值明细 var chargeDetail = new DTO.ChargeDetail(); chargeDetail.ChargeAmount = para.amount; chargeDetail.ChargeStatus = ChargeDetailInfo.ChargeDetailStatus.WaitPay; //chargeDetail.ChargeWay = plugin.PluginInfo.DisplayName; chargeDetail.ChargeWay = PaymentApplication.GetForeGroundPaymentName(plugin.PluginInfo.Description); chargeDetail.CreateTime = DateTime.Now; chargeDetail.MemId = CurrentUser.Id; var sitesetting = SiteSettingApplication.SiteSettings; if (para.ispresent && sitesetting.IsOpenRechargePresent) { var rule = RechargePresentRuleApplication.GetRules().FirstOrDefault(d => d.ChargeAmount == para.amount); if (rule != null) { chargeDetail.PresentAmount = rule.PresentAmount; } } var id = MemberCapitalApplication.AddChargeApply(chargeDetail); string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); string urlPre = webRoot + "/m-" + Core.PlatformType.Android + "/Payment/"; string notifyPre = urlPre + "CapitalChargeNotify/"; string returnPre = webRoot + "/m-" + Core.PlatformType.Android; var model = mobilePayments.ToArray().Select(item => { string url = string.Empty; try { url = item.Biz.GetRequestUrl(returnPre, notifyPre + item.PluginInfo.PluginId.Replace(".", "-") + "/", id.ToString(), para.amount, "会员充值"); } catch (Exception ex) { Core.Log.Error("获取支付方式错误:", ex); } return(new { id = item.PluginInfo.PluginId, //name = item.PluginInfo.DisplayName, name = PaymentApplication.GetForeGroundPaymentName(item.PluginInfo.DisplayName), logo = item.Biz.Logo, url = url }); }); model = model.Where(item => !string.IsNullOrWhiteSpace(item.url) && item.id.Contains(para.typeid)).OrderByDescending(d => d.id); dynamic result = SuccessResult(); result.data = model; return(result); } catch (Exception ex) { Core.Log.Error("预账户充值报错:", ex); return(ErrorResult("预账户充值报错")); } }
/// <summary> /// 订单详细信息页面 /// </summary> /// <param name="id">订单Id</param> public ActionResult Detail(long id) { OrderDetailView view = OrderApplication.Detail(id, UserId, PlatformType, Request.Url.Host); ViewBag.Detail = view.Detail; ViewBag.Bonus = view.Bonus; ViewBag.ShareHref = view.ShareHref; ViewBag.IsRefundTimeOut = view.IsRefundTimeOut; ViewBag.Logo = SiteSettings.Logo; view.Order.FightGroupOrderJoinStatus = view.FightGroupJoinStatus; view.Order.FightGroupCanRefund = view.FightGroupCanRefund; var customerServices = CustomerServiceApplication.GetMobileCustomerServiceAndMQ(view.Order.ShopId); ViewBag.CustomerServices = customerServices; string shipperAddress = string.Empty, shipperTelPhone = string.Empty; #region 门店信息 if (view.Order.ShopBranchId > 0) { var shopBranchInfo = ShopBranchApplication.GetShopBranchById(view.Order.ShopBranchId); ViewBag.ShopBranchInfo = shopBranchInfo; if (view.Order.OrderType == OrderInfo.OrderTypes.Virtual && shopBranchInfo != null) { shipperAddress = RegionApplication.GetFullName(shopBranchInfo.AddressId) + " " + shopBranchInfo.AddressDetail; shipperTelPhone = shopBranchInfo.ContactPhone; } } else { if (view.Order.OrderType == OrderInfo.OrderTypes.Virtual) { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(view.Order.ShopId); if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } #endregion ViewBag.isCanRefundOrder = OrderApplication.CanRefund(view.Order); #region 虚拟订单信息 if (view.Order.OrderType == OrderInfo.OrderTypes.Virtual) { var orderItemInfo = view.Detail.OrderItems.FirstOrDefault(); if (orderItemInfo != null) { ViewBag.virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderItemInfo.ProductId); var orderVerificationCodes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { view.Order.Id }); orderVerificationCodes.ForEach(a => { a.QRCode = GetQRCode(a.VerificationCode); }); ViewBag.orderVerificationCodes = orderVerificationCodes; ViewBag.virtualOrderItemInfos = OrderApplication.GetVirtualOrderItemInfosByOrderId(view.Order.Id); } } #endregion //发票信息 ViewBag.OrderInvoiceInfo = OrderApplication.GetOrderInvoiceInfo(view.Order.Id); //统一显示支付方式名称 view.Order.PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(view.Order.PaymentTypeGateway) ?? view.Order.PaymentTypeName; ViewBag.ShipperAddress = shipperAddress; ViewBag.ShipperTelPhone = shipperTelPhone; return(View(view.Order)); }
public ActionResult CreateSPEI(PaymentViewModel model) { //Setear variables del conector PaymentApplication paymentApp = _paymentService.GetPaymentApplicationByKey(AppKey); paymentProviderService.MerchantId = paymentApp.MerchantId; paymentProviderService.PublicKey = paymentApp.PublicKey; paymentProviderService.PrivateKey = paymentApp.PrivateKey; paymentProviderService.DashboardURL = paymentApp.DashboardURL; PaymentModel payment = new PaymentModel() { ClientId = paymentApp.ClientId, OrderId = model.OrderId, Amount = model.Amount, DueDate = DateUtil.GetDateTimeNow().AddDays(TransferExpirationDays), Description = String.Format("Pago de orden {0}", model.OrderId), }; model.PaymentMethod = PaymentMethod.BANK_ACCOUNT; payment = paymentProviderService.CreateBankTransferPayment(payment); model.ChargeSuccess = payment.ChargeSuccess; if (payment.ChargeSuccess) { //Primero guardar en BD Payment paymentBO = new Payment(); paymentBO.CreationDate = DateUtil.GetDateTimeNow(); paymentBO.User = new User() { Id = Authenticator.AuthenticatedUser.Id }; paymentBO.Amount = model.Amount; paymentBO.OrderId = model.OrderId; paymentBO.ConfirmationEmail = model.ConfirmationEmail; paymentBO.ProviderId = payment.Id; paymentBO.Status = payment.Status; paymentBO.DueDate = payment.DueDate; paymentBO.Method = PaymentMethod.BANK_ACCOUNT; paymentBO.TransactionType = PaymentType.CHARGE; paymentBO.ConfirmationDate = null; _paymentService.Create(paymentBO); model.Id = payment.Id; model.Description = payment.Description; model.JsonData = payment.ResultData; model.DueDate = payment.DueDate; model.PaymentCardURL = payment.PaymentCardURL; model.BankName = payment.PaymentMethod.BankName; model.Clabe = payment.PaymentMethod.Clabe; model.Reference = payment.PaymentMethod.Reference; model.Name = payment.PaymentMethod.Name; model.Agreement = payment.PaymentMethod.Agreement; } else { model.Description = payment.ResultData; } //return View("CreateSPEI", model); return(View("CheckoutSuccess", model)); }
public ActionResult CreateTDC(PaymentViewModel model) { //Setear variables del conector PaymentApplication paymentApp = _paymentService.GetPaymentApplicationByKey(AppKey); paymentProviderService.MerchantId = paymentApp.MerchantId; paymentProviderService.PublicKey = paymentApp.PublicKey; paymentProviderService.PrivateKey = paymentApp.PrivateKey; paymentProviderService.DashboardURL = paymentApp.DashboardURL; PaymentModel payment = new PaymentModel() { ClientId = paymentApp.ClientId, OrderId = model.OrderId, Amount = model.Amount, TokenId = model.TokenId, DeviceSessionId = model.DeviceSessionId, Description = String.Format("Pago de orden {0}", model.OrderId), RedirectUrl = SecureVerificationURL, //Use3DSecure = true }; //Primero en BD Payment paymentBO = new Payment(); paymentBO.CreationDate = DateUtil.GetDateTimeNow(); paymentBO.User = new User() { Id = Authenticator.AuthenticatedUser.Id }; paymentBO.Amount = model.Amount; paymentBO.OrderId = model.OrderId; paymentBO.ConfirmationEmail = model.ConfirmationEmail; paymentBO.Status = PaymentStatus.IN_PROGRESS; paymentBO.Method = PaymentMethod.CARD; paymentBO.TransactionType = PaymentType.CHARGE; paymentBO.ConfirmationDate = null; _paymentService.Create(paymentBO); //Luego cobrar model.PaymentMethod = PaymentMethod.CARD; payment = paymentProviderService.CreateTDCPayment(payment); //Si hubiera reintento, probar Antifraude if (UseSelective3DSecure && !payment.ChargeSuccess & payment.ResultCode == PaymentError.ANTI_FRAUD) { payment.Use3DSecure = true; payment = paymentProviderService.CreateTDCPayment(payment); } model.ChargeSuccess = payment.ChargeSuccess; if (payment.ChargeSuccess) { //Luego actualizar paymentBO.ProviderId = payment.Id; paymentBO.Status = payment.Status; paymentBO.DueDate = payment.DueDate; paymentBO.LogData = payment.ResultData; _paymentService.Update(paymentBO); model.Id = payment.Id; model.Description = payment.Description; model.JsonData = payment.ResultData; model.DueDate = payment.DueDate; model.PaymentCardURL = payment.PaymentCardURL; } else { paymentBO.Status = PaymentStatus.ERROR; paymentBO.LogData = payment.ResultData; _paymentService.Update(paymentBO); model.Description = payment.ResultData; } // Session.Add("Payments.PaymentModel", model); if (payment.PaymentMethod != null && !string.IsNullOrEmpty(payment.PaymentMethod.RedirectUrl)) { return(Redirect(payment.PaymentMethod.RedirectUrl)); } //return View("CreateTDC", model); return(View("CheckoutSuccess", model)); }
public object GetOrderDetail(long id) { CheckUserLogin(); OrderInfo order = ServiceProvider.Instance <IOrderService> .Create.GetOrder(id, CurrentUser.Id); var orderService = ServiceProvider.Instance <IOrderService> .Create; var bonusService = ServiceProvider.Instance <IShopBonusService> .Create; var orderRefundService = ServiceProvider.Instance <IRefundService> .Create; var bonusmodel = bonusService.GetGrantByUserOrder(id, CurrentUser.Id); bool hasBonus = bonusmodel != null ? true : false; string shareHref = ""; string shareTitle = ""; string shareDetail = ""; string shareImg = ""; if (hasBonus) { shareHref = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/shopbonus/index/" + bonusService.GetGrantIdByOrderId(id); var bonus = ShopBonusApplication.GetBonus(bonusmodel.ShopBonusId); shareTitle = bonus.ShareTitle; shareDetail = bonus.ShareDetail; shareImg = HimallIO.GetRomoteImagePath(bonus.ShareImg); } var vshop = ServiceProvider.Instance <IVShopService> .Create.GetVShopByShopId(order.ShopId); var customerServices = CustomerServiceApplication.GetMobileCustomerServiceAndMQ(order.ShopId); var shop = ShopApplication.GetShop(order.ShopId); var orderItems = OrderApplication.GetOrderItemsByOrderId(order.Id); var products = ProductManagerApplication.GetProducts(orderItems.Select(p => p.ProductId)); var refunds = OrderApplication.GetOrderRefundsByOrder(order.Id); //获取订单商品项数据 var orderDetail = new { ShopId = shop.Id, ShopName = shop.ShopName, OrderItems = orderItems.Select(item => { var product = products.FirstOrDefault(p => p.Id == item.ProductId); var typeInfo = TypeApplication.GetType(product.TypeId); string colorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; string sizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; string versionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; if (product != null) { colorAlias = !string.IsNullOrWhiteSpace(product.ColorAlias) ? product.ColorAlias : colorAlias; sizeAlias = !string.IsNullOrWhiteSpace(product.SizeAlias) ? product.SizeAlias : sizeAlias; versionAlias = !string.IsNullOrWhiteSpace(product.VersionAlias) ? product.VersionAlias : versionAlias; } var itemrefund = refunds.FirstOrDefault(d => d.OrderItemId == item.Id && d.RefundMode != OrderRefundInfo.OrderRefundMode.OrderRefund); int?itemrefstate = (itemrefund == null ? null : (int?)itemrefund.SellerAuditStatus); itemrefstate = (itemrefstate > 4 ? (int?)itemrefund.ManagerConfirmStatus : itemrefstate); var IsCanRefund = OrderApplication.CanRefund(order, itemrefstate, itemId: item.Id); return(new { ItemId = item.Id, ProductId = item.ProductId, ProductName = item.ProductName, Count = item.Quantity, Price = item.SalePrice, ProductImage = Core.HimallIO.GetRomoteProductSizeImage(product.RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_100), color = item.Color, size = item.Size, version = item.Version, IsCanRefund = IsCanRefund, ColorAlias = colorAlias, SizeAlias = sizeAlias, VersionAlias = versionAlias, EnabledRefundAmount = item.EnabledRefundAmount, OrderRefundId = (itemrefund == null ? 0 : itemrefund.Id), RefundStats = itemrefstate }); }) }; //取拼团订单状态 var fightGroupOrderInfo = ServiceProvider.Instance <IFightGroupService> .Create.GetFightGroupOrderStatusByOrderId(order.Id); var _ordrefobj = orderRefundService.GetOrderRefundByOrderId(order.Id) ?? new OrderRefundInfo { Id = 0 }; if (order.OrderStatus != OrderInfo.OrderOperateStatus.WaitDelivery && order.OrderStatus != OrderInfo.OrderOperateStatus.WaitSelfPickUp) { _ordrefobj = new OrderRefundInfo { Id = 0 }; } int?ordrefstate = (_ordrefobj == null ? null : (int?)_ordrefobj.SellerAuditStatus); ordrefstate = (ordrefstate > 4 ? (int?)_ordrefobj.ManagerConfirmStatus : ordrefstate); var hasAppendComment = ServiceProvider.Instance <ICommentService> .Create.HasAppendComment(orderItems.FirstOrDefault().Id); var orderModel = new { Id = order.Id, OrderType = order.OrderType, OrderTypeName = order.OrderType.ToDescription(), Status = order.OrderStatus.ToDescription(), JoinStatus = fightGroupOrderInfo == null ? -2 : fightGroupOrderInfo.JoinStatus, ShipTo = order.ShipTo, Phone = order.CellPhone, Address = order.RegionFullName + " " + order.Address, HasExpressStatus = !string.IsNullOrWhiteSpace(order.ShipOrderNumber), ExpressCompanyName = order.ExpressCompanyName, Freight = order.Freight, Tax = order.Tax, IntegralDiscount = order.IntegralDiscount, RealTotalAmount = order.OrderTotalAmount, CapitalAmount = order.CapitalAmount, RefundTotalAmount = order.RefundTotalAmount, ProductTotalAmount = order.ProductTotalAmount, OrderPayAmount = order.OrderPayAmount,//订单需要第三方支付的金额 PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName, PaymentTypeDesc = order.PaymentTypeDesc, OrderDate = order.OrderDate.ToString("yyyy-MM-dd HH:mm:ss"), ShopName = order.ShopName, VShopId = vshop == null ? 0 : vshop.Id, commentCount = OrderApplication.GetOrderCommentCount(order.Id), ShopId = order.ShopId, orderStatus = (int)order.OrderStatus, //Invoice = order.InvoiceType.ToDescription(), //InvoiceValue = (int)order.InvoiceType, //InvoiceContext = order.InvoiceContext, //InvoiceTitle = order.InvoiceTitle, //InvoiceCode = order.InvoiceCode, PaymentType = order.PaymentType.ToDescription(), PaymentTypeValue = (int)order.PaymentType, FullDiscount = order.FullDiscount, DiscountAmount = order.DiscountAmount, OrderRemarks = string.IsNullOrEmpty(order.OrderRemarks) ? "" : order.OrderRemarks, HasBonus = hasBonus, ShareHref = shareHref, ShareTitle = shareTitle, ShareDetail = shareDetail, ShareImg = shareImg, IsCanRefund = !(orderDetail.OrderItems.Any(e => e.IsCanRefund == true)) && OrderApplication.CanRefund(order, ordrefstate, null), RefundStats = ordrefstate, OrderRefundId = _ordrefobj.Id > 0 ? _ordrefobj.Id : 0, EnabledRefundAmount = order.OrderEnabledRefundAmount, HasAppendComment = hasAppendComment, SelfTake = order.DeliveryType == Himall.CommonModel.DeliveryType.SelfTake ? 1 : 0, OrderInvoice = OrderApplication.GetOrderInvoiceInfo(order.Id) }; #region 门店配送信息 Himall.DTO.ShopBranch storeInfo = null; if (order.ShopBranchId > 0) { storeInfo = ShopBranchApplication.GetShopBranchById(order.ShopBranchId); } #endregion #region 虚拟订单信息 VirtualProductInfo virtualProductInfo = null; int validityType = 0; string startDate = string.Empty, endDate = string.Empty; List <dynamic> orderVerificationCodes = null; List <dynamic> virtualOrderItemInfos = null; bool isCanRefundVirtual = false; if (order.OrderType == OrderInfo.OrderTypes.Virtual) { var orderItemInfo = orderItems.FirstOrDefault(); if (orderItemInfo != null) { virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderItemInfo.ProductId); if (virtualProductInfo != null) { validityType = virtualProductInfo.ValidityType ? 1 : 0; if (validityType == 1) { startDate = virtualProductInfo.StartDate.Value.ToString("yyyy-MM-dd"); endDate = virtualProductInfo.EndDate.Value.ToString("yyyy-MM-dd"); } } var codes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { order.Id }); orderVerificationCodes = codes.Select(p => { return(new { VerificationCode = Regex.Replace(p.VerificationCode, @"(\d{4})", "$1 "), Status = p.Status, StatusText = p.Status.ToDescription(), QRCode = GetQRCode(p.VerificationCode) }); }).ToList <dynamic>(); var virtualItems = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id); virtualOrderItemInfos = virtualItems.Select(p => { return(new { VirtualProductItemName = p.VirtualProductItemName, Content = ReplaceImage(p.Content, p.VirtualProductItemType), VirtualProductItemType = p.VirtualProductItemType }); }).ToList <dynamic>(); } } if (order.OrderStatus == Himall.Entities.OrderInfo.OrderOperateStatus.WaitVerification) { if (virtualProductInfo != null) { if (virtualProductInfo.SupportRefundType == 2) { isCanRefundVirtual = true; } else if (virtualProductInfo.SupportRefundType == 1) { if (virtualProductInfo.EndDate.Value > DateTime.Now) { isCanRefundVirtual = true; } } else if (virtualProductInfo.SupportRefundType == 3) { isCanRefundVirtual = false; } if (isCanRefundVirtual) { long num = orderVerificationCodes.Where(a => a.Status == OrderInfo.VerificationCodeStatus.WaitVerification).Count(); if (num > 0) { isCanRefundVirtual = true; } else { isCanRefundVirtual = false; } } } } #endregion #region 虚拟订单核销地址信息 string shipperAddress = string.Empty, shipperTelPhone = string.Empty; if (order.OrderType == OrderInfo.OrderTypes.Virtual) { if (order.ShopBranchId > 0 && storeInfo != null) { shipperAddress = RegionApplication.GetFullName(storeInfo.AddressId) + " " + storeInfo.AddressDetail; shipperTelPhone = storeInfo.ContactPhone; } else { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(order.ShopId); if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } #endregion return(new { success = true, Order = orderModel, OrderItem = orderDetail.OrderItems, StoreInfo = storeInfo, CustomerServices = customerServices, ValidityType = validityType, StartDate = startDate, EndDate = endDate, OrderVerificationCodes = orderVerificationCodes, VirtualOrderItemInfos = virtualOrderItemInfos, IsCanRefundVirtual = isCanRefundVirtual, ShipperAddress = shipperAddress, ShipperTelPhone = shipperTelPhone }); }
private static void SaveInterestPayment(DateTime entryDate, decimal InterestPayment, LoanAccount loanAccount, Payment ParentPayment) { if (InterestPayment > 0) { var receivables = from r in Context.Receivables join rs in Context.ReceivableStatus on r.Id equals rs.ReceivableId where r.FinancialAccountId == loanAccount.FinancialAccountId && rs.IsActive == true && (rs.ReceivableStatusType.Id == ReceivableStatusType.OpenType.Id || rs.ReceivableStatusType.Id == ReceivableStatusType.PartiallyPaidType.Id) orderby r.ValidityPeriod select r; foreach (var receivable in receivables) { if (InterestPayment > 0) { decimal amountapplied = 0; if (receivable.Balance <= InterestPayment) amountapplied = (decimal)receivable.Balance; else if (receivable.Balance > InterestPayment) amountapplied = InterestPayment; PaymentApplication paymentApplication = new PaymentApplication(); paymentApplication.Payment = ParentPayment; paymentApplication.ReceivableId = receivable.Id; paymentApplication.AmountApplied = amountapplied; Context.PaymentApplications.AddObject(paymentApplication); receivable.Balance -= amountapplied; Receivable.InsertReceivableStatus(receivable.Id, receivable.Balance, entryDate); InterestPayment -= amountapplied; } //Context.SaveChanges(); } } }
public ActionResult Detail(long id) { var order = _iOrderService.GetOrder(id, CurrentUser.Id);//限制到用户 var orderItems = _iOrderService.GetOrderItemsByOrderId(order.Id); //补充商品货号 var proids = orderItems.Select(d => d.ProductId); var procodelist = ProductManagerApplication.GetProductByIds(proids).Select(d => new { d.Id, d.ProductCode, d.FreightTemplateId }).ToList(); foreach (var item in orderItems) { var _tmp = procodelist.Find(d => d.Id == item.ProductId); if (_tmp != null) { item.ProductCode = _tmp.ProductCode; item.FreightId = _tmp.FreightTemplateId; } } var service = ServiceApplication.Create <Mall.IServices.IProductService>(); // string RegionIdPath = regionService.GetRegionPath(order.RegionId); var freightProductGroup = orderItems.GroupBy(a => a.FreightId); if (order.DeliveryType != CommonModel.DeliveryType.SelfTake) { var regionService = ServiceApplication.Create <Mall.IServices.IRegionService>(); var region = regionService.GetRegion(order.RegionId); int cityId = 0; if (region != null) { cityId = region.Id; } //foreach (var f in freightProductGroup) //{ // var productIds = f.Select(a => a.ProductId); // var counts = f.Select(a => Convert.ToInt32(a.Quantity)); // decimal freight = service.GetFreight(productIds, counts, cityId); // foreach (var item in f) // { // item.Freight = freight; // } //} } ViewBag.freightProductGroup = freightProductGroup; ViewBag.Coupon = 0; var coupon = _iCouponService.GetCouponRecordInfo(order.UserId, order.Id); var bonus = _iShopBonusService.GetUsedPrice(order.Id, order.UserId); if (coupon != null) { ViewBag.Coupon = CouponApplication.GetCouponInfo(coupon.CouponId).Price; } else if (bonus > 0) { ViewBag.Coupon = bonus; } if (order.OrderType == Entities.OrderInfo.OrderTypes.FightGroup) { var fgord = _iFightGroupService.GetFightGroupOrderStatusByOrderId(order.Id); order.FightGroupOrderJoinStatus = fgord.GetJoinStatus; order.FightGroupCanRefund = fgord.CanRefund; } //使用OrderListModel // AutoMapper.Mapper.CreateMap<OrderInfo, OrderListModel>(); // AutoMapper.Mapper.CreateMap<OrderItemInfo, OrderItemListModel>(); var orderModel = order.Map <OrderListModel>(); orderModel.OrderItemList = orderItems.Map <IEnumerable <OrderItemListModel> >(); if (order.ShopBranchId > 0) {//补充数据 var branch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId); if (branch != null) { orderModel.ShopBranchName = branch.ShopBranchName; orderModel.ShopBranchAddress = branch.AddressFullName; orderModel.ShopBranchContactPhone = branch.ContactPhone; } } if (order.FightGroupOrderJoinStatus.HasValue) { orderModel.FightGroupJoinStatus = order.FightGroupOrderJoinStatus.Value; } orderModel.UserRemark = order.OrderRemarks; ViewBag.Keyword = SiteSettings.Keyword; string shipperAddress = string.Empty, shipperTelPhone = string.Empty; #region 虚拟订单 if (order.OrderType == OrderInfo.OrderTypes.Virtual) { orderModel.OrderVerificationCodes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { order.Id }); orderModel.OrderVerificationCodes.ForEach(a => { a.QRCode = GetQRCode(a.VerificationCode); }); orderModel.VirtualOrderItems = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id); if (order.ShopBranchId > 0)//门店订单取门店地址 { var shopBranch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId); if (shopBranch != null) { shipperAddress = RegionApplication.GetFullName(shopBranch.AddressId) + " " + shopBranch.AddressDetail; shipperTelPhone = shopBranch.ContactPhone; } } else { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(order.ShopId); if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } ViewBag.ShipperAddress = shipperAddress; ViewBag.ShipperTelPhone = shipperTelPhone; #endregion orderModel.PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName; //发票信息 orderModel.OrderInvoice = OrderApplication.GetOrderInvoiceInfo(order.Id); return(View(orderModel)); }
public object PostCharge(PaymentChargeModel para) { para.amount = Math.Round(para.amount, 2); if (para.amount <= 0) { return(Json(ErrorResult <dynamic>("请输入正确的金额"))); } if (string.IsNullOrWhiteSpace(para.openId)) { return(Json(ErrorResult <dynamic>("缺少OpenId"))); } try { //获取支付插件 var mobilePayments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).Where(item => item.Biz.SupportPlatforms.Contains(Core.PlatformType.WeiXinSmallProg)); if (mobilePayments.Any()) { var plugin = mobilePayments.Where(x => x.PluginInfo.PluginId.Contains(para.typeId)).FirstOrDefault(); //添加充值明细 var chargeDetail = new DTO.ChargeDetail(); chargeDetail.ChargeAmount = para.amount; chargeDetail.ChargeStatus = ChargeDetailInfo.ChargeDetailStatus.WaitPay; chargeDetail.ChargeWay = PaymentApplication.GetForeGroundPaymentName(plugin.PluginInfo.Description); chargeDetail.CreateTime = DateTime.Now; chargeDetail.MemId = CurrentUser.Id; var sitesetting = SiteSettingApplication.SiteSettings; if (para.ispresent && sitesetting.IsOpenRechargePresent) { var rule = RechargePresentRuleApplication.GetRules().FirstOrDefault(d => d.ChargeAmount == para.amount); if (rule != null) { chargeDetail.PresentAmount = rule.PresentAmount; } } var id = MemberCapitalApplication.AddChargeApply(chargeDetail); string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); string urlPre = webRoot + "/m-" + Core.PlatformType.Android + "/Payment/"; string notifyPre = urlPre + "CapitalChargeNotify/"; string returnPre = ""; var models = mobilePayments.ToArray().Select(item => { string url = string.Empty; try { url = item.Biz.GetRequestUrl(returnPre, notifyPre + item.PluginInfo.PluginId.Replace(".", "-") + "/", id.ToString(), para.amount, "会员充值", openId: para.openId); } catch (Exception ex) { Core.Log.Error("获取支付方式错误:", ex); } //适配小程序接口,从支付插件里解析出相应参数 //字符串格式:prepayId:234320480,partnerid:32423489,nonceStr=dslkfjsld #region 适配小程序接口,从支付插件里解析出相应参数 var prepayId = string.Empty; var nonceStr = string.Empty; var timeStamp = string.Empty; var sign = string.Empty; if (!string.IsNullOrWhiteSpace(url)) { var paras = url.Split(','); foreach (var str in paras) { var keyValuePair = str.Split(':'); if (keyValuePair.Length == 2) { switch (keyValuePair[0]) { case "prepayId": prepayId = keyValuePair[1]; break; case "nonceStr": nonceStr = keyValuePair[1]; break; case "timeStamp": timeStamp = keyValuePair[1]; break; case "sign": sign = keyValuePair[1]; break; } } } } #endregion return(new { prepayId = prepayId, nonceStr = nonceStr, timeStamp = timeStamp, sign = sign }); }); var model = models.FirstOrDefault(); if (null == model) { return(Json(ErrorResult <dynamic>("获取支付方式失败,请与管理员联系"))); } return(Json(model)); } else { Core.Log.Error("暂未配置支付方式"); return(Json(ErrorResult <dynamic>("暂未配置支付方式"))); } } catch (Exception ex) { Core.Log.Error("预账户充值报错:", ex); return(Json(ErrorResult <dynamic>("预账户充值报错"))); } }
public object GetOrderDetail(long orderId) { CheckUserLogin(); var orderService = ServiceProvider.Instance <IOrderService> .Create; var order = orderService.GetOrder(orderId, CurrentUser.Id); var orderitems = orderService.GetOrderItemsByOrderId(order.Id); var orderRefundService = ServiceProvider.Instance <IRefundService> .Create; var productService = ServiceProvider.Instance <IProductService> .Create; var coupon = ServiceProvider.Instance <ICouponService> .Create.GetCouponRecordInfo(order.UserId, order.Id); string couponName = ""; decimal couponAmout = 0; if (coupon != null) { var c = CouponApplication.GetCouponInfo(coupon.CouponId); couponName = c.CouponName; couponAmout = c.Price; } //订单信息是否正常 if (order == null) { throw new MallException("订单号不存在!"); } dynamic expressTrace = new ExpandoObject(); //取订单物流信息 if (!string.IsNullOrWhiteSpace(order.ShipOrderNumber)) { var expressData = ServiceProvider.Instance <IExpressService> .Create.GetExpressData(order.ExpressCompanyName, order.ShipOrderNumber); if (expressData.Success) { expressData.ExpressDataItems = expressData.ExpressDataItems.OrderByDescending(item => item.Time);//按时间逆序排列 expressTrace.traces = expressData.ExpressDataItems.Select(item => new { acceptTime = item.Time.ToString("yyyy-MM-dd HH:mm:ss"), acceptStation = item.Content }); } } var orderRefunds = OrderApplication.GetOrderRefunds(orderitems.Select(p => p.Id)); var isCanOrderReturn = OrderApplication.CanRefund(order); //获取订单商品项数据 var orderDetail = new { ShopId = order.ShopId, EnabledRefundAmount = order.OrderEnabledRefundAmount, OrderItems = orderitems.Select(item => { var productinfo = productService.GetProduct(item.ProductId); Entities.TypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetType(productinfo.TypeId); string colorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; string sizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; string versionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; var itemStatusText = ""; var itemrefund = orderRefunds.Where(or => or.OrderItemId == item.Id).FirstOrDefault(d => d.RefundMode != OrderRefundInfo.OrderRefundMode.OrderRefund); int?itemrefstate = (itemrefund == null ? 0 : (int?)itemrefund.SellerAuditStatus); itemrefstate = (itemrefstate > 4 ? (int?)itemrefund.ManagerConfirmStatus : itemrefstate); if (itemrefund != null) { //默认为商家处理进度 if (itemrefstate == 4) { //商家拒绝,可以再发起申请 itemStatusText = ""; } else { itemStatusText = "售后处理中"; } } if (itemrefstate > 4) {//如果商家已经处理完,则显示平台处理进度 if (itemrefstate == 7) { itemStatusText = "退款成功"; } } if (productinfo != null) { colorAlias = (!string.IsNullOrWhiteSpace(productinfo.ColorAlias)) ? productinfo.ColorAlias : colorAlias;//如果商品有自定义规格名称,则用 sizeAlias = (!string.IsNullOrWhiteSpace(productinfo.SizeAlias)) ? productinfo.SizeAlias : sizeAlias; versionAlias = (!string.IsNullOrWhiteSpace(productinfo.VersionAlias)) ? productinfo.VersionAlias : versionAlias; } long activeId = 0; int activetype = 0; var limitbuyser = ServiceProvider.Instance <ILimitTimeBuyService> .Create; var limitBuy = limitbuyser.GetLimitTimeMarketItemByProductId(item.ProductId); if (limitBuy != null) { //salePrice = limitBuy.MinPrice; activeId = limitBuy.Id; activetype = 1; } else { #region 限时购预热 var FlashSale = limitbuyser.IsFlashSaleDoesNotStarted(item.ProductId); var FlashSaleConfig = limitbuyser.GetConfig(); if (FlashSale != null) { TimeSpan flashSaleTime = DateTime.Parse(FlashSale.BeginDate) - DateTime.Now; //开始时间还剩多久 TimeSpan preheatTime = new TimeSpan(FlashSaleConfig.Preheat, 0, 0); //预热时间是多久 if (preheatTime >= flashSaleTime) //预热大于开始 { if (!FlashSaleConfig.IsNormalPurchase) { activeId = FlashSale.Id; activetype = 1; } } } #endregion } return(new { Status = itemrefstate, StatusText = itemStatusText, Id = item.Id, SkuId = item.SkuId, ProductId = item.ProductId, Name = item.ProductName, Amount = item.Quantity, Price = item.SalePrice, //ProductImage = "http://" + Url.Request.RequestUri.Host + productService.GetProduct(item.ProductId).GetImage(ProductInfo.ImageSize.Size_100), Image = Core.MallIO.GetRomoteProductSizeImage(productService.GetProduct(item.ProductId).RelativePath, 1, (int)Mall.CommonModel.ImageSize.Size_100), color = item.Color, size = item.Size, version = item.Version, IsCanRefund = OrderApplication.CanRefund(order, itemrefstate, itemId: item.Id), ColorAlias = colorAlias, SizeAlias = sizeAlias, VersionAlias = versionAlias, SkuText = colorAlias + ":" + item.Color + ";" + sizeAlias + ":" + item.Size + ";" + versionAlias + ":" + item.Version, EnabledRefundAmount = item.EnabledRefundAmount, ActiveId = activeId, //活动Id ActiveType = activetype //活动类型(1代表限购,2代表团购,3代表商品预售,4代表限购预售,5代表团购预售) }); }) }; //取拼团订单状态 var fightGroupOrderInfo = ServiceProvider.Instance <IFightGroupService> .Create.GetFightGroupOrderStatusByOrderId(order.Id); #region 门店信息 var branchInfo = new ShopBranch(); if (order.ShopBranchId > 0) { branchInfo = ShopBranchApplication.GetShopBranchById(order.ShopBranchId); } else { branchInfo = null; } #endregion #region 虚拟订单信息 VirtualProductInfo virtualProductInfo = null; int validityType = 0; string startDate = string.Empty, endDate = string.Empty; List <dynamic> orderVerificationCodes = null; List <dynamic> virtualOrderItemInfos = null; bool isCanRefundVirtual = false; if (order.OrderType == OrderInfo.OrderTypes.Virtual) { var orderItemInfo = orderitems.FirstOrDefault(); if (orderItemInfo != null) { virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderItemInfo.ProductId); if (virtualProductInfo != null) { validityType = virtualProductInfo.ValidityType ? 1 : 0; if (validityType == 1) { startDate = virtualProductInfo.StartDate.Value.ToString("yyyy-MM-dd"); endDate = virtualProductInfo.EndDate.Value.ToString("yyyy-MM-dd"); } } var codes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>() { order.Id }); orderVerificationCodes = codes.Select(p => { return(new { VerificationCode = Regex.Replace(p.VerificationCode, @"(\d{4})", "$1 "), Status = p.Status, StatusText = p.Status.ToDescription(), QRCode = GetQRCode(p.VerificationCode) }); }).ToList <dynamic>(); var virtualItems = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id); virtualOrderItemInfos = virtualItems.Select(p => { return(new { VirtualProductItemName = p.VirtualProductItemName, Content = ReplaceImage(p.Content, p.VirtualProductItemType), VirtualProductItemType = p.VirtualProductItemType }); }).ToList <dynamic>(); } } if (order.OrderStatus == Mall.Entities.OrderInfo.OrderOperateStatus.WaitVerification) { if (virtualProductInfo != null) { if (virtualProductInfo.SupportRefundType == 2) { isCanRefundVirtual = true; } else if (virtualProductInfo.SupportRefundType == 1) { if (virtualProductInfo.EndDate.Value > DateTime.Now) { isCanRefundVirtual = true; } } else if (virtualProductInfo.SupportRefundType == 3) { isCanRefundVirtual = false; } if (isCanRefundVirtual) { long num = orderVerificationCodes.Where(a => a.Status == OrderInfo.VerificationCodeStatus.WaitVerification).Count(); if (num > 0) { isCanRefundVirtual = true; } else { isCanRefundVirtual = false; } } } } #endregion #region 虚拟订单核销地址信息 string shipperAddress = string.Empty, shipperTelPhone = string.Empty; if (order.OrderType == OrderInfo.OrderTypes.Virtual) { if (order.ShopBranchId > 0 && branchInfo != null) { shipperAddress = RegionApplication.GetFullName(branchInfo.AddressId) + " " + branchInfo.AddressDetail; shipperTelPhone = branchInfo.ContactPhone; } else { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(order.ShopId); if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } #endregion var bonusmodel = ServiceProvider.Instance <IShopBonusService> .Create.GetGrantByUserOrder(orderId, CurrentUser.Id); bool hasBonus = bonusmodel != null ? true : false; string shareHref = ""; string shareTitle = ""; string shareDetail = ""; string shareImg = ""; if (hasBonus) { shareHref = "/m-weixin/ShopBonus/Index/" + ServiceProvider.Instance <IShopBonusService> .Create.GetGrantIdByOrderId(orderId); var bonus = ShopBonusApplication.GetBonus(bonusmodel.ShopBonusId); shareTitle = bonus.ShareTitle; shareDetail = bonus.ShareDetail; shareImg = MallIO.GetRomoteImagePath(bonus.ShareImg); } var orderModel = new { OrderId = order.Id, Status = (int)order.OrderStatus, StatusText = order.OrderStatus.ToDescription(), EnabledRefundAmount = order.OrderEnabledRefundAmount, OrderTotal = order.OrderTotalAmount, CapitalAmount = order.CapitalAmount, OrderAmount = order.ProductTotalAmount, DeductionPoints = 0, DeductionMoney = order.IntegralDiscount, //CouponAmount = couponAmout.ToString("F2"),//优惠劵金额 CouponAmount = order.DiscountAmount, //优惠劵金额 CouponName = couponName, //优惠劵名称 RefundAmount = order.RefundTotalAmount, Tax = order.Tax, AdjustedFreight = order.Freight, OrderDate = order.OrderDate.ToString("yyyy-MM-dd HH:mm:ss"), ItemStatus = 0, ItemStatusText = "", ShipTo = order.ShipTo, ShipToDate = order.ShippingDate.HasValue ? order.ShippingDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", Cellphone = order.CellPhone, Address = order.DeliveryType == CommonModel.DeliveryType.SelfTake && branchInfo != null ? branchInfo.AddressFullName : (order.RegionFullName + " " + order.Address), FreightFreePromotionName = string.Empty, ReducedPromotionName = string.Empty, ReducedPromotionAmount = order.FullDiscount, SentTimesPointPromotionName = string.Empty, CanBackReturn = !string.IsNullOrWhiteSpace(order.PaymentTypeGateway), CanCashierReturn = false, PaymentType = order.PaymentType.ToDescription(), OrderPayAmount = order.OrderPayAmount,//订单需要第三方支付的金额 PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName, PaymentTypeDesc = order.PaymentTypeDesc, Remark = string.IsNullOrEmpty(order.OrderRemarks) ? "" : order.OrderRemarks, //InvoiceTitle = order.InvoiceTitle, //Invoice = order.InvoiceType.ToDescription(), //InvoiceValue = (int)order.InvoiceType, //InvoiceContext = order.InvoiceContext, //InvoiceCode = order.InvoiceCode, ModeName = order.DeliveryType.ToDescription(), LogisticsData = expressTrace, TakeCode = order.PickupCode, LineItems = orderDetail.OrderItems, IsCanRefund = !(orderDetail.OrderItems.Any(e => e.IsCanRefund == true)) && OrderApplication.CanRefund(order, null, null), IsSelfTake = order.DeliveryType == Mall.CommonModel.DeliveryType.SelfTake ? 1 : 0, BranchInfo = branchInfo, DeliveryType = (int)order.DeliveryType, OrderInvoice = OrderApplication.GetOrderInvoiceInfo(order.Id), ValidityType = validityType, StartDate = startDate, EndDate = endDate, OrderVerificationCodes = orderVerificationCodes, VirtualOrderItemInfos = virtualOrderItemInfos, IsCanRefundVirtual = isCanRefundVirtual, ShipperAddress = shipperAddress, ShipperTelPhone = shipperTelPhone, OrderType = order.OrderType, JoinStatus = fightGroupOrderInfo == null ? -2 : fightGroupOrderInfo.JoinStatus, HasBonus = hasBonus, ShareHref = shareHref, ShareTitle = shareTitle, ShareDetail = shareDetail, ShareImg = shareImg, ShopName = order.ShopName }; return(Json(orderModel)); }