public List <ISaleModel> GetSaleList() { List <ISaleModel> sales = Factory.InstanceISaleModelList(); ISoldProductAccomplishedDataAccess soldProductsAccomplishedData = Factory.InstanceSoldProductAccomplishedDataAccess(); List <ISoldProductAccomplishedModel> products = soldProductsAccomplishedData.GetAll(); foreach (ISoldProductAccomplishedModel product in products) { ISaleModel saleAux = Factory.InstanceSaleModel(); saleAux = sales.Where(x => x.Name == product.Name && x.CategoryName == product.Category.Name).FirstOrDefault(); if (saleAux == null) { ISaleModel sale = Factory.InstanceSaleModel(); sale.Name = product.Name; sale.CategoryName = product.Category.Name; sale.Price = product.Price; sale.Ammount = 1; sales.Add(sale); } else { sales.Where(x => x.Name == product.Name && x.CategoryName == product.Category.Name).FirstOrDefault().Ammount++; sales.Where(x => x.Name == product.Name && x.CategoryName == product.Category.Name).FirstOrDefault().Price += product.Price; } } return(sales); }
public bool Authorize(ISaleModel ccSale) { if (_activeSplit == null || _activeSplit.IsPaid) { return(false); } _order.IsAuthorizing = true; PaymentType = SplitPaymentType.Card; SaleResponse response = ccSale.Process(); bool result = (response != null && response.IsValid) ? true : false; //bool result = true; string errormessage = null; if (response != null && !result) { errormessage = response.ErrorMessage; } Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (result) { if (BaseAppUI.Properties.Settings.Default.TipSignModifierSwitch == "SignOnReceipt") { SwitchSplitPaymentProccess(response); new ViewModel.Notifies.ThanksNotify(_order).Show(() => { //SwitchSplitPaymentProccess(); _order.IsAuthorizing = false; }); } else { new ViewModel.Notifies.TipSignModifier(_order).Show(() => { SwitchSplitPaymentProccess(response); new ViewModel.Notifies.ThanksNotify(_order).Show(() => { //SwitchSplitPaymentProccess(); _order.IsAuthorizing = false; }); }); } } else { new ViewModel.Notifies.TransactionFailedNotify(errormessage, null).Show(() => { _order.IsAuthorizing = false; }); } })); return(result); }
public AuthorizingNotify(Func <ISaleModel, bool> authorize, ISaleModel ccsale) : base() { authorize.BeginInvoke(ccsale, AuthorizeCallBack, authorize); }
public bool Authorize(ISaleModel ccSale) { _order.IsAuthorizing = true; SaleResponse response = ccSale.Process(); GConfig.response2 = response; //Save Response to Order on successful response. //Add by SAA 5/6/16 if (response.Resp_Msg == "APPROVAL") { LinkCreditCardResponseToOrder(response); } bool result = (response != null && response.IsValid) ? true : false; //bool result = true; string errormessage = null; if (response != null && !result) { errormessage = response.ErrorMessage; } Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (result) { _order.PaymentType = Model.OrderPaymentTypes.Card; _order.OrderStatus = Model.OrderStatuses.Completed; var _h = _order._orderHeader; _h.dOrderTax = _order.TaxSubtotal; _h.dOrderAmount = _order.AllTotal; _h.TxnId = response.Resp_TxnId; _h.vApprovalCode = response.Resp_ApprovalCode; //new ViewModel.Notifies.PaymentCompletedNotify().Show(() => // Commenting this to remove payment complete screen. Amjad 5/15 //{ ((BaseAppUI.ViewModel.Sections.Payment)MainVM.Main.Content).Release(); if (BaseAppUI.Properties.Settings.Default.TipSignModifierSwitch == "SignOnReceipt") { ReceiptPrinter.Print(_order); // Print Merchant Copy Automatically for signature & tip - Amjad 5/15 new ViewModel.Notifies.ThanksNotify(_order).Show(() => { MainVM.Main.SwitchToView(Model.SectionType.Dashboard); }); } else { new ViewModel.Notifies.TipSignModifier(_order).Show(() => { new ViewModel.Notifies.ThanksNotify(_order).Show(() => { MainVM.Main.SwitchToView(Model.SectionType.Dashboard); }); }); } //}); } else { new ViewModel.Notifies.TransactionFailedNotify(errormessage, null).Show(); } })); _order.IsAuthorizing = false; return(result); }