/// <summary> /// This method determines if all the eligiblity requirements are met for this reward. /// </summary> protected override bool EligibilityRequirements(Customer customer, string siteType) { // Style Ambassador that joined within 30 days (determined by Date1). Replicated site only (not applicable for event). // Added back office so we can show messaging to the customer when this reward is active if (siteType == "rep" || siteType == "backOffice") { if (customer.CustomerTypeID == CustomerTypes.IndependentStyleAmbassador) { // Subtracting a day to since Day 1 begins when the customer joins as a Style Ambassador (determined by Date1) ExpirationDate = ThirtyDaysWhenCustomerBecameStyleAmbassador(customer); bool first30Days = DateTime.Now.Date <= ExpirationDate; var pointAccountResponse = Exigo.GetCustomerPointAccount(customer.CustomerID, RewardPointsAccountId.Value); var creditsRemaining = (null != pointAccountResponse ? pointAccountResponse.Balance : 0M); if (first30Days && creditsRemaining > 0.00M) { return(true); } } } return(false); }
public RewardsAccount CalculatePointsAccount(IList <Product> products) { var appliedAmount = 0M; if (IsRewardPointsAccount) { var pointAccountResponse = Exigo.GetCustomerPointAccount(CustomerId, RewardPointsAccountId.Value); var creditsRemaining = (null != pointAccountResponse ? pointAccountResponse.Balance : 0M); var productWithDiscount = GetRewardProducts(products); foreach (var product in productWithDiscount) { if (product.Quantity < product.Discounts.Count) { throw new ApplicationException("Number of discounts applied cannot exceed the number of products."); } appliedAmount += product.Discounts.Where(discount => discount.DiscountType == DiscountType.RecruitingReward).Sum(discount => discount.AppliedAmount); } RewardsAccount account = new RewardsAccount { PointAccountID = RewardPointsAccountId.Value, Balance = creditsRemaining, AppliedAmount = appliedAmount }; return(account); } return(null); }
public decimal GetPointAccountBalance(int customerId, int pointAccountId) { var response = Exigo.GetCustomerPointAccount(customerId, pointAccountId); return(null != response ? response.Balance : 0M); }
/// <summary> /// This method calculates the points account for this reward. /// </summary> public RewardsAccount CalculatePointsAccount(IList <Product> productsInShoppingCart) { if (IsRewardPointsAccount) { var pointAccountResponse = Exigo.GetCustomerPointAccount(CustomerId, RewardPointsAccountId.Value); var creditsRemaining = (null != pointAccountResponse ? pointAccountResponse.Balance : 0M); var productWithDiscount = GetRewardProducts(productsInShoppingCart); var account = new RewardsAccount { PointAccountID = RewardPointsAccountId.Value, Balance = creditsRemaining, AppliedAmount = productWithDiscount.Count() }; return(account); } return(null); }
private static BookingReward CreateBookingReward(int customerId, int partyId, int bookingsRewardOwnerId) { var bookingReward = new BookingReward(); if (partyId == 0) { return(bookingReward); } //Get Party Details of Party that we earned booking rewards from. var party = Exigo.GetCustomer(partyId); var customerSite = Exigo.GetCustomerSite(partyId); //Get Point Account Value Earned for Booking Rewards - CustomerPointAccounts - PointAccountID 3 var bookingsRewardsCash = Exigo.GetCustomerPointAccount(partyId, PointAccounts.BookingsRewardsCash); bookingReward.PartyName = party.FirstName; bookingReward.WebAlias = customerSite.WebAlias; bookingReward.BookingRewardOwner = bookingsRewardOwnerId; bookingReward.CustomerID = party.CustomerID; //This will be the Field 3, Field 4, Field 5, Field 6 from the ExtendedDetails bookingReward.Balance = (bookingsRewardsCash != null) ? bookingsRewardsCash.Balance : 0; bookingReward.PointAccountID = PointAccounts.BookingsRewardsCash; return(bookingReward); }