Try your search with a different keyword or use * as a wildcard.
using Nop.Services.Discounts;
using Nop.Services.Plugins;
namespace Nop.Tests.Nop.Services.Tests.Discounts;
public partial class TestDiscountRequirementRule : BasePlugin, IDiscountRequirementRule
{
private IDiscountService _discountService;
public TestDiscountRequirementRule(IDiscountService discountService)
{
_discountService = discountService;
}
///
/// Check discount requirement
///
/// Object that contains all information required to check the requirement (Current customer, discount, etc)
/// Result
public async Task CheckRequirementAsync(DiscountRequirementValidationRequest request)
{
var dr = await _discountService.GetDiscountRequirementByIdAsync(request.DiscountRequirementId);
var valid = !dr.IsGroup;
valid = valid && !dr.InteractionTypeId.HasValue;
return new DiscountRequirementValidationResult
{
IsValid = valid
};
}
///
/// Get URL for rule configuration
///
/// Discount identifier
/// Discount requirement identifier (if editing)
/// URL
public string GetConfigurationUrl(int discountId, int? discountRequirementId)
{
throw new NotImplementedException();
}
}