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