Skip to content

Commit

Permalink
fix: companies house code now checks insolvency flag properly (dvsa/o…
Browse files Browse the repository at this point in the history
  • Loading branch information
ilindsay authored May 7, 2024
1 parent 5351e52 commit 4e93a92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ final class Compare extends AbstractCommandHandler
*/
public function handleCommand(CommandInterface $command)
{
$this->result->setFlag('isInsolvent', false);

$companyNumber = $command->getCompanyNumber();

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ public function handleCommand(CommandInterface $command)
}

$companyNumber = $messages[0]['Body'];
$this->result->merge($this->handleSideEffect(Compare::create(['companyNumber' => $companyNumber])));
$companyResult = $this->handleSideEffect(Compare::create(['companyNumber' => $companyNumber]));
$this->result->merge($companyResult);

$companiesHouseCompany = $this->getRepo()->getLatestByCompanyNumber($companyNumber);
$isProcessed = $companiesHouseCompany->getInsolvencyProcessed();

if ($this->result->getFlag('isInsolvent') && !$isProcessed) {
if ($companyResult->getFlag('isInsolvent') === true && !$isProcessed) {
$insolvencyMessage = $this->messageBuilderService->buildMessage(
['companyOrLlpNo' => $companyNumber],
ProcessInsolvency::class,
Expand Down

0 comments on commit 4e93a92

Please sign in to comment.