private async Task ValidateGiftCardAmountsAsync() { // grab every gift card that the customer applied to this order IList <GiftCard> appliedGiftCards = await _giftCardService.GetActiveGiftCardsAppliedByCustomerAsync(await _workContext.GetCurrentCustomerAsync()); if (appliedGiftCards.Count > 1) { throw new Exception("Only one gift card may be applied to an order"); } foreach (GiftCard nopGiftCard in appliedGiftCards) { // check isam to make sure each gift card has the right $$ GiftCard isamGiftCard = _isamGiftCardService.GetGiftCardInfo(nopGiftCard.GiftCardCouponCode).GiftCard; decimal nopAmtLeft = nopGiftCard.Amount; List <GiftCardUsageHistory> nopGcHistory = (await _giftCardService.GetGiftCardUsageHistoryAsync(nopGiftCard)).ToList(); foreach (var history in nopGcHistory) { nopAmtLeft -= history.UsedValue; } if (isamGiftCard.Amount != nopAmtLeft) { throw new Exception("A gift card has been used since it was placed on this order"); } } }