AddToBlacklist

This section describes one of the fraud screening methods used in the development of fraud screening plug-ins that allow CloudBlue Commerce to integrate with third-party fraud screening systems. For more information, please see Overview and How to Develop Fraud Screening Plug-ins.

Method naming convention

%PluginName%_AddToBlacklist

Purpose

This method adds a particular value to the plug-in's blacklist if the blacklist does not contain this value (if the request contains the data the plug-in 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 plug-ins. However, it is not necessary for non-blacklist or validation and eligibility plug-ins.

Input Parameters

  • blacklist – array of blacklist records.
  • value – string value that will be checked whether it is in the blacklist.

Return Parameters

  • result – 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 plug-in

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;
}