-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace MaxMind\MinFraud\Model; | ||
|
||
/** | ||
* Model with the disposition set by custom rules. | ||
* | ||
* In order to receive a disposition, you must be use the minFraud custom | ||
* rules. | ||
* | ||
* @property-read string|null $action The action to take on the transaction as | ||
* defined by your custom rules. The current set of values are "accept", | ||
* "manual_review", and "reject". If you do not have custom rules set up, | ||
* `null` will be returned. | ||
* | ||
* @property-read string|null $reason The reason for the action. The current | ||
* possible values are "custom_rule", "block_list", and "default". If you do | ||
* not have custom rules set up, `null` will be returned. | ||
*/ | ||
class Disposition extends AbstractModel | ||
{ | ||
/** | ||
* @internal | ||
*/ | ||
protected $action; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
protected $reason; | ||
|
||
public function __construct($response, $locales = ['en']) | ||
{ | ||
parent::__construct($response, $locales); | ||
$this->action = $this->safeArrayLookup($response['action']); | ||
$this->reason = $this->safeArrayLookup($response['reason']); | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace MaxMind\Test\MinFraud\Model; | ||
|
||
use MaxMind\MinFraud\Model\Disposition; | ||
|
||
class DispositionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testDisposition() | ||
{ | ||
$array = [ | ||
'action' => 'manual_review', | ||
'reason' => 'custom_rule', | ||
]; | ||
$disposition = new Disposition($array); | ||
|
||
$this->assertSame( | ||
$array['action'], | ||
$disposition->action, | ||
'action' | ||
); | ||
|
||
$this->assertSame( | ||
$array['reason'], | ||
$disposition->reason, | ||
'reason' | ||
); | ||
|
||
$this->assertSame( | ||
$array, | ||
$disposition->jsonSerialize(), | ||
'correctly implements JsonSerializable' | ||
); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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