@@ -16,35 +16,35 @@ |
||
16 | 16 | |
17 | 17 | final class Check extends Response |
18 | 18 | { |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * Check constructor |
21 | 21 | * |
22 | 22 | * @param AccountInfo $accountinfo account information set |
23 | 23 | */ |
24 | - function __construct(AccountInfo $accountinfo) { |
|
25 | - parent::__construct(); |
|
24 | + function __construct(AccountInfo $accountinfo) { |
|
25 | + parent::__construct(); |
|
26 | 26 | |
27 | - $this->setElementValue('StatusCode', 0); |
|
28 | - $this->setElementValue('StatusDetail', 'checked'); |
|
27 | + $this->setElementValue('StatusCode', 0); |
|
28 | + $this->setElementValue('StatusDetail', 'checked'); |
|
29 | 29 | |
30 | - $this->create_AccountInfo($accountinfo); |
|
31 | - } |
|
30 | + $this->create_AccountInfo($accountinfo); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * Create AccountInfo node with child nodes |
35 | 35 | * |
36 | 36 | * @param AccountInfo $accountinfo account information set |
37 | 37 | */ |
38 | - public function create_AccountInfo($accountinfo) |
|
39 | - { |
|
40 | - if (isset($this->AccountInfo)) return; |
|
38 | + public function create_AccountInfo($accountinfo) |
|
39 | + { |
|
40 | + if (isset($this->AccountInfo)) return; |
|
41 | 41 | |
42 | - $this->AccountInfo = self::createElement('AccountInfo'); |
|
43 | - $this->Response->appendChild($this->AccountInfo); |
|
42 | + $this->AccountInfo = self::createElement('AccountInfo'); |
|
43 | + $this->Response->appendChild($this->AccountInfo); |
|
44 | 44 | |
45 | - foreach($accountinfo as $parameter=>$value) |
|
46 | - { |
|
47 | - $this->AccountInfo->appendChild(self::createElement($parameter, $value)); |
|
48 | - } |
|
49 | - } |
|
45 | + foreach($accountinfo as $parameter=>$value) |
|
46 | + { |
|
47 | + $this->AccountInfo->appendChild(self::createElement($parameter, $value)); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | } |
@@ -15,30 +15,30 @@ |
||
15 | 15 | |
16 | 16 | final class Confirm extends Response |
17 | 17 | { |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * Confirm constructor |
20 | 20 | * |
21 | 21 | * @param string $orderdate |
22 | 22 | */ |
23 | - function __construct($orderdate) { |
|
24 | - parent::__construct(); |
|
23 | + function __construct($orderdate) { |
|
24 | + parent::__construct(); |
|
25 | 25 | |
26 | - $this->setElementValue('StatusCode', 0); |
|
27 | - $this->setElementValue('StatusDetail', 'checked'); |
|
26 | + $this->setElementValue('StatusCode', 0); |
|
27 | + $this->setElementValue('StatusDetail', 'checked'); |
|
28 | 28 | |
29 | - $this->create_OrderDate($orderdate); |
|
30 | - } |
|
29 | + $this->create_OrderDate($orderdate); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * Create OrderDate node |
34 | 34 | * |
35 | 35 | * @param string $orderdate |
36 | 36 | */ |
37 | - public function create_OrderDate($orderdate) |
|
38 | - { |
|
39 | - if (isset($this->OrderDate)) return; |
|
37 | + public function create_OrderDate($orderdate) |
|
38 | + { |
|
39 | + if (isset($this->OrderDate)) return; |
|
40 | 40 | |
41 | - $this->OrderDate = self::createElement('OrderDate', $orderdate); |
|
42 | - $this->Response->appendChild($this->OrderDate); |
|
43 | - } |
|
41 | + $this->OrderDate = self::createElement('OrderDate', $orderdate); |
|
42 | + $this->Response->appendChild($this->OrderDate); |
|
43 | + } |
|
44 | 44 | } |
@@ -15,30 +15,30 @@ |
||
15 | 15 | |
16 | 16 | final class Cancel extends Response |
17 | 17 | { |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * Cancel constructor |
20 | 20 | * |
21 | 21 | * @param string $orderdate |
22 | 22 | */ |
23 | - function __construct($canceldate) { |
|
24 | - parent::__construct(); |
|
23 | + function __construct($canceldate) { |
|
24 | + parent::__construct(); |
|
25 | 25 | |
26 | - $this->setElementValue('StatusCode', 0); |
|
27 | - $this->setElementValue('StatusDetail', 'checked'); |
|
26 | + $this->setElementValue('StatusCode', 0); |
|
27 | + $this->setElementValue('StatusDetail', 'checked'); |
|
28 | 28 | |
29 | - $this->create_CancelDate($canceldate); |
|
30 | - } |
|
29 | + $this->create_CancelDate($canceldate); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * Create CancelDate node |
34 | 34 | * |
35 | 35 | * @param string $canceldate |
36 | 36 | */ |
37 | - public function create_CancelDate($canceldate) |
|
38 | - { |
|
39 | - if (isset($this->CancelDate)) return; |
|
37 | + public function create_CancelDate($canceldate) |
|
38 | + { |
|
39 | + if (isset($this->CancelDate)) return; |
|
40 | 40 | |
41 | - $this->CancelDate = self::createElement('CancelDate', $canceldate); |
|
42 | - $this->Response->appendChild($this->CancelDate); |
|
43 | - } |
|
41 | + $this->CancelDate = self::createElement('CancelDate', $canceldate); |
|
42 | + $this->Response->appendChild($this->CancelDate); |
|
43 | + } |
|
44 | 44 | } |
@@ -15,30 +15,30 @@ |
||
15 | 15 | |
16 | 16 | final class Payment extends Response |
17 | 17 | { |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * Payment constructor |
20 | 20 | * |
21 | 21 | * @param string $paymentid |
22 | 22 | */ |
23 | - function __construct($paymentid) { |
|
24 | - parent::__construct(); |
|
23 | + function __construct($paymentid) { |
|
24 | + parent::__construct(); |
|
25 | 25 | |
26 | - $this->setElementValue('StatusCode', 0); |
|
27 | - $this->setElementValue('StatusDetail', 'checked'); |
|
26 | + $this->setElementValue('StatusCode', 0); |
|
27 | + $this->setElementValue('StatusDetail', 'checked'); |
|
28 | 28 | |
29 | - $this->create_PaymentId($paymentid); |
|
30 | - } |
|
29 | + $this->create_PaymentId($paymentid); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * Create PaymentId node |
34 | 34 | * |
35 | 35 | * @param string $paymentid |
36 | 36 | */ |
37 | - public function create_PaymentId($paymentid) |
|
38 | - { |
|
39 | - if (isset($this->PaymentId)) return; |
|
37 | + public function create_PaymentId($paymentid) |
|
38 | + { |
|
39 | + if (isset($this->PaymentId)) return; |
|
40 | 40 | |
41 | - $this->PaymentId = self::createElement('PaymentId', $paymentid); |
|
42 | - $this->Response->appendChild($this->PaymentId); |
|
43 | - } |
|
41 | + $this->PaymentId = self::createElement('PaymentId', $paymentid); |
|
42 | + $this->Response->appendChild($this->PaymentId); |
|
43 | + } |
|
44 | 44 | } |
@@ -15,16 +15,16 @@ |
||
15 | 15 | |
16 | 16 | final class ErrorInfo extends Response |
17 | 17 | { |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * ErrorInfo constructor |
20 | 20 | * |
21 | 21 | * @param integer $code Error code |
22 | 22 | * @param string $message Error message text |
23 | 23 | */ |
24 | - function __construct($code, $message) { |
|
25 | - parent::__construct(); |
|
24 | + function __construct($code, $message) { |
|
25 | + parent::__construct(); |
|
26 | 26 | |
27 | - $this->setElementValue('StatusCode', $code); |
|
28 | - $this->setElementValue('StatusDetail', $message); |
|
29 | - } |
|
27 | + $this->setElementValue('StatusCode', $code); |
|
28 | + $this->setElementValue('StatusDetail', $message); |
|
29 | + } |
|
30 | 30 | } |
@@ -4,60 +4,60 @@ |
||
4 | 4 | |
5 | 5 | class Key |
6 | 6 | { |
7 | - public function __construct() {} |
|
8 | - |
|
9 | - /** |
|
10 | - * Get content of key file |
|
11 | - * @param string $fname |
|
12 | - * @param string $type |
|
13 | - * @return string |
|
14 | - * @throws Exception\Runtime |
|
15 | - */ |
|
16 | - public function get($fname, $type) |
|
17 | - { |
|
7 | + public function __construct() {} |
|
8 | + |
|
9 | + /** |
|
10 | + * Get content of key file |
|
11 | + * @param string $fname |
|
12 | + * @param string $type |
|
13 | + * @return string |
|
14 | + * @throws Exception\Runtime |
|
15 | + */ |
|
16 | + public function get($fname, $type) |
|
17 | + { |
|
18 | 18 | try |
19 | 19 | { |
20 | - $this->check_exists($fname); |
|
20 | + $this->check_exists($fname); |
|
21 | 21 | |
22 | - $key = $this->load($fname); |
|
22 | + $key = $this->load($fname); |
|
23 | 23 | } |
24 | 24 | catch (\Exception $e) |
25 | 25 | { |
26 | - throw new Exception\Runtime('The file with the '.$type.' key was '.$e->getMessage().'!', -98); |
|
26 | + throw new Exception\Runtime('The file with the '.$type.' key was '.$e->getMessage().'!', -98); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return $key; |
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Check if exist key file |
|
34 | - * |
|
35 | - * @param string $fname |
|
36 | - * @throws Exception\Runtime |
|
37 | - */ |
|
38 | - protected function check_exists($fname) |
|
39 | - { |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Check if exist key file |
|
34 | + * |
|
35 | + * @param string $fname |
|
36 | + * @throws Exception\Runtime |
|
37 | + */ |
|
38 | + protected function check_exists($fname) |
|
39 | + { |
|
40 | 40 | if ( ! file_exists($fname)) |
41 | 41 | { |
42 | - throw new Exception\Runtime('not exists'); |
|
42 | + throw new Exception\Runtime('not exists'); |
|
43 | 43 | } |
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Load key file |
|
48 | - * |
|
49 | - * @param string $fname |
|
50 | - * @return string |
|
51 | - * @throws Exception\Runtime |
|
52 | - */ |
|
53 | - protected function load($fname) |
|
54 | - { |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Load key file |
|
48 | + * |
|
49 | + * @param string $fname |
|
50 | + * @return string |
|
51 | + * @throws Exception\Runtime |
|
52 | + */ |
|
53 | + protected function load($fname) |
|
54 | + { |
|
55 | 55 | $key = @file_get_contents($fname); |
56 | 56 | if ($key === FALSE) |
57 | 57 | { |
58 | - throw new Exception\Runtime('not read'); |
|
58 | + throw new Exception\Runtime('not read'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return $key; |
62 | - } |
|
62 | + } |
|
63 | 63 | } |
@@ -142,11 +142,11 @@ |
||
142 | 142 | } |
143 | 143 | try |
144 | 144 | { |
145 | - $pkeyid = (new Key())->get($options['ProviderPKey'], 'private'); |
|
145 | + $pkeyid = (new Key())->get($options['ProviderPKey'], 'private'); |
|
146 | 146 | } |
147 | 147 | catch (\Exception $e) |
148 | 148 | { |
149 | - return null; |
|
149 | + return null; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $pr_key = openssl_pkey_get_private($pkeyid); |