diff --git a/composer.json b/composer.json
index 28f5fa9272..6afaaf824b 100644
--- a/composer.json
+++ b/composer.json
@@ -211,7 +211,7 @@
"spryker/stores-api": "^1.0.0",
"spryker/stores-backend-api": "^1.0.0",
"spryker/stores-rest-api": "^1.2.0",
- "spryker/tax-app": "^0.2.0",
+ "spryker/tax-app": "^0.3.1",
"spryker/tax-product-connector": "^4.7.1",
"spryker/up-selling-products-rest-api": "^1.2.2",
"spryker/urls-rest-api": "^1.0.2",
diff --git a/composer.lock b/composer.lock
index 7f1365fa4d..12153e59bd 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "ed1ff066a6c12033167b921f5f1d3854",
+ "content-hash": "653e9c9b5a9e6d04858b3c1b43bd2cec",
"packages": [
{
"name": "async-aws/core",
@@ -29910,16 +29910,16 @@
},
{
"name": "spryker/oms",
- "version": "11.28.0",
+ "version": "11.29.0",
"source": {
"type": "git",
"url": "https://github.com/spryker/oms.git",
- "reference": "a8b5a3481a0ba5474e014d3d397eaee4410a7271"
+ "reference": "4571b837f13e37d381db6c109643c3387837feda"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spryker/oms/zipball/a8b5a3481a0ba5474e014d3d397eaee4410a7271",
- "reference": "a8b5a3481a0ba5474e014d3d397eaee4410a7271",
+ "url": "https://api.github.com/repos/spryker/oms/zipball/4571b837f13e37d381db6c109643c3387837feda",
+ "reference": "4571b837f13e37d381db6c109643c3387837feda",
"shasum": ""
},
"require": {
@@ -29933,7 +29933,7 @@
"spryker/mail": "^4.6.0",
"spryker/mail-extension": "^1.0.0",
"spryker/message-broker": "^1.2.1",
- "spryker/oms-extension": "^1.3.0",
+ "spryker/oms-extension": "^1.4.0",
"spryker/propel": "^3.28.0",
"spryker/propel-orm": "^1.16.0",
"spryker/sales": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0 || ^11.0.0",
@@ -29976,9 +29976,9 @@
],
"description": "Oms module",
"support": {
- "source": "https://github.com/spryker/oms/tree/11.28.0"
+ "source": "https://github.com/spryker/oms/tree/11.29.0"
},
- "time": "2023-11-02T20:09:27+00:00"
+ "time": "2023-12-29T11:01:15+00:00"
},
{
"name": "spryker/oms-discount-connector",
@@ -30031,21 +30031,21 @@
},
{
"name": "spryker/oms-extension",
- "version": "1.3.0",
+ "version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/spryker/oms-extension.git",
- "reference": "5351c4b6f3772cc01eea83816a69515ea320c2ab"
+ "reference": "fa6eb2df3a453ad03fcd93b8ce6ed342936f829a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spryker/oms-extension/zipball/5351c4b6f3772cc01eea83816a69515ea320c2ab",
- "reference": "5351c4b6f3772cc01eea83816a69515ea320c2ab",
+ "url": "https://api.github.com/repos/spryker/oms-extension/zipball/fa6eb2df3a453ad03fcd93b8ce6ed342936f829a",
+ "reference": "fa6eb2df3a453ad03fcd93b8ce6ed342936f829a",
"shasum": ""
},
"require": {
- "php": ">=7.2",
- "spryker/transfer": "^3.8.0"
+ "php": ">=8.1",
+ "spryker/transfer": "^3.27.0"
},
"require-dev": {
"spryker/code-sniffer": "*"
@@ -30067,9 +30067,9 @@
],
"description": "OmsExtension module",
"support": {
- "source": "https://github.com/spryker/oms-extension/tree/1.3.0"
+ "source": "https://github.com/spryker/oms-extension/tree/1.4.0"
},
- "time": "2020-06-23T16:50:44+00:00"
+ "time": "2023-12-29T11:01:15+00:00"
},
{
"name": "spryker/oms-multi-thread",
@@ -46127,20 +46127,20 @@
},
{
"name": "spryker/tax-app",
- "version": "0.2.0",
+ "version": "0.3.1",
"source": {
"type": "git",
"url": "https://github.com/spryker/tax-app.git",
- "reference": "a6b7a4375f28cb65ffd99e69e1835654c52646d9"
+ "reference": "ca927c58e707f01909f10e599bf40d59bf8af1cc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spryker/tax-app/zipball/a6b7a4375f28cb65ffd99e69e1835654c52646d9",
- "reference": "a6b7a4375f28cb65ffd99e69e1835654c52646d9",
+ "url": "https://api.github.com/repos/spryker/tax-app/zipball/ca927c58e707f01909f10e599bf40d59bf8af1cc",
+ "reference": "ca927c58e707f01909f10e599bf40d59bf8af1cc",
"shasum": ""
},
"require": {
- "php": ">=8.0",
+ "php": ">=8.1",
"psr/http-message": "^1.0.0",
"spryker/calculation-extension": "^1.0.0",
"spryker/guzzle": "^2.4.1",
@@ -46149,6 +46149,7 @@
"spryker/message-broker": "^1.5.0",
"spryker/message-broker-extension": "^1.0.0",
"spryker/oauth-client": "^1.4.0",
+ "spryker/oms-extension": "^1.4.0",
"spryker/propel-orm": "^1.18.0",
"spryker/ramsey-uuid": "^2.0.0",
"spryker/sales": "^11.0.0",
@@ -46192,9 +46193,9 @@
],
"description": "TaxApp module",
"support": {
- "source": "https://github.com/spryker/tax-app/tree/0.2.0"
+ "source": "https://github.com/spryker/tax-app/tree/0.3.1"
},
- "time": "2023-10-26T12:55:48+00:00"
+ "time": "2024-01-10T08:27:19+00:00"
},
{
"name": "spryker/tax-app-extension",
@@ -60898,5 +60899,5 @@
"platform-overrides": {
"php": "8.1.0"
},
- "plugin-api-version": "2.6.0"
+ "plugin-api-version": "2.2.0"
}
diff --git a/config/Shared/config_default.php b/config/Shared/config_default.php
index dfd29438e0..f82455d68e 100644
--- a/config/Shared/config_default.php
+++ b/config/Shared/config_default.php
@@ -705,6 +705,7 @@
= $config[OauthClientConstants::TENANT_IDENTIFIER]
= $config[PaymentConstants::TENANT_IDENTIFIER]
= $config[AppCatalogGuiConstants::TENANT_IDENTIFIER]
+ = $config[TaxAppConstants::TENANT_IDENTIFIER]
= getenv('SPRYKER_TENANT_IDENTIFIER') ?: '';
$config[MessageBrokerConstants::MESSAGE_TO_CHANNEL_MAP] =
diff --git a/config/Zed/oms/DummyPayment01.xml b/config/Zed/oms/DummyPayment01.xml
index 876271bd39..fec56fb371 100644
--- a/config/Zed/oms/DummyPayment01.xml
+++ b/config/Zed/oms/DummyPayment01.xml
@@ -32,9 +32,7 @@
-
- cancellable
-
+
@@ -107,12 +105,6 @@
skip timeout
-
- confirmed
- cancelled
- cancel
-
-
waiting
picking list generation scheduled
diff --git a/src/Pyz/Zed/Calculation/CalculationDependencyProvider.php b/src/Pyz/Zed/Calculation/CalculationDependencyProvider.php
index 706903b885..a168d8012f 100644
--- a/src/Pyz/Zed/Calculation/CalculationDependencyProvider.php
+++ b/src/Pyz/Zed/Calculation/CalculationDependencyProvider.php
@@ -17,7 +17,6 @@
use Spryker\Zed\Calculation\Communication\Plugin\Calculator\ItemDiscountAmountFullAggregatorPlugin;
use Spryker\Zed\Calculation\Communication\Plugin\Calculator\ItemProductOptionPriceAggregatorPlugin;
use Spryker\Zed\Calculation\Communication\Plugin\Calculator\ItemSubtotalAggregatorPlugin;
-use Spryker\Zed\Calculation\Communication\Plugin\Calculator\ItemTaxAmountFullAggregatorPlugin;
use Spryker\Zed\Calculation\Communication\Plugin\Calculator\NetTotalCalculatorPlugin;
use Spryker\Zed\Calculation\Communication\Plugin\Calculator\OrderTaxTotalCalculationPlugin;
use Spryker\Zed\Calculation\Communication\Plugin\Calculator\PriceCalculatorPlugin;
@@ -42,9 +41,6 @@
use Spryker\Zed\Shipment\Communication\Plugin\Calculation\FilterObsoleteShipmentExpensesCalculatorPlugin;
use Spryker\Zed\Shipment\Communication\Plugin\Calculation\ShipmentTaxRateCalculatorPlugin;
use Spryker\Zed\Shipment\Communication\Plugin\Calculation\ShipmentTotalCalculatorPlugin;
-use Spryker\Zed\Tax\Communication\Plugin\Calculator\TaxAmountAfterCancellationCalculatorPlugin;
-use Spryker\Zed\Tax\Communication\Plugin\Calculator\TaxAmountCalculatorPlugin;
-use Spryker\Zed\Tax\Communication\Plugin\Calculator\TaxRateAverageAggregatorPlugin;
use Spryker\Zed\TaxApp\Communication\Plugin\Calculation\TaxAppCalculationPlugin;
use Spryker\Zed\TaxProductConnector\Communication\Plugin\Calculation\ProductItemTaxRateCalculatorPlugin;
@@ -122,6 +118,10 @@ class CalculationDependencyProvider extends SprykerCalculationDependencyProvider
* TaxRateAverageAggregatorPlugin - average tax rate for item, used when recalculating canceled amount when refunded
* - Item.taxRateAverageAggregation
*
+ * TaxAppCalculationPlugin - Calculate tax using external tax application. Replaces all tax calculation plugins above.
+ * Replaced tax calculation plugins should be moved to {@link \Spryker\Zed\TaxApp\TaxAppDependencyProvider::getFallbackQuoteCalculationPlugins} method.
+ * Replaced tax calculation plugin stack should include all plugins which were present between extracted tax-related plugins.
+ *
* ProductItemTaxRateCalculatorPlugin - Sets tax rate to item based on shipping address
* - Item.taxRate
*
@@ -213,13 +213,10 @@ protected function getQuoteCalculatorPluginStack(Container $container): array
new DiscountAmountAggregatorForGenericAmountPlugin(),
new ItemDiscountAmountFullAggregatorPlugin(),
- new TaxAmountCalculatorPlugin(),
- new ItemTaxAmountFullAggregatorPlugin(),
+ new TaxAppCalculationPlugin(),
new PriceToPayAggregatorPlugin(),
- new TaxRateAverageAggregatorPlugin(),
-
new RefundableAmountCalculatorPlugin(),
new CalculateBundlePricesPlugin(),
@@ -229,7 +226,6 @@ protected function getQuoteCalculatorPluginStack(Container $container): array
new DiscountTotalCalculatorPlugin(),
new RefundTotalCalculatorPlugin(),
new TaxTotalCalculatorPlugin(),
- new TaxAppCalculationPlugin(),
new GrandTotalCalculatorPlugin(),
new NetTotalCalculatorPlugin(),
@@ -261,13 +257,10 @@ protected function getOrderCalculatorPluginStack(Container $container): array
new DiscountAmountAggregatorForGenericAmountPlugin(),
new ItemDiscountAmountFullAggregatorPlugin(),
- new TaxAmountCalculatorPlugin(),
- new ItemTaxAmountFullAggregatorPlugin(),
+ new TaxAppCalculationPlugin(),
new PriceToPayAggregatorPlugin(),
- new TaxAmountAfterCancellationCalculatorPlugin(),
-
new RefundableAmountCalculatorPlugin(),
new ExpenseTotalCalculatorPlugin(),
@@ -275,7 +268,7 @@ protected function getOrderCalculatorPluginStack(Container $container): array
new RefundTotalCalculatorPlugin(),
new CanceledTotalCalculationPlugin(),
new OrderTaxTotalCalculationPlugin(),
- new TaxAppCalculationPlugin(),
+
new GrandTotalCalculatorPlugin(),
new NetTotalCalculatorPlugin(),
];
diff --git a/src/Pyz/Zed/Oms/OmsDependencyProvider.php b/src/Pyz/Zed/Oms/OmsDependencyProvider.php
index f48b87cda7..451dab82ae 100644
--- a/src/Pyz/Zed/Oms/OmsDependencyProvider.php
+++ b/src/Pyz/Zed/Oms/OmsDependencyProvider.php
@@ -33,6 +33,7 @@
use Spryker\Zed\Shipment\Dependency\Plugin\Oms\ShipmentManualEventGrouperPlugin;
use Spryker\Zed\Shipment\Dependency\Plugin\Oms\ShipmentOrderMailExpanderPlugin;
use Spryker\Zed\TaxApp\Communication\Plugin\Oms\Command\SubmitPaymentTaxInvoicePlugin;
+use Spryker\Zed\TaxApp\Communication\Plugin\Oms\OrderRefundedEventListenerPlugin;
use Spryker\Zed\WarehouseAllocation\Communication\Plugin\Oms\SalesOrderWarehouseAllocationCommandPlugin;
class OmsDependencyProvider extends SprykerOmsDependencyProvider
@@ -175,4 +176,14 @@ protected function getTimeoutProcessorPlugins(): array
new InitiationTimeoutProcessorPlugin(),
];
}
+
+ /**
+ * @return array<\Spryker\Zed\OmsExtension\Dependency\Plugin\OmsEventTriggeredListenerPluginInterface>
+ */
+ protected function getOmsEventTriggeredListenerPlugins(): array
+ {
+ return [
+ new OrderRefundedEventListenerPlugin(),
+ ];
+ }
}
diff --git a/src/Pyz/Zed/TaxApp/TaxAppDependencyProvider.php b/src/Pyz/Zed/TaxApp/TaxAppDependencyProvider.php
new file mode 100644
index 0000000000..06014f6b5c
--- /dev/null
+++ b/src/Pyz/Zed/TaxApp/TaxAppDependencyProvider.php
@@ -0,0 +1,48 @@
+
+ */
+ protected function getFallbackQuoteCalculationPlugins(): array
+ {
+ return [
+ new TaxAmountCalculatorPlugin(),
+ new ItemTaxAmountFullAggregatorPlugin(),
+ new PriceToPayAggregatorPlugin(),
+ new TaxRateAverageAggregatorPlugin(),
+ ];
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return array<\Spryker\Zed\CalculationExtension\Dependency\Plugin\CalculationPluginInterface>
+ */
+ protected function getFallbackOrderCalculationPlugins(): array
+ {
+ return [
+ new TaxAmountCalculatorPlugin(),
+ new ItemTaxAmountFullAggregatorPlugin(),
+ new PriceToPayAggregatorPlugin(),
+ new TaxAmountAfterCancellationCalculatorPlugin(),
+ ];
+ }
+}
diff --git a/tests/PyzTest/Zed/MessageBroker/MessageHandlers/TaxApp/Communication/TaxAppConfigMessageTest.php b/tests/PyzTest/Zed/MessageBroker/MessageHandlers/TaxApp/Communication/TaxAppConfigMessageTest.php
index 7cab6c4e0c..1f6a5a3fc7 100644
--- a/tests/PyzTest/Zed/MessageBroker/MessageHandlers/TaxApp/Communication/TaxAppConfigMessageTest.php
+++ b/tests/PyzTest/Zed/MessageBroker/MessageHandlers/TaxApp/Communication/TaxAppConfigMessageTest.php
@@ -9,8 +9,8 @@
use Codeception\Test\Unit;
use Generated\Shared\Transfer\ConfigureTaxAppTransfer;
+use Generated\Shared\Transfer\DeleteTaxAppTransfer;
use Generated\Shared\Transfer\MessageAttributesTransfer;
-use Generated\Shared\Transfer\StoreTransfer;
use PyzTest\Zed\MessageBroker\TaxAppCommunicationTester;
/**
@@ -55,7 +55,6 @@ public function testConfigureTaxAppMessageIsSuccessfullyHandled(): void
MessageAttributesTransfer::STORE_REFERENCE => static::STORE_REFERENCE,
], [
ConfigureTaxAppTransfer::VENDOR_CODE => static::VENDOR_CODE,
- ConfigureTaxAppTransfer::API_URL => 'url',
ConfigureTaxAppTransfer::IS_ACTIVE => true,
]);
@@ -75,12 +74,12 @@ public function testDeleteTaxAppMessageIsSuccessfullyHandled(): void
$storeTransfer = $this->tester->getAllowedStore();
$this->tester->setStoreReferenceData([$storeTransfer->getName() => static::STORE_REFERENCE]);
- $this->createDummyTaxAppConfig($storeTransfer);
+ $this->createDummyTaxAppConfig();
$deleteTaxAppTransfer = $this->tester->buildDeleteTaxAppTransfer([
MessageAttributesTransfer::STORE_REFERENCE => static::STORE_REFERENCE,
], [
- ConfigureTaxAppTransfer::VENDOR_CODE => static::VENDOR_CODE,
+ DeleteTaxAppTransfer::VENDOR_CODE => static::VENDOR_CODE,
]);
// Act
@@ -91,16 +90,15 @@ public function testDeleteTaxAppMessageIsSuccessfullyHandled(): void
}
/**
- * @param \Generated\Shared\Transfer\StoreTransfer $storeTransfer
- *
* @return void
*/
- protected function createDummyTaxAppConfig(StoreTransfer $storeTransfer): void
+ protected function createDummyTaxAppConfig(): void
{
$this->tester->handleTaxAppMessage(
$this->tester->buildConfigureTaxAppTransfer([
MessageAttributesTransfer::STORE_REFERENCE => static::STORE_REFERENCE,
ConfigureTaxAppTransfer::VENDOR_CODE => static::VENDOR_CODE,
+ ConfigureTaxAppTransfer::IS_ACTIVE => true,
]),
);
}
diff --git a/tests/PyzTest/Zed/MessageBroker/_support/TaxAppCommunicationTester.php b/tests/PyzTest/Zed/MessageBroker/_support/TaxAppCommunicationTester.php
index aa7f7c78a2..ac64813d8f 100644
--- a/tests/PyzTest/Zed/MessageBroker/_support/TaxAppCommunicationTester.php
+++ b/tests/PyzTest/Zed/MessageBroker/_support/TaxAppCommunicationTester.php
@@ -13,6 +13,7 @@
use Generated\Shared\Transfer\ConfigureTaxAppTransfer;
use Generated\Shared\Transfer\DeleteTaxAppTransfer;
use Generated\Shared\Transfer\StoreTransfer;
+use Generated\Shared\Transfer\TaxAppApiUrlsTransfer;
use Orm\Zed\TaxApp\Persistence\SpyTaxAppConfig;
use Orm\Zed\TaxApp\Persistence\SpyTaxAppConfigQuery;
use Spryker\Shared\Kernel\Transfer\TransferInterface;
@@ -47,9 +48,12 @@ public function assertTaxAppConfigIsSavedCorrectlyForStore(StoreTransfer $storeT
{
$taxAppConfigEntity = $this->findTaxAppConfigEntity($storeTransfer, $configureTaxAppTransfer->getVendorCode());
- $this->assertEquals($taxAppConfigEntity->getApiUrl(), $configureTaxAppTransfer->getApiUrl());
+ $taxAppConfigApiUrlsTransfer = (new TaxAppApiUrlsTransfer())->fromArray(json_decode($taxAppConfigEntity->getApiUrls(), true));
+
+ $this->assertEquals($taxAppConfigApiUrlsTransfer->getRefundsUrl(), $configureTaxAppTransfer->getApiUrlsOrFail()->getRefundsUrlOrFail());
+ $this->assertEquals($taxAppConfigApiUrlsTransfer->getQuotationUrl(), $configureTaxAppTransfer->getApiUrlsOrFail()->getQuotationUrlOrFail());
$this->assertEquals($taxAppConfigEntity->getVendorCode(), $configureTaxAppTransfer->getVendorCode());
- $this->assertEquals($taxAppConfigEntity->getApplicationId(), $configureTaxAppTransfer->getMessageAttributesOrFail()->getEmitterOrFail());
+ $this->assertEquals($taxAppConfigEntity->getApplicationId(), $configureTaxAppTransfer->getMessageAttributesOrFail()->getActorIdOrFail());
$this->assertEquals($taxAppConfigEntity->getIsActive(), $configureTaxAppTransfer->getIsActive());
}
@@ -74,7 +78,7 @@ public function assertTaxAppConfigIsRemovedForStore(StoreTransfer $storeTransfer
*/
public function buildConfigureTaxAppTransfer(array $messageAttributesSeed = [], array $configureTaxAppSeed = []): ConfigureTaxAppTransfer
{
- return (new ConfigureTaxAppBuilder())->seed($configureTaxAppSeed)
+ return (new ConfigureTaxAppBuilder())->seed($configureTaxAppSeed)->withApiUrls()
->withMessageAttributes($messageAttributesSeed)
->build();
}