| Conditions | 3 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3.1105 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | 1 | public function downloadXml(DownloadXmlCommand $command): DownloadXmlResult |
|
| 26 | { |
||
| 27 | 1 | $soapCaller = $this->settings()->createCallerForService(Services::utilities()); |
|
| 28 | do { |
||
| 29 | 1 | $rawResponse = $soapCaller->call('get_xml', [ |
|
| 30 | 1 | 'uuid' => $command->uuid(), |
|
| 31 | 1 | 'taxpayer_id' => $command->rfc(), |
|
| 32 | 1 | 'invoice_type' => $command->type(), |
|
| 33 | ]); |
||
| 34 | 1 | $result = new DownloadXmlResult($rawResponse); |
|
| 35 | // Finkok sometimes returns the path to the file instead of content (Ticket #18950) |
||
| 36 | 1 | if ('.xml' === substr($result->xml(), -4)) { |
|
| 37 | usleep(200000); // 0.2 seconds |
||
| 38 | continue; |
||
| 39 | } |
||
| 40 | 1 | break; |
|
| 41 | } while (true); |
||
| 42 | 1 | return $result; |
|
| 43 | } |
||
| 45 |