Gateway::createType()   A
last analyzed

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