update controllers logic

This commit is contained in:
root
2026-04-23 00:04:35 -04:00
parent 1977a513df
commit ca4ba272fc
353 changed files with 13402 additions and 1301 deletions
@@ -5,14 +5,17 @@ namespace App\Services\Refunds;
use App\Models\Configuration;
use App\Models\Invoice;
use App\Models\Refund;
use App\Services\ApplicationUrlService;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
class RefundOverpaymentService
{
public function __construct(private RefundNotificationService $notifications)
{
public function __construct(
private RefundNotificationService $notifications,
private ApplicationUrlService $urls,
) {
}
public function recalculate(bool $triggerEvents = false, ?string $invoiceNumber = null, ?int $actorId = null): array
@@ -146,7 +149,7 @@ class RefundOverpaymentService
]);
if ($refund && $triggerEvents) {
$this->notifications->notifyPending($pid, $over, url('/login'));
$this->notifications->notifyPending($pid, $over, $this->urls->webLoginUrl());
}
return ['ok' => true, 'message' => 'Overpayment detected and refund created.'];
@@ -250,7 +253,7 @@ class RefundOverpaymentService
if ($refund) {
$created[] = (int) $refund->id;
if ($triggerEvents) {
$this->notifications->notifyPending($pid, $over, url('/login'));
$this->notifications->notifyPending($pid, $over, $this->urls->webLoginUrl());
}
}
} elseif (in_array($existing->status, [Refund::STATUS_PENDING, Refund::STATUS_PARTIAL], true)) {