|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace MaxMind\MinFraud\Model; |
| 6 | + |
| 7 | +/** |
| 8 | + * The risk score reason for the multiplier. |
| 9 | + * |
| 10 | + * This class provides both a machine-readable code and a human-readable |
| 11 | + * explanation of the reason for the risk score, see |
| 12 | + * {@link https://dev.maxmind.com/minfraud/api-documentation/responses/#schema--response--risk-score-reason--multiplier-reason}. |
| 13 | + * |
| 14 | + * Although more codes may be added in the future, the current codes are: |
| 15 | + * |
| 16 | + * * `BROWSER_LANGUAGE` - Riskiness of the browser user-agent and language associated with the request. |
| 17 | + * * `BUSINESS_ACTIVITY` - Riskiness of business activity associated with the request. |
| 18 | + * * `COUNTRY` - Riskiness of the country associated with the request. |
| 19 | + * * `CUSTOMER_ID` - Riskiness of a customer's activity. |
| 20 | + * * `EMAIL_DOMAIN` - Riskiness of email domain. |
| 21 | + * * `EMAIL_DOMAIN_NEW` - Riskiness of newly-sighted email domain. |
| 22 | + * * `EMAIL_ADDRESS_NEW` - Riskiness of newly-sighted email address. |
| 23 | + * * `EMAIL_LOCAL_PART` - Riskiness of the local part of the email address. |
| 24 | + * * `EMAIL_VELOCITY` - Velocity on email - many requests on same email over short period of time. |
| 25 | + * * `ISSUER_ID_NUMBER_COUNTRY_MISMATCH` - Riskiness of the country mismatch between IP, billing, |
| 26 | + * shipping and IIN country. |
| 27 | + * * `ISSUER_ID_NUMBER_ON_SHOP_ID` - Risk of Issuer ID Number for the shop ID. |
| 28 | + * * `ISSUER_ID_NUMBER_LAST_DIGITS_ACTIVITY` - Riskiness of many recent requests and previous |
| 29 | + * high-risk requests on the IIN and last digits of the credit card. |
| 30 | + * * `ISSUER_ID_NUMBER_SHOP_ID_VELOCITY` - Risk of recent Issuer ID Number activity for the shop ID. |
| 31 | + * * `INTRACOUNTRY_DISTANCE` - Risk of distance between IP, billing, and shipping location. |
| 32 | + * * `ANONYMOUS_IP` - Risk due to IP being an Anonymous IP. |
| 33 | + * * `IP_BILLING_POSTAL_VELOCITY` - Velocity of distinct billing postal code on IP address. |
| 34 | + * * `IP_EMAIL_VELOCITY` - Velocity of distinct email address on IP address. |
| 35 | + * * `IP_HIGH_RISK_DEVICE` - High-risk device sighted on IP address. |
| 36 | + * * `IP_ISSUER_ID_NUMBER_VELOCITY` - Velocity of distinct IIN on IP address. |
| 37 | + * * `IP_ACTIVITY` - Riskiness of IP based on minFraud network activity. |
| 38 | + * * `LANGUAGE` - Riskiness of browser language. |
| 39 | + * * `MAX_RECENT_EMAIL` - Riskiness of email address based on past minFraud risk scores on email. |
| 40 | + * * `MAX_RECENT_PHONE` - Riskiness of phone number based on past minFraud risk scores on phone. |
| 41 | + * * `MAX_RECENT_SHIP` - Riskiness of email address based on past minFraud risk scores on ship address. |
| 42 | + * * `MULTIPLE_CUSTOMER_ID_ON_EMAIL` - Riskiness of email address having many customer IDs. |
| 43 | + * * `ORDER_AMOUNT` - Riskiness of the order amount. |
| 44 | + * * `ORG_DISTANCE_RISK` - Risk of ISP and distance between billing address and IP location. |
| 45 | + * * `PHONE` - Riskiness of the phone number or related numbers. |
| 46 | + * * `CART` - Riskiness of shopping cart contents. |
| 47 | + * * `TIME_OF_DAY` - Risk due to local time of day. |
| 48 | + * * `TRANSACTION_REPORT_EMAIL` - Risk due to transaction reports on the email address. |
| 49 | + * * `TRANSACTION_REPORT_IP` - Risk due to transaction reports on the IP address. |
| 50 | + * * `TRANSACTION_REPORT_PHONE` - Risk due to transaction reports on the phone number. |
| 51 | + * * `TRANSACTION_REPORT_SHIP` - Risk due to transaction reports on the shipping address. |
| 52 | + * * `EMAIL_ACTIVITY` - Riskiness of the email address based on minFraud network activity. |
| 53 | + * * `PHONE_ACTIVITY` - Riskiness of the phone number based on minFraud network activity. |
| 54 | + * * `SHIP_ACTIVITY` - Riskiness of ship address based on minFraud network activity. |
| 55 | + */ |
| 56 | +class Reason implements \JsonSerializable |
| 57 | +{ |
| 58 | + /** |
| 59 | + * @var string This value is a machine-readable code identifying the reason |
| 60 | + */ |
| 61 | + public readonly string $code; |
| 62 | + |
| 63 | + /** |
| 64 | + * @var string This value provides a human-readable explanation of the reason. The description |
| 65 | + * may change at any time and should not be matched against. |
| 66 | + */ |
| 67 | + public readonly string $reason; |
| 68 | + |
| 69 | + public function __construct(array $response) |
| 70 | + { |
| 71 | + $this->code = $response['code']; |
| 72 | + $this->reason = $response['reason']; |
| 73 | + } |
| 74 | + |
| 75 | + public function jsonSerialize(): array |
| 76 | + { |
| 77 | + $js = []; |
| 78 | + |
| 79 | + $js['code'] = $this->code; |
| 80 | + $js['reason'] = $this->reason; |
| 81 | + |
| 82 | + return $js; |
| 83 | + } |
| 84 | +} |
0 commit comments