Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
55.56% |
10 / 18 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| SeniorProcessInvoiceItemDivision | |
55.56% |
10 / 18 |
|
0.00% |
0 / 1 |
2.35 | |
0.00% |
0 / 1 |
| execute | |
55.56% |
10 / 18 |
|
0.00% |
0 / 1 |
2.35 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Shared\Integrations\Senior; |
| 4 | |
| 5 | use Domain\Invoice\DTOs\SeniorProcessInvoiceItemDivisionDTO; |
| 6 | use Domain\Shared\Integrations\Senior\Exceptions\IntegrationSoapSeniorException; |
| 7 | use SoapFault; |
| 8 | |
| 9 | use function __; |
| 10 | |
| 11 | class SeniorProcessInvoiceItemDivision extends SeniorImportBase |
| 12 | { |
| 13 | /** |
| 14 | * @throws IntegrationSoapSeniorException |
| 15 | */ |
| 16 | public function execute(SeniorProcessInvoiceItemDivisionDTO $divisionDTO): ?object |
| 17 | { |
| 18 | $wsdlURI = config('integration.url').'/sapiens_Synccom_br_SoelX_ConferenciaNotasFiscaisEntrada?wsdl'; |
| 19 | |
| 20 | try { |
| 21 | $client = new SeniorSoapClient($wsdlURI, $this->options); |
| 22 | $response = $client->processarDivisaoItem( |
| 23 | config('integration.user'), |
| 24 | config('integration.user_password'), |
| 25 | 0, |
| 26 | $divisionDTO->toArray() |
| 27 | ); |
| 28 | |
| 29 | $this->verifyErroFromSenior($response, $wsdlURI); |
| 30 | |
| 31 | return $response; |
| 32 | } catch (SoapFault $soapFault) { |
| 33 | throw new IntegrationSoapSeniorException( |
| 34 | __("Failure to consume Senior's soap: :message (:wsdl)", [ |
| 35 | 'message' => $soapFault->getMessage(), |
| 36 | 'wsdl' => $wsdlURI, |
| 37 | ]), |
| 38 | previous: $soapFault |
| 39 | ); |
| 40 | } |
| 41 | } |
| 42 | } |