1: <?php
2:
3: namespace MaxMind\MinFraud\Model;
4:
5: /**
6: * Model of the Score response.
7: *
8: * @property-read int $fundsRemaining The approximate US dollar value of the
9: * funds remaining on your MaxMind account.
10: * @property-read int $queriesRemaining The approximate number of queries
11: * remaining for this service before your account runs out of funds.
12: * @property-read int $rawResponse The raw data that comes back from the post
13: * request to the maxmind server.
14: * @property-read string $id This is a UUID that identifies the minFraud request.
15: * Please use this ID in bug reports or support requests to MaxMind so that we
16: * can easily identify a particular request.
17: * @property-read float $riskScore This property contains the risk score, from 0.01
18: * to 99. A higher score indicates a higher risk of fraud. For example, a
19: * score of 20 indicates a 20% chance that a transaction is fraudulent. We
20: * never return a risk score of 0, since all transactions have the possibility
21: * of being fraudulent. Likewise we never return a risk score of 100.
22: * @property-read \MaxMind\MinFraud\Model\Disposition disposition An object
23: * containing the disposition set by custom rules.
24: * @property-read \MaxMind\MinFraud\Model\ScoreIpAddress $ipAddress An object
25: * containing the IP risk for the transaction.
26: * @property-read array $warnings This array contains
27: * {@link \MaxMind\MinFraud\Model\Warning Warning} objects detailing issues
28: * with the request that was sent, such as invalid or unknown inputs. It
29: * is highly recommended that you check this array for issues when integrating
30: * the web service.
31: */
32: class Score extends AbstractModel
33: {
34: /**
35: * @internal
36: */
37: protected $disposition;
38:
39: /**
40: * @internal
41: */
42: protected $fundsRemaining;
43:
44: /**
45: * @internal
46: */
47: protected $id;
48:
49: /**
50: * @internal
51: */
52: protected $ipAddress;
53:
54: /**
55: * @internal
56: */
57: protected $queriesRemaining;
58:
59: /**
60: * @internal
61: */
62: protected $rawResponse;
63:
64: /**
65: * @internal
66: */
67: protected $riskScore;
68:
69: /**
70: * @internal
71: */
72: protected $warnings;
73:
74: public function __construct($response, $locales = ['en'])
75: {
76: parent::__construct($response, $locales);
77:
78: $this->disposition
79: = new Disposition($this->safeArrayLookup($response['disposition']));
80: $this->fundsRemaining = $this->safeArrayLookup($response['funds_remaining']);
81: $this->queriesRemaining = $this->safeArrayLookup($response['queries_remaining']);
82: $this->id = $this->safeArrayLookup($response['id']);
83: $this->ipAddress
84: = new ScoreIpAddress($this->safeArrayLookup($response['ip_address']));
85: $this->riskScore = $this->safeArrayLookup($response['risk_score']);
86:
87: $this->warnings = [];
88: foreach ($this->safeArrayLookup($response['warnings'], []) as $warning) {
89: array_push($this->warnings, new Warning($warning));
90: }
91: }
92: }
93: