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 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); } }