fix gitlab tests
This commit is contained in:
@@ -10,7 +10,8 @@ class FeeRefundCalculatorService
|
||||
public function __construct(
|
||||
private FeeConfigService $config,
|
||||
private FeeStudentFeeService $studentFees
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function calculateRefund(array $students, int $parentId): array
|
||||
{
|
||||
@@ -25,7 +26,6 @@ class FeeRefundCalculatorService
|
||||
'parent_id' => $parentId,
|
||||
'school_year' => $schoolYear,
|
||||
]);
|
||||
|
||||
return $this->resultPayload(0.0, $totalPaid, $refundDeadline, $schoolEndDate, $weeksOfStudy, 0, []);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ class FeeRefundCalculatorService
|
||||
'parent_id' => $parentId,
|
||||
'registered_count' => count($registered),
|
||||
]);
|
||||
|
||||
return $this->resultPayload(0.0, $totalPaid, $refundDeadline, $schoolEndDate, $weeksOfStudy, 0, []);
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ class FeeRefundCalculatorService
|
||||
|
||||
$withdrawnWithFees = array_values(array_filter(
|
||||
$allStudents,
|
||||
fn (array $student): bool => ! empty($student['_is_withdrawn'])
|
||||
fn (array $student): bool => !empty($student['_is_withdrawn'])
|
||||
));
|
||||
|
||||
$refundAmount = 0.0;
|
||||
@@ -83,32 +82,29 @@ class FeeRefundCalculatorService
|
||||
'reason' => null,
|
||||
];
|
||||
|
||||
if (! $withdrawalDate) {
|
||||
if (!$withdrawalDate) {
|
||||
$entry['reason'] = 'missing_withdrawal_date';
|
||||
Log::warning('Refund skipped for student: missing withdrawal date', [
|
||||
'parent_id' => $parentId,
|
||||
'student_id' => $studentId,
|
||||
]);
|
||||
$studentBreakdown[] = $entry;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $refundDeadline || strtotime($withdrawalDate) > strtotime($refundDeadline)) {
|
||||
if (!$refundDeadline || strtotime($withdrawalDate) > strtotime($refundDeadline)) {
|
||||
$entry['reason'] = 'after_refund_deadline';
|
||||
$studentBreakdown[] = $entry;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $schoolEndDate) {
|
||||
if (!$schoolEndDate) {
|
||||
$entry['reason'] = 'missing_school_end_date';
|
||||
Log::warning('Refund skipped for student: missing school end date', [
|
||||
'parent_id' => $parentId,
|
||||
'student_id' => $studentId,
|
||||
]);
|
||||
$studentBreakdown[] = $entry;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -121,7 +117,6 @@ class FeeRefundCalculatorService
|
||||
'weeks_of_study' => $weeksOfStudy,
|
||||
]);
|
||||
$studentBreakdown[] = $entry;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -158,7 +153,7 @@ class FeeRefundCalculatorService
|
||||
if ($uncappedRefund > 0) {
|
||||
$ratio = $totalPaid / $uncappedRefund;
|
||||
foreach ($studentBreakdown as &$row) {
|
||||
if (! empty($row['eligible'])) {
|
||||
if (!empty($row['eligible'])) {
|
||||
$row['refund_amount'] = round($row['refund_amount'] * $ratio, 2);
|
||||
}
|
||||
}
|
||||
@@ -197,7 +192,6 @@ class FeeRefundCalculatorService
|
||||
foreach ($students as $student) {
|
||||
if ($this->studentFees->isWithdrawn($student)) {
|
||||
$withdrawn[] = $student;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -219,7 +213,6 @@ class FeeRefundCalculatorService
|
||||
}
|
||||
|
||||
$daysRemaining = $withdrawDateObj->diff($schoolEndDateObj)->days;
|
||||
|
||||
return (int) min($weeksOfStudy, max(0, (int) ceil($daysRemaining / 7)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user