Total Complexity | 5 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class Response extends \UAPAY\Response |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $id; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $paymentPageUrl; |
||
19 | |||
20 | /** |
||
21 | * Handle decoded JSON |
||
22 | * |
||
23 | * @throws Exception\JSON |
||
24 | */ |
||
25 | protected function json_handle() |
||
26 | { |
||
27 | parent::json_handle(); |
||
28 | |||
29 | if (!isset($this->json['data']['id'])) |
||
30 | { |
||
31 | throw new Exception\JSON('data does not contain the id field!'); |
||
32 | } |
||
33 | |||
34 | $this->id = $this->json['data']['id']; |
||
35 | |||
36 | if (!isset($this->json['data']['paymentPageUrl'])) |
||
37 | { |
||
38 | throw new Exception\JSON('data does not contain the paymentPageUrl field!'); |
||
39 | } |
||
40 | |||
41 | $this->paymentPageUrl = $this->json['data']['paymentPageUrl']; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Get order id |
||
46 | * |
||
47 | * @return string id order |
||
48 | */ |
||
49 | public function id() |
||
50 | { |
||
51 | return $this->id; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Get paymentPageUrl to go to the payment page |
||
56 | * |
||
57 | * @return string paymentPageUrl |
||
58 | */ |
||
59 | public function paymentPageUrl() |
||
62 | } |
||
63 | } |
||
64 |