Skip to content

Development #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: release/4.3.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ Add the Yoti SDK dependency:

```json
"require": {
"yoti/yoti-php-sdk" : "^4.3.0"
"yoti/yoti-php-sdk" : "^4.4.0"
}
```

Or run this Composer command
```console
$ composer require yoti/yoti-php-sdk "^4.3.0"
$ composer require yoti/yoti-php-sdk "^4.4.0"
```

## Setup
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yoti/yoti-php-sdk",
"description": "Yoti SDK for quickly integrating your PHP backend with Yoti",
"version": "4.3.0",
"version": "4.4.0",
"keywords": [
"yoti",
"sdk"
Expand Down
2 changes: 1 addition & 1 deletion examples/digitalidentity/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is a template for defining the environment variables
0# This file is a template for defining the environment variables
# Set the application config values here

YOTI_SDK_ID=xxxxxxxxxxxxxxxxxxxxx
Expand Down
2 changes: 1 addition & 1 deletion examples/digitalidentity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ This example requires [Docker](https://docs.docker.com/)
## Digital Identity(Advanced) Share Example
* Visit [/generate-advanced-identity-share](https://localhost:4002/generate-advanced-identity-share)
* ## Digital Identity DBS Example
* Visit [/generate-dbs-share](https://localhost:4002/generate-dbs-share)
* Visit [/generate-dbs-share](https://localhost:4002/generate-dbs-share)
1 change: 1 addition & 0 deletions examples/digitalidentity/resources/views/dbs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ function onErrorListener(...data) {
await onReadyToStart()
}</script>
<script src="https://www.yoti.com/share/client/v2" onload="onClientLoaded()"></script>

</body>
</html>
4 changes: 3 additions & 1 deletion examples/doc-scan/app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ public function show(Request $request, DocScanClient $client)
->withMaxRetries(3)
->build()
)
/*
->withRequestedCheck(
(new RequestedWatchlistAdvancedCaCheckBuilder())
->withConfig($customConfig)
->build()
)
)*/
->withRequestedCheck(
(new RequestedFaceMatchCheckBuilder())
->withManualCheckFallback()
Expand Down Expand Up @@ -150,6 +151,7 @@ public function show(Request $request, DocScanClient $client)
->withErrorUrl(config('app.url') . '/error')
->withPrivacyPolicyUrl(config('app.url') . '/privacy-policy')
->withBiometricConsentFlow('EARLY')
->withBrandId('brand_id')
->build()
)
->withRequiredDocument(
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Constants
public const SDK_IDENTIFIER = 'PHP';

/** Default SDK version */
public const SDK_VERSION = '4.3.0';
public const SDK_VERSION = '4.4.0';

/** Base url for connect page (user will be redirected to this page eg. baseurl/app-id) */
public const CONNECT_BASE_URL = 'https://www.yoti.com/connect';
Expand Down
55 changes: 53 additions & 2 deletions src/DocScan/Session/Create/SdkConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ class SdkConfig implements \JsonSerializable
*/
private $biometricConsentFlow;

/**
* @var string|null
*/
private $darkMode;

/**
* @var string|null
*/
private $primaryColourDarkMode;

/**
* @var string|null
*/
private $brandId;

/**
* @param string|null $allowedCaptureMethods
* @param string|null $primaryColour
Expand All @@ -81,6 +96,9 @@ class SdkConfig implements \JsonSerializable
* @param bool|null $allowHandoff
* @param array<string, int>|null $idDocumentTextDataExtractionRetriesConfig
* @param string|null $biometricConsentFlow
* @param string|null $darkMode
* @param string|null $primaryColourDarkMode
* @param string|null $brandId
*/
public function __construct(
?string $allowedCaptureMethods,
Expand All @@ -94,7 +112,10 @@ public function __construct(
?string $privacyPolicyUrl = null,
?bool $allowHandoff = null,
?array $idDocumentTextDataExtractionRetriesConfig = null,
?string $biometricConsentFlow = null
?string $biometricConsentFlow = null,
?string $darkMode = null,
?string $primaryColourDarkMode = null,
?string $brandId = null
) {
$this->allowedCaptureMethods = $allowedCaptureMethods;
$this->primaryColour = $primaryColour;
Expand All @@ -110,6 +131,9 @@ public function __construct(
$this->attemptsConfiguration = new AttemptsConfiguration($idDocumentTextDataExtractionRetriesConfig);
}
$this->biometricConsentFlow = $biometricConsentFlow;
$this->darkMode = $darkMode;
$this->primaryColourDarkMode = $primaryColourDarkMode;
$this->brandId = $brandId;
}

/**
Expand All @@ -129,7 +153,10 @@ public function jsonSerialize(): \stdClass
'privacy_policy_url' => $this->getPrivacyPolicyUrl(),
'allow_handoff' => $this->getAllowHandoff(),
'attempts_configuration' => $this->getAttemptsConfiguration(),
'biometric_consent_flow' => $this->getBiometricConsentFlow()
'biometric_consent_flow' => $this->getBiometricConsentFlow(),
'dark_mode' => $this->getDarkMode(),
'primary_colour_dark_mode' => $this->getPrimaryColourDarkMode(),
'brand_id' => $this->getBrandId()
]);
}

Expand Down Expand Up @@ -228,4 +255,28 @@ public function getBiometricConsentFlow(): ?string
{
return $this->biometricConsentFlow;
}

/**
* @return string|null
*/
public function getDarkMode(): ?string
{
return $this->darkMode;
}

/**
* @return string|null
*/
public function getPrimaryColourDarkMode(): ?string
{
return $this->primaryColourDarkMode;
}

/**
* @return string|null
*/
public function getBrandId(): ?string
{
return $this->brandId;
}
}
56 changes: 55 additions & 1 deletion src/DocScan/Session/Create/SdkConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ class SdkConfigBuilder
*/
private $biometricConsentFlow;

/**
* @var string|null
*/
private $darkMode;

/**
* @var string|null
*/
private $primaryColourDarkMode;

/**
* @var string|null
*/
private $brandId;

public function withAllowsCamera(): self
{
return $this->withAllowedCaptureMethod(self::CAMERA);
Expand Down Expand Up @@ -146,6 +161,7 @@ public function withBiometricConsentFlow(string $biometricConsentFlow): self
$this->biometricConsentFlow = $biometricConsentFlow;
return $this;
}

/**
* Allows configuring the number of attempts permitted for text extraction on an ID document
*
Expand Down Expand Up @@ -199,6 +215,41 @@ public function withIdDocumentTextExtractionGenericAttempts(int $genericRetries)
return $this;
}

public function withDarkMode(string $darkMode): self
{
$this->darkMode = $darkMode;
return $this;
}

public function withDarkModeOn(): self
{
$this->darkMode = "ON";
return $this;
}

public function withDarkModeOff(): self
{
$this->darkMode = "OFF";
return $this;
}

public function withDarkModeAuto(): self
{
$this->darkMode = "AUTO";
return $this;
}

public function withPrimaryColourDarkMode(string $primaryColourDarkMode): self
{
$this->primaryColourDarkMode = $primaryColourDarkMode;
return $this;
}

public function withBrandId(string $brandId): self
{
$this->brandId = $brandId;
return $this;
}

public function build(): SdkConfig
{
Expand All @@ -214,7 +265,10 @@ public function build(): SdkConfig
$this->privacyPolicyUrl,
$this->allowHandoff,
$this->idDocumentTextDataExtractionRetriesConfig,
$this->biometricConsentFlow
$this->biometricConsentFlow,
$this->darkMode,
$this->primaryColourDarkMode,
$this->brandId
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public function __construct(array $searchConfig)
$this->apiKey = $searchConfig['api_key'];
$this->monitoring = $searchConfig['monitoring'];
$this->clientRef = $searchConfig['client_ref'];
$this->tags = array_key_exists('tags', $searchConfig) ? json_decode($searchConfig['tags'], true) : [];
$this->tags = array_key_exists('tags', $searchConfig) && is_string($searchConfig['tags'])
? json_decode($searchConfig['tags'], true)
: (array_key_exists('tags', $searchConfig) && is_array($searchConfig['tags']) ? $searchConfig['tags'] : []);
}

/**
Expand Down
26 changes: 24 additions & 2 deletions src/ShareUrl/Policy/WantedAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,32 @@ class WantedAttribute implements \JsonSerializable
*/
private $acceptSelfAsserted;

/**
* @var bool|null
*/
private $optional;

/**
* @param string $name
* @param string $derivation
* @param bool $acceptSelfAsserted
* @param \Yoti\ShareUrl\Policy\Constraints $constraints
* @param bool $optional
*/
public function __construct(
string $name,
string $derivation = null,
bool $acceptSelfAsserted = null,
Constraints $constraints = null
Constraints $constraints = null,
bool $optional = null
) {
Validation::notEmptyString($name, 'name');
$this->name = $name;

$this->derivation = $derivation;
$this->acceptSelfAsserted = $acceptSelfAsserted;
$this->constraints = $constraints;
$this->optional = $optional;
}

/**
Expand Down Expand Up @@ -97,6 +105,14 @@ public function getAcceptSelfAsserted(): ?bool
return $this->acceptSelfAsserted;
}

/**
* @return bool|null
*/
public function getOptional(): ?bool
{
return $this->optional;
}

/**
* @inheritDoc
*
Expand All @@ -106,7 +122,7 @@ public function jsonSerialize(): array
{
$json = [
'name' => $this->getName(),
'optional' => false,
'optional' => $this->getOptional(),
];

if ($this->getDerivation() !== null) {
Expand All @@ -121,6 +137,12 @@ public function jsonSerialize(): array
$json['accept_self_asserted'] = $this->getAcceptSelfAsserted();
}

if ($this->getOptional() !== null) {
$json['optional'] = $this->getOptional();
}



return $json;
}

Expand Down
17 changes: 16 additions & 1 deletion src/ShareUrl/Policy/WantedAttributeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class WantedAttributeBuilder
*/
private $acceptSelfAsserted;

/**
* @var bool|null
*/
private $optional = false;
/**
* @param string $name
*
Expand Down Expand Up @@ -73,6 +77,16 @@ public function withAcceptSelfAsserted(?bool $acceptSelfAsserted = true): self
return $this;
}

/**
* @param bool $optional
*
* @return $this
*/
public function withOptional(?bool $optional = false): self
{
$this->optional = $optional;
return $this;
}
/**
* @return \Yoti\ShareUrl\Policy\WantedAttribute
*/
Expand All @@ -82,7 +96,8 @@ public function build(): WantedAttribute
$this->name,
$this->derivation,
$this->acceptSelfAsserted,
$this->constraints
$this->constraints,
$this->optional
);
}
}
Loading
Loading