Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| SeniorPreOrderImport | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| execute | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Shared\Integrations\Senior; |
| 4 | |
| 5 | use Domain\Shared\Integrations\Senior\Exceptions\IntegrationSoapSeniorException; |
| 6 | use Domain\StockIO\DTOs\SeniorPreOrderDTO; |
| 7 | use SoapFault; |
| 8 | use function __; |
| 9 | use function is_null; |
| 10 | |
| 11 | class SeniorPreOrderImport extends SeniorImportBase |
| 12 | { |
| 13 | /** |
| 14 | * @param SeniorPreOrderDTO $seniorPreOrderDTO |
| 15 | * @return array |
| 16 | * @throws IntegrationSoapSeniorException |
| 17 | */ |
| 18 | public function execute(SeniorPreOrderDTO $seniorPreOrderDTO): array |
| 19 | { |
| 20 | $wsdlURI = config('integration.url') . '/sapiens_Synccom_br_soelx_prefaturas?wsdl'; |
| 21 | try { |
| 22 | $params = [ |
| 23 | 'codEmp' => $seniorPreOrderDTO->codemp, |
| 24 | 'codFil' => $seniorPreOrderDTO->codfil, |
| 25 | 'numAne' => $seniorPreOrderDTO->numane, |
| 26 | 'numPfa' => $seniorPreOrderDTO->numpfa, |
| 27 | ]; |
| 28 | |
| 29 | $client = new SeniorSoapClient($wsdlURI, $this->options); |
| 30 | $response = $client->Listar(config('integration.user'), config('integration.user_password'), 0, $params); |
| 31 | |
| 32 | $this->verifyErroFromSenior($response, $wsdlURI); |
| 33 | |
| 34 | if (is_null($response->jsonOutput)) { |
| 35 | return []; |
| 36 | } |
| 37 | |
| 38 | return $this->convertBase64InArray($response->jsonOutput); |
| 39 | |
| 40 | } catch (SoapFault $soapFault) { |
| 41 | throw new IntegrationSoapSeniorException( |
| 42 | __("Failure to consume Senior's soap: :message (:wsdl)", [ |
| 43 | 'message' => $soapFault->getMessage(), |
| 44 | 'wsdl' => $wsdlURI, |
| 45 | ]), |
| 46 | previous: $soapFault |
| 47 | ); |
| 48 | } |
| 49 | } |
| 50 | } |