using GB5Shared.DTO.Framework.Login; using GoodBooks.PAY.PAYDAL.DTO.Loyalty; namespace GoodBooks.PAY.PAYBLL.Loyalty { public interface ICustomerLoyaltyBLL { /// /// Idempotent enrollment. Returns success (not error) if customer is already enrolled. /// Creates a zero-point ledger row as an enrollment marker. /// Task EnrollCustomer(CustomerLoyaltyEnrollmentDTO dto, LoginDTO login, CancellationToken ct); Task GetEnrollment(int enrollmentId, LoginDTO login, CancellationToken ct); /// /// Returns the live balance as serialised JSON {AvailablePoints: N}. /// Always queries TLOYALTYLEDGER directly — never from enrollment header. /// Task GetCustomerLoyaltyBalance(int enrollmentId, LoginDTO login, CancellationToken ct); Task GetLoyaltyLedger(int enrollmentId, int pageOffset, int pageSize, LoginDTO login, CancellationToken ct); /// /// Awards loyalty points for a payment success event. /// Resolves the correct earn rule, calculates points, appends a ledger row, /// updates enrollment totals, and checks for tier upgrades. /// Called by PayWebhookBLL (and CashbackLedgerBLL for mode-4 payouts). /// Task EarnPointsAsync( int enrollmentId, int payOrderId, decimal netPayableAmt, int? productId, int? categoryId, int payGatewayId, LoginDTO login, CancellationToken ct); /// /// Inserts compensating negative-points rows for all enrollments with points /// expiring today. Called daily by LoyaltyPointsExpiryJob. /// APPEND-ONLY — never updates existing ledger rows. /// Task ExpirePointsAsync(LoginDTO login, CancellationToken ct); } }