AddToBlacklist
This section describes one of the fraud screening methods used in the development of fraud screening plugins that allow CloudBlue Commerce to integrate with third-party fraud screening systems. For more information, refer to Overview and How to Develop Fraud Screening Plugins.
Method naming convention
%PluginName%_AddToBlacklist
Purpose
This method adds a particular value to the plug-in blacklist if the blacklist does not contain this value (if the request contains the data the plugin can blacklist). If the blacklist already contains this value, the method activates the corresponding record.
Mandatory / optional
This is one of the fraud screening methods mandatory for all blacklist plugins. However, it is not necessary for non-blacklist or validation and eligibility plugins.
Input Parameters
blacklist
: an array of blacklist records.value
: a string value that will be checked whether it is in the blacklist.
Return Parameters
result
: an object of the\FraudSDK\AddToBlacklist
type that defines either the value that will be added to the blacklist or the ID of the blacklist record that will be activated.
Relationship with other methods
None
Implementation example. Blacklist plugin
function BlacklistDemo_AddToBlacklist($blacklist, $value) { $blacklisted_row_id = _isZipBlacklisted($blacklist, $value); $is_blacklisted = ($blacklisted_row_id !== FALSE); $result = \FraudSDK\createAddToBlacklist(); if ($is_blacklisted) { $result->setOpEnable($blacklisted_row_id) ->setMessage('Blacklisted ZIP record is enabled'); } else { $result->setOpInsert(['zip_code' => $value]) ->setMessage('ZIP code have been added to the blacklist'); } return $result; }