/**
  * @return bool
  */
 public function isSuccess()
 {
     $transactionResponse = $this->createTransactionResponse->getTransactionResponse();
     $resultCode = $this->createTransactionResponse->getMessages()->getResultCode();
     if ($resultCode === 'Error' && null === $transactionResponse) {
         $this->messages = [self::TRANSACTION_RESPONSE => $this->createTransactionErrorToArray($this->createTransactionResponse->getMessages())];
         return false;
     }
     if ($transactionResponse->getResponseCode() !== "1") {
         $this->messages = [self::TRANSACTION_RESPONSE => array_merge($this->createTransactionErrorToArray($this->createTransactionResponse->getMessages()), $this->transactionResponseErrorsToArray($transactionResponse->getErrors()))];
         return false;
     }
     $this->messages = [self::TRANSACTION_RESPONSE => $this->createTransactionErrorToArray($this->createTransactionResponse->getMessages())];
     $this->data = [self::TRANSACTION_RESPONSE => ['responseCode' => $transactionResponse->getResponseCode(), 'authCode' => $transactionResponse->getAuthCode(), 'avsResultCode' => $transactionResponse->getAvsResultCode(), 'ccvResultCode' => $transactionResponse->getCvvResultCode(), 'cavvResultCode' => $transactionResponse->getCavvResultCode(), 'transId' => $transactionResponse->getTransId(), 'refTransID' => $transactionResponse->getRefTransID(), 'transHash' => $transactionResponse->getTransHash(), 'accountNumber' => $transactionResponse->getAccountNumber(), 'accountType' => $transactionResponse->getAccountType(), 'userFields' => $this->getUserFieldsFromTransactionResponse($transactionResponse)]];
     $profileResponse = $this->createTransactionResponse->getProfileResponse();
     if (null !== $profileResponse) {
         $this->messages = array_merge($this->messages, [self::PROFILE_RESPONSE => $this->createTransactionErrorToArray($profileResponse->getMessages())]);
         $this->data = array_merge($this->data, [self::PROFILE_RESPONSE => ['resultCode' => $profileResponse->getMessages()->getResultCode(), 'customerProfileId' => $profileResponse->getCustomerProfileId(), 'customerPaymentProfileIdList' => $profileResponse->getCustomerPaymentProfileIdList(), 'customerShippingAddressIdList' => $profileResponse->getCustomerShippingAddressIdList()]]);
     }
     return true;
 }
 function displayTransactionMessages(apiContract\CreateTransactionResponse $response)
 {
     if (null != $response) {
         $logMessage = sprintf("\n%s: Displaying Transaction Response.", \net\authorize\util\Helpers::now());
         echo $logMessage;
         file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
         if (null != $response->getTransactionResponse()) {
             $logMessage = sprintf("\n%s: Transaction Response Code: '%s'.", \net\authorize\util\Helpers::now(), $response->getTransactionResponse()->getResponseCode());
             echo $logMessage;
             file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
             $allMessages = $response->getTransactionResponse()->getMessages();
             $allErrors = $response->getTransactionResponse()->getErrors();
             $errorCount = 0;
             if (null != $allErrors) {
                 foreach ($allErrors as $error) {
                     $errorCount++;
                     $logMessage = sprintf("\n%s: %d - Error: Code:'%s', Text:'%s'", \net\authorize\util\Helpers::now(), $errorCount, $error->getErrorCode(), $error->getErrorText());
                     echo $logMessage;
                     file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
                 }
             }
             $messageCount = 0;
             if (null != $allMessages) {
                 foreach ($allMessages as $message) {
                     $messageCount++;
                     //$logMessage = sprintf("\n%s: %d - Message: Code:'%s', Description:'%s'", \net\authorize\util\Helpers::now(), $errorCount, $message->getCode(), $message->getDescription());
                     $logMessage = sprintf("\n%s: %d - Message: ", \net\authorize\util\Helpers::now(), $messageCount);
                     echo $logMessage;
                     file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
                 }
             }
             $logMessage = sprintf("\n%s: Transaction Response, Errors: '%d', Messages: '%d'.", \net\authorize\util\Helpers::now(), $errorCount, $messageCount);
             echo $logMessage;
             file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
         }
     }
 }