Completed
Push — master ( 35e829...731b5b )
by Marco
01:15
created

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