From c961bb1609ea2e424dbd8d054b40ed1af936e22d Mon Sep 17 00:00:00 2001 From: Oleksii Didkovskyi Date: Fri, 15 Nov 2019 17:32:08 +0200 Subject: [PATCH] fix/AVASUP-425 Error with exemptions created and edited in Avalara AP - Added the more detailed explanation of the no certificate display from the customer account. --- Controller/Certificates/Download.php | 11 ++++++++--- Helper/CertificateDownloadControllerHelper.php | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Controller/Certificates/Download.php b/Controller/Certificates/Download.php index be6c43e3..4992546b 100644 --- a/Controller/Certificates/Download.php +++ b/Controller/Certificates/Download.php @@ -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); diff --git a/Helper/CertificateDownloadControllerHelper.php b/Helper/CertificateDownloadControllerHelper.php index 11e4d8be..cc652d66 100644 --- a/Helper/CertificateDownloadControllerHelper.php +++ b/Helper/CertificateDownloadControllerHelper.php @@ -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 */