Skip to content

Commit 8160327

Browse files
authored
Merge pull request #267 from getyoti/release-3.9.1
Release 3.9.1
2 parents 393dae9 + a2cc716 commit 8160327

File tree

43 files changed

+897
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+897
-244
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ composer.lock
66
phpcs.xml
77

88
.phpunit.result.cache
9+
phpunit.xml.bak
910

1011
.php_cs.cache
1112

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "yoti/yoti-php-sdk",
33
"description": "Yoti SDK for quickly integrating your PHP backend with Yoti",
4-
"version": "3.9.0",
4+
"version": "3.9.1",
55
"keywords": [
66
"yoti",
77
"sdk"

examples/doc-scan/app/Http/Controllers/HomeController.php

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
use Illuminate\Http\Request;
66
use Illuminate\Routing\Controller as BaseController;
77
use Yoti\DocScan\DocScanClient;
8-
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedFuzzyMatchingStrategy;
9-
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedSearchProfileSources;
8+
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedExactMatchingStrategyBuilder;
9+
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedFuzzyMatchingStrategyBuilder;
10+
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedSearchProfileSourcesBuilder;
11+
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedTypeListSourcesBuilder;
12+
use Yoti\DocScan\Session\Create\Check\RequestedCustomAccountWatchlistAdvancedCaConfigBuilder;
1013
use Yoti\DocScan\Session\Create\Check\RequestedDocumentAuthenticityCheckBuilder;
1114
use Yoti\DocScan\Session\Create\Check\RequestedFaceMatchCheckBuilder;
1215
use Yoti\DocScan\Session\Create\Check\RequestedIdDocumentComparisonCheckBuilder;
@@ -29,11 +32,52 @@ class HomeController extends BaseController
2932
{
3033
public function show(Request $request, DocScanClient $client)
3134
{
35+
//WatchScreening Config
3236
$watchScreeningConfig = (new RequestedWatchlistScreeningConfigBuilder())
3337
->withSanctionsCategory()
3438
->withAdverseMediaCategory()
3539
->build();
3640

41+
//Search Profiles Sources
42+
$searchProfileSources = (new RequestedSearchProfileSourcesBuilder())
43+
->withSearchProfile("5c62a621-ed6a-4f07-89a1-a941c1733b7c")
44+
->build();
45+
46+
//TypeListSources
47+
$typeListSources = (new RequestedTypeListSourcesBuilder())
48+
->withTypes(['type1', 'type2'])
49+
->build();
50+
51+
//FuzzyMatchingStrategy
52+
$fuzzyMatchingStrategy = (new RequestedFuzzyMatchingStrategyBuilder())
53+
->withFuzziness(0.5)
54+
->build();
55+
56+
//ExactMatchingStrategy
57+
$exactMatchingStrategy = (new RequestedExactMatchingStrategyBuilder())
58+
->build();
59+
60+
//CustomAccountConfig
61+
$customConfig = (new RequestedCustomAccountWatchlistAdvancedCaConfigBuilder())
62+
->withMatchingStrategy($exactMatchingStrategy)
63+
->withSources($searchProfileSources)
64+
->withShareUrl(false)
65+
->withRemoveDeceased(true)
66+
->withApiKey('qiKTHG7Mgqj31mK2d21F7QPpaVBp9zKc')
67+
->withClientRef("string")
68+
->withMonitoring(true)
69+
->withTags(['tag1'])
70+
->build();
71+
72+
//YotiAccountConfig
73+
$yotiConfig = (new RequestedYotiAccountWatchlistAdvancedCaConfigBuilder())
74+
->withMatchingStrategy($exactMatchingStrategy)
75+
->withSources($typeListSources)
76+
->withShareUrl(false)
77+
->withRemoveDeceased(true)
78+
->build();
79+
80+
3781
$sessionSpec = (new SessionSpecificationBuilder())
3882
->withClientSessionTokenTtl(600)
3983
->withResourcesTtl(90000)
@@ -47,6 +91,11 @@ public function show(Request $request, DocScanClient $client)
4791
->forZoomLiveness()
4892
->build()
4993
)
94+
->withRequestedCheck(
95+
(new RequestedWatchlistAdvancedCaCheckBuilder())
96+
->withConfig($customConfig)
97+
->build()
98+
)
5099
->withRequestedCheck(
51100
(new RequestedFaceMatchCheckBuilder())
52101
->withManualCheckAlways()
@@ -78,17 +127,17 @@ public function show(Request $request, DocScanClient $client)
78127
)
79128
->withSdkConfig(
80129
(new SdkConfigBuilder())
81-
->withAllowsCameraAndUpload()
82-
->withPrimaryColour('#2d9fff')
83-
->withSecondaryColour('#FFFFFF')
84-
->withFontColour('#FFFFFF')
85-
->withLocale('en-GB')
86-
->withPresetIssuingCountry('GBR')
87-
->withSuccessUrl(config('app.url') . '/success')
88-
->withErrorUrl(config('app.url') . '/error')
89-
->withPrivacyPolicyUrl(config('app.url') . '/privacy-policy')
90-
->build()
91-
)
130+
->withAllowsCameraAndUpload()
131+
->withPrimaryColour('#2d9fff')
132+
->withSecondaryColour('#FFFFFF')
133+
->withFontColour('#FFFFFF')
134+
->withLocale('en-GB')
135+
->withPresetIssuingCountry('GBR')
136+
->withSuccessUrl(config('app.url') . '/success')
137+
->withErrorUrl(config('app.url') . '/error')
138+
->withPrivacyPolicyUrl(config('app.url') . '/privacy-policy')
139+
->build()
140+
)
92141
->withRequiredDocument(
93142
(new RequiredIdDocumentBuilder())
94143
->withFilter(
@@ -118,9 +167,9 @@ public function show(Request $request, DocScanClient $client)
118167

119168
return view('home', [
120169
'iframeUrl' => config('yoti')['doc.scan.iframe.url'] . '?' . http_build_query([
121-
'sessionID' => $session->getSessionId(),
122-
'sessionToken' => $session->getClientSessionToken(),
123-
])
170+
'sessionID' => $session->getSessionId(),
171+
'sessionToken' => $session->getClientSessionToken(),
172+
])
124173
]);
125174
}
126175
}

src/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Constants
2525
public const SDK_IDENTIFIER = 'PHP';
2626

2727
/** Default SDK version */
28-
public const SDK_VERSION = '3.9.0';
28+
public const SDK_VERSION = '3.9.1';
2929

3030
/** Base url for connect page (user will be redirected to this page eg. baseurl/app-id) */
3131
public const CONNECT_BASE_URL = 'https://www.yoti.com/connect';

src/DocScan/Session/Create/Check/Advanced/RequestedExactMatchingStrategy.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yoti\DocScan\Session\Create\Check\Advanced;
66

7+
use Yoti\DocScan\Constants;
78
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaMatchingStrategy;
89

910
class RequestedExactMatchingStrategy extends RequestedCaMatchingStrategy
@@ -15,4 +16,12 @@ public function isExactMatch(): bool
1516
{
1617
return true;
1718
}
19+
20+
/**
21+
* @return string
22+
*/
23+
public function getType(): string
24+
{
25+
return Constants::EXACT;
26+
}
1827
}

src/DocScan/Session/Create/Check/Advanced/RequestedFuzzyMatchingStrategy.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Yoti\DocScan\Session\Create\Check\Advanced;
66

7+
use stdClass;
8+
use Yoti\DocScan\Constants;
79
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaMatchingStrategy;
810

911
class RequestedFuzzyMatchingStrategy extends RequestedCaMatchingStrategy
@@ -13,6 +15,9 @@ class RequestedFuzzyMatchingStrategy extends RequestedCaMatchingStrategy
1315
*/
1416
private $fuzziness;
1517

18+
/**
19+
* @param float $fuzziness
20+
*/
1621
public function __construct(float $fuzziness)
1722
{
1823
$this->fuzziness = $fuzziness;
@@ -25,4 +30,23 @@ public function getFuzziness(): float
2530
{
2631
return $this->fuzziness;
2732
}
33+
34+
/**
35+
* @return stdClass
36+
*/
37+
public function jsonSerialize(): stdClass
38+
{
39+
$json = parent::jsonSerialize();
40+
$json->fuzziness = $this->getFuzziness();
41+
42+
return $json;
43+
}
44+
45+
/**
46+
* @return string
47+
*/
48+
public function getType(): string
49+
{
50+
return Constants::FUZZY;
51+
}
2852
}

src/DocScan/Session/Create/Check/Advanced/RequestedSearchProfileSources.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Yoti\DocScan\Session\Create\Check\Advanced;
66

7+
use stdClass;
8+
use Yoti\DocScan\Constants;
79
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaSources;
810

911
class RequestedSearchProfileSources extends RequestedCaSources
@@ -13,6 +15,9 @@ class RequestedSearchProfileSources extends RequestedCaSources
1315
*/
1416
private $searchProfile;
1517

18+
/**
19+
* @param string $searchProfile
20+
*/
1621
public function __construct(string $searchProfile)
1722
{
1823
$this->searchProfile = $searchProfile;
@@ -25,4 +30,23 @@ public function getSearchProfile(): string
2530
{
2631
return $this->searchProfile;
2732
}
33+
34+
/**
35+
* @return string
36+
*/
37+
public function getType(): string
38+
{
39+
return Constants::PROFILE;
40+
}
41+
42+
/**
43+
* @return stdClass
44+
*/
45+
public function jsonSerialize(): stdClass
46+
{
47+
$json = parent::jsonSerialize();
48+
$json->search_profile = $this->getSearchProfile();
49+
50+
return $json;
51+
}
2852
}

src/DocScan/Session/Create/Check/Advanced/RequestedTypeListSources.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Yoti\DocScan\Session\Create\Check\Advanced;
66

7+
use stdClass;
8+
use Yoti\DocScan\Constants;
79
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaSources;
810

911
class RequestedTypeListSources extends RequestedCaSources
@@ -29,4 +31,23 @@ public function getTypes(): array
2931
{
3032
return $this->types;
3133
}
34+
35+
/**
36+
* @return string
37+
*/
38+
public function getType(): string
39+
{
40+
return Constants::TYPE_LIST;
41+
}
42+
43+
/**
44+
* @return stdClass
45+
*/
46+
public function jsonSerialize(): stdClass
47+
{
48+
$json = parent::jsonSerialize();
49+
$json->types = $this->getTypes();
50+
51+
return $json;
52+
}
3253
}

src/DocScan/Session/Create/Check/Contracts/Advanced/RequestedCaMatchingStrategy.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44

55
namespace Yoti\DocScan\Session\Create\Check\Contracts\Advanced;
66

7-
abstract class RequestedCaMatchingStrategy
7+
use stdClass;
8+
use Yoti\Util\Json;
9+
10+
abstract class RequestedCaMatchingStrategy implements \JsonSerializable
811
{
12+
/**
13+
* @var string
14+
*/
15+
public $type;
16+
17+
/**
18+
* @return string
19+
*/
20+
abstract public function getType(): string;
21+
22+
/**
23+
* @return stdClass
24+
*/
25+
public function jsonSerialize(): stdClass
26+
{
27+
return (object)Json::withoutNullValues([
28+
'type' => $this->getType(),
29+
]);
30+
}
931
}

src/DocScan/Session/Create/Check/Contracts/Advanced/RequestedCaSources.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44

55
namespace Yoti\DocScan\Session\Create\Check\Contracts\Advanced;
66

7-
abstract class RequestedCaSources
7+
use stdClass;
8+
use Yoti\Util\Json;
9+
10+
abstract class RequestedCaSources implements \JsonSerializable
811
{
12+
/**
13+
* @var string
14+
*/
15+
public $type;
16+
17+
/**
18+
* @return string
19+
*/
20+
abstract public function getType(): string;
21+
22+
/**
23+
* @return stdClass
24+
*/
25+
public function jsonSerialize(): stdClass
26+
{
27+
return (object)Json::withoutNullValues([
28+
'type' => $this->getType(),
29+
]);
30+
}
931
}

0 commit comments

Comments
 (0)