Passed
Push — feature/paypal-express ( ddef87...f7968e )
by Volodymyr
05:46
created

BraintreeEntityManager::addOrderItemToSuccessLog()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
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
     *
37
     * @return void
38
     */
39
    public function addOrderItemToSuccessLog(int $idPaymentBraintree, int $idPaymentBrainreeOrderItem): void
40
    {
41
        $paymentBraintreeTransactionStatusLogEntity = $this->getFactory()
42
            ->createPaymentBraintreeTransactionStatusLogQuery()->findOneByFkPaymentBraintree($idPaymentBraintree);
43
44
        if ($paymentBraintreeTransactionStatusLogEntity) {
45
            $paymentBraintreeTransactionStatusLogEntity->setFkPaymentBraintreeOrderItem($idPaymentBrainreeOrderItem);
46
            $paymentBraintreeTransactionStatusLogEntity->save();
47
        }
48
    }
49
}
50