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
|
|
|
|