|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PagOnline\Tokenizer; |
|
4
|
|
|
|
|
5
|
|
|
use PagOnline\Exceptions\IgfsMissingParException; |
|
6
|
|
|
use PagOnline\IgfsUtils; |
|
7
|
|
|
|
|
8
|
|
|
class IgfsCgTokenizerDelete extends BaseIgfsCgTokenizer |
|
9
|
|
|
{ |
|
10
|
|
|
public $payInstrToken; |
|
11
|
|
|
public $billingID; |
|
12
|
|
|
/** |
|
13
|
|
|
* @var string |
|
14
|
|
|
*/ |
|
15
|
|
|
protected $requestNamespace = Requests\IgfsCgTokenizerDeleteRequest::class; |
|
16
|
|
|
|
|
17
|
1 |
|
public function resetFields() |
|
18
|
|
|
{ |
|
19
|
1 |
|
parent::resetFields(); |
|
20
|
1 |
|
$this->payInstrToken = null; |
|
21
|
1 |
|
$this->billingID = null; |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* {@inheritdoc} |
|
26
|
|
|
*/ |
|
27
|
1 |
|
protected function getAdditionalRequestSignatureFields(): array |
|
28
|
|
|
{ |
|
29
|
1 |
|
return [ |
|
30
|
1 |
|
$this->payInstrToken, |
|
31
|
1 |
|
]; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
6 |
|
protected function checkFields() |
|
35
|
|
|
{ |
|
36
|
6 |
|
parent::checkFields(); |
|
37
|
2 |
|
if ($this->payInstrToken == null) { |
|
38
|
1 |
|
throw new IgfsMissingParException('Missing payInstrToken'); |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
1 |
|
protected function buildRequest() |
|
43
|
|
|
{ |
|
44
|
1 |
|
$request = parent::buildRequest(); |
|
45
|
1 |
|
$this->replaceRequestParameter($request, 'payInstrToken', $this->payInstrToken); |
|
46
|
1 |
|
$this->replaceRequestParameter($request, 'billingID', $this->billingID); |
|
47
|
|
|
|
|
48
|
1 |
|
return $request; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @param array $response |
|
53
|
|
|
* |
|
54
|
|
|
* @throws \PagOnline\Exceptions\IgfsException |
|
55
|
|
|
* |
|
56
|
|
|
* @return string |
|
57
|
|
|
*/ |
|
58
|
|
|
protected function getResponseSignature($response) |
|
59
|
|
|
{ |
|
60
|
|
|
$fields = [ |
|
61
|
|
|
IgfsUtils::getValue($response, 'tid'), // TID |
|
62
|
|
|
IgfsUtils::getValue($response, 'shopID'), // SHOPID |
|
63
|
|
|
IgfsUtils::getValue($response, 'rc'), // RC |
|
64
|
|
|
IgfsUtils::getValue($response, 'errorDesc'), ]; // ERRORDESC |
|
65
|
|
|
// signature dove il buffer e' cosi composto TID|SHOPID|RC|ERRORDESC |
|
66
|
|
|
return $this->getSignature($fields); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|