1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Computop\Business\Processor; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\ComputopNotificationTransfer; |
|
|
|
|
11
|
|
|
use Spryker\Zed\Kernel\Persistence\EntityManager\TransactionTrait; |
12
|
|
|
use SprykerEco\Zed\Computop\ComputopConfig; |
13
|
|
|
use SprykerEco\Zed\Computop\Persistence\ComputopEntityManagerInterface; |
14
|
|
|
|
15
|
|
|
class NotificationProcessor implements NotificationProcessorInterface |
16
|
|
|
{ |
17
|
|
|
use TransactionTrait; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var \SprykerEco\Zed\Computop\Persistence\ComputopEntityManagerInterface |
21
|
|
|
*/ |
22
|
|
|
protected $computopEntityManager; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var \SprykerEco\Zed\Computop\ComputopConfig |
26
|
|
|
*/ |
27
|
|
|
protected $computopConfig; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param \SprykerEco\Zed\Computop\Persistence\ComputopEntityManagerInterface $computopEntityManager |
31
|
|
|
* @param \SprykerEco\Zed\Computop\ComputopConfig $computopConfig |
32
|
|
|
*/ |
33
|
|
|
public function __construct(ComputopEntityManagerInterface $computopEntityManager, ComputopConfig $computopConfig) |
34
|
|
|
{ |
35
|
|
|
$this->computopEntityManager = $computopEntityManager; |
36
|
|
|
$this->computopConfig = $computopConfig; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer |
41
|
|
|
* |
42
|
|
|
* @return \Generated\Shared\Transfer\ComputopNotificationTransfer |
43
|
|
|
*/ |
44
|
|
|
public function processNotification( |
45
|
|
|
ComputopNotificationTransfer $computopNotificationTransfer |
46
|
|
|
): ComputopNotificationTransfer { |
47
|
|
|
return $this->getTransactionHandler()->handleTransaction( |
48
|
|
|
function () use ($computopNotificationTransfer): ComputopNotificationTransfer { |
49
|
|
|
return $this->executeSaveComputopNotificationTransaction($computopNotificationTransfer); |
50
|
|
|
} |
51
|
|
|
); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer |
56
|
|
|
* |
57
|
|
|
* @return \Generated\Shared\Transfer\ComputopNotificationTransfer |
58
|
|
|
*/ |
59
|
|
|
protected function executeSaveComputopNotificationTransaction( |
60
|
|
|
ComputopNotificationTransfer $computopNotificationTransfer |
61
|
|
|
): ComputopNotificationTransfer { |
62
|
|
|
$this->computopEntityManager->savePaymentComputopNotification($computopNotificationTransfer); |
63
|
|
|
$isProcessed = $this->computopEntityManager->updatePaymentComputopOrderItemPaymentConfirmation( |
64
|
|
|
$computopNotificationTransfer, |
65
|
|
|
$this->getCurrentOrderItemEntityStatus($computopNotificationTransfer) |
66
|
|
|
); |
67
|
|
|
|
68
|
|
|
$computopNotificationTransfer->setIsProcessed($isProcessed); |
69
|
|
|
|
70
|
|
|
return $computopNotificationTransfer; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer |
75
|
|
|
* |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
|
|
protected function getCurrentOrderItemEntityStatus(ComputopNotificationTransfer $computopNotificationTransfer): string |
79
|
|
|
{ |
80
|
|
|
if ((int)$computopNotificationTransfer->getAmountcap() > 0) { |
81
|
|
|
return $this->computopConfig->getOmsStatusCaptured(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
if ((int)$computopNotificationTransfer->getAmountauth() > 0) { |
85
|
|
|
return $this->computopConfig->getOmsStatusAuthorized(); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
return $this->computopConfig->getOmsStatusNew(); |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths