Completed
Push — master ( 480dec...35e829 )
by Marco
01:15
created

Gateway::setApiKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Omnipay\Heidelpay;
4
5
use Omnipay\Common\AbstractGateway;
6
use Omnipay\Heidelpay\Message\AuthorizeRequest;
7
use Omnipay\Heidelpay\Message\ChargeRequest;
8
use Omnipay\Heidelpay\Message\CreateCustomerRequest;
9
use Omnipay\Heidelpay\Message\CreateTypeRequest;
10
11
/**
12
 * Heidelpay Charge Gateway.
13
 *
14
 * @see \Omnipay\Heidelpay\AbstractGateway
15
 * @see \Omnipay\Heidelpay\Message\AbstractRequest
16
 *
17
 * @link https://docs.heidelpay.com/reference
18
 */
19
class Gateway extends AbstractGateway
20
{
21
22
    public function getName()
23
    {
24
        return 'Heidelpay';
25
    }
26
27
    /**
28
     * Get the gateway parameters.
29
     *
30
     * @return array
31
     */
32
    public function getDefaultParameters()
33
    {
34
        return array(
35
            'apiKey' => '',
36
            'testMode' => false
37
        );
38
    }
39
40
    /**
41
     * Get the gateway API Key.
42
     *
43
     * @return string
44
     */
45
    public function getApiKey()
46
    {
47
        return $this->getParameter('apiKey');
48
    }
49
50
    /**
51
     * Set the gateway API Key.
52
     *
53
     * @param string $value
54
     *
55
     * @return Gateway provides a fluent interface.
56
     */
57
    public function setApiKey($value)
58
    {
59
        return $this->setParameter('apiKey', $value);
60
    }
61
62
    /**
63
     * Create a type request
64
     *
65
     * @param array $parameters
66
     * @return \Omnipay\Common\Message\AbstractRequest
67
     */
68
    public function createType(array $parameters = array())
69
    {
70
        return $this->createRequest(CreateTypeRequest::class, $parameters);
71
    }
72
73
    /**
74
     * Create a customer request
75
     *
76
     * @param array $parameters
77
     * @return \Omnipay\Common\Message\AbstractRequest
78
     */
79
    public function createCustomer(array $parameters = array())
80
    {
81
        return $this->createRequest(CreateCustomerRequest::class, $parameters);
82
    }
83
84
    /**
85
     * Authorize and handling of return from 3D Secure or PayPal redirection.
86
     * @param  array  $parameters
87
     * @return \Omnipay\Common\Message\AbstractRequest
88
     */
89
    public function authorize(array $parameters = [])
90
    {
91
        return $this->createRequest(AuthorizeRequest::class, $parameters);
92
    }
93
94
    public function capture(array $parameters = array())
95
    {
96
        return $this->createRequest(ChargeRequest::class, $parameters);
97
    }
98
99
    public function purchase(array $parameters = array())
100
    {
101
        return $this->createRequest(ChargeRequest::class, $parameters);
102
    }
103
}
104