1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\Komerci\Message; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Komerci Authorize Request |
7
|
|
|
*/ |
8
|
|
|
class WSVoidRequest extends WSAbstractRequest |
9
|
|
|
{ |
10
|
2 |
|
public function getPreAuth() |
11
|
|
|
{ |
12
|
2 |
|
return $this->getParameter('preauth'); |
13
|
|
|
} |
14
|
|
|
|
15
|
1 |
|
public function setPreAuth($value) |
16
|
|
|
{ |
17
|
1 |
|
return $this->setParameter('preauth', $value); |
18
|
|
|
} |
19
|
|
|
|
20
|
1 |
|
public function getConfPreAuth() |
21
|
|
|
{ |
22
|
1 |
|
return $this->getParameter('confpreauth'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function setConfPreAuth($value) |
26
|
|
|
{ |
27
|
|
|
return $this->setParameter('confpreauth', $value); |
28
|
|
|
} |
29
|
|
|
|
30
|
2 |
|
public function getData() |
31
|
|
|
{ |
32
|
2 |
|
$this->validate('apikey', 'amount', 'transactionReference', 'numautor', 'username', 'password'); |
33
|
|
|
|
34
|
2 |
|
if ($this->getPreAuth()) { |
35
|
1 |
|
return $this->getVoidPreAuthData(); |
36
|
1 |
|
} else if ($this->getConfPreAuth()) { |
37
|
|
|
return $this->getVoidConfPreAuthData(); |
38
|
|
|
} else { |
39
|
1 |
|
return $this->getVoidPurchaseData(); |
40
|
|
|
} |
41
|
|
|
} |
42
|
|
|
|
43
|
2 |
|
protected function getVoidPurchaseData() |
44
|
|
|
{ |
45
|
|
|
$data = array( |
46
|
2 |
|
'Total' => sprintf("%.2F", round($this->getAmount() * 100) / 100), |
47
|
2 |
|
'Filiacao' => $this->getApiKey(), |
48
|
2 |
|
'NumCv' => $this->getTransactionReference(), |
49
|
2 |
|
'NumAutor' => $this->getNumAutor(), |
50
|
2 |
|
'Concentrador' => '', |
51
|
2 |
|
'Usr' => $this->getUsername(), |
52
|
2 |
|
'Pwd' => $this->getPassword() |
53
|
2 |
|
); |
54
|
|
|
|
55
|
2 |
|
return $data; |
56
|
|
|
} |
57
|
|
|
|
58
|
1 |
|
protected function getVoidPreAuthData() |
59
|
|
|
{ |
60
|
1 |
|
$data = $this->getVoidPurchaseData(); |
61
|
|
|
|
62
|
1 |
|
$data['Distribuidor'] = ''; |
63
|
1 |
|
$data['Data'] = $this->getFormattedDate(); |
64
|
|
|
|
65
|
1 |
|
return $data; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
protected function getVoidConfPreAuthData() |
69
|
|
|
{ |
70
|
|
|
$data = $this->getVoidPurchaseData(); |
71
|
|
|
|
72
|
|
|
$data['Parcelas'] = $this->getFormattedInstallments(); |
73
|
|
|
$data['Data'] = $this->getFormattedDate(); |
74
|
|
|
|
75
|
|
|
return $data; |
76
|
|
|
} |
77
|
|
|
|
78
|
2 |
|
public function sendData($data) |
79
|
|
|
{ |
80
|
2 |
|
if ($this->getPreAuth()) { |
81
|
1 |
|
$httpResponse = $this->prepareSendData($data, 'VoidPreAuthorization'); |
82
|
2 |
|
} else if ($this->getConfPreAuth()) { |
83
|
|
|
$httpResponse = $this->prepareSendData($data, 'VoidConfPreAuthorization'); |
84
|
|
|
} else { |
85
|
1 |
|
$httpResponse = $this->prepareSendData($data, 'VoidTransaction'); |
86
|
|
|
} |
87
|
2 |
|
return $this->response = new WSConfPreAuthResponse($this, $httpResponse->xml()); |
|
|
|
|
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.