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
@@ -3,10 +3,16 @@
namespace App\Services\Payments;
use App\Models\Configuration;
use App\Services\ApplicationUrlService;
use Illuminate\Support\Facades\DB;
class PaymentEnrollmentEventService
{
public function __construct(
private ApplicationUrlService $urls,
) {
}
public function buildEventData(
int $parentId,
array $studentIds,
@@ -16,7 +22,7 @@ class PaymentEnrollmentEventService
): array {
$schoolYear = $schoolYear ?: Configuration::getConfig('school_year');
$semester = $semester ?: Configuration::getConfig('semester');
$portalLink = $portalLink ?: url('/login');
$portalLink = $portalLink ?: $this->urls->webLoginUrl();
$parent = DB::table('users')
->select('id', 'firstname', 'lastname', 'email')
@@ -6,6 +6,7 @@ use App\Models\Configuration;
use App\Models\PaymentNotificationLog;
use App\Models\User;
use App\Services\EmailService;
use App\Support\MailHtml;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@@ -255,14 +256,7 @@ class PaymentNotificationService
</div>
HTML;
if (view()->exists('emails._wrap_layout')) {
$body = view('emails._wrap_layout', [
'title' => 'Monthly Tuition Reminder',
'body_html' => $bodyHtml,
], ['saveData' => true]);
} else {
$body = $bodyHtml;
}
$body = MailHtml::document('Monthly Tuition Reminder', $bodyHtml);
return [$subject, $body];
}
@@ -8,6 +8,7 @@ use App\Models\Invoice;
use App\Models\PaymentNotificationLog;
use App\Models\User;
use App\Services\EmailService;
use App\Support\MailHtml;
use DateTimeImmutable;
use DateTimeZone;
@@ -84,14 +85,7 @@ class PaymentTestNotificationService
. "<li><strong>Maximum installments available:</strong> {$installmentInfo['max_installments']}</li>"
. "</ul>";
if (view()->exists('emails._wrap_layout')) {
$body = view('emails._wrap_layout', [
'title' => 'Monthly Tuition Reminder',
'body_html' => $bodyHtml,
], ['saveData' => true]);
} else {
$body = $bodyHtml;
}
$body = MailHtml::document('Monthly Tuition Reminder', $bodyHtml);
$ok = $this->emailService->send($email, $subject, (string) $body, 'finance');
if ($ok && $ccEmail && strcasecmp($ccEmail, $email) !== 0) {
@@ -3,11 +3,17 @@
namespace App\Services\Payments;
use App\Models\Payment;
use App\Services\ApplicationUrlService;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
class PaypalPaymentService
{
public function __construct(
private ApplicationUrlService $urls,
) {
}
public function getRedirectUrl(): string
{
return (string) (config('services.paypal.payment_url')
@@ -50,8 +56,8 @@ class PaypalPaymentService
->setTransactions([$transaction]);
$redirectUrls = new \PayPal\Api\RedirectUrls();
$redirectUrls->setReturnUrl(url('/api/v1/finance/paypal/execute'))
->setCancelUrl(url('/api/v1/finance/paypal/cancel'));
$redirectUrls->setReturnUrl($this->urls->paypalExecuteReturnUrl())
->setCancelUrl($this->urls->paypalCancelUrl());
$paypalPayment->setRedirectUrls($redirectUrls);
$paypalPayment->create($apiContext);