using GB5Shared.DTO.Framework.Login; using GoodBooks.PAY.PAYDAL.DTO.Loyalty; namespace GoodBooks.PAY.PAYBLL.Loyalty { public interface ILoyaltyEarnCfgBLL { Task> GetEarnCfgsByProgram(int programId, LoginDTO login, CancellationToken ct); /// /// Resolves the highest-priority active earn rule for a given transaction context. /// Priority order (highest wins): ByProduct (5) > ByCategory (4) > ByGateway (3) > ByTier (2) > Global (1). /// Returns null when no eligible rule exists. /// Pure in-memory operation — no async. /// LoyaltyEarnCfgDTO? ResolveEarnRule( IEnumerable rules, int? productId, int? categoryId, int? gatewayId, int? tierId); /// /// Calculates the earn points for a given net payable amount. /// Result is floored to a whole number. /// tierMultiplier defaults to 1.0 when the program has no tiering. /// decimal CalculateEarnPoints(decimal netPayableAmt, LoyaltyEarnCfgDTO earnRule, LoyaltyTierDTO? tier); } }