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

AuthorizeNet   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 1
cbo 5
dl 0
loc 47
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getId() 0 4 1
A pay() 0 22 3
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\WebDriver\WebDriver;
9
10
class AuthorizeNet implements PaymentMethodInterface
11
{
12
13
    const ACTION = 'Checkout\PaymentMethods\AuthorizeNet';
14
15
    protected $webDriver;
16
    protected $testCase;
17
    protected $paymentInformation;
18
19
    public function __construct(
20
        WebDriver                   $webDriver,
21
        AbstractMagentoTestCase     $testCase,
22
        PaymentInformation          $paymentInformation
23
    ) {
24
        $this->webDriver            = $webDriver;
25
        $this->testCase             = $testCase;
26
        $this->paymentInformation   = $paymentInformation;
27
    }
28
29
    public function getId()
30
    {
31
        return 'p_method_authorizenet';
32
    }
33
34
    public function pay($requirePayment)
35
    {
36
        if ($requirePayment) {
37
            $this->testCase->assertElementExists($this->getId());
38
        }
39
40
        if ($this->webDriver->elementDisplayed($this->getId())) {
41
            $this->webDriver->byId($this->getId())->click();
42
        }
43
        $this->webDriver->byId('authorizenet_cc_number')
44
                        ->clear()
45
                        ->sendKeys($this->paymentInformation->getCreditCardNumber());
46
        $expirationMonthSelect = new WebDriverSelect($this->webDriver->byId('authorizenet_expiration'));
47
        $expirationMonthSelect->selectByValue($this->paymentInformation->getExpiryMonth());
48
49
        $expirationYearSelect = new WebDriverSelect($this->webDriver->byId('authorizenet_expiration_yr'));
50
        $expirationYearSelect->selectByValue($this->paymentInformation->getExpiryYear());
51
52
        $typeSelect = new WebDriverSelect($this->webDriver->byId('authorizenet_cc_type'));
53
        $typeSelect->selectByValue($this->paymentInformation->getType());
54
55
    }
56
}