1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\WindcaveHpp; |
4
|
|
|
|
5
|
|
|
use Omnipay\Common\AbstractGateway; |
6
|
|
|
use Omnipay\WindcaveHpp\Message\AcceptNotification; |
7
|
|
|
use Omnipay\WindcaveHpp\Message\CompletePurchaseRequest; |
8
|
|
|
use Omnipay\WindcaveHpp\Message\PurchaseRequest; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Windcave HPP Payment Gateway |
12
|
|
|
*/ |
13
|
|
|
class Gateway extends AbstractGateway { |
14
|
|
|
/** |
15
|
|
|
* Get name |
16
|
|
|
* |
17
|
|
|
* @return string |
18
|
|
|
*/ |
19
|
|
|
public function getName() { |
20
|
|
|
return 'Windcave Hpp'; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Get default parameters |
25
|
|
|
* |
26
|
|
|
* @return array |
27
|
|
|
*/ |
28
|
|
|
public function getDefaultParameters() { |
29
|
|
|
return []; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function setApiUsername($value) { |
33
|
|
|
return $this->setParameter('apiUsername', $value); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function getApiUsername() { |
37
|
|
|
return $this->getParameter('apiUsername'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function setApiKey($value) { |
41
|
|
|
return $this->setParameter('apiKey', $value); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function getApiKey() { |
45
|
|
|
return $this->getParameter('apiKey'); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Purchase |
50
|
|
|
* |
51
|
|
|
* @param array $parameters Parameters |
52
|
|
|
* |
53
|
|
|
* @return Omnipay\WindcaveHpp\Message\PurchaseRequest |
|
|
|
|
54
|
|
|
*/ |
55
|
|
|
public function purchase(array $parameters = []) { |
56
|
|
|
return $this->createRequest( |
|
|
|
|
57
|
|
|
PurchaseRequest::class, |
58
|
|
|
$parameters |
59
|
|
|
); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Complete a purchase process |
64
|
|
|
* |
65
|
|
|
* @param array $parameters |
66
|
|
|
* |
67
|
|
|
* @return Omnipay\WindcaveHpp\Message\CompletePurchaseRequest |
|
|
|
|
68
|
|
|
*/ |
69
|
|
|
public function completePurchase(array $parameters = []) { |
70
|
|
|
return $this->createRequest( |
|
|
|
|
71
|
|
|
CompletePurchaseRequest::class, |
72
|
|
|
$parameters |
73
|
|
|
); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function acceptNotification(array $parameters = []) { |
77
|
|
|
return $this->createRequest( |
78
|
|
|
AcceptNotification::class, |
79
|
|
|
$parameters |
80
|
|
|
)->send(); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|