Exemple #1
0
 /**
  * Executes command basing on business object
  *
  * @param array $commandSubject
  * @return null
  */
 public function execute(array $commandSubject)
 {
     // @TODO implement exceptions catching
     $transferO = $this->transferFactory->create($this->requestBuilder->build($commandSubject));
     $response = $this->client->placeRequest($transferO);
     $result = $this->validator->validate(array_merge($commandSubject, ['response' => $response]));
     if ($result !== null && !$result->isValid()) {
         $commandSubject['payment']->getPayment()->setIsTransactionPending(true);
         return;
     }
     $this->handler->handle($commandSubject, $response);
 }
 /**
  * Executes command basing on business object
  *
  * @param array $commandSubject
  * @return null
  * @throws \Exception
  */
 public function execute(array $commandSubject)
 {
     // @TODO implement exceptions catching
     $transferO = $this->transferFactory->create($this->requestBuilder->build($commandSubject));
     $response = $this->client->placeRequest($transferO);
     if ($this->validator) {
         $result = $this->validator->validate(array_merge($commandSubject, ['response' => $response]));
         if (!$result->isValid()) {
             throw new CommandException(__(implode("\n", $result->getFailsDescription())));
         }
     }
     if ($this->handler) {
         $this->handler->handle($commandSubject, $response);
     }
 }
 /**
  * Executes command basing on business object
  *
  * @param array $commandSubject
  * @return void
  * @throws CommandException
  */
 public function execute(array $commandSubject)
 {
     // @TODO implement exceptions catching
     $transferO = $this->transferFactory->create($this->requestBuilder->build($commandSubject));
     $response = $this->client->placeRequest($transferO);
     if ($this->validator !== null) {
         $result = $this->validator->validate(array_merge($commandSubject, ['response' => $response]));
         if (!$result->isValid()) {
             $this->logExceptions($result->getFailsDescription());
             throw new CommandException(__('Transaction has been declined. Please try again later.'));
         }
     }
     if ($this->handler) {
         $this->handler->handle($commandSubject, $response);
     }
 }