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.

AuthorizeNet   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
lcom 1
cbo 3
dl 0
loc 63
rs 10
c 1
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setDefaults() 0 8 1
A configureType() 0 8 2
A configureTest() 0 5 1
A setUseVisa() 0 4 1
A setUseAmericanExpress() 0 4 1
A setUseDiscover() 0 4 1
A setUseMastercard() 0 4 1
1
<?php
2
3
namespace Magium\Magento\Actions\Checkout\PaymentInformation;
4
5
use Magium\Magento\AbstractMagentoTestCase;
6
use Magium\Magento\Actions\Checkout\PaymentInformation;
7
8
class AuthorizeNet extends PaymentInformation
9
{
10
    const ACTION = 'Checkout\PaymentInformation\AuthorizeNet';
11
12
    const TYPE_UNKNOWN = 'UNKNOWN';
13
    const TYPE_VISA = 'VI';
14
    const TYPE_AMERICAN_EXPRESS = 'AE';
15
    const TYPE_DISCOVER = 'DI';
16
    const TYPE_MASTERCARD = 'MC';
17
18
    protected $ccNums = [
19
        self::TYPE_VISA                => '4007000000027',
20
        self::TYPE_AMERICAN_EXPRESS    => '370000000000002',
21
        self::TYPE_DISCOVER            => '6011000000000012',
22
 	    self::TYPE_MASTERCARD          => '5424000000000015',
23
        self::TYPE_UNKNOWN             => '0000000000000000'
24
    ];
25
26
    protected function setDefaults()
27
    {
28
        parent::setDefaults();
29
        $defaultCC = current($this->ccNums);
30
        $defaultType = key($this->ccNums);
31
        $this->setCreditCardNumber($defaultCC);
32
        $this->setType($defaultType);
33
    }
34
35
    protected function configureType($type)
36
    {
37
        if (!isset($this->ccNums[$type])) {
38
            throw new InvalidPaymentInformationException('Unknown payment type: ' . $type);
39
        }
40
        $this->setCreditCardNumber($this->ccNums[$type]);
41
        $this->setType($type);
42
    }
43
44
    public function configureTest(AbstractMagentoTestCase $testCase)
45
    {
46
        $testCase->setPaymentMethod('AuthorizeNet');
47
        $testCase->setTypePreference('Magium\Magento\Actions\Checkout\PaymentInformation', get_class($this));
48
    }
49
50
    public function setUseVisa()
51
    {
52
        $this->configureType(self::TYPE_VISA);
53
    }
54
55
    public function setUseAmericanExpress()
56
    {
57
        $this->configureType(self::TYPE_AMERICAN_EXPRESS);
58
    }
59
60
    public function setUseDiscover()
61
    {
62
        $this->configureType(self::TYPE_DISCOVER);
63
    }
64
65
    public function setUseMastercard()
66
    {
67
        $this->configureType(self::TYPE_MASTERCARD);
68
    }
69
70
}