Skip to content

Commit

Permalink
Merge pull request #34 from astoundcommerce/fix/AVASUP-425
Browse files Browse the repository at this point in the history
fix/AVASUP-425 Error with exemptions created and edited in Avalara AP
  • Loading branch information
marynychsv authored Nov 18, 2019
2 parents d62d49e + c961bb1 commit fb6c261
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Controller/Certificates/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ public function execute(): ResultInterface
return $result;
} else {
if (null === $result || ($result instanceof DataObject && $result->hasData('error'))) {
$this->messageManager->addError(
__('Something went wrong, please check the log file for more information')
);
$codeExplainInfo = __('Something went wrong, please check the log file for more information');

if($result->getData('error')['code'] == '400'){
$codeExplainInfo = __('The certificate file can\'t be displayed.
It hasn\'t been generated or upload to the AvaTax Service early.');
};

$this->messageManager->addError($codeExplainInfo);
}
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
Expand Down
3 changes: 2 additions & 1 deletion Helper/CertificateDownloadControllerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public function getDownloadRawResult()
$errorData = [
'class' => self::class,
'trace' => $exception->getTraceAsString(),
'error_message' => $exception->getMessage()
'error_message' => $exception->getMessage(),
'code' => $exception->getCode()
];
$this->logger->error($exception->getMessage(), $errorData);
/** @var \Magento\Framework\DataObject $error */
Expand Down

0 comments on commit fb6c261

Please sign in to comment.