public static Orders.Order CurrentShoppingCart(Orders.OrderService svc, Store currentStore) { Orders.Order result = null; if (CurrentUserHasCart(currentStore)) { Orders.Order cachedCart = SessionManager.CachedShoppingCart; if (cachedCart != null) { return(cachedCart); } else { result = svc.Orders.FindForCurrentStore(GetCurrentCartID(currentStore)); if (result != null) { if (!result.IsPlaced) { if (result.bvin != string.Empty) { SessionManager.CachedShoppingCart = result; return(result); } } } } } result = new Orders.Order(); svc.Orders.Upsert(result); SetCurrentCartId(currentStore, result.bvin); SessionManager.CachedShoppingCart = result; return(result); }
public OrderPaymentManager(Order ord, MerchantTribeApplication app) { o = ord; this.MTApp = app; svc = MTApp.OrderServices; this.contacts = this.MTApp.ContactServices; this.content = this.MTApp.ContentServices; Accounts.Store CurrentStore = app.CurrentRequestContext.CurrentStore; pointsManager = CustomerPointsManager.InstantiateForDatabase(CurrentStore.Settings.RewardsPointsIssuedPerDollarSpent, CurrentStore.Settings.RewardsPointsNeededPerDollarCredit, app.CurrentRequestContext.CurrentStore.Id); }
public void Populate(Orders.Order o, OrderService svc) { Clear(); foreach (Orders.OrderTransaction t in svc.Transactions.FindForOrder(o.bvin)) { _TotalCredit += t.AmountAppliedToOrder; switch (t.Action) { case MerchantTribe.Payment.ActionType.CashReceived: case MerchantTribe.Payment.ActionType.CheckReceived: case MerchantTribe.Payment.ActionType.CreditCardCapture: case MerchantTribe.Payment.ActionType.CreditCardCharge: case MerchantTribe.Payment.ActionType.GiftCardCapture: case MerchantTribe.Payment.ActionType.GiftCardDecrease: case MerchantTribe.Payment.ActionType.PayPalCapture: case MerchantTribe.Payment.ActionType.PayPalCharge: case MerchantTribe.Payment.ActionType.PurchaseOrderAccepted: case MerchantTribe.Payment.ActionType.CompanyAccountAccepted: case MerchantTribe.Payment.ActionType.RewardPointsCapture: case MerchantTribe.Payment.ActionType.RewardPointsDecrease: _AmountCharged += t.AmountAppliedToOrder; break; case MerchantTribe.Payment.ActionType.CreditCardHold: case MerchantTribe.Payment.ActionType.GiftCardHold: case MerchantTribe.Payment.ActionType.PayPalHold: case MerchantTribe.Payment.ActionType.RewardPointsHold: _AmountAuthorized += t.AmountHeldForOrder; break; case MerchantTribe.Payment.ActionType.CashReturned: case MerchantTribe.Payment.ActionType.CheckReturned: case MerchantTribe.Payment.ActionType.CreditCardRefund: case MerchantTribe.Payment.ActionType.GiftCardIncrease: case MerchantTribe.Payment.ActionType.PayPalRefund: case MerchantTribe.Payment.ActionType.RewardPointsIncrease: _AmountRefunded += -1 * t.AmountAppliedToOrder; break; } } _PaymentsSummary = svc.OrdersListPaymentMethods(o); _AmountDue = o.TotalGrand - _TotalCredit; }
public static void AcceptAllNewOrders(OrderService svc) { OrderSearchCriteria criteria = new OrderSearchCriteria(); criteria.IsPlaced = true; criteria.StatusCode = OrderStatusCode.Received; int pageSize = 1000; int totalCount = 0; List<OrderSnapshot> orders = svc.Orders.FindByCriteriaPaged(criteria, 1, pageSize, ref totalCount); if (orders != null) { foreach (OrderSnapshot o in orders) { Order ord = svc.Orders.FindForCurrentStore(o.bvin); if (ord != null) { ord.StatusCode = OrderStatusCode.ReadyForPayment; ord.StatusName = "Ready for Payment"; svc.Orders.Update(ord); } } } }
public decimal TotalGrandAfterStoreCredits(OrderService orderService) { List<OrderTransaction> transaction = orderService.Transactions.FindForOrder(this.bvin); decimal potentialCredits = orderService.Transactions.TransactionsPotentialStoreCredits(transaction); return (TotalGrand - potentialCredits); }