1 | <?php |
||
19 | class MatiHttpClient implements MatiClientInterface |
||
20 | { |
||
21 | /** |
||
22 | * Bearer token used in API calls |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $access_token; |
||
27 | |||
28 | public function __construct(string $access_token = null) |
||
32 | |||
33 | /** |
||
34 | * Set an access token to be used by the requests |
||
35 | * |
||
36 | * @param string $access_token |
||
37 | * @return self |
||
38 | */ |
||
39 | public function withToken(string $access_token): MatiClientInterface |
||
44 | |||
45 | /** |
||
46 | * Get an access token from the OAuth service |
||
47 | * |
||
48 | * @param string $client_id |
||
49 | * @param string $client_secret |
||
50 | * @return Response |
||
51 | * @throws RequestException |
||
52 | */ |
||
53 | public function getAccessToken(string $client_id, string $client_secret): Response |
||
63 | |||
64 | /** |
||
65 | * Create a new verification process |
||
66 | * |
||
67 | * @param array|null $metadata Key/Value pair of data to identify the user |
||
68 | * @param string|null $flowId |
||
69 | * @param string|null $user_ip |
||
70 | * @param string|null $user_agent |
||
71 | * @return Response |
||
72 | * @throws RequestException|LogicException |
||
73 | */ |
||
74 | public function createVerification( |
||
106 | |||
107 | /** |
||
108 | * Send an input for a document, selfie or other file required during a process |
||
109 | * |
||
110 | * @param string $identity_id |
||
111 | * @param IdentityInputInterface[]|Collection $inputs |
||
112 | * |
||
113 | * @throws LogicException|RequestException|TypeError |
||
114 | * @return Response |
||
115 | */ |
||
116 | public function sendInput(string $identity_id, $inputs): Response |
||
153 | |||
154 | /** |
||
155 | * Retrieve info about a verification process |
||
156 | * |
||
157 | * @param string $resource_url URL received by webhook |
||
158 | * |
||
159 | * @throws RequestException |
||
160 | * @return Response |
||
161 | */ |
||
162 | public function retrieveResourceDataFromUrl(string $resource_url) |
||
168 | |||
169 | /** |
||
170 | * Retrieve info about a verification process |
||
171 | * |
||
172 | * @param string $verification_id |
||
173 | * |
||
174 | * @throws RequestException |
||
175 | * @return Response |
||
176 | */ |
||
177 | public function retrieveResourceDataByVerificationId(string $verification_id) |
||
183 | |||
184 | /** |
||
185 | * Download the file sent by the user during the verification process |
||
186 | * |
||
187 | * @param string $media_url |
||
188 | * |
||
189 | * @throws RequestException |
||
190 | * @return Response |
||
191 | */ |
||
192 | public function downloadVerificationMedia(string $media_url) |
||
198 | |||
199 | /** |
||
200 | * Get auth API URL |
||
201 | * |
||
202 | * @return string |
||
203 | */ |
||
204 | protected function getAuthUrl() |
||
208 | |||
209 | /** |
||
210 | * Get REST API URL |
||
211 | * |
||
212 | * @return string |
||
213 | */ |
||
214 | protected function getApiUrl() |
||
218 | } |
||
219 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: