BaseIgfsCgTran::parseResponseMap()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 7
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 15
ccs 0
cts 8
cp 0
crap 2
rs 10
1
<?php
2
3
namespace PagOnline\Tran;
4
5
use PagOnline\BaseIgfsCg;
6
use PagOnline\Exceptions\IgfsMissingParException;
7
use PagOnline\IgfsUtils;
8
9
/**
10
 * Class BaseIgfsCgTran.
11
 */
12
abstract class BaseIgfsCgTran extends BaseIgfsCg
13
{
14
    public $addInfo1;
15
    public $addInfo2;
16
    public $addInfo3;
17
    public $addInfo4;
18
    public $addInfo5;
19
20
    public $tranID;
21
22 4
    public function resetFields(): void
23
    {
24 4
        parent::resetFields();
25 4
        $this->addInfo1 = null;
26 4
        $this->addInfo2 = null;
27 4
        $this->addInfo3 = null;
28 4
        $this->addInfo4 = null;
29 4
        $this->addInfo5 = null;
30 4
        $this->tranID = null;
31
    }
32
33 24
    protected function checkFields(): void
34
    {
35 24
        parent::checkFields();
36 9
        if (empty($this->shopID)) {
37 4
            throw new IgfsMissingParException('Missing shopID');
38
        }
39
    }
40
41 4
    protected function buildRequest()
42
    {
43 4
        $request = parent::buildRequest();
44 4
        $this->replaceRequestParameter($request, 'addInfo1', $this->addInfo1);
45 4
        $this->replaceRequestParameter($request, 'addInfo2', $this->addInfo2);
46 4
        $this->replaceRequestParameter($request, 'addInfo3', $this->addInfo3);
47 4
        $this->replaceRequestParameter($request, 'addInfo4', $this->addInfo4);
48 4
        $this->replaceRequestParameter($request, 'addInfo5', $this->addInfo5);
49
50 4
        return $request;
51
    }
52
53 8
    protected function getServicePort(): string
54
    {
55 8
        return 'PaymentTranGatewayPort';
56
    }
57
58
    /**
59
     * @param array $response
60
     */
61
    protected function parseResponseMap($response): void
62
    {
63
        parent::parseResponseMap($response);
64
        // Opzionale
65
        $this->tranID = IgfsUtils::getValue($response, 'tranID');
66
        // Opzionale
67
        $this->addInfo1 = IgfsUtils::getValue($response, 'addInfo1');
68
        // Opzionale
69
        $this->addInfo2 = IgfsUtils::getValue($response, 'addInfo2');
70
        // Opzionale
71
        $this->addInfo3 = IgfsUtils::getValue($response, 'addInfo3');
72
        // Opzionale
73
        $this->addInfo4 = IgfsUtils::getValue($response, 'addInfo4');
74
        // Opzionale
75
        $this->addInfo5 = IgfsUtils::getValue($response, 'addInfo5');
76
    }
77
}
78