Skip to content

Commit

Permalink
SDK-2265 Retrieve Receipt (#323)
Browse files Browse the repository at this point in the history
* SDK-2265 Retrieve Receipt
* Add several tests to SDK-2265
* SDK-2265 Retrieve Receipt Fix Decryption
* SDK-2265-examples - updated routes
* SDK-2265 anchor updates
* SDK-2265 removed profile attributes, updated namings, removed unnecessary comments
* SDK-2265 added test FetchShareReceipt and updated ReceiptItemKeyTest, code quality updates
* SDK-2265 php 7.4 type hint remove
  • Loading branch information
LuborRod authored Jun 21, 2024
1 parent ea0dd50 commit 5b3c526
Show file tree
Hide file tree
Showing 160 changed files with 8,732 additions and 38 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"8.1.29","version":"3.59.3:v3.59.3#30ba9ecc2b0e5205e578fe29973c15653d9bfd29","indent":" ","lineEnding":"\n","rules":{"array_syntax":{"syntax":"short"},"no_unused_imports":true,"ordered_imports":{"imports_order":["const","class","function"]},"php_unit_fqcn_annotation":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true},"hashes":{"\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32718\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder30753\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder24222\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder25907\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder35317\/src\/DigitalIdentityClient.php":"9fba09c315d5bba5bd7b90ae9a717003","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3167\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder667\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32289\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder821\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder8036\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3553\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder9961\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder34449\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32249\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37291\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3093\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder28127\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder33456\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37936\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder20323\/tests\/Identity\/DigitalIdentityServiceTest.php":"a2830bae77f9853790b730ab1c52a9c0","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder135\/src\/DocScan\/Session\/Retrieve\/IdDocumentResourceResponse.php":"7bf4d09cc0a58470af431046cfc7687e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder452\/src\/DocScan\/Session\/Retrieve\/IdDocumentResourceResponse.php":"7bf4d09cc0a58470af431046cfc7687e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder1835\/src\/DocScan\/Session\/Retrieve\/IdDocumentResourceResponse.php":"f39668a92c3059e9d8298359ad6eedc9","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder11703\/src\/DocScan\/Session\/Create\/SdkConfig.php":"e570742d72b41967f9cc7e20495b7100","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder6945\/src\/DocScan\/Session\/Create\/SdkConfig.php":"defa00a16760c0f07cb4f16484770ddc","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder10761\/src\/DocScan\/Session\/Create\/SdkConfig.php":"61b63d7cb686a25b1e664868fb8a5460","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder25491\/src\/DocScan\/Session\/Create\/SdkConfig.php":"52a187cef6aa401b2c24a6af50f6d1b3","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder25245\/src\/DocScan\/Session\/Create\/SdkConfig.php":"e97a84e32a50146e14db930c88f07dec","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder6169\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"994c482f94c986253a3da93140575f26","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder14820\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"994c482f94c986253a3da93140575f26","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder8237\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"07bb664508b1053fde7518c3e5c9e0d2","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder30396\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"994c482f94c986253a3da93140575f26","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder26547\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"575c5c8750d0429c00d78f86f8b15d71","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder26103\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"756a15f92fed8a36b7645e3400543738","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32665\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"bbcf30388bf6ab6423a58d6c8cf20b2a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder12231\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"d4c1e5cd33fc66ed0e9016ef83067f13","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder15671\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"1baf3d3d5e54d0120769f58a50b2d6a4","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder16639\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"790f204c58bb5c755878db5467155929","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder29864\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"1baf3d3d5e54d0120769f58a50b2d6a4","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32797\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"9d3a05bc0553ae4fb61fad16444794f1","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder17371\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"1ab0b067273a82103be9978f9090d751","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder2626\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"b262cf859858d0bfc7d493b82cfaf386","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder36694\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"b217af9f0e6d73ee26e5037494076717","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder24413\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"3a913bedb33741c25993d6f54631aab5","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder27718\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"639289121ce1709eeb7da41ad648d3f7","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder21698\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"c7d6178d1b7e1734a2315145e477d61a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder22514\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"e991f862707f4967f66f52cf6e1ff4fc","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37049\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"427142582bbc86bf6c5e80aa8c7b2945","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder24008\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"17c7713fa71fecefc01fc83ae0120850","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder19212\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"d45835ea3ec3e7889e1262ff766f22a8","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder6528\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskConfig.php":"a8b7d00af84b1ecf11a3755ef4270a21","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder29603\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"b262cf859858d0bfc7d493b82cfaf386","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37059\/src\/DocScan\/Session\/Create\/Task\/RequestedTextExtractionTaskBuilder.php":"5ebeced1a30fcb9579e2c023fb6683f9","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder18315\/examples\/doc-scan\/routes\/web.php":"cb44e031de8731bfa516c2057adb3705","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder33073\/examples\/profile\/app\/Http\/Controllers\/IdentityController.php":"2f614a4174a0403ac48ef6dcd4796ebc","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder1171\/examples\/doc-scan\/routes\/web.php":"cb44e031de8731bfa516c2057adb3705","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder24221\/examples\/profile\/app\/Providers\/YotiDigitalIdentityServiceProvider.php":"ca9bdcd9f57192ded3421ec399c655d3","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder28861\/examples\/profile\/app\/Providers\/YotiDigitalIdentityServiceProvider.php":"ca9bdcd9f57192ded3421ec399c655d3","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder28556\/examples\/digitalidentity\/config\/app.php":"fd9dd9b2aa7f77bd4898eff4039a5399","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder14596\/examples\/profile\/config\/app.php":"fd9dd9b2aa7f77bd4898eff4039a5399","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder29786\/examples\/profile\/config\/app.php":"fd9dd9b2aa7f77bd4898eff4039a5399","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder18285\/examples\/profile\/config\/app.php":"dc2cea437306a860734271b629691f1b","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder6012\/examples\/profile\/config\/app.php":"dc2cea437306a860734271b629691f1b","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder9177\/examples\/digitalidentity\/storage\/framework\/views\/95c786522cd6c5bb1d0a69b2f33616f23bfd97c6.php":"fec431b44c0882fb0ff10121625ab7df","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder5081\/examples\/profile\/routes\/web.php":"4d6d95a1a884c50539b3ba82cb1cae6e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder28691\/examples\/profile\/routes\/web.php":"b21cb257df9016e8e827652aecc620d6","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder16838\/examples\/digitalidentity\/storage\/framework\/views\/95c786522cd6c5bb1d0a69b2f33616f23bfd97c6.php":"fec431b44c0882fb0ff10121625ab7df","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder35858\/examples\/profile\/routes\/web.php":"b21cb257df9016e8e827652aecc620d6","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder18443\/examples\/digitalidentity\/storage\/framework\/views\/95c786522cd6c5bb1d0a69b2f33616f23bfd97c6.php":"fec431b44c0882fb0ff10121625ab7df","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder1673\/examples\/profile\/routes\/web.php":"b21cb257df9016e8e827652aecc620d6","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder4880\/examples\/digitalidentity\/storage\/framework\/views\/95c786522cd6c5bb1d0a69b2f33616f23bfd97c6.php":"fec431b44c0882fb0ff10121625ab7df"}}
14 changes: 14 additions & 0 deletions examples/digitalidentity/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is a template for defining the environment variables
# Set the application config values here

YOTI_SDK_ID=xxxxxxxxxxxxxxxxxxxxx

# Below is the private key (in .pem format) associated with the Yoti Application you created on Yoti Hub
YOTI_KEY_FILE_PATH=./keys/php-sdk-access-security.pem

# Laravel config:
APP_NAME=yoti.sdk.digitalidentity.demo
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
16 changes: 16 additions & 0 deletions examples/digitalidentity/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log

*.pem
keys/*.pem
sdk
24 changes: 24 additions & 0 deletions examples/digitalidentity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Digital Identity Example

## Requirements

This example requires [Docker](https://docs.docker.com/)

## Setup

* Create your application in the [Yoti Hub](https://hub.yoti.com) (this requires having a Yoti account)
* Set the application domain of your app to `localhost:4002`
* Do the steps below inside the [examples/digitalidentity](./) folder
* Put `your-application-pem-file.pem` file inside the [keys](keys) folder, as Docker requires the `.pem` file to reside within the same location where it's run from.
* Copy `.env.example` to `.env`
* Open `.env` file and fill in the environment variable `YOTI_SDK_ID`
* Set `YOTI_KEY_FILE_PATH` to `./keys/your-application-pem-file.pem`
* Install dependencies `docker-compose up composer`
* Run the `docker-compose up --build` command
* Visit [https://localhost:4002](https://localhost:4002)
* Run the `docker-compose stop` command to stop the containers.

> To see how to retrieve activity details using the one time use token, refer to the [digitalidentity controller](app/Http/Controllers/IdentityController.php)
## Digital Identity Example
* Visit [/generate-share](https://localhost:4002/generate-share)
41 changes: 41 additions & 0 deletions examples/digitalidentity/app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
55 changes: 55 additions & 0 deletions examples/digitalidentity/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];

/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Log;
use mysql_xdevapi\Exception;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Yoti\DigitalIdentityClient;
use Yoti\Identity\Policy\PolicyBuilder;
use Yoti\Identity\ShareSessionRequestBuilder;
use Yoti\YotiClient;

class IdentityController extends BaseController
{
public function generateSession(DigitalIdentityClient $client)
{
try {

$policy = (new PolicyBuilder())
->withFamilyName()
->withGivenNames()
->withFullName()
->withDateOfBirth()
->withGender()
->withNationality()
->withPhoneNumber()
->withSelfie()
->withEmail()
->withDocumentDetails()
->withDocumentImages()
->build();

$redirectUri = 'https://host/redirect/';

$shareSessionRequest = (new ShareSessionRequestBuilder())
->withPolicy($policy)
->withRedirectUri($redirectUri)
->build();
$session = $client->createShareSession($shareSessionRequest);
return $session->getId();
}
catch (\Throwable $e) {
Log::error($e->getTraceAsString());
throw new BadRequestHttpException($e->getMessage());
}
}
public function show(DigitalIdentityClient $client)
{
try {
return view('identity', [
'title' => 'Digital Identity Complete Example',
'sdkId' => $client->id
]);
} catch (\Throwable $e) {
Log::error($e->getTraceAsString());
throw new BadRequestHttpException($e->getMessage());
}
}
}
Loading

0 comments on commit 5b3c526

Please sign in to comment.