Skip to content

Commit

Permalink
SDK-2438 added advanced ca and added related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmet-yoti committed Aug 20, 2024
1 parent 14003c5 commit 5c8627c
Show file tree
Hide file tree
Showing 15 changed files with 687 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Advanced;

use Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced\SandboxCaMatchingStrategy;
use Yoti\Sandbox\DocScan\SandboxConstants;

class SandboxExactMatchingStrategy extends SandboxCaMatchingStrategy
{
/**
* @return bool
*/
public function isExactMatch(): bool
{
return true;
}

/**
* @return string
*/
public function getType(): string
{
return SandboxConstants::EXACT;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Advanced;

use Yoti\DocScan\Session\Create\Check\Advanced\RequestedExactMatchingStrategy;

class SandboxExactMatchingStrategyBuilder
{
/**
* @return RequestedExactMatchingStrategy
*/
public function build(): RequestedExactMatchingStrategy
{
return new RequestedExactMatchingStrategy();
}
}
52 changes: 52 additions & 0 deletions src/DocScan/Request/Check/Advanced/SandboxSearchProfileSources.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Advanced;

use stdClass;
use Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced\SandboxCaSources;
use Yoti\Sandbox\DocScan\SandboxConstants;

class SandboxSearchProfileSources extends SandboxCaSources
{
/**
* @var string
*/
private $searchProfile;

/**
* @param string $searchProfile
*/
public function __construct(string $searchProfile)
{
$this->searchProfile = $searchProfile;
}

/**
* @return string
*/
public function getSearchProfile(): string
{
return $this->searchProfile;
}

/**
* @return string
*/
public function getType(): string
{
return SandboxConstants::PROFILE;
}

/**
* @return stdClass
*/
public function jsonSerialize(): stdClass
{
$json = parent::jsonSerialize();
$json->search_profile = $this->getSearchProfile();

return $json;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Advanced;

class SandboxSearchProfileSourcesBuilder
{
/**
* @var string
*/
private $searchProfile;

/**
* @param string $searchProfile
* @return $this
*/
public function withSearchProfile(string $searchProfile): SandboxSearchProfileSourcesBuilder
{
$this->searchProfile = $searchProfile;

return $this;
}

/**
* @return SandboxSearchProfileSources
*/
public function build(): SandboxSearchProfileSources
{
return new SandboxSearchProfileSources($this->searchProfile);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced;

use stdClass;
use Yoti\Util\Json;

abstract class SandboxCaMatchingStrategy implements \JsonSerializable
{
/**
* @var string
*/
public $type;

/**
* @return string
*/
abstract public function getType(): string;

/**
* @return stdClass
*/
public function jsonSerialize(): stdClass
{
return (object)Json::withoutNullValues([
'type' => $this->getType(),
]);
}
}
31 changes: 31 additions & 0 deletions src/DocScan/Request/Check/Contracts/Advanced/SandboxCaSources.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced;

use stdClass;
use Yoti\Util\Json;

abstract class SandboxCaSources implements \JsonSerializable
{
/**
* @var string
*/
public $type;

/**
* @return string
*/
abstract public function getType(): string;

/**
* @return stdClass
*/
public function jsonSerialize(): stdClass
{
return (object)Json::withoutNullValues([
'type' => $this->getType(),
]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Contracts;

use stdClass;
use Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced\SandboxCaMatchingStrategy;
use Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced\SandboxCaSources;
use Yoti\Sandbox\DocScan\Request\Check\SandboxCheckConfigInterface;

abstract class SandboxWatchlistAdvancedCaConfig implements SandboxCheckConfigInterface
{
/**
* @var bool
*/
private $removeDeceased;

/**
* @var bool
*/
private $shareUrl;

/**
* @var SandboxCaSources
*/
private $sources;

/**
* @var SandboxCaMatchingStrategy
*/
private $matchingStrategy;

/**
* @return string
*/
abstract public function getType(): string;

/**
* @param bool $removeDeceased
* @param bool $shareUrl
* @param SandboxCaSources $sources
* @param SandboxCaMatchingStrategy $matchingStrategy
*/
public function __construct(
bool $removeDeceased,
bool $shareUrl,
SandboxCaSources $sources,
SandboxCaMatchingStrategy $matchingStrategy
) {
$this->removeDeceased = $removeDeceased;
$this->shareUrl = $shareUrl;
$this->sources = $sources;
$this->matchingStrategy = $matchingStrategy;
}

/**
* @return bool
*/
public function getRemoveDeceased(): bool
{
return $this->removeDeceased;
}

/**
* @return bool
*/
public function getShareUrl(): bool
{
return $this->shareUrl;
}

/**
* @return SandboxCaSources
*/
public function getSources(): SandboxCaSources
{
return $this->sources;
}

/**
* @return SandboxCaMatchingStrategy
*/
public function getMatchingStrategy(): SandboxCaMatchingStrategy
{
return $this->matchingStrategy;
}

/**
* @return stdClass
*/
public function jsonSerialize(): stdClass
{
return (object)[
'remove_deceased' => $this->getRemoveDeceased(),
'share_url' => $this->getShareUrl(),
'sources' => $this->getSources(),
'matching_strategy' => $this->getMatchingStrategy(),
'type' => $this->getType(),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

declare(strict_types=1);

namespace Yoti\Sandbox\DocScan\Request\Check\Contracts;

use Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced\SandboxCaMatchingStrategy;
use Yoti\Sandbox\DocScan\Request\Check\Contracts\Advanced\SandboxCaSources;

abstract class SandboxWatchlistAdvancedCaConfigBuilder
{
/**
* @var bool
*/
protected $removeDeceased;

/**
* @var bool
*/
protected $shareUrl;

/**
* @var SandboxCaSources
*/
protected $sources;

/**
* @var SandboxCaMatchingStrategy
*/
protected $matchingStrategy;

/**
* @return mixed
*/
abstract public function build();

/**
* @param bool $removeDeceased
* @return $this
*/
public function withRemoveDeceased(bool $removeDeceased): SandboxWatchlistAdvancedCaConfigBuilder
{
$this->removeDeceased = $removeDeceased;

return $this;
}

/**
* @param bool $shareUrl
* @return $this
*/
public function withShareUrl(bool $shareUrl): SandboxWatchlistAdvancedCaConfigBuilder
{
$this->shareUrl = $shareUrl;

return $this;
}

/**
* @param SandboxCaSources $sources
* @return $this
*/
public function withSources(SandboxCaSources $sources): SandboxWatchlistAdvancedCaConfigBuilder
{
$this->sources = $sources;

return $this;
}

/**
* @param SandboxCaMatchingStrategy $matchingStrategy
* @return $this
*/
public function withMatchingStrategy(
SandboxCaMatchingStrategy $matchingStrategy
): SandboxWatchlistAdvancedCaConfigBuilder {
$this->matchingStrategy = $matchingStrategy;

return $this;
}
}
Loading

0 comments on commit 5c8627c

Please sign in to comment.