add test batches
This commit is contained in:
@@ -14,7 +14,8 @@ class RefundPolicyService
|
||||
public function __construct(
|
||||
private FeeRefundDetailService $refundDetails,
|
||||
private RefundInvoiceAdjustmentService $invoiceAdjustments
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function processWithdrawalRefund(
|
||||
int $parentId,
|
||||
@@ -38,7 +39,7 @@ class RefundPolicyService
|
||||
->orderByDesc('created_at')
|
||||
->first();
|
||||
|
||||
if (! $invoice) {
|
||||
if (!$invoice) {
|
||||
return ['ok' => false, 'error' => 'No invoice found for refund processing.'];
|
||||
}
|
||||
|
||||
@@ -115,14 +116,14 @@ class RefundPolicyService
|
||||
|
||||
$refundAmount = (float) ($details['refund_amount'] ?? 0.0);
|
||||
$debitAmount = (float) ($details['debit_amount'] ?? 0.0);
|
||||
$eligible = ! empty($details['eligible']);
|
||||
$eligible = !empty($details['eligible']);
|
||||
$status = $refundAmount > 0 ? Refund::STATUS_PENDING : Refund::STATUS_REJECTED;
|
||||
|
||||
$reason = null;
|
||||
if ($refundAmount <= 0) {
|
||||
if (! $eligible) {
|
||||
if (!$eligible) {
|
||||
$reason = 'No refund due to late withdrawal.';
|
||||
} elseif (! empty($details['full_discount'])) {
|
||||
} elseif (!empty($details['full_discount'])) {
|
||||
$reason = 'No refund due to full discount.';
|
||||
} elseif ($debitAmount > 0) {
|
||||
$reason = 'No refund due; book fee balance remains.';
|
||||
@@ -188,7 +189,7 @@ class RefundPolicyService
|
||||
'updated_by' => $actorId,
|
||||
]);
|
||||
|
||||
if (! $created) {
|
||||
if (!$created) {
|
||||
return ['ok' => false, 'error' => 'Failed to create refund record.'];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user