Passed
Pull Request — main (#1)
by Leith
01:50
created

Gateway   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 60
rs 10
c 1
b 0
f 0
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A refund() 0 3 1
A getApiKey() 0 3 1
A completePurchase() 0 3 1
A getName() 0 3 1
A getDefaultParameters() 0 7 1
A getApiSecret() 0 3 1
A setMerchantId() 0 3 1
A purchase() 0 3 1
A setApiSecret() 0 3 1
A getMerchantId() 0 3 1
A setApiKey() 0 3 1
1
<?php
2
3
namespace Omnipay\Worldline;
4
5
use Omnipay\Common\AbstractGateway;
6
use Omnipay\Worldline\Message\CompletePurchaseRequest;
7
use Omnipay\Worldline\Message\PurchaseRequest;
8
use Omnipay\Worldline\Message\RefundRequest;
9
10
/**
11
 * Worldline Hosted Checkout Gateway
12
 *
13
 * @link http://www..worldline-solutions.com/
14
 *
15
 * @see https://docs.direct.worldline-solutions.com/en/api-reference#tag/HostedCheckout
16
 */
17
class Gateway extends AbstractGateway
18
{
19
    public function getName()
20
    {
21
        return 'Worldline';
22
    }
23
24
    public function getDefaultParameters()
25
    {
26
        return array(
27
            'apiKey'     => '',
28
            'apiSecret'  => '',
29
            'merchantId' => '',
30
            'testMode'   => false,
31
        );
32
    }
33
34
    public function getApiKey()
35
    {
36
        return $this->getParameter('apiKey');
37
    }
38
39
    public function setApiKey($value)
40
    {
41
        return $this->setParameter('apiKey', $value);
42
    }
43
44
    public function getApiSecret()
45
    {
46
        return $this->getParameter('apiSecret');
47
    }
48
49
    public function setApiSecret($value)
50
    {
51
        return $this->setParameter('apiSecret', $value);
52
    }
53
54
    public function getMerchantId()
55
    {
56
        return $this->getParameter('merchantId');
57
    }
58
59
    public function setMerchantId($value)
60
    {
61
        return $this->setParameter('merchantId', $value);
62
    }
63
64
    public function purchase(array $parameters = [])
65
    {
66
        return $this->createRequest(PurchaseRequest::class, $parameters);
67
    }
68
69
    public function completePurchase(array $parameters = [])
70
    {
71
        return $this->createRequest(CompletePurchaseRequest::class, $parameters);
72
    }
73
74
    public function refund(array $parameters = [])
75
    {
76
        return $this->createRequest(RefundRequest::class, $parameters);
77
    }
78
}
79