GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 8b1591...71dda7 )
by Kevin
03:16
created

SavedCC::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Magium\Magento\Actions\Checkout\PaymentMethods;
4
5
use Facebook\WebDriver\WebDriverSelect;
6
use Magium\Magento\AbstractMagentoTestCase;
7
use Magium\Magento\Actions\Checkout\PaymentInformation;
8
use Magium\Magento\Identities\Customer;
9
use Magium\WebDriver\WebDriver;
10
11
class SavedCC implements PaymentMethodInterface
12
{
13
14
    const ACTION = 'Checkout\PaymentMethods\SavedCC';
15
16
    protected $webDriver;
17
    protected $testCase;
18
    protected $paymentInformation;
19
    protected $customer;
20
    protected $assertion;
21
22
    public function __construct(
23
        WebDriver                   $webDriver,
24
        AbstractMagentoTestCase     $testCase,
25
        PaymentInformation          $paymentInformation,
26
        Customer                    $customer,
27
        \Magium\Magento\Assertions\Checkout\PaymentMethods\SavedCC $assertion
28
    ) {
29
        $this->webDriver    = $webDriver;
30
        $this->testCase     = $testCase;
31
        $this->paymentInformation = $paymentInformation;
32
        $this->customer = $customer;
33
        $this->assertion = $assertion;
34
    }
35
36
    public function getId()
37
    {
38
        return 'ccsave_cc_owner';
39
    }
40
41
    public function pay($requirePayment)
42
    {
43
        if ($requirePayment) {
44
            $this->testCase->assertElementExists($this->getId());
45
        }
46
47
        if ($this->webDriver->elementDisplayed($this->getId())) {
48
            $this->webDriver->byId($this->getId())->click();
49
        }
50
        $this->assertion->assert();
51
52
        $this->webDriver->byId('ccsave_cc_owner')->clear();
53
        $this->webDriver->byId('ccsave_cc_owner')->sendKeys(
54
            $this->customer->getBillingFirstName() . ' ' . $this->customer->getBillingLastName()
55
        );
56
57
        $select = new WebDriverSelect($this->webDriver->byId('ccsave_cc_type'));
58
        $select->selectByValue($this->paymentInformation->getType());
59
60
        $this->webDriver->byId('ccsave_cc_number')->clear();
61
        $this->webDriver->byId('ccsave_cc_number')->sendKeys($this->paymentInformation->getCreditCardNumber());
62
63
        $select = new WebDriverSelect($this->webDriver->byId('ccsave_expiration'));
64
        $select->selectByValue($this->paymentInformation->getExpiryMonth());
65
66
        $select = new WebDriverSelect($this->webDriver->byId('ccsave_expiration_yr'));
67
        $select->selectByValue($this->paymentInformation->getExpiryYear());
68
69
    }
70
}