HostedGateway   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 107
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 2
cbo 1
dl 0
loc 107
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getProfileId() 0 4 1
A setProfileId() 0 4 1
A getSecretKey() 0 4 1
A setSecretKey() 0 4 1
A getAccessKey() 0 4 1
A setAccessKey() 0 4 1
A purchase() 0 4 1
A completePurchase() 0 4 1
A getDefaultParameters() 0 9 1
1
<?php
2
3
namespace Omnipay\CyberSource;
4
5
use Omnipay\Common\AbstractGateway;
6
use Omnipay\CyberSource\Message\CompletePurchaseRequest;
7
use Omnipay\CyberSource\Message\PurchaseRequest;
8
9
/**
10
 * CyberSource Secure Acceptance Hosted Checkout Gateway
11
 *
12
 * @link https://www.cybersource.com/developers/getting_started/integration_methods/secure_acceptance_wm/
13
 */
14
class HostedGateway extends AbstractGateway
15
{
16 1
    public function getName()
17
    {
18 1
        return 'CyberSource Hosted';
19
    }
20
21 23
    public function getDefaultParameters()
22
    {
23
        return array(
24 23
            'profileId' => '',
25
            'accessKey' => '',
26
            'secretKey' => '',
27
            'testMode' => false,
28
        );
29
    }
30
31
    /**
32
     * Get the profile ID for the merchant account
33
     *
34
     * @return string
35
     */
36 1
    public function getProfileId()
37
    {
38 1
        return $this->getParameter('profileId');
39
    }
40
41
    /**
42
     * Set the profile ID for the merchant account
43
     *
44
     * @param string $value  ASCII Alphanumeric + punctuation string, maximum 36 characters
45
     *
46
     * @return AbstractRequest
47
     */
48 3
    public function setProfileId($value)
49
    {
50 3
        return $this->setParameter('profileId', $value);
51
    }
52
53
    /**
54
     * Get the secret key for the merchant account
55
     *
56
     * @return string
57
     */
58 1
    public function getSecretKey()
59
    {
60 1
        return $this->getParameter('secretKey');
61
    }
62
63
    /**
64
     * Set the secret key for the merchant account
65
     *
66
     * @param string $value  Alphanumeric string, maximum 32 characters
67
     *
68
     * @return AbstractRequest
69
     */
70 3
    public function setSecretKey($value)
71
    {
72 3
        return $this->setParameter('secretKey', $value);
73
    }
74
75
    /**
76
     * Get the access key for the merchant account
77
     *
78
     * @return string
79
     */
80 1
    public function getAccessKey()
81
    {
82 1
        return $this->getParameter('accessKey');
83
    }
84
85
    /**
86
     * Set the access key for the merchant account
87
     *
88
     * @param string $value  Alphanumeric string, maximum 32 characters
89
     *
90
     * @return AbstractRequest
91
     */
92 3
    public function setAccessKey($value)
93
    {
94 3
        return $this->setParameter('accessKey', $value);
95
    }
96
97
    /**
98
     * Redirect the customer to CyberSource to make a purchase
99
     *
100
     * @param array $parameters
101
     *
102
     * @return \Omnipay\Common\Message\AbstractRequest
103
     */
104 3
    public function purchase(array $parameters = array())
105
    {
106 3
        return $this->createRequest('\Omnipay\CyberSource\Message\PurchaseRequest', $parameters);
107
    }
108
109
    /**
110
     * Complete a purchase process
111
     *
112
     * @param array $parameters
113
     *
114
     * @return \Omnipay\Common\Message\AbstractRequest
115
     */
116 6
    public function completePurchase(array $parameters = array())
117
    {
118 6
        return $this->createRequest('\Omnipay\CyberSource\Message\CompletePurchaseRequest', $parameters);
119
    }
120
}
121