Issues (4)

src/Response/EncryptResponse.php (2 issues)

1
<?php
2
3
/*
4
 * This file is part of the GestPayWS library.
5
 *
6
 * (c) Manuel Dalla Lana <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EndelWar\GestPayWS\Response;
13
14
/**
15
 * Class EncryptResponse
16
 *
17
 * @property string $TransactionType;
18
 * @property string $TransactionResult;
19
 * @property string $CryptDecryptString;
20
 * @property int $ErrorCode;
21
 * @property string $ErrorDescription;
22
 */
23
class EncryptResponse extends Response
24
{
25
    protected $paymentPageUrl = [
26
        'test' => 'https://sandbox.gestpay.net/pagam/pagam.aspx',
27
        'production' => 'https://ecomm.sella.it/pagam/pagam.aspx',
28
    ];
29
    protected $parametersName = [
30
        'TransactionType',
31
        'TransactionResult',
32
        'CryptDecryptString',
33
        'ErrorCode',
34
        'ErrorDescription',
35
    ];
36
37
    /**
38
     * @param \stdClass $soapResponse
39
     * @throws \Exception
40
     */
41
    public function __construct($soapResponse)
42
    {
43
        $xml = simplexml_load_string($soapResponse->EncryptResult->any);
44
        parent::__construct($xml);
0 ignored issues
show
It seems like $xml can also be of type false; however, parameter $xml of EndelWar\GestPayWS\Respo...Response::__construct() does only seem to accept SimpleXMLElement, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
        parent::__construct(/** @scrutinizer ignore-type */ $xml);
Loading history...
45
    }
46
47
    /**
48
     * @param string $shopLogin
49
     * @param string $wsdlEnvironment
50
     * @return string
51
     */
52
    public function getPaymentPageUrl($shopLogin, $wsdlEnvironment)
53
    {
54
        return $this->paymentPageUrl[$wsdlEnvironment] . '?a=' . $shopLogin . '&b=' . $this->CryptDecryptString;
0 ignored issues
show
Bug Best Practice introduced by
The property CryptDecryptString does not exist on EndelWar\GestPayWS\Response\EncryptResponse. Since you implemented __get, consider adding a @property annotation.
Loading history...
55
    }
56
}
57