Skip to content

Commit

Permalink
Merge pull request #46 from nirav-patel-avalara/Bugfix/CONNECT-43004
Browse files Browse the repository at this point in the history
Bugfix/connect 43004
  • Loading branch information
avl-asheesh-singh authored Jun 29, 2022
2 parents a9ac068 + 515f122 commit 0d9e95d
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 28 deletions.
7 changes: 5 additions & 2 deletions Block/Checkout/CertificatesLayoutProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ public function __construct(
public function process($jsLayout)
{
$config = [
'documentManagementEnabled' => false
'documentManagementEnabled' => false,
'certificatesAutoValidationDisabled' => false

];

if ($this->config->isModuleEnabled() && $this->documentManagementConfig->isEnabled()) {
Expand All @@ -127,7 +129,8 @@ public function process($jsLayout)
'newCertText' => $newCertText,
'manageCertsText' => __($this->documentManagementConfig->getCheckoutLinkTextManageExistingCert()),
'enabledCountries' => $this->documentManagementConfig->getEnabledCountries(),
'documentManagementEnabled' => true
'documentManagementEnabled' => true,
'certificatesAutoValidationDisabled' => $this->documentManagementConfig->isCertificatesAutoValidationDisabled()
];
}

Expand Down
13 changes: 11 additions & 2 deletions Framework/AppInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
interface AppInterface
{
/**
* If this is updated it must also be updated in composer.json
* Connector version
*/
const APP_VERSION = '2.2.10';
const APP_VERSION = '2.3.0';
/**
* Avalara APP String
*/
const CONNECTOR_STRING = 'a0o5a000007TuRvAAK';

/**
* Avalara APP name
*/
const APP_NAME = 'Magento for SalesTax || '.self::APP_VERSION.'v2';
}
2 changes: 1 addition & 1 deletion Framework/Interaction/Rest/ClientPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function getClient(
$avaTaxClient = $this->avaTaxClientFactory->create(
[
'appName' => $this->config->getApplicationName(),
'appVersion' => $this->config->getApplicationVersion(),
'appVersion' => $this->config->getConnectorString(),
'machineName' => $this->config->getApplicationDomain(),
'environment' => $isProduction ? self::API_MODE_PROD : self::API_MODE_DEV,
]
Expand Down
23 changes: 5 additions & 18 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,36 +577,23 @@ public function getCustomerCodeFormat( $store = null, $scopeType = ScopeInterfac
}

/**
* Generate AvaTax Application Name from a combination of Magento version number and AvaTax module name
* Format: Magento 2.x Community - AvaTax
* Limited to 50 characters to comply with API requirements
* Generate AvaTax Application Name from a AvaTax module name
*
* @return string
*/
public function getApplicationName()
{
return substr($this->magentoProductMetadata->getName(), 0, 7) . ' ' . // "Magento" - 8 chars
substr(
$this->magentoProductMetadata->getVersion(),
0,
14
) . ' ' . // 2.x & " " - 50 - 8 - 13 - 14 = 15 chars
substr(
$this->magentoProductMetadata->getEdition(),
0,
10
) . ' - ' . // "Community - "|"Enterprise - " - 13 chars
'AvaTax';
return AvaTaxAppInterface::APP_NAME;
}

/**
* The version of the AvaTax module
* Connector String of avatax module
*
* @return string
*/
public function getApplicationVersion()
public function getConnectorString()
{
return AvaTaxAppInterface::APP_VERSION;
return AvaTaxAppInterface::CONNECTOR_STRING;
}

/**
Expand Down
15 changes: 15 additions & 0 deletions Helper/DocumentManagementConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class DocumentManagementConfig extends AbstractHelper

const XML_PATH_AVATAX_DOCUMENT_MANAGEMENT_CHECKOUT_LINK_TEXT_MANAGE_EXISTING_CERTS = 'tax/avatax_document_management/checkout_link_text_manage_existing_certs';

const XML_PATH_CERTCAPTURE_AUTO_VALIDATION = 'tax/avatax_certificate_capture/disable_certcapture_auto_validation';

/**
* @param int|null $store
* @param string|null $scopeType
Expand Down Expand Up @@ -106,5 +108,18 @@ public function getCheckoutLinkTextManageExistingCert($store = null, $scopeType
$store
);
}

/**
* @return bool
*/
public function isCertificatesAutoValidationDisabled($store = null, $scopeType = ScopeInterface::SCOPE_STORE)
{
return (bool)$this->scopeConfig->getValue(
self::XML_PATH_CERTCAPTURE_AUTO_VALIDATION,
$scopeType,
$store
);
}


}
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ This extension contains integration tests to verify the extension's functionalit
- Magento 2.3.x
- :white_check_mark: Community
- :white_check_mark: Enterprise
- Magento 2.2.x
- :white_check_mark: Community
- :white_check_mark: Enterprise

As of version 1.0.0 of this extension, this extension supports [Magento Enterprise's split database mode](http://devdocs.magento.com/guides/v2.1/config-guide/multi-master/multi-master.html).

Expand Down
4 changes: 3 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ This is the recommended installation method as it allows you to easily update th
1. Require the desired version of AvaTax. Latest version can be installed by running following command:

```
composer require avalara/avatax-magento:2.2.4
composer require avalara/avatax-magento:2.3.0
```

2. Setup the AvaTax module in magento

```bash
bin/magento module:enable --clear-static-content ClassyLlama_AvaTax
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
bin/magento cache:flush
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ define([
sdk(this.dialogElement[0], {
// Include if cert is a renewal?
upload: true,

submit_to_stack: Boolean(Number(this.certificatesAutoValidationDisabled)),
onCertSuccess: onCertificateComplete,
onManualSubmit: onCertificateComplete,
onUpload: onCertificateComplete
Expand Down

0 comments on commit 0d9e95d

Please sign in to comment.