|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Omnipay\Komerci; |
|
4
|
|
|
|
|
5
|
|
|
use Omnipay\Common\AbstractGateway; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Komerci Gateway |
|
9
|
|
|
* |
|
10
|
|
|
* Quote: It is brazilian solution to accept payments with MasterCard, Visa and Diners Club International credit cards on the Internet. |
|
11
|
|
|
* |
|
12
|
|
|
* @link https://www.userede.com.br/ |
|
13
|
|
|
* @link http://www.omnipay.com.br/gateways/komerci |
|
14
|
|
|
*/ |
|
15
|
|
|
class Gateway extends AbstractGateway |
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
1 |
|
public function getName() |
|
19
|
|
|
{ |
|
20
|
1 |
|
return 'Rede Komerci WebService'; |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
1 |
|
public function getShortName() |
|
24
|
|
|
{ |
|
25
|
1 |
|
return 'Komerci'; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
38 |
|
public function getDefaultParameters() |
|
29
|
|
|
{ |
|
30
|
|
|
return array( |
|
31
|
38 |
|
'apikey' => '', |
|
32
|
38 |
|
'username' => '', |
|
33
|
38 |
|
'password' => '', |
|
34
|
|
|
'testMode' => false |
|
35
|
38 |
|
); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
public function getApiKey() |
|
39
|
|
|
{ |
|
40
|
1 |
|
return $this->getParameter('apikey'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
5 |
|
public function setApiKey($value) |
|
44
|
|
|
{ |
|
45
|
5 |
|
return $this->setParameter('apikey', $value); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
2 |
|
public function getTestMode() |
|
49
|
|
|
{ |
|
50
|
2 |
|
return $this->getParameter('testMode'); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
8 |
|
public function setTestMode($value) |
|
54
|
|
|
{ |
|
55
|
8 |
|
if ($value) { |
|
56
|
8 |
|
$this->setUsername('testews'); |
|
57
|
8 |
|
$this->setPassword('testews'); |
|
58
|
8 |
|
} |
|
59
|
8 |
|
return $this->setParameter('testMode', $value); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
1 |
|
public function getUsername() |
|
63
|
|
|
{ |
|
64
|
1 |
|
return $this->getParameter('username'); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
8 |
|
public function setUsername($value) |
|
68
|
|
|
{ |
|
69
|
8 |
|
return $this->setParameter('username', $value); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
1 |
|
public function getPassword() |
|
73
|
|
|
{ |
|
74
|
1 |
|
return $this->getParameter('password'); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
8 |
|
public function setPassword($value) |
|
78
|
|
|
{ |
|
79
|
8 |
|
return $this->setParameter('password', $value); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
6 |
|
public function authorize(array $parameters = array()) |
|
83
|
|
|
{ |
|
84
|
6 |
|
return $this->createRequest('\Omnipay\Komerci\Message\WSAuthorizeRequest', $parameters); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
6 |
|
public function capture(array $parameters = array()) |
|
88
|
|
|
{ |
|
89
|
6 |
|
return $this->createRequest('\Omnipay\Komerci\Message\WSConfPreAuthRequest', $parameters); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
4 |
|
public function purchase(array $parameters = array()) |
|
93
|
|
|
{ |
|
94
|
4 |
|
return $this->createRequest('\Omnipay\Komerci\Message\WSPurchaseRequest', $parameters); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
4 |
|
public function void(array $parameters = array()) |
|
98
|
|
|
{ |
|
99
|
4 |
|
return $this->createRequest('\Omnipay\Komerci\Message\WSVoidRequest', $parameters); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
} |
|
103
|
|
|
|