|
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\ArvatoRss\Communication\Plugin\Oms\Condition; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\ArvatoRssApiCallLogTransfer; |
|
|
|
|
|
|
11
|
|
|
use Orm\Zed\Sales\Persistence\SpySalesOrderItem; |
|
|
|
|
|
|
12
|
|
|
use Spryker\Zed\Kernel\Communication\AbstractPlugin; |
|
13
|
|
|
use Spryker\Zed\Oms\Dependency\Plugin\Condition\ConditionInterface; |
|
14
|
|
|
use SprykerEco\Shared\ArvatoRss\ArvatoRssApiConfig; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @method \SprykerEco\Zed\ArvatoRss\Business\ArvatorssFacadeInterface getFacade() |
|
18
|
|
|
* @method \SprykerEco\Zed\ArvatoRss\Persistence\ArvatoRssQueryContainerInterface getQueryContainer() |
|
19
|
|
|
* @method \SprykerEco\Zed\ArvatoRss\Persistence\ArvatoRssRepositoryInterface getRepository() |
|
20
|
|
|
* @method \SprykerEco\Zed\ArvatoRss\Communication\ArvatoRssCommunicationFactory getFactory() |
|
21
|
|
|
*/ |
|
22
|
|
|
class IsStoreOrderSuccessfulPlugin extends AbstractPlugin implements ConditionInterface |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @api |
|
26
|
|
|
* |
|
27
|
|
|
* @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $orderItem |
|
28
|
|
|
* |
|
29
|
|
|
* @return bool |
|
30
|
|
|
*/ |
|
31
|
|
|
public function check(SpySalesOrderItem $orderItem) |
|
32
|
|
|
{ |
|
33
|
|
|
return $this->isStoreOrderSuccessful( |
|
34
|
|
|
$orderItem |
|
35
|
|
|
->getOrder() |
|
36
|
|
|
->getOrderReference() |
|
37
|
|
|
); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param string $orderReference |
|
42
|
|
|
* |
|
43
|
|
|
* @return bool |
|
44
|
|
|
*/ |
|
45
|
|
|
protected function isStoreOrderSuccessful($orderReference) |
|
46
|
|
|
{ |
|
47
|
|
|
$storeOrderApiCallLogTransfer = $this->getApiCallLogEntry($orderReference); |
|
48
|
|
|
|
|
49
|
|
|
if ($storeOrderApiCallLogTransfer === null) { |
|
50
|
|
|
return false; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
return $this->isTransactionSuccessful($storeOrderApiCallLogTransfer); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param string $orderReference |
|
58
|
|
|
* |
|
59
|
|
|
* @return \Generated\Shared\Transfer\ArvatoRssApiCallLogTransfer |
|
60
|
|
|
*/ |
|
61
|
|
|
protected function getApiCallLogEntry(string $orderReference): ArvatoRssApiCallLogTransfer |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->getRepository() |
|
|
|
|
|
|
64
|
|
|
->findApiLogByOrderReferenceAndType( |
|
65
|
|
|
$orderReference, |
|
66
|
|
|
ArvatoRssApiConfig::TRANSACTION_TYPE_STORE_ORDER |
|
67
|
|
|
); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param \Generated\Shared\Transfer\ArvatoRssApiCallLogTransfer $arvatoRssApiCallLogTransfer |
|
72
|
|
|
* |
|
73
|
|
|
* @return bool |
|
74
|
|
|
*/ |
|
75
|
|
|
protected function isTransactionSuccessful(ArvatoRssApiCallLogTransfer $arvatoRssApiCallLogTransfer) |
|
76
|
|
|
{ |
|
77
|
|
|
return $arvatoRssApiCallLogTransfer->getResultCode() == ArvatoRssApiConfig::RESULT_CODE_SUCCESS; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
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