private void ResolveAPF() { if (ShoppingCart != null && ShoppingCart.CartItems != null && APFDueProvider.IsAPFSkuPresent(ShoppingCart.CartItems)) { if (_paymentsSummary != null && _paymentsSummary.CurrentPaymentInfo != null && _paymentsSummary.CurrentPaymentInfo.Any()) { CreditPayment_V01 payment = _paymentsSummary.CurrentPaymentInfo[0] as CreditPayment_V01; if (payment == null) { return; } if (this.Locale == "pt-BR" && payment.AuthorizationMethod != AuthorizationMethodType.Online) { return; } DistributorOrderingProfile orderingProfile = this.DistributorOrderingProfile; if (orderingProfile != null) { int payedApf = APFDueProvider.APFQuantityInCart(ShoppingCart); var currentDueDate = orderingProfile.ApfDueDate; var newDueDate = currentDueDate + new TimeSpan(payedApf * 365, 0, 0, 0); orderingProfile.ApfDueDate = newDueDate; Session.Add("apfdue", newDueDate); APFDueProvider.UpdateAPFDuePaid(DistributorID, newDueDate); new DistributorOrderingProfileFactory().ReloadDistributorOrderingProfile(DistributorID, CountryCode); } } } }
private void ReadFromData() { DistributorOrderingProfile distributorOrderingProfile = DistributorOrderingProfileProvider.GetProfile(DistributorID, CountryCode); _distributorId = DistributorID; _apfDueDate = distributorOrderingProfile.ApfDueDate; if (_testing) { APFDueProvider.UpdateAPFDuePaid(_distributorId, _apfDueDate); } _apfSku = APFDueProvider.GetAPFSku(); _cart = (Page as ProductsBase).ShoppingCart; _apfIsDue = APFDueProvider.IsAPFDueAndNotPaid(_distributorId, HLConfigManager.Configurations.Locale); _apfDueWithinOneYear = APFDueProvider.IsAPFDueWithinOneYear(_distributorId, CountryCode); _apfDueGreaterThanOneYear = APFDueProvider.IsAPFDueGreaterThanOneYear(_distributorId, CountryCode); if (_apfIsDue) { _apfsDue = APFDueProvider.APFQuantityDue(_distributorId, HLConfigManager.Configurations.Locale); } List <ShoppingCartItem_V01> item = (from c in _cart.CartItems where c.SKU == _apfSku select c).ToList(); _apfsInCart = 0; if (item.Count > 0) { _apfsInCart = item[0].Quantity; } }
private void ResolveAPF(MyHLShoppingCart cart) { if (APFDueProvider.IsAPFSkuPresent(cart.CartItems)) { int payedApf = APFDueProvider.APFQuantityInCart(cart); var currentDueDate = DistributorOrderingProfileProvider.GetProfile(cart.DistributorID, cart.CountryCode).ApfDueDate; var newDueDate = currentDueDate + new TimeSpan(payedApf * 365, 0, 0, 0); DistributorOrderingProfileProvider.GetProfile(cart.DistributorID, cart.CountryCode).ApfDueDate = newDueDate; //TODO : what to do //DistributorProvider.UpdateDistributor(ods); Session.Add("apfdue", newDueDate); APFDueProvider.UpdateAPFDuePaid(cart.DistributorID, newDueDate); } }