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