diff --git a/.travis.yml b/.travis.yml index e4e9f17..9e8f60d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,8 @@ language: php sudo: false php: - - 7.2 + - 7.3 + - 8.2 before_script: - travis_retry composer self-update diff --git a/README.md b/README.md index d24a8d9..3b3fa3e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Total Downloads](https://poser.pugx.org/omnipay/braintree/d/total.png)](https://packagist.org/packages/omnipay/braintree) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment -processing library for PHP 7.2+. This package implements Braintree support for Omnipay. +processing library for PHP 7.3+. This package implements Braintree support for Omnipay. ## Installation diff --git a/composer.json b/composer.json index 353f9f0..a7de20f 100644 --- a/composer.json +++ b/composer.json @@ -32,10 +32,10 @@ }, "require": { "omnipay/common": "^3", - "braintree/braintree_php": "^5.0" + "braintree/braintree_php": "^6.0" }, "require-dev": { - "omnipay/tests": "^3" + "omnipay/tests": "^4" }, "extra": { "branch-alias": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 535809e..4f8afb5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,23 @@ - - - - ./tests/ - - - - - ./src - - + + + + ./src + + + + + ./tests/ + + diff --git a/src/MerchantIndividual.php b/src/MerchantIndividual.php index 76ecd24..cc469f3 100644 --- a/src/MerchantIndividual.php +++ b/src/MerchantIndividual.php @@ -184,7 +184,7 @@ public function setName($value) { $names = explode(' ', $value, 2); $this->setFirstName($names[0]); - $this->setLastName(isset($names[1]) ? $names[1] : null); + $this->setLastName($names[1] ?? null); return $this; } diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index 7e946a1..0be01e8 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -159,16 +159,6 @@ public function setDeviceData($value) return $this->setParameter('deviceData', $value); } - public function getDeviceSessionId() - { - return $this->getParameter('deviceSessionId'); - } - - public function setDeviceSessionId($value) - { - return $this->setParameter('deviceSessionId', $value); - } - public function getMerchantAccountId() { return $this->getParameter('merchantAccountId'); diff --git a/src/Message/AuthorizeRequest.php b/src/Message/AuthorizeRequest.php index fa8e590..1fba1db 100644 --- a/src/Message/AuthorizeRequest.php +++ b/src/Message/AuthorizeRequest.php @@ -23,7 +23,6 @@ public function getData() 'customerId' => $this->getCustomerId(), 'descriptor' => $this->getDescriptor(), 'deviceData' => $this->getDeviceData(), - 'deviceSessionId' => $this->getDeviceSessionId(), 'merchantAccountId' => $this->getMerchantAccountId(), 'orderId' => $this->getTransactionId(), 'purchaseOrderNumber' => $this->getPurchaseOrderNumber(), diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php index 6c616c2..edab2c7 100644 --- a/tests/GatewayTest.php +++ b/tests/GatewayTest.php @@ -15,7 +15,12 @@ class GatewayTest extends GatewayTestCase */ protected $gateway; - public function setUp() + /** + * @var array + */ + protected $options; + + public function setUp(): void { parent::setUp(); @@ -150,30 +155,21 @@ public function testCancelSubscription() public function testParseNotification() { if(Version::MAJOR >= 3) { - $xml = ''; - $payload = base64_encode($xml); - $signature = Digest::hexDigestSha1(Configuration::privateKey(), $payload); - $gatewayMock = $this->buildGatewayMock($payload); - $gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest(), $gatewayMock); - $params = array( - 'bt_signature' => $payload.'|'.$signature, - 'bt_payload' => $payload - ); - $request = $gateway->parseNotification($params); - $this->assertInstanceOf('\Braintree\WebhookNotification', $request); + $xml = ''; } else { $xml = ''; - $payload = base64_encode($xml); - $signature = Digest::hexDigestSha1(Configuration::privateKey(), $payload); - $gatewayMock = $this->buildGatewayMock($payload); - $gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest(), $gatewayMock); - $params = array( - 'bt_signature' => $payload.'|'.$signature, - 'bt_payload' => $payload - ); - $request = $gateway->parseNotification($params); - $this->assertInstanceOf('\Braintree\WebhookNotification', $request); } + + $payload = base64_encode($xml); + $signature = Digest::hexDigestSha1(Configuration::privateKey(), $payload); + $gatewayMock = $this->buildGatewayMock($payload); + $gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest(), $gatewayMock); + $params = array( + 'bt_signature' => $payload.'|'.$signature, + 'bt_payload' => $payload + ); + $request = $gateway->parseNotification($params); + $this->assertInstanceOf('\Braintree\WebhookNotification', $request); } /** diff --git a/tests/MerchantBusinessTest.php b/tests/MerchantBusinessTest.php index a788c1a..a7908a7 100644 --- a/tests/MerchantBusinessTest.php +++ b/tests/MerchantBusinessTest.php @@ -8,7 +8,12 @@ class MerchantBusinessTest extends TestCase { - public function setUp() + /** + * @var MerchantBusiness + */ + protected $business; + + public function setUp(): void { $this->business = new MerchantBusiness(); } diff --git a/tests/MerchantFundingTest.php b/tests/MerchantFundingTest.php index b31b6ce..78157b2 100644 --- a/tests/MerchantFundingTest.php +++ b/tests/MerchantFundingTest.php @@ -7,7 +7,12 @@ class MerchantFundingTest extends TestCase { - public function setUp() + /** + * @var MerchantFunding + */ + protected $funding; + + public function setUp(): void { $this->funding = new MerchantFunding(); } diff --git a/tests/MerchantIndividualTest.php b/tests/MerchantIndividualTest.php index abf9349..e268699 100644 --- a/tests/MerchantIndividualTest.php +++ b/tests/MerchantIndividualTest.php @@ -8,7 +8,12 @@ class MerchantIndividualTest extends TestCase { - public function setUp() + /** + * @var MerchantIndividual + */ + protected $individual; + + public function setUp(): void { $this->individual = new MerchantIndividual(); } diff --git a/tests/Message/AbstractMerchantAccountRequestTest.php b/tests/Message/AbstractMerchantAccountRequestTest.php index 05e64b8..4a9c670 100644 --- a/tests/Message/AbstractMerchantAccountRequestTest.php +++ b/tests/Message/AbstractMerchantAccountRequestTest.php @@ -13,7 +13,7 @@ class AbstractMerchantAccountRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $this->request = Mockery::mock('\Omnipay\Braintree\Message\AbstractMerchantAccountRequest')->makePartial(); $this->request->initialize(); diff --git a/tests/Message/AbstractRequestTest.php b/tests/Message/AbstractRequestTest.php index ec64ae4..8b5b6f8 100644 --- a/tests/Message/AbstractRequestTest.php +++ b/tests/Message/AbstractRequestTest.php @@ -12,7 +12,7 @@ class AbstractRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $this->request = Mockery::mock('\Omnipay\Braintree\Message\AbstractRequest')->makePartial(); $this->request->initialize(); @@ -42,7 +42,6 @@ public function provideKeepsData(){ array('customerId', 'abc123'), array('descriptor', array('a' => 'b')), array('deviceData', 'abc123'), - array('deviceSessionId', 'abc123'), array('merchantAccountId', 'abc123'), array('recurring', true), array('addBillingAddressToPaymentMethod', true), diff --git a/tests/Message/AuthorizeRequestTest.php b/tests/Message/AuthorizeRequestTest.php index 54e46e9..0761aa6 100644 --- a/tests/Message/AuthorizeRequestTest.php +++ b/tests/Message/AuthorizeRequestTest.php @@ -4,6 +4,7 @@ use Braintree\Configuration; use Omnipay\Tests\TestCase; +use Omnipay\Common\Exception\InvalidRequestException; class AuthorizeRequestTest extends TestCase { @@ -12,7 +13,7 @@ class AuthorizeRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -176,23 +177,24 @@ public function testGetServiceFeeAmountNoDecimalsRounding() $this->assertSame('137', $this->request->getServiceFeeAmount()); } - /** - * @expectedException \Omnipay\Common\Exception\InvalidRequestException - */ public function testServiceFeeAmountWithIntThrowsException() { // ambiguous value, avoid errors upgrading from v0.9 $this->assertSame($this->request, $this->request->setServiceFeeAmount(10)); + + $this->expectException(InvalidRequestException::class); + $this->request->getServiceFeeAmount(); + } - /** - * @expectedException \Omnipay\Common\Exception\InvalidRequestException - */ public function testServiceFeeAmountWithIntStringThrowsException() { // ambiguous value, avoid errors upgrading from v0.9 $this->assertSame($this->request, $this->request->setServiceFeeAmount('10')); + + $this->expectException(InvalidRequestException::class); + $this->request->getServiceFeeAmount(); } } diff --git a/tests/Message/CaptureRequestTest.php b/tests/Message/CaptureRequestTest.php index fb08f86..30de79d 100644 --- a/tests/Message/CaptureRequestTest.php +++ b/tests/Message/CaptureRequestTest.php @@ -12,7 +12,7 @@ class CaptureRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/ClientTokenRequestTest.php b/tests/Message/ClientTokenRequestTest.php index f0a04ef..c517168 100644 --- a/tests/Message/ClientTokenRequestTest.php +++ b/tests/Message/ClientTokenRequestTest.php @@ -12,7 +12,7 @@ class ClientTokenRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/ClientTokenResponseTest.php b/tests/Message/ClientTokenResponseTest.php index aa0c40c..e4d54ec 100644 --- a/tests/Message/ClientTokenResponseTest.php +++ b/tests/Message/ClientTokenResponseTest.php @@ -12,7 +12,7 @@ class ClientTokenResponseTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/CreateCustomerRequestTest.php b/tests/Message/CreateCustomerRequestTest.php index c36f1b5..185bd95 100644 --- a/tests/Message/CreateCustomerRequestTest.php +++ b/tests/Message/CreateCustomerRequestTest.php @@ -12,7 +12,7 @@ class CreateCustomerRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/CreateMerchantAccountRequestTest.php b/tests/Message/CreateMerchantAccountRequestTest.php index 06900c6..63aeede 100644 --- a/tests/Message/CreateMerchantAccountRequestTest.php +++ b/tests/Message/CreateMerchantAccountRequestTest.php @@ -13,7 +13,7 @@ class CreateMerchantAccountRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/CustomerResponseTest.php b/tests/Message/CustomerResponseTest.php index 38ecd5e..b2f20fa 100644 --- a/tests/Message/CustomerResponseTest.php +++ b/tests/Message/CustomerResponseTest.php @@ -15,7 +15,7 @@ class CustomerResponseTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/DeleteCustomerRequestTest.php b/tests/Message/DeleteCustomerRequestTest.php index 1dc4575..d5c62c3 100644 --- a/tests/Message/DeleteCustomerRequestTest.php +++ b/tests/Message/DeleteCustomerRequestTest.php @@ -12,7 +12,7 @@ class DeleteCustomerRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/DeletePaymentMethodRequestTest.php b/tests/Message/DeletePaymentMethodRequestTest.php index cd80c41..3eeebdf 100644 --- a/tests/Message/DeletePaymentMethodRequestTest.php +++ b/tests/Message/DeletePaymentMethodRequestTest.php @@ -12,7 +12,7 @@ class DeletePaymentMethodRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $this->request = new DeletePaymentMethodRequest($this->getHttpClient(), $this->getHttpRequest(), Configuration::gateway()); $this->request->initialize( diff --git a/tests/Message/FindCustomerRequestTest.php b/tests/Message/FindCustomerRequestTest.php index c51d819..b8c4241 100644 --- a/tests/Message/FindCustomerRequestTest.php +++ b/tests/Message/FindCustomerRequestTest.php @@ -10,7 +10,7 @@ class FindCustomerRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/FindRequestTest.php b/tests/Message/FindRequestTest.php index 64e7356..3107b7f 100644 --- a/tests/Message/FindRequestTest.php +++ b/tests/Message/FindRequestTest.php @@ -12,7 +12,7 @@ class FindRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/PlanRequestTest.php b/tests/Message/PlanRequestTest.php index b1f077f..4559ff3 100644 --- a/tests/Message/PlanRequestTest.php +++ b/tests/Message/PlanRequestTest.php @@ -15,7 +15,7 @@ class PlanRequestTest extends TestCase /** @var PlanRequest */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/PlanResponseTest.php b/tests/Message/PlanResponseTest.php index 550a84c..4782eea 100644 --- a/tests/Message/PlanResponseTest.php +++ b/tests/Message/PlanResponseTest.php @@ -16,7 +16,7 @@ class PlanResponseTest extends TestCase /** @var PlanRequest */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/PurchaseRequestTest.php b/tests/Message/PurchaseRequestTest.php index 9e01d19..ca09ab1 100644 --- a/tests/Message/PurchaseRequestTest.php +++ b/tests/Message/PurchaseRequestTest.php @@ -12,7 +12,7 @@ class PurchaseRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/RefundRequestTest.php b/tests/Message/RefundRequestTest.php index 42e3d67..c5d12f4 100644 --- a/tests/Message/RefundRequestTest.php +++ b/tests/Message/RefundRequestTest.php @@ -12,7 +12,7 @@ class RefundRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/ReleaseFromEscrowRequestTest.php b/tests/Message/ReleaseFromEscrowRequestTest.php index cb06d1f..1721310 100644 --- a/tests/Message/ReleaseFromEscrowRequestTest.php +++ b/tests/Message/ReleaseFromEscrowRequestTest.php @@ -12,7 +12,7 @@ class ReleaseFromEscrowRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/ResponseTest.php b/tests/Message/ResponseTest.php index 1a5c7b9..36702be 100644 --- a/tests/Message/ResponseTest.php +++ b/tests/Message/ResponseTest.php @@ -14,7 +14,7 @@ class ResponseTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/SubscriptionResponseTest.php b/tests/Message/SubscriptionResponseTest.php index a3818e7..77c8c11 100644 --- a/tests/Message/SubscriptionResponseTest.php +++ b/tests/Message/SubscriptionResponseTest.php @@ -16,7 +16,7 @@ class SubscriptionResponseTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/UpdateCustomerRequestTest.php b/tests/Message/UpdateCustomerRequestTest.php index 46badf7..f0c100d 100644 --- a/tests/Message/UpdateCustomerRequestTest.php +++ b/tests/Message/UpdateCustomerRequestTest.php @@ -12,7 +12,7 @@ class UpdateCustomerRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/UpdateMerchantAccountRequestTest.php b/tests/Message/UpdateMerchantAccountRequestTest.php index 56a4c0e..4b71e8d 100644 --- a/tests/Message/UpdateMerchantAccountRequestTest.php +++ b/tests/Message/UpdateMerchantAccountRequestTest.php @@ -13,7 +13,7 @@ class UpdateMerchantAccountRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Message/UpdatePaymentMethodRequestTest.php b/tests/Message/UpdatePaymentMethodRequestTest.php index fd6f59b..df40081 100644 --- a/tests/Message/UpdatePaymentMethodRequestTest.php +++ b/tests/Message/UpdatePaymentMethodRequestTest.php @@ -12,7 +12,7 @@ class UpdatePaymentMethodRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $this->request = new UpdatePaymentMethodRequest($this->getHttpClient(), $this->getHttpRequest(), Configuration::gateway()); } diff --git a/tests/Message/VoidRequestTest.php b/tests/Message/VoidRequestTest.php index 6a9b51b..57a6c73 100644 --- a/tests/Message/VoidRequestTest.php +++ b/tests/Message/VoidRequestTest.php @@ -12,7 +12,7 @@ class VoidRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { parent::setUp();