|
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 Spryker\Zed\Kernel\Persistence\AbstractEntityManager; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @method \SprykerEco\Zed\Braintree\Persistence\BraintreePersistenceFactory getFactory() |
|
14
|
|
|
*/ |
|
15
|
|
|
class BraintreeEntityManager extends AbstractEntityManager implements BraintreeEntityManagerInterface |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @param int $idPaymentBraintree |
|
19
|
|
|
* @param bool $isShipmentPaid |
|
20
|
|
|
* |
|
21
|
|
|
* @return void |
|
22
|
|
|
*/ |
|
23
|
|
|
public function updateIsShipmentPaidValue(int $idPaymentBraintree, bool $isShipmentPaid): void |
|
24
|
|
|
{ |
|
25
|
|
|
$paymentBraintreeEntity = $this->getFactory()->createPaymentBraintreeQuery()->findOneByIdPaymentBraintree($idPaymentBraintree); |
|
26
|
|
|
|
|
27
|
|
|
if ($paymentBraintreeEntity) { |
|
28
|
|
|
$paymentBraintreeEntity->setIsShipmentPaid($isShipmentPaid); |
|
29
|
|
|
$paymentBraintreeEntity->save(); |
|
30
|
|
|
} |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param int $idPaymentBraintree |
|
35
|
|
|
* @param int $idPaymentBrainreeOrderItem |
|
36
|
|
|
* @param string $transactionId |
|
37
|
|
|
* |
|
38
|
|
|
* @return void |
|
39
|
|
|
*/ |
|
40
|
|
|
public function addOrderItemToSuccessLog(int $idPaymentBraintree, int $idPaymentBrainreeOrderItem, string $transactionId): void |
|
41
|
|
|
{ |
|
42
|
|
|
$paymentBraintreeTransactionStatusLogEntity = $this->getFactory() |
|
43
|
|
|
->createPaymentBraintreeTransactionStatusLogQuery() |
|
44
|
|
|
->filterByTransactionId($transactionId) |
|
45
|
|
|
->findOneByFkPaymentBraintree($idPaymentBraintree); |
|
46
|
|
|
|
|
47
|
|
|
if ($paymentBraintreeTransactionStatusLogEntity) { |
|
48
|
|
|
$paymentBraintreeTransactionStatusLogEntity->setFkPaymentBraintreeOrderItem($idPaymentBrainreeOrderItem); |
|
49
|
|
|
$paymentBraintreeTransactionStatusLogEntity->save(); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @param int $idPaymentBraintree |
|
55
|
|
|
* @param string $transactionId |
|
56
|
|
|
* @param bool $isShipmentOperation |
|
57
|
|
|
* |
|
58
|
|
|
* @return void |
|
59
|
|
|
*/ |
|
60
|
|
|
public function updateIsShipmentOperationValue(int $idPaymentBraintree, string $transactionId, bool $isShipmentOperation): void |
|
61
|
|
|
{ |
|
62
|
|
|
$paymentBraintreeTransactionStatusLogEntity = $this->getFactory() |
|
63
|
|
|
->createPaymentBraintreeTransactionStatusLogQuery() |
|
64
|
|
|
->filterByTransactionId($transactionId) |
|
65
|
|
|
->findOneByFkPaymentBraintree($idPaymentBraintree); |
|
66
|
|
|
|
|
67
|
|
|
if ($paymentBraintreeTransactionStatusLogEntity) { |
|
68
|
|
|
$paymentBraintreeTransactionStatusLogEntity->setIsShipmentOperation($isShipmentOperation); |
|
69
|
|
|
$paymentBraintreeTransactionStatusLogEntity->save(); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|