1 | <?php |
||
10 | class PurchaseRequest extends AbstractRequest |
||
11 | { |
||
12 | /** @var string */ |
||
13 | protected $liveEndpoint = 'https://sis.redsys.es/sis/realizarPago'; |
||
14 | /** @var string */ |
||
15 | protected $testEndpoint = 'https://sis-t.redsys.es:25443/sis/realizarPago'; |
||
16 | /** @var array */ |
||
17 | protected static $consumerLanguages = array( |
||
18 | 'es' => '001', // Spanish |
||
19 | 'en' => '002', // English |
||
20 | 'ca' => '003', // Catalan - same as Valencian (010) |
||
21 | 'fr' => '004', // French |
||
22 | 'de' => '005', // German |
||
23 | 'nl' => '006', // Dutch |
||
24 | 'it' => '007', // Italian |
||
25 | 'sv' => '008', // Swedish |
||
26 | 'pt' => '009', // Portuguese |
||
27 | 'pl' => '011', // Polish |
||
28 | 'gl' => '012', // Galician |
||
29 | 'eu' => '013', // Basque |
||
30 | ); |
||
31 | |||
32 | 2 | public function getCardholder() |
|
36 | |||
37 | 4 | public function setCardholder($value) |
|
41 | |||
42 | 3 | public function getConsumerLanguage() |
|
46 | |||
47 | /** |
||
48 | * Set the language presented to the consumer |
||
49 | * |
||
50 | * @param string|int Either the ISO 639-1 code to be converted, or the gateway's own numeric language code |
||
51 | */ |
||
52 | 4 | public function setConsumerLanguage($value) |
|
53 | { |
||
54 | 4 | if (is_int($value)) { |
|
55 | 1 | if ($value < 0 || $value > 13) { |
|
56 | 1 | $value = 1; |
|
57 | 1 | } |
|
58 | 1 | $value = str_pad($value, 3, '0', STR_PAD_LEFT); |
|
59 | 4 | } elseif (!is_numeric($value)) { |
|
60 | 4 | $value = isset(self::$consumerLanguages[$value]) ? self::$consumerLanguages[$value] : '001'; |
|
61 | 4 | } |
|
62 | |||
63 | 4 | return $this->setParameter('consumerLanguage', $value); |
|
64 | } |
||
65 | |||
66 | 6 | public function getHmacKey() |
|
70 | |||
71 | 12 | public function setHmacKey($value) |
|
75 | |||
76 | 2 | public function getMerchantData() |
|
80 | |||
81 | 4 | public function setMerchantData($value) |
|
85 | |||
86 | 4 | public function getMerchantId() |
|
90 | |||
91 | 12 | public function setMerchantId($value) |
|
95 | |||
96 | 4 | public function getMerchantName() |
|
100 | |||
101 | 12 | public function setMerchantName($value) |
|
105 | |||
106 | 4 | public function getTerminalId() |
|
110 | |||
111 | 12 | public function setTerminalId($value) |
|
115 | |||
116 | /** |
||
117 | * Override the abstract method to add requirement that it must start with 4 numeric characters |
||
118 | * |
||
119 | * @param string|int $value The transaction ID (merchant order) to set for the transaction |
||
120 | */ |
||
121 | 8 | public function setTransactionId($value) |
|
136 | |||
137 | 2 | public function getData() |
|
160 | |||
161 | 1 | public function sendData($data) |
|
165 | |||
166 | 2 | public function getEndpoint() |
|
170 | } |
||
171 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.