1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PagOnline\PayByMail; |
4
|
|
|
|
5
|
|
|
use PagOnline\Exceptions\IgfsMissingParException; |
6
|
|
|
use PagOnline\IgfsUtils; |
7
|
|
|
|
8
|
|
|
class IgfsCgPayByMailVerify extends BaseIgfsCgPayByMail |
9
|
|
|
{ |
10
|
|
|
public $mailID; |
11
|
|
|
|
12
|
|
|
public $tranID; |
13
|
|
|
public $status; |
14
|
|
|
public $addInfo1; |
15
|
|
|
public $addInfo2; |
16
|
|
|
public $addInfo3; |
17
|
|
|
public $addInfo4; |
18
|
|
|
public $addInfo5; |
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $requestNamespace = Requests\IgfsCgPayByMailVerifyRequest::class; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
*/ |
27
|
1 |
|
public function resetFields() |
28
|
|
|
{ |
29
|
1 |
|
parent::resetFields(); |
30
|
1 |
|
$this->mailID = null; |
31
|
1 |
|
$this->tranID = null; |
32
|
1 |
|
$this->status = null; |
33
|
1 |
|
$this->addInfo1 = null; |
34
|
1 |
|
$this->addInfo2 = null; |
35
|
1 |
|
$this->addInfo3 = null; |
36
|
1 |
|
$this->addInfo4 = null; |
37
|
1 |
|
$this->addInfo5 = null; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* {@inheritdoc} |
42
|
|
|
*/ |
43
|
1 |
|
protected function getAdditionalRequestSignatureFields(): array |
44
|
|
|
{ |
45
|
1 |
|
return [ |
46
|
1 |
|
$this->mailID, |
47
|
1 |
|
]; |
48
|
|
|
} |
49
|
|
|
|
50
|
6 |
|
protected function checkFields() |
51
|
|
|
{ |
52
|
6 |
|
parent::checkFields(); |
53
|
2 |
|
if (empty($this->mailID)) { |
54
|
1 |
|
throw new IgfsMissingParException('Missing mailID'); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* {@inheritdoc} |
60
|
|
|
*/ |
61
|
1 |
|
protected function buildRequest() |
62
|
|
|
{ |
63
|
1 |
|
$request = parent::buildRequest(); |
64
|
1 |
|
$this->replaceRequestParameter($request, 'mailID', $this->mailID); |
65
|
|
|
|
66
|
1 |
|
return $request; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
protected function parseResponseMap($response) |
70
|
|
|
{ |
71
|
|
|
parent::parseResponseMap($response); |
72
|
|
|
// Opzionale |
73
|
|
|
$this->tranID = IgfsUtils::getValue($response, 'tranID'); |
74
|
|
|
// Opzionale |
75
|
|
|
$this->status = IgfsUtils::getValue($response, 'status'); |
76
|
|
|
// Opzionale |
77
|
|
|
$this->addInfo1 = IgfsUtils::getValue($response, 'addInfo1'); |
78
|
|
|
// Opzionale |
79
|
|
|
$this->addInfo2 = IgfsUtils::getValue($response, 'addInfo2'); |
80
|
|
|
// Opzionale |
81
|
|
|
$this->addInfo3 = IgfsUtils::getValue($response, 'addInfo3'); |
82
|
|
|
// Opzionale |
83
|
|
|
$this->addInfo4 = IgfsUtils::getValue($response, 'addInfo4'); |
84
|
|
|
// Opzionale |
85
|
|
|
$this->addInfo5 = IgfsUtils::getValue($response, 'addInfo5'); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param array $response |
90
|
|
|
* |
91
|
|
|
* @throws \PagOnline\Exceptions\IgfsException |
92
|
|
|
* |
93
|
|
|
* @return string |
94
|
|
|
*/ |
95
|
|
|
protected function getResponseSignature($response) |
96
|
|
|
{ |
97
|
|
|
$fields = [ |
98
|
|
|
IgfsUtils::getValue($response, 'tid'), // TID |
99
|
|
|
IgfsUtils::getValue($response, 'shopID'), // SHOPID |
100
|
|
|
IgfsUtils::getValue($response, 'rc'), // RC |
101
|
|
|
IgfsUtils::getValue($response, 'errorDesc'), // ERRORDESC |
102
|
|
|
IgfsUtils::getValue($response, 'mailID'), // MAILID |
103
|
|
|
IgfsUtils::getValue($response, 'tranID'), // ORDERID |
104
|
|
|
IgfsUtils::getValue($response, 'status'), // STATUS |
105
|
|
|
]; |
106
|
|
|
// signature dove il buffer e' cosi composto TID|SHOPID|RC|ERRORDESC|MAILID|STATUS |
107
|
|
|
return $this->getSignature($fields); |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|