Skip to content

Commit 2007192

Browse files
author
Rodion Liuborets
committed
Add WatchlistSummary response view
1 parent 148f1b0 commit 2007192

20 files changed

+236
-131
lines changed

src/DocScan/Session/Retrieve/Contracts/CaMatchingStrategyResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ abstract class CaMatchingStrategyResponse
99
/**
1010
* @var string
1111
*/
12-
private $type;
12+
protected $type;
1313

1414
/**
1515
* @return string

src/DocScan/Session/Retrieve/Contracts/CaSourcesResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ abstract class CaSourcesResponse
99
/**
1010
* @var string
1111
*/
12-
private $type;
12+
protected $type;
1313

1414
/**
1515
* @return string

src/DocScan/Session/Retrieve/Contracts/Config.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/DocScan/Session/Retrieve/Contracts/Summary.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/DocScan/Session/Retrieve/Contracts/WatchlistAdvancedCaSearchConfigResponse.php

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
namespace Yoti\DocScan\Session\Retrieve\Contracts;
66

7-
abstract class WatchlistAdvancedCaSearchConfigResponse extends WatchlistSearchConfigResponse
7+
use Yoti\DocScan\Constants;
8+
use Yoti\DocScan\Session\Retrieve\Matching\ExactMatchingStrategyResponse;
9+
use Yoti\DocScan\Session\Retrieve\Sources\SearchProfileSourcesResponse;
10+
use Yoti\DocScan\Session\Retrieve\Sources\TypeListSourcesResponse;
11+
12+
class WatchlistAdvancedCaSearchConfigResponse extends WatchlistSearchConfigResponse
813
{
914
/**
1015
* @var string $type
@@ -31,6 +36,49 @@ abstract class WatchlistAdvancedCaSearchConfigResponse extends WatchlistSearchCo
3136
*/
3237
private $matchingStrategy;
3338

39+
/**
40+
* @param array<string, mixed> $searchConfig
41+
*/
42+
public function __construct(array $searchConfig)
43+
{
44+
$this->type = $searchConfig['type'];
45+
$this->removeDeceased = $searchConfig['remove_deceased'];
46+
$this->shareUrl = $searchConfig['share_url'];
47+
48+
$this->setSources($searchConfig);
49+
$this->setMatchingStrategy($searchConfig);
50+
}
51+
52+
/**
53+
* @param array<string, mixed> $searchConfig
54+
*/
55+
private function setSources(array $searchConfig): void
56+
{
57+
if ($searchConfig['sources']['type'] == Constants::PROFILE) {
58+
$this->sources = new SearchProfileSourcesResponse($searchConfig['search_profile']);
59+
}
60+
if ($searchConfig['sources']['type'] == Constants::TYPE_LIST) {
61+
$this->sources = new TypeListSourcesResponse($searchConfig['types']);
62+
}
63+
}
64+
65+
/**
66+
* @param array<string, mixed> $searchConfig
67+
*/
68+
private function setMatchingStrategy(array $searchConfig): void
69+
{
70+
if ($searchConfig['matching_strategy']['type'] == Constants::EXACT) {
71+
$this->matchingStrategy = new ExactMatchingStrategyResponse(
72+
$searchConfig['matching_strategy']['exact_match']
73+
);
74+
}
75+
if ($searchConfig['matching_strategy']['type'] == Constants::FUZZY) {
76+
$this->matchingStrategy = new ExactMatchingStrategyResponse(
77+
$searchConfig['matching_strategy']['fuzziness']
78+
);
79+
}
80+
}
81+
3482
/**
3583
* @return bool
3684
*/

src/DocScan/Session/Retrieve/Contracts/WatchlistReportResponse.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/DocScan/Session/Retrieve/Contracts/WatchlistSummaryResponse.php

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/DocScan/Session/Retrieve/CustomAccountWatchlistCaSearchConfigResponse.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ class CustomAccountWatchlistCaSearchConfigResponse extends WatchlistAdvancedCaSe
2828
*/
2929
private $clientRef;
3030

31+
/**
32+
* @param array<string, mixed> $searchConfig
33+
*/
34+
public function __construct(array $searchConfig)
35+
{
36+
parent::__construct($searchConfig);
37+
$this->apiKey = $searchConfig['api_key'];
38+
$this->monitoring = $searchConfig['monitoring'];
39+
$this->clientRef = $searchConfig['client_ref'];
40+
$this->tags = json_decode($searchConfig['tags'], true);
41+
}
42+
3143
/**
3244
* @return string
3345
*/

src/DocScan/Session/Retrieve/Matching/ExactMatchingStrategyResponse.php

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

55
namespace Yoti\DocScan\Session\Retrieve\Matching;
66

7+
use Yoti\DocScan\Constants;
78
use Yoti\DocScan\Session\Retrieve\Contracts\CaMatchingStrategyResponse;
89

910
class ExactMatchingStrategyResponse extends CaMatchingStrategyResponse
@@ -13,6 +14,15 @@ class ExactMatchingStrategyResponse extends CaMatchingStrategyResponse
1314
*/
1415
private $exactMatch;
1516

17+
/**
18+
* @param bool $exactMatch
19+
*/
20+
public function __construct(bool $exactMatch)
21+
{
22+
$this->type = Constants::EXACT;
23+
$this->exactMatch = $exactMatch;
24+
}
25+
1626
/**
1727
* @return bool
1828
*/

src/DocScan/Session/Retrieve/Matching/FuzzyMatchingStrategyResponse.php

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

55
namespace Yoti\DocScan\Session\Retrieve\Matching;
66

7+
use Yoti\DocScan\Constants;
78
use Yoti\DocScan\Session\Retrieve\Contracts\CaMatchingStrategyResponse;
89

910
class FuzzyMatchingStrategyResponse extends CaMatchingStrategyResponse
@@ -13,6 +14,15 @@ class FuzzyMatchingStrategyResponse extends CaMatchingStrategyResponse
1314
*/
1415
private $fuzziness;
1516

17+
/**
18+
* @param float $fuzziness
19+
*/
20+
public function __construct(float $fuzziness)
21+
{
22+
$this->type = Constants::FUZZY;
23+
$this->fuzziness = $fuzziness;
24+
}
25+
1626
/**
1727
* @return float
1828
*/

0 commit comments

Comments
 (0)