@@ 78-105 (lines=28) @@ | ||
75 | } |
|
76 | ||
77 | ||
78 | public function queryOrder($orderId): bool |
|
79 | { |
|
80 | $headers = [ |
|
81 | "Authorization" => "Basic ".$this->username.$this->password |
|
82 | ]; |
|
83 | $this->request = new Request('POST', $this->baseUrl."pay", $headers); |
|
84 | ||
85 | try { |
|
86 | $response = $this->client->send($this->request, [ |
|
87 | 'form_params' => [ |
|
88 | 'request_id' => $requestId = Str::random(32), |
|
89 | ], |
|
90 | ]); |
|
91 | ||
92 | $response = json_decode($response->getBody()->getContents(), true); |
|
93 | $this->response = $response['content']; |
|
94 | ||
95 | return $response['code'] == '001' ? true : false; |
|
96 | } catch (ClientException $e) { |
|
97 | $this->httpError = $e; |
|
98 | ||
99 | return false; |
|
100 | } catch (\Exception $e) { |
|
101 | $this->httpError = $e; |
|
102 | ||
103 | return false; |
|
104 | } |
|
105 | } |
|
106 | ||
107 | public function variationCodes($serviceId): bool |
|
108 | { |
|
@@ 107-134 (lines=28) @@ | ||
104 | } |
|
105 | } |
|
106 | ||
107 | public function variationCodes($serviceId): bool |
|
108 | { |
|
109 | $headers = [ |
|
110 | "Authorization" => "Basic ".$this->username.$this->password |
|
111 | ]; |
|
112 | $this->request = new Request('GET', $this->baseUrl."service-variations", $headers); |
|
113 | ||
114 | try { |
|
115 | $response = $this->client->send($this->request, [ |
|
116 | 'query_params' => [ |
|
117 | 'serviceID' => $serviceId, |
|
118 | ], |
|
119 | ]); |
|
120 | ||
121 | $response = json_decode($response->getBody()->getContents(), true); |
|
122 | $this->response = $response['content']; |
|
123 | ||
124 | return $response['content'] ? true : false; |
|
125 | } catch (ClientException $e) { |
|
126 | $this->httpError = $e; |
|
127 | ||
128 | return false; |
|
129 | } catch (\Exception $e) { |
|
130 | $this->httpError = $e; |
|
131 | ||
132 | return false; |
|
133 | } |
|
134 | } |
|
135 | ||
136 | public function verifySmartCard($smartCardNumber, $serviceId): bool |
|
137 | { |
|
@@ 136-164 (lines=29) @@ | ||
133 | } |
|
134 | } |
|
135 | ||
136 | public function verifySmartCard($smartCardNumber, $serviceId): bool |
|
137 | { |
|
138 | $headers = [ |
|
139 | "Authorization" => "Basic ".$this->username.$this->password |
|
140 | ]; |
|
141 | $this->request = new Request('GET', $this->baseUrl."merchant-verify", $headers); |
|
142 | ||
143 | try { |
|
144 | $response = $this->client->send($this->request, [ |
|
145 | 'query_params' => [ |
|
146 | 'billersCode' => $smartCardNumber, |
|
147 | 'serviceID' => $serviceId, |
|
148 | ], |
|
149 | ]); |
|
150 | ||
151 | $response = json_decode($response->getBody()->getContents(), true); |
|
152 | $this->response = $response['content']; |
|
153 | ||
154 | return $response['code'] == '000' ? true : false; |
|
155 | } catch (ClientException $e) { |
|
156 | $this->httpError = $e; |
|
157 | ||
158 | return false; |
|
159 | } catch (\Exception $e) { |
|
160 | $this->httpError = $e; |
|
161 | ||
162 | return false; |
|
163 | } |
|
164 | } |
|
165 | ||
166 | public function payUtility($smartCardNumber, $cableTv, $package, $callbackUrl = null, $phone = null): bool |
|
167 | { |