Fixed: Apply refund rule according to configured cancellation rule

This commit is contained in:
amit sharma
2026-09-30 15:27:00 +05:30
parent d8cf510fe5
commit a47bb84f14

View File

@@ -176,6 +176,11 @@ class HotelOrderRefundRules extends ObjectModel
$daysBeforeCancel = (int) $daysDifference->format('%a');
$ruleApplied = false;
// check the rule with the highest days first, so the closest matching rule is applied
usort($refundRules, function ($ruleA, $ruleB) {
return $ruleB['days'] - $ruleA['days'];
});
foreach ($refundRules as $refRule) {
if ($daysBeforeCancel >= $refRule['days']) {
if ($objOrder->is_advance_payment) {