Skip to content

Commit

Permalink
Fix RiskMetadata (#443)
Browse files Browse the repository at this point in the history
* Add Riskmetadata factories to entities

* Add new properties to RiskMetadata

* Fix test
  • Loading branch information
ashkarpetin authored Dec 18, 2020
1 parent 468b9c9 commit 22230e4
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Security - in case of vulnerabilities.
### Added

- [x] Added new properties to `Transaction`: `arn`, `paymentInstruction`
- [x] Added new properties to `RiskMetadata`: `hasMismatchedTimeZone`, `hasMismatchedBankCountry`, `hasMismatchedBillingAddressCountry`
- [x] Added new property to `ApiKey`: `apiUser`

### Deprecated
Expand Down
24 changes: 24 additions & 0 deletions src/Entities/RiskMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,28 @@ public function getDistance()
{
return $this->getAttribute('distance');
}

/**
* @return bool
*/
public function getHasMismatchedTimeZone()
{
return $this->getAttribute('hasMismatchedTimeZone');
}

/**
* @return bool
*/
public function getHasMismatchedBankCountry()
{
return $this->getAttribute('hasMismatchedBankCountry');
}

/**
* @return bool
*/
public function getHasMismatchedBillingAddressCountry()
{
return $this->getAttribute('hasMismatchedBillingAddressCountry');
}
}
12 changes: 11 additions & 1 deletion src/Entities/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function createDeliveryAddress(array $data)
}

/**
* @return RiskMetadata
* @return RiskMetadata|null
*/
public function getRiskMetadata()
{
Expand All @@ -368,6 +368,16 @@ public function setRiskMetadata($value)
return $this->setAttribute('riskMetadata', $value);
}

/**
* @param array $data
*
* @return RiskMetadata
*/
public function createRiskMetadata(array $data)
{
return new RiskMetadata($data);
}

/**
* @return array
*/
Expand Down
12 changes: 11 additions & 1 deletion src/Entities/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,23 @@ public function setBillingAddress($value)
}

/**
* @return RiskMetadata
* @return RiskMetadata|null
*/
public function getRiskMetadata()
{
return $this->getAttribute('riskMetadata');
}

/**
* @param array $data
*
* @return RiskMetadata
*/
public function createRiskMetadata(array $data)
{
return new RiskMetadata($data);
}

/**
* @param array $data
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Entities/Subscriptions/SubscriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function populatePlanFromArrayReceivedFromServer()
self::assertSame($data['billingAddress'], $value->getBillingAddress()->jsonSerialize());
self::assertInstanceOf(Address::class, $value->getDeliveryAddress());
self::assertSame($data['deliveryAddress'], $value->getDeliveryAddress()->jsonSerialize());
self::assertSame($data['riskMetadata'], $value->getRiskMetadata());
self::assertSame($data['riskMetadata'], $value->getRiskMetadata()->jsonSerialize());
self::assertSame($data['lineItems'], $value->getLineItems());
self::assertSame($data['lineItemSubtotal'], $value->getLineItemSubtotal());
self::assertInternalType('array', $value->getItems());
Expand Down

0 comments on commit 22230e4

Please sign in to comment.