mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-02 06:14:51 -04:00
CodeRabbit issues addressed: 1. Negative points prevention in Reward_lib: - adjustRewardPoints(): Validate sufficient balance before deduct/adjust - handleCustomerChange(): Cap charge at available points, add 'insufficient' flag - adjustRewardDelta(): Validate sufficient points for positive adjustments 2. Sale.php fixes: - Add null coalescing for reward points in processPaymentType() - Validate giftcard payment format before accessing array index - Remove unused loop variables $paymentId and $line - Add null check for deleted customer in delete() method - Log warnings when insufficient points detected 3. Test coverage: - Add test for exact points match (hasSufficientPoints) - Add tests for insufficient points scenarios - Add tests for negative adjustment (refund) - Add tests for handleCustomerChange caps All changes prevent customers from having negative reward point balances.