NAME
Data::Validate::Sanctions::Redis - An extension of Data::Validate::Sanctions::Redis that stores sanction data in redis.
SYNOPSIS ## no critic use Data::Validate::Sanctions::Redis;
my
$validator
= Data::Validate::Sanctions::Redis->new(
connection
=>
$redis_read
);
# to validate clients by their name
'BAD'
if
$validator
->is_sanctioned(
"$last_name $first_name"
);
# or by more profile data
'BAD'
if
$validator
->get_sanctioned_info(
first_name
=>
$first_name
,
last_name
=>
$last_name
,
date_of_birth
=>
$date_of_birth
)->{matched};
# to update the sanction dataset (needs redis write access)
my
$validator
= Data::Validate::Sanctions::Redis->new(
connection
=>
$redis_write
);
## no critic
$validator
->update_data(
eu_token
=>
$token
);
# create object from the parent (factory) class
my
$validator
= Data::Validate::Sanctions->new(
storage
=>
'redis'
,
connection
=>
$redis_write
);
DESCRIPTION
Data::Validate::Sanctions::Redis is a simple validitor to validate a name against sanctions lists. For more details about the sanction sources please refer to the parent module Data::Validate::Sanctions.
METHODS
new
Create the object with the redis object:
my
$validator
= Data::Validate::Sanctions::Redis->new(
connection
=>
$redis
);
is_sanctioned
Checks if the input profile info matches a sanctioned entity. The arguments are the same as those of get_sanctioned_info.
It returns 1 if a match is found, otherwise 0.
get_sanctioned_info
Tries to find a match a sanction entry matching the input profile args. It takes arguments in two forms. In the new API, it takes a hashref containing the following named arguments:
first_name: first name
last_name: last name
date_of_birth: (optional) date of birth as a string or epoch
place_of_birth: (optional) place of birth as a country name or code
residence: (optional) name or code of the country of residence
nationality: (optional) name or code of the country of nationality
citizen: (optional) name or code of the country of citizenship
postal_code: (optional) postal/zip code
national_id: (optional) national ID number
passport_no: (oiptonal) passort number
For backward compatibility it also supports the old API, taking the following args:
first_name: first name
last_name: last name
date_of_birth: (optional) date of birth as a string or epoch
It returns a hash-ref containg the following data:
- - matched: 1 if a match was found; 0 otherwise
- - list: the source for the matched entry,
- - matched_args: a name-value hash-ref of the similar arguments,
- - comment: additional comments if necessary,
update_data
Fetches latest versions of sanction lists, and updates corresponding sections of stored file, if needed
last_updated
Returns timestamp of when the latest list was updated. If argument is provided - return timestamp of when that list was updated.
_name_matches
Pass in the client's name and sanctioned individual's name to see if they are similar or not
AUTHOR
Binary.com <fayland@binary.com>
COPYRIGHT
Copyright 2022- Binary.com
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.