diff --git a/LICENSE b/LICENSE
index c678ef8f0..73dcc7bf7 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
-MIT License
+The MIT License (MIT)
-Copyright (c) 2017 SPRYKER SYSTEMS GMBH
+Copyright (c) 2016-present Spryker Systems GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
+SOFTWARE.
diff --git a/src/SprykerEco/Shared/Computop/Transfer/computop.transfer.xml b/src/SprykerEco/Shared/Computop/Transfer/computop.transfer.xml
index 9a7706cba..f9545ce86 100644
--- a/src/SprykerEco/Shared/Computop/Transfer/computop.transfer.xml
+++ b/src/SprykerEco/Shared/Computop/Transfer/computop.transfer.xml
@@ -566,6 +566,7 @@
+
diff --git a/src/SprykerEco/Yves/Computop/Controller/CallbackController.php b/src/SprykerEco/Yves/Computop/Controller/CallbackController.php
index 4f8d64127..ed8d32a65 100644
--- a/src/SprykerEco/Yves/Computop/Controller/CallbackController.php
+++ b/src/SprykerEco/Yves/Computop/Controller/CallbackController.php
@@ -213,9 +213,13 @@ public function notifyAction(Request $request)
->fromArray($responseHeaderTransfer->toArray(), true)
->setType($decryptedArray[ComputopApiConfig::NOTIFICATION_PARAMETER_PAYMENT_TYPE] ?? '');
- $this->getClient()->processNotification($computopNotificationTransfer);
+ $computopNotificationTransfer = $this->getClient()->processNotification($computopNotificationTransfer);
- return new Response();
+ if ($computopNotificationTransfer->getIsProcessed()) {
+ return new Response();
+ }
+
+ return new Response('', Response::HTTP_NOT_ACCEPTABLE);
}
/**
diff --git a/src/SprykerEco/Zed/Computop/Business/Processor/NotificationProcessor.php b/src/SprykerEco/Zed/Computop/Business/Processor/NotificationProcessor.php
index ea4c451dd..1e7fdacdd 100644
--- a/src/SprykerEco/Zed/Computop/Business/Processor/NotificationProcessor.php
+++ b/src/SprykerEco/Zed/Computop/Business/Processor/NotificationProcessor.php
@@ -36,24 +36,27 @@ public function __construct(ComputopEntityManagerInterface $computopEntityManage
public function processNotification(
ComputopNotificationTransfer $computopNotificationTransfer
): ComputopNotificationTransfer {
- $this->getTransactionHandler()->handleTransaction(
- function () use ($computopNotificationTransfer): void {
- $this->executeSaveComputopNotificationTransaction($computopNotificationTransfer);
+ return $this->getTransactionHandler()->handleTransaction(
+ function () use ($computopNotificationTransfer): ComputopNotificationTransfer {
+ return $this->executeSaveComputopNotificationTransaction($computopNotificationTransfer);
}
);
-
- return $computopNotificationTransfer;
}
/**
* @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer
*
- * @return void
+ * @return \Generated\Shared\Transfer\ComputopNotificationTransfer
*/
protected function executeSaveComputopNotificationTransaction(
ComputopNotificationTransfer $computopNotificationTransfer
- ): void {
+ ): ComputopNotificationTransfer {
$this->computopEntityManager->savePaymentComputopNotification($computopNotificationTransfer);
- $this->computopEntityManager->updatePaymentComputopOrderItemPaymentConfirmation($computopNotificationTransfer);
+ $isProcessed = $this->computopEntityManager
+ ->updatePaymentComputopOrderItemPaymentConfirmation($computopNotificationTransfer);
+
+ $computopNotificationTransfer->setIsProcessed($isProcessed);
+
+ return $computopNotificationTransfer;
}
}
diff --git a/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManager.php b/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManager.php
index 7f8751394..8818d39cd 100644
--- a/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManager.php
+++ b/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManager.php
@@ -38,11 +38,11 @@ public function savePaymentComputopNotification(ComputopNotificationTransfer $co
/**
* @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer
*
- * @return void
+ * @return bool
*/
public function updatePaymentComputopOrderItemPaymentConfirmation(
ComputopNotificationTransfer $computopNotificationTransfer
- ): void {
+ ): bool {
$paymentComputopOrderItemEntities = $this->getFactory()
->createPaymentComputopOrderItemQuery()
->useSpyPaymentComputopQuery()
@@ -51,9 +51,15 @@ public function updatePaymentComputopOrderItemPaymentConfirmation(
->endUse()
->find();
+ if (!$paymentComputopOrderItemEntities->count()) {
+ return false;
+ }
+
foreach ($paymentComputopOrderItemEntities as $paymentComputopOrderItemEntity) {
$paymentComputopOrderItemEntity->setIsPaymentConfirmed($computopNotificationTransfer->getIsSuccess());
$paymentComputopOrderItemEntity->save();
}
+
+ return true;
}
}
diff --git a/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManagerInterface.php b/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManagerInterface.php
index b4b94955c..84bf7b8a0 100644
--- a/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManagerInterface.php
+++ b/src/SprykerEco/Zed/Computop/Persistence/ComputopEntityManagerInterface.php
@@ -21,9 +21,9 @@ public function savePaymentComputopNotification(ComputopNotificationTransfer $co
/**
* @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer
*
- * @return void
+ * @return bool
*/
public function updatePaymentComputopOrderItemPaymentConfirmation(
ComputopNotificationTransfer $computopNotificationTransfer
- ): void;
+ ): bool;
}