Last active
December 13, 2015 19:38
-
-
Save jakeasmith/4964318 to your computer and use it in GitHub Desktop.
Super simple example of how to implement a system that can handle multiple types of fraud checks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Fraud levels: | |
* 0 - no fraud | |
* 1 - needs to be reviewed | |
* 2 - denied | |
*/ | |
// Set the initial fraud status to zero | |
$fraud_status = 0; | |
// Loop thru our fraud checks | |
foreach($fraud_checks as $check) { | |
// Run the check | |
$check_status = $check->run(); | |
// Elevate the fraud status, if needed | |
if($check_status > $fraud_status) | |
$fraud_status = $check_status | |
// Don't waste time running more checks if we already know its fraud | |
if($check_status === 2) | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment