|
15 | 15 | use Yoti\DocScan\Session\Retrieve\Configuration\SessionConfigurationResponse;
|
16 | 16 | use Yoti\DocScan\Session\Retrieve\CreateFaceCaptureResourceResponse;
|
17 | 17 | use Yoti\DocScan\Session\Retrieve\GetSessionResult;
|
| 18 | +use Yoti\DocScan\Session\Retrieve\Instructions\ContactProfileResponse; |
| 19 | +use Yoti\DocScan\Session\Retrieve\Instructions\InstructionsResponse; |
18 | 20 | use Yoti\DocScan\Support\SupportedDocumentsResponse;
|
19 | 21 | use Yoti\Http\Payload;
|
20 | 22 | use Yoti\Http\Request;
|
@@ -309,6 +311,90 @@ public function putIbvInstructions(string $sessionId, Instructions $instructions
|
309 | 311 | self::assertResponseIsSuccess($response);
|
310 | 312 | }
|
311 | 313 |
|
| 314 | + /** |
| 315 | + * @param string $sessionId |
| 316 | + * @return InstructionsResponse |
| 317 | + * @throws DocScanException |
| 318 | + */ |
| 319 | + public function getIbvInstructions(string $sessionId): InstructionsResponse |
| 320 | + { |
| 321 | + $response = (new RequestBuilder($this->config)) |
| 322 | + ->withBaseUrl($this->apiUrl) |
| 323 | + ->withPemFile($this->pemFile) |
| 324 | + ->withEndpoint(sprintf('/sessions/%s/instructions', $sessionId)) |
| 325 | + ->withGet() |
| 326 | + ->build() |
| 327 | + ->execute(); |
| 328 | + |
| 329 | + self::assertResponseIsSuccess($response); |
| 330 | + |
| 331 | + $result = Json::decode((string)$response->getBody()); |
| 332 | + |
| 333 | + return new InstructionsResponse($result); |
| 334 | + } |
| 335 | + |
| 336 | + /** |
| 337 | + * @param string $sessionId |
| 338 | + * @return Media |
| 339 | + * @throws DocScanException |
| 340 | + */ |
| 341 | + public function getIbvInstructionsPdf(string $sessionId): Media |
| 342 | + { |
| 343 | + $response = (new RequestBuilder($this->config)) |
| 344 | + ->withBaseUrl($this->apiUrl) |
| 345 | + ->withPemFile($this->pemFile) |
| 346 | + ->withEndpoint(sprintf('/sessions/%s/instructions/pdf', $sessionId)) |
| 347 | + ->withGet() |
| 348 | + ->build() |
| 349 | + ->execute(); |
| 350 | + |
| 351 | + self::assertResponseIsSuccess($response); |
| 352 | + |
| 353 | + $content = (string)$response->getBody(); |
| 354 | + $mimeType = $response->getHeader("Content-Type")[0] ?? ''; |
| 355 | + |
| 356 | + return new Media($mimeType, $content); |
| 357 | + } |
| 358 | + |
| 359 | + /** |
| 360 | + * @param string $sessionId |
| 361 | + * @return ContactProfileResponse |
| 362 | + * @throws DocScanException |
| 363 | + */ |
| 364 | + public function fetchInstructionsContactProfile(string $sessionId): ContactProfileResponse |
| 365 | + { |
| 366 | + $response = (new RequestBuilder($this->config)) |
| 367 | + ->withBaseUrl($this->apiUrl) |
| 368 | + ->withPemFile($this->pemFile) |
| 369 | + ->withEndpoint(sprintf('/sessions/%s/instructions/contact-profile', $sessionId)) |
| 370 | + ->withGet() |
| 371 | + ->build() |
| 372 | + ->execute(); |
| 373 | + |
| 374 | + self::assertResponseIsSuccess($response); |
| 375 | + |
| 376 | + $result = Json::decode((string)$response->getBody()); |
| 377 | + |
| 378 | + return new ContactProfileResponse($result); |
| 379 | + } |
| 380 | + |
| 381 | + /** |
| 382 | + * @param string $sessionId |
| 383 | + * @throws DocScanException |
| 384 | + */ |
| 385 | + public function triggerIbvEmailNotification(string $sessionId): void |
| 386 | + { |
| 387 | + $response = (new RequestBuilder($this->config)) |
| 388 | + ->withBaseUrl($this->apiUrl) |
| 389 | + ->withPemFile($this->pemFile) |
| 390 | + ->withEndpoint(sprintf('/sessions/%s/instructions/email', $sessionId)) |
| 391 | + ->withPost() |
| 392 | + ->build() |
| 393 | + ->execute(); |
| 394 | + |
| 395 | + self::assertResponseIsSuccess($response); |
| 396 | + } |
| 397 | + |
312 | 398 | /**
|
313 | 399 | * @param ResponseInterface $response
|
314 | 400 | *
|
|
0 commit comments