PaymentDataQuoteUpdater   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A update() 0 12 2
1
<?php
2
3
/**
4
 * Apache OSL-2
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AmazonPay\Business\Quote;
9
10
use Generated\Shared\Transfer\PaymentTransfer;
11
use Generated\Shared\Transfer\QuoteTransfer;
12
use SprykerEco\Shared\AmazonPay\AmazonPayConfig;
13
14
class PaymentDataQuoteUpdater implements QuoteUpdaterInterface
15
{
16
    /**
17
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
18
     *
19
     * @return \Generated\Shared\Transfer\QuoteTransfer
20
     */
21
    public function update(QuoteTransfer $quoteTransfer)
22
    {
23
        if (!$quoteTransfer->getPayment()) {
24
            $paymentTransfer = new PaymentTransfer();
25
            $paymentTransfer->setPaymentMethod(AmazonPayConfig::PROVIDER_NAME);
26
            $paymentTransfer->setPaymentProvider(AmazonPayConfig::PROVIDER_NAME);
27
            $paymentTransfer->setPaymentSelection(AmazonPayConfig::PROVIDER_NAME);
28
            $paymentTransfer->setAmount($quoteTransfer->getTotals()->getPriceToPay());
29
            $quoteTransfer->setPayment($paymentTransfer);
30
        }
31
32
        return $quoteTransfer;
33
    }
34
}
35