1 <?php
2
3 namespace MaxMind\MinFraud\Model;
4
5 /**
6 * Model of the Score response.
7 *
8 * @property-read integer $fundsRemaining The approximate US dollar value of the
9 * funds remaining on your MaxMind account.
10 * @property-read integer $queriesRemaining The approximate number of queries
11 * remaining for this service before your account runs out of funds.
12 * @property-read integer $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 array $warnings This array contains
23 * {@link \MaxMind\MinFraud\Model\Warning Warning} objects detailing issues
24 * with the request that was sent, such as invalid or unknown inputs. It
25 * is highly recommended that you check this array for issues when integrating
26 * the web service.
27 */
28 class Score extends AbstractModel
29 {
30 /**
31 * @internal
32 */
33 protected $fundsRemaining;
34
35 /**
36 * @internal
37 */
38 protected $queriesRemaining;
39
40 /**
41 * @internal
42 */
43 protected $id;
44
45 /**
46 * @internal
47 */
48 protected $ipAddress;
49
50 /**
51 * @internal
52 */
53 protected $rawResponse;
54
55 /**
56 * @internal
57 */
58 protected $riskScore;
59
60 /**
61 * @internal
62 */
63 protected $warnings;
64
65 public function __construct($response, $locales = ['en'])
66 {
67 parent::__construct($response, $locales);
68
69 $this->fundsRemaining = $this->safeArrayLookup($response['funds_remaining']);
70 $this->queriesRemaining = $this->safeArrayLookup($response['queries_remaining']);
71 $this->id = $this->safeArrayLookup($response['id']);
72 $this->ipAddress
73 = new ScoreIpAddress($this->safeArrayLookup($response['ipAddress']));
74 $this->riskScore = $this->safeArrayLookup($response['risk_score']);
75
76 $this->warnings = [];
77 foreach ($this->safeArrayLookup($response['warnings'], []) as $warning) {
78 array_push($this->warnings, new Warning($warning));
79 }
80 }
81 }
82