|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Braintree\Persistence; |
|
9
|
|
|
|
|
10
|
|
|
use Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionStatusLogToOrderItem; |
|
|
|
|
|
|
11
|
|
|
use Propel\Runtime\Collection\ObjectCollection; |
|
12
|
|
|
use Spryker\Zed\Kernel\Persistence\AbstractEntityManager; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @method \SprykerEco\Zed\Braintree\Persistence\BraintreePersistenceFactory getFactory() |
|
16
|
|
|
*/ |
|
17
|
|
|
class BraintreeEntityManager extends AbstractEntityManager implements BraintreeEntityManagerInterface |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @param int $idPaymentBraintree |
|
21
|
|
|
* @param bool $isShipmentPaid |
|
22
|
|
|
* |
|
23
|
|
|
* @return void |
|
24
|
|
|
*/ |
|
25
|
|
|
public function updateIsShipmentPaidValue(int $idPaymentBraintree, bool $isShipmentPaid): void |
|
26
|
|
|
{ |
|
27
|
|
|
$paymentBraintreeEntity = $this->getFactory()->createPaymentBraintreeQuery()->findOneByIdPaymentBraintree($idPaymentBraintree); |
|
28
|
|
|
|
|
29
|
|
|
if ($paymentBraintreeEntity) { |
|
30
|
|
|
$paymentBraintreeEntity->setIsShipmentPaid($isShipmentPaid); |
|
31
|
|
|
$paymentBraintreeEntity->save(); |
|
32
|
|
|
} |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param int $idPaymentBraintree |
|
37
|
|
|
* @param \ArrayObject|\Generated\Shared\Transfer\ItemTransfer[] $itemTransfers |
|
38
|
|
|
* @param string $transactionId |
|
39
|
|
|
* |
|
40
|
|
|
* @return void |
|
41
|
|
|
*/ |
|
42
|
|
|
public function addOrderItemsToTransactionLog(int $idPaymentBraintree, iterable $itemTransfers, string $transactionId): void |
|
43
|
|
|
{ |
|
44
|
|
|
$paymentBraintreeTransactionStatusLogEntity = $this->getFactory() |
|
45
|
|
|
->createPaymentBraintreeTransactionStatusLogQuery() |
|
46
|
|
|
->filterByTransactionId($transactionId) |
|
47
|
|
|
->findOneByFkPaymentBraintree($idPaymentBraintree); |
|
48
|
|
|
|
|
49
|
|
|
if ($paymentBraintreeTransactionStatusLogEntity) { |
|
50
|
|
|
$paymentBraintreeOrderItemEntities = $this->getFactory() |
|
51
|
|
|
->createPaymentBraintreeOrderItemQuery() |
|
52
|
|
|
->filterByFkSalesOrderItem_In($this->getSalesOrderItemIds($itemTransfers)) |
|
53
|
|
|
->find(); |
|
54
|
|
|
|
|
55
|
|
|
$objectCollection = new ObjectCollection(); |
|
56
|
|
|
$objectCollection->setModel(SpyPaymentBraintreeTransactionStatusLogToOrderItem::class); |
|
57
|
|
|
|
|
58
|
|
|
foreach ($paymentBraintreeOrderItemEntities as $paymentBraintreeOrderItemEntity) { |
|
59
|
|
|
$paymentBraintreeTransactionOrderItemEntity = new SpyPaymentBraintreeTransactionStatusLogToOrderItem(); |
|
60
|
|
|
$paymentBraintreeTransactionOrderItemEntity->setFkPaymentBraintreeTransactionStatusLog( |
|
61
|
|
|
$paymentBraintreeTransactionStatusLogEntity->getIdPaymentBraintreeTransactionStatusLog() |
|
62
|
|
|
); |
|
63
|
|
|
$paymentBraintreeTransactionOrderItemEntity->setFkPaymentBraintreeOrderItem($paymentBraintreeOrderItemEntity->getIdPaymentBraintreeOrderItem()); |
|
64
|
|
|
|
|
65
|
|
|
$objectCollection->append($paymentBraintreeTransactionOrderItemEntity); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
$objectCollection->save(); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param int $idPaymentBraintree |
|
74
|
|
|
* @param string $transactionId |
|
75
|
|
|
* @param bool $isShipmentOperation |
|
76
|
|
|
* |
|
77
|
|
|
* @return void |
|
78
|
|
|
*/ |
|
79
|
|
|
public function updateIsShipmentOperationValue(int $idPaymentBraintree, string $transactionId, bool $isShipmentOperation): void |
|
80
|
|
|
{ |
|
81
|
|
|
$paymentBraintreeTransactionStatusLogEntity = $this->getFactory() |
|
82
|
|
|
->createPaymentBraintreeTransactionStatusLogQuery() |
|
83
|
|
|
->filterByTransactionId($transactionId) |
|
84
|
|
|
->findOneByFkPaymentBraintree($idPaymentBraintree); |
|
85
|
|
|
|
|
86
|
|
|
if ($paymentBraintreeTransactionStatusLogEntity) { |
|
87
|
|
|
$paymentBraintreeTransactionStatusLogEntity->setIsShipmentOperation($isShipmentOperation); |
|
88
|
|
|
$paymentBraintreeTransactionStatusLogEntity->save(); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @param \ArrayObject|\Generated\Shared\Transfer\ItemTransfer[] $itemTransfers |
|
94
|
|
|
* |
|
95
|
|
|
* @return array |
|
96
|
|
|
*/ |
|
97
|
|
|
protected function getSalesOrderItemIds(iterable $itemTransfers): array |
|
98
|
|
|
{ |
|
99
|
|
|
$salesOrderItemIds = []; |
|
100
|
|
|
|
|
101
|
|
|
foreach ($itemTransfers as $itemTransfer) { |
|
102
|
|
|
$salesOrderItemIds[] = $itemTransfer->getIdSalesOrderItem(); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
return $salesOrderItemIds; |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|
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