Skip to content

Commit

Permalink
Merge pull request #85 from maxmind/greg/cc-is-business
Browse files Browse the repository at this point in the history
Add support for /credit_card/is_business output
  • Loading branch information
horgh authored Apr 3, 2020
2 parents e085ca6 + 308dc7a commit a31c01a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGELOG
=========

1.12.0
-------------------

* Added support for the new credit card output `/credit_card/is_business`.
This indicates whether the card is a business card. It may be accessed via
`$response->creditCard->isBusiness` on the minFraud Insights and Factors
response objects.

1.11.0 (2020-03-26)
-------------------

Expand Down
8 changes: 8 additions & 0 deletions src/MinFraud/Model/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* location of the majority of customers using this credit card as determined
* by their billing address. In cases where the location of customers is highly
* mixed, this defaults to the country of the bank issuing the card.
* @property-read bool|null $isBusiness This property is true if the card is a
* business card.
* @property-read bool|null $isIssuedInBillingAddressCountry This property is
* true if the country of the billing address matches the country of the
* majority of customers using this credit card. In cases where the location
Expand All @@ -39,6 +41,11 @@ class CreditCard extends AbstractModel
*/
protected $country;

/**
* @internal
*/
protected $isBusiness;

/**
* @internal
*/
Expand Down Expand Up @@ -72,6 +79,7 @@ public function __construct($response, $locales = ['en'])

$this->brand = $this->safeArrayLookup($response['brand']);
$this->country = $this->safeArrayLookup($response['country']);
$this->isBusiness = $this->safeArrayLookup($response['is_business']);
$this->isIssuedInBillingAddressCountry
= $this->safeArrayLookup($response['is_issued_in_billing_address_country']);
$this->isPrepaid = $this->safeArrayLookup($response['is_prepaid']);
Expand Down
7 changes: 7 additions & 0 deletions tests/MaxMind/Test/MinFraud/Model/CreditCardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function testCreditCard()
],
'brand' => 'Visa',
'country' => 'US',
'is_business' => true,
'is_issued_in_billing_address_country' => false,
'is_prepaid' => true,
'is_virtual' => true,
Expand Down Expand Up @@ -64,6 +65,12 @@ public function testCreditCard()
'country'
);

$this->assertSame(
$array['is_business'],
$cc->isBusiness,
'isBusiness'
);

$this->assertSame(
$array['is_issued_in_billing_address_country'],
$cc->isIssuedInBillingAddressCountry,
Expand Down
1 change: 1 addition & 0 deletions tests/data/factors-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
},
"brand": "Visa",
"country": "US",
"is_business": true,
"is_issued_in_billing_address_country": true,
"is_prepaid": true,
"type": "credit"
Expand Down
1 change: 1 addition & 0 deletions tests/data/insights-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
},
"brand": "Visa",
"country": "US",
"is_business": true,
"is_issued_in_billing_address_country": true,
"is_prepaid": true,
"type": "credit"
Expand Down

0 comments on commit a31c01a

Please sign in to comment.