<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Customer\Controller\Adminhtml\System\Config\Validatevat; use Magento\Framework\Controller\Result\JsonFactory; class Validate extends \Magento\Customer\Controller\Adminhtml\System\Config\Validatevat { /** * @var JsonFactory */ protected $resultJsonFactory; /** * @param \Magento\Backend\App\Action\Context $context * @param JsonFactory $resultJsonFactory */ public function __construct( \Magento\Backend\App\Action\Context $context, JsonFactory $resultJsonFactory ) { parent::__construct($context); $this->resultJsonFactory = $resultJsonFactory; } /** * Check whether vat is valid * * @return \Magento\Framework\Controller\Result\Json */ public function execute() { $result = $this->_validate(); /** @var \Magento\Framework\Controller\Result\Json $resultJson */ $resultJson = $this->resultJsonFactory->create(); return $resultJson->setData([ 'valid' => (int)$result->getIsValid(), 'message' => $result->getRequestMessage(), ]); } }