Skip to content

Commit

Permalink
SUPESC-577 Fixed wrong tax set calculation for product items. (#9630)
Browse files Browse the repository at this point in the history
SUPESC-577 Fixed wrong tax set calculation for product items.
  • Loading branch information
AsonUnique authored Sep 28, 2022
1 parent 6219757 commit d34787e
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 201 deletions.
175 changes: 0 additions & 175 deletions architecture-baseline.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
[
{
"fileName": "src/Spryker/Service/Customer/Dependency/Service/CustomerToUtilEncodingServiceBridge.php",
"description": "Bridges: Type should be defined for param `value` in method `Spryker\\Service\\Customer\\Dependency\\Service\\CustomerToUtilEncodingServiceBridge::encodeJson()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Service/Customer/Dependency/Service/CustomerToUtilEncodingServiceBridge.php",
"description": "Bridges: Type should be defined for param `options` in method `Spryker\\Service\\Customer\\Dependency\\Service\\CustomerToUtilEncodingServiceBridge::encodeJson()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Service/Customer/Dependency/Service/CustomerToUtilEncodingServiceBridge.php",
"description": "Bridges: Type should be defined for param `depth` in method `Spryker\\Service\\Customer\\Dependency\\Service\\CustomerToUtilEncodingServiceBridge::encodeJson()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Service/Customer/Dependency/Service/CustomerToUtilEncodingServiceInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `encodeJson()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Communication/Form/AddressForm.php",
"description": "Method `Spryker\\Zed\\Customer\\Communication\\Form\\AddressForm::getBlockPrefix()` must have return type.",
Expand All @@ -48,13 +20,6 @@
"ruleset": "Spryker",
"priority": "1"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php",
"description": "Bridges: Type should be defined for param `countryName` in method `Spryker\\Zed\\Customer\\Dependency\\Facade\\CustomerToCountryBridge::getPreferredCountryByName()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php",
"description": "Bridges: Method `getPreferredCountryByName()` must have `public function get<DomainEntity>Collection(<DomainEntity>CriteriaTransfer): <DomainEntity>CollectionTransfer` signature.",
Expand All @@ -69,41 +34,13 @@
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php",
"description": "Bridges: Type should be defined for param `iso2Code` in method `Spryker\\Zed\\Customer\\Dependency\\Facade\\CustomerToCountryBridge::getCountryByIso2Code()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php",
"description": "Bridges: Method `getCountryByIso2Code()` must have `public function get<DomainEntity>Collection(<DomainEntity>CriteriaTransfer): <DomainEntity>CollectionTransfer` signature.",
"rule": "BridgeFacadeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getPreferredCountryByName()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getAvailableCountries()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getCountryByIso2Code()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToLocaleBridge.php",
"description": "Bridges: Method `getCurrentLocale()` must have `public function get<DomainEntity>Collection(<DomainEntity>CriteriaTransfer): <DomainEntity>CollectionTransfer` signature.",
Expand All @@ -118,13 +55,6 @@
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToLocaleBridge.php",
"description": "Bridges: Type should be defined for param `idLocale` in method `Spryker\\Zed\\Customer\\Dependency\\Facade\\CustomerToLocaleBridge::getLocaleById()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToLocaleBridge.php",
"description": "Bridges: Method `getLocaleById()` must have `public function get<DomainEntity>Collection(<DomainEntity>CriteriaTransfer): <DomainEntity>CollectionTransfer` signature.",
Expand All @@ -139,55 +69,13 @@
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToLocaleInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getCurrentLocale()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToLocaleInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getLocaleCollection()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToLocaleInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getLocaleById()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToLocaleInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getCurrentLocaleName()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToMailInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `handleMail()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToRouterFacadeBridge.php",
"description": "Bridges: Method `getBackofficeChainRouter()` must have `public function get<DomainEntity>Collection(<DomainEntity>CriteriaTransfer): <DomainEntity>CollectionTransfer` signature.",
"rule": "BridgeFacadeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToSequenceNumberInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `generate()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToStoreFacadeBridge.php",
"description": "Bridges: Method `getCurrentStore()` must have `public function get<DomainEntity>Collection(<DomainEntity>CriteriaTransfer): <DomainEntity>CollectionTransfer` signature.",
Expand All @@ -201,68 +89,5 @@
"rule": "BridgeFacadeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToStoreFacadeInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getCurrentStore()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Facade/CustomerToStoreFacadeInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `getAllStores()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilDateTimeServiceInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `formatDateTime()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeServiceBridge.php",
"description": "Bridges: Type should be defined for param `text` in method `Spryker\\Zed\\Customer\\Dependency\\Service\\CustomerToUtilSanitizeServiceBridge::escapeHtml()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeServiceBridge.php",
"description": "Bridges: Type should be defined for param `double` in method `Spryker\\Zed\\Customer\\Dependency\\Service\\CustomerToUtilSanitizeServiceBridge::escapeHtml()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeServiceBridge.php",
"description": "Bridges: Type should be defined for param `charset` in method `Spryker\\Zed\\Customer\\Dependency\\Service\\CustomerToUtilSanitizeServiceBridge::escapeHtml()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeServiceInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `escapeHtml()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilValidateServiceBridge.php",
"description": "Bridges: Type should be defined for param `email` in method `Spryker\\Zed\\Customer\\Dependency\\Service\\CustomerToUtilValidateServiceBridge::isEmailFormatValid()`.",
"rule": "BridgeMethodsRule",
"ruleset": "Spryker",
"priority": "2"
},
{
"fileName": "src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilValidateServiceInterface.php",
"description": "Bridges: The bridge interface has incorrect method signature for `isEmailFormatValid()`. Missed return type. That violates the rule \"All bridge interface methods must have exactly the same or more strict signature as their parent\"",
"rule": "BridgeMethodsInterfaceRule",
"ruleset": "Spryker",
"priority": "2"
}
]
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"spryker/session": "^3.0.0 || ^4.0.0",
"spryker/store": "^1.4.0",
"spryker/symfony": "^3.0.0",
"spryker/tax-product-connector-extension": "^1.0.0",
"spryker/transfer": "^3.25.0",
"spryker/util-date-time": "^1.0.0",
"spryker/util-encoding": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct($utilEncodingService)
*
* @return string|null
*/
public function encodeJson($value, $options = null, $depth = null)
public function encodeJson(array $value, ?int $options = null, ?int $depth = null): ?string
{
return $this->utilEncodingService->encodeJson($value, $options, $depth);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ interface CustomerToUtilEncodingServiceInterface
*
* @return string|null
*/
public function encodeJson($value, $options = null, $depth = null);
public function encodeJson(array $value, ?int $options = null, ?int $depth = null): ?string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace Spryker\Zed\Customer\Communication\Plugin\TaxProductConnector;

use Generated\Shared\Transfer\AddressTransfer;
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
use Spryker\Zed\TaxProductConnectorExtension\Communication\Dependency\Plugin\ShippingAddressValidatorPluginInterface;

/**
* @deprecated Exists for Backward Compatibility reasons only.
*
* @method \Spryker\Zed\Customer\CustomerConfig getConfig()
* @method \Spryker\Zed\Customer\Business\CustomerFacadeInterface getFacade()
* @method \Spryker\Zed\Customer\Communication\CustomerCommunicationFactory getFactory()
* @method \Spryker\Zed\Customer\Persistence\CustomerQueryContainerInterface getQueryContainer()
*/
class CustomerAddressShippingAddressValidatorPlugin extends AbstractPlugin implements ShippingAddressValidatorPluginInterface
{
/**
* {@inheritDoc}
* - Checks if `AddressTransfer.idCustomerAddress` or `AddressTransfer.firstName` and `AddressTransfer.lastName` are not empty.
*
* @api
*
* @param \Generated\Shared\Transfer\AddressTransfer $addressTransfer
*
* @return bool
*/
public function isValid(AddressTransfer $addressTransfer): bool
{
return $addressTransfer->getIdCustomerAddress() !== null
|| (trim($addressTransfer->getFirstName()) && trim($addressTransfer->getLastName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace Spryker\Zed\Customer\Dependency\Facade;

use Generated\Shared\Transfer\CountryCollectionTransfer;
use Generated\Shared\Transfer\CountryTransfer;

class CustomerToCountryBridge implements CustomerToCountryInterface
{
/**
Expand All @@ -27,15 +30,15 @@ public function __construct($countryFacade)
*
* @return \Generated\Shared\Transfer\CountryTransfer
*/
public function getPreferredCountryByName($countryName)
public function getPreferredCountryByName(string $countryName): CountryTransfer
{
return $this->countryFacade->getPreferredCountryByName($countryName);
}

/**
* @return \Generated\Shared\Transfer\CountryCollectionTransfer
*/
public function getAvailableCountries()
public function getAvailableCountries(): CountryCollectionTransfer
{
return $this->countryFacade->getAvailableCountries();
}
Expand All @@ -45,7 +48,7 @@ public function getAvailableCountries()
*
* @return \Generated\Shared\Transfer\CountryTransfer
*/
public function getCountryByIso2Code($iso2Code)
public function getCountryByIso2Code(string $iso2Code): CountryTransfer
{
return $this->countryFacade->getCountryByIso2Code($iso2Code);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@

namespace Spryker\Zed\Customer\Dependency\Facade;

use Generated\Shared\Transfer\CountryCollectionTransfer;
use Generated\Shared\Transfer\CountryTransfer;

interface CustomerToCountryInterface
{
/**
* @param string $countryName
*
* @return \Generated\Shared\Transfer\CountryTransfer
*/
public function getPreferredCountryByName($countryName);
public function getPreferredCountryByName(string $countryName): CountryTransfer;

/**
* @return \Generated\Shared\Transfer\CountryCollectionTransfer
*/
public function getAvailableCountries();
public function getAvailableCountries(): CountryCollectionTransfer;

/**
* @param string $iso2Code
*
* @return \Generated\Shared\Transfer\CountryTransfer
*/
public function getCountryByIso2Code($iso2Code);
public function getCountryByIso2Code(string $iso2Code): CountryTransfer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace Spryker\Zed\Customer\Dependency\Facade;

use Generated\Shared\Transfer\LocaleTransfer;

class CustomerToLocaleBridge implements CustomerToLocaleInterface
{
/**
Expand All @@ -25,7 +27,7 @@ public function __construct($localeFacade)
/**
* @return \Generated\Shared\Transfer\LocaleTransfer
*/
public function getCurrentLocale()
public function getCurrentLocale(): LocaleTransfer
{
return $this->localeFacade->getCurrentLocale();
}
Expand All @@ -43,7 +45,7 @@ public function getLocaleCollection(): array
*
* @return \Generated\Shared\Transfer\LocaleTransfer
*/
public function getLocaleById($idLocale)
public function getLocaleById(int $idLocale): LocaleTransfer
{
return $this->localeFacade->getLocaleById($idLocale);
}
Expand Down
Loading

0 comments on commit d34787e

Please sign in to comment.