1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* eCoin driver for Omnipay PHP payment library |
5
|
|
|
* |
6
|
|
|
* @link https://github.com/hiqdev/omnipay-ecoin |
7
|
|
|
* @package omnipay-ecoin |
8
|
|
|
* @license MIT |
9
|
|
|
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Omnipay\eCoin; |
13
|
|
|
|
14
|
|
|
use Omnipay\Common\AbstractGateway; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Gateway for eCoin. |
18
|
|
|
*/ |
19
|
|
|
class Gateway extends AbstractGateway |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* {@inheritdoc} |
23
|
1 |
|
*/ |
24
|
|
|
public function getName() |
25
|
1 |
|
{ |
26
|
|
|
return 'eCoin'; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* {@inheritdoc} |
31
|
29 |
|
*/ |
32
|
|
|
public function getDefaultParameters() |
33
|
|
|
{ |
34
|
29 |
|
return [ |
35
|
|
|
'purse' => '', |
36
|
|
|
'secret' => '', |
37
|
|
|
'testMode' => false, |
38
|
|
|
]; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Get the unified purse. |
43
|
|
|
* |
44
|
|
|
* @return string merchant purse |
45
|
2 |
|
*/ |
46
|
|
|
public function getPurse() |
47
|
2 |
|
{ |
48
|
|
|
return $this->getParameter('purse'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Set the unified purse. |
53
|
|
|
* |
54
|
|
|
* @param string $value merchant purse |
55
|
|
|
* |
56
|
|
|
* @return self |
57
|
29 |
|
*/ |
58
|
|
|
public function setPurse($value) |
59
|
29 |
|
{ |
60
|
|
|
return $this->setParameter('purse', $value); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Get the unified secret key. |
65
|
|
|
* |
66
|
|
|
* @return string secret key |
67
|
2 |
|
*/ |
68
|
|
|
public function getSecret() |
69
|
2 |
|
{ |
70
|
|
|
return $this->getParameter('secret'); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Set the unified secret key. |
75
|
|
|
* |
76
|
|
|
* @param string $value secret key |
77
|
|
|
* |
78
|
|
|
* @return self |
79
|
29 |
|
*/ |
80
|
|
|
public function setSecret($value) |
81
|
29 |
|
{ |
82
|
|
|
return $this->setParameter('secret', $value); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param array $parameters |
87
|
|
|
* |
88
|
|
|
* @return \Omnipay\eCoin\Message\PurchaseRequest |
89
|
3 |
|
*/ |
90
|
|
|
public function purchase(array $parameters = []) |
91
|
3 |
|
{ |
92
|
|
|
return $this->createRequest('\Omnipay\eCoin\Message\PurchaseRequest', $parameters); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param array $parameters |
97
|
|
|
* |
98
|
|
|
* @return \Omnipay\eCoin\Message\CompletePurchaseRequest |
99
|
3 |
|
*/ |
100
|
|
|
public function completePurchase(array $parameters = []) |
101
|
3 |
|
{ |
102
|
|
|
return $this->createRequest('\Omnipay\eCoin\Message\CompletePurchaseRequest', $parameters); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|