Gateway   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 65
rs 10
wmc 12

12 Methods

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