public ActionResult OrgComplete(decimal orderID) { var order = OrderService.GetByPKAndUserID(orderID, AuthService.CurrentUser.UserID); if (order == null) { return(RedirectToCart()); } if (order.OrderDetails.Any(x => !x.IsOrg)) { OrderService.DeleteAndSubmit(order); return(RedirectToCart()); } order.OurOrg_TC = PaymentDataCreator.GetOurOrg(order, CourseService.SeminarCourses()); if (order.PaymentType_TC == null) { MailService.OrderInfoForManager(order, null, true); } order.PaymentType_TC = PaymentTypes.Invoice; ShoppingCartVMService.Clear(); CheckOrder(order); OrderService.SubmitChanges(); var model = new OrgOrderCompleteVM { Order = order }; return(BaseView(Views.Order.OrgComplete, model)); }
public string GetUrl(Order order) { SberbankOrderService.EnableTracking(); var sberOrder = SberbankOrderService.FirstOrDefault(x => x.CommonOrderId == order.CommonOrderId); Guid sberbankId; if (sberOrder != null) { sberbankId = sberOrder.SberbankId; } else { var result = HttpUtils.Get(root + "/payment/rest/register.do", PaymentDataCreator.SberbankMerchant(order)); sberbankId = JsonConvert.DeserializeAnonymousType(result, new { orderId = Guid.Empty, formUrl = "" }) .orderId; if (sberbankId == Guid.Empty) { Logger.Exception(new Exception(result), "sberbank " + order.CommonOrderId); return(null); } SberbankOrderService.InsertAndSubmit(new SberbankOrder { CommonOrderId = order.CommonOrderId, SberbankId = sberbankId }); } return(sberUrl + IdToString(sberbankId)); }
public int GetAmount(string id, Order order) { var param = PaymentDataCreator.SberbankMerchantLogin(order); param.Add("orderId", id); var result = HttpUtils.Get(root + "/payment/rest/getOrderStatus.do", param); var ammount = JsonConvert.DeserializeAnonymousType(result, new { Amount = 0 }).Amount; return(ammount / 100); }
public string SetPaymentType(string paymentType, decimal orderID) { var order = OrderService.GetByPKAndUserID(orderID, AuthService.CurrentUser.UserID); if (order == null || order.PaymentType_TC == paymentType) { return(null); } order.Manager_TC = GetOrderManagerTC(orderID); var sendToUser = order.PaymentType_TC == PaymentTypes.NoPayment; if (order.PaymentType_TC.IsEmpty()) { order.UpdateDate = DateTime.Now; } order.PaymentType_TC = paymentType; if (order.OurOrg_TC == null) { order.OurOrg_TC = PaymentDataCreator.GetOurOrg(order, CourseService.SeminarCourses()); } OrderService.SubmitChanges(); var eduDocTypeTC = ShoppingCartVMService.EduDocType; ShoppingCartVMService.EduDocType = null; Task.Factory.StartNew(() => SpecialistExportService.Export(order.OrderID, true, eduDocTypeTC)) .ContinueWith(x => { if (x.Exception.InnerException.Message.StartsWith( CommonTexts.FullGroupError) && order.OrderDetails.Any(z => z.IsTestCert)) { MailService.TestCertFull(); } // else { // Logger.Exception(x.Exception.InnerException, "specialist export error"); // } }, TaskContinuationOptions.OnlyOnFaulted); MailService.OrderComplete(order, sendToUser); return(order.OurOrg_TC); }
public ActionResult OrderOrg(decimal id) { var order = OrderService.GetByPK(id); return(Content(PaymentDataCreator.GetOurOrg(order, CourseService.SeminarCourses()))); }