commandPool = $commandPool; $this->subjectReader = $subjectReader; } /** * @inheritdoc */ public function execute(array $commandSubject): void { if ($this->shouldAcceptInGateway($commandSubject)) { $this->commandPool->get(self::ACCEPT_FDS) ->execute($commandSubject); } } /** * Determines if the transaction needs to be accepted in the gateway * * @param array $commandSubject * @return bool * @throws CommandException */ private function shouldAcceptInGateway(array $commandSubject): bool { $details = $this->commandPool->get('get_transaction_details') ->execute($commandSubject) ->get(); return in_array($details['transaction']['transactionStatus'], self::NEEDS_APPROVAL_STATUSES); } }