update controllers logic
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user