-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from portabilis/portabilis-patch-2019-08-30
[2.2] Portabilis patch 30/08/2019
- Loading branch information
Showing
36 changed files
with
1,674 additions
and
1,607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
use App\Models\LegacyEnrollment; | ||
use CoreExt_Controller_Request; | ||
use CoreExt_Exception; | ||
use PromocaoApiController; | ||
|
||
class PromotionService | ||
{ | ||
/** | ||
* @var LegacyEnrollment | ||
*/ | ||
private $enrollment; | ||
|
||
public function __construct(LegacyEnrollment $enrollment) | ||
{ | ||
$this->enrollment = $enrollment; | ||
} | ||
|
||
public function fakeRequest() | ||
{ | ||
$fakeRequest = new CoreExt_Controller_Request( | ||
[ | ||
'data' => [ | ||
'oper' => 'post', | ||
'resource' => 'promocao', | ||
'matricula_id' => $this->enrollment->ref_cod_matricula, | ||
'instituicao_id' => $this->enrollment->schoolClass->school->ref_cod_instituicao, | ||
'ano' => $this->enrollment->registration->ano, | ||
'escola' => $this->enrollment->schoolClass->school_id, | ||
'curso' => $this->enrollment->schoolClass->ref_cod_curso, | ||
'serie' => $this->enrollment->schoolClass->ref_ref_cod_serie, | ||
'turma' => $this->enrollment->ref_cod_turma | ||
] | ||
]); | ||
|
||
$promocaoApi = new PromocaoApiController(); | ||
$promocaoApi->setRequest($fakeRequest); | ||
|
||
try { | ||
$promocaoApi->Gerar(); | ||
} catch (CoreExt_Exception $exception) { | ||
// Quando o aluno não possuir enturmação na escola que está | ||
// cancelando a matrícula, uma Exception era lançada ao | ||
// instanciar o ServiceBoletim, este catch garante que não irá | ||
// quebrar o processo. | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.