From c48fa0a3b0b7b18c23dee98f5abd3610539bb214 Mon Sep 17 00:00:00 2001 From: Alec Smecher Date: Fri, 6 Oct 2017 08:05:19 -0700 Subject: [PATCH 01/19] #172 Correct variable names in sample code --- src/Message/RestCompletePurchaseRequest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Message/RestCompletePurchaseRequest.php b/src/Message/RestCompletePurchaseRequest.php index b246fce..4603755 100644 --- a/src/Message/RestCompletePurchaseRequest.php +++ b/src/Message/RestCompletePurchaseRequest.php @@ -29,8 +29,8 @@ * * // Once the transaction has been approved, we need to complete it. * $transaction = $gateway->completePurchase(array( - * 'payer_id' => $payer_id, - * 'transactionReference' => $sale_id, + * 'payer_id' => $payerId, + * 'transactionReference' => $paymentId, * )); * $response = $transaction->send(); * if ($response->isSuccessful()) { From 016403c8bb6fc369356efffb99709f10f247b7c4 Mon Sep 17 00:00:00 2001 From: Marco Hillger Date: Fri, 5 Jan 2018 13:39:46 +0100 Subject: [PATCH 02/19] added invoice_number to REST API --- src/Message/RestAuthorizeRequest.php | 1 + tests/ProGatewayTest.php | 2 +- tests/RestGatewayTest.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Message/RestAuthorizeRequest.php b/src/Message/RestAuthorizeRequest.php index 8694df0..19762f9 100644 --- a/src/Message/RestAuthorizeRequest.php +++ b/src/Message/RestAuthorizeRequest.php @@ -230,6 +230,7 @@ public function getData() 'total' => $this->getAmount(), 'currency' => $this->getCurrency(), ), + 'invoice_number' => $this->getTransactionId() ) ), 'experience_profile_id' => $this->getExperienceProfileId() diff --git a/tests/ProGatewayTest.php b/tests/ProGatewayTest.php index cdb05e2..9754836 100644 --- a/tests/ProGatewayTest.php +++ b/tests/ProGatewayTest.php @@ -20,7 +20,7 @@ public function setUp() 'lastName' => 'User', 'number' => '4111111111111111', 'expiryMonth' => '12', - 'expiryYear' => '2017', + 'expiryYear' => date('Y'), 'cvv' => '123', )), ); diff --git a/tests/RestGatewayTest.php b/tests/RestGatewayTest.php index db89871..5df0bea 100644 --- a/tests/RestGatewayTest.php +++ b/tests/RestGatewayTest.php @@ -31,7 +31,7 @@ public function setUp() 'lastName' => 'User', 'number' => '4111111111111111', 'expiryMonth' => '12', - 'expiryYear' => '2017', + 'expiryYear' => date('Y'), 'cvv' => '123', )), ); From 098e1335dcacb6033b28d87d6656e5406a2c46af Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 28 Mar 2018 18:09:54 +0200 Subject: [PATCH 03/19] Upgrade to omnipay/common 3.x --- .travis.yml | 12 +----- composer.json | 11 +++-- grumphp.yml | 15 +++++++ src/Message/AbstractRequest.php | 10 ++--- src/Message/AbstractRestRequest.php | 48 +++++++-------------- src/Message/RestTokenRequest.php | 26 ++++------- tests/ExpressGatewayTest.php | 4 +- tests/Message/RestAuthorizeResponseTest.php | 4 +- tests/Message/RestResponseTest.php | 26 ++++++++--- 9 files changed, 77 insertions(+), 79 deletions(-) create mode 100644 grumphp.yml diff --git a/.travis.yml b/.travis.yml index 77109ff..29b8648 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,8 @@ language: php php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - 7.1 - - hhvm + - 7.2 env: global: @@ -14,11 +10,8 @@ env: matrix: include: - - php: 5.3 + - php: 7.1 env: setup=lowest - dist: precise - - php: 5.5 - env: setup=stable sudo: false @@ -27,7 +20,6 @@ before_install: install: - if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi - - if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable; fi - if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text diff --git a/composer.json b/composer.json index d7e259d..6ed2f7b 100644 --- a/composer.json +++ b/composer.json @@ -27,15 +27,18 @@ "psr-4": { "Omnipay\\PayPal\\" : "src/" } }, "require": { - "omnipay/common": "~2.0" + "omnipay/common": "^3@beta" }, "require-dev": { - "omnipay/tests": "~2.0" + "omnipay/tests": "^3", + "squizlabs/php_codesniffer": "^3", + "phpro/grumphp": "^0.14" }, "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "3.0.x-dev" } }, - "minimum-stability": "dev" + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/grumphp.yml b/grumphp.yml new file mode 100644 index 0000000..4b767a0 --- /dev/null +++ b/grumphp.yml @@ -0,0 +1,15 @@ +parameters: + git_dir: . + bin_dir: vendor/bin + tasks: + phpunit: + config_file: ~ + testsuite: ~ + group: [] + always_execute: false + phpcs: + standard: PSR2 + warning_severity: ~ + ignore_patterns: + - tests/ + triggered_by: [php] \ No newline at end of file diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index 0885093..819fa7a 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -24,11 +24,11 @@ * Account; it also gives the merchant the flexibility to change payment * processors without having to re-do their technical integration. When using * PayPal Payments Pro (Payflow Edition) using Payflow Gateway integration, - * merchants can use Transparent Redirect feature to help manage PCI compliance. + * merchants can use Transparent Redirect feature to help manage PCI compliance. * * @link https://developer.paypal.com/docs/classic/products/payflow-gateway/ * @link https://developer.paypal.com/docs/classic/express-checkout/gs_expresscheckout/ - * @link https://developer.paypal.com/docs/classic/products/ppp-payflow-edition/ + * @link https://developer.paypal.com/docs/classic/products/ppp-payflow-edition/ * @link https://devtools-paypal.com/integrationwizard/ * @link http://paypal.github.io/sdk/ */ @@ -320,11 +320,9 @@ protected function getItemData() public function sendData($data) { - $httpRequest = $this->httpClient->post($this->getEndpoint(), null, http_build_query($data, '', '&')); - $httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35 - $httpResponse = $httpRequest->send(); + $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], http_build_query($data, '', '&')); - return $this->createResponse($httpResponse->getBody()); + return $this->createResponse($httpResponse->getBody()->getContents()); } protected function getEndpoint() diff --git a/src/Message/AbstractRestRequest.php b/src/Message/AbstractRestRequest.php index 19ef31e..f354037 100644 --- a/src/Message/AbstractRestRequest.php +++ b/src/Message/AbstractRestRequest.php @@ -122,39 +122,15 @@ protected function getEndpoint() public function sendData($data) { - // don't throw exceptions for 4xx errors - $this->httpClient->getEventDispatcher()->addListener( - 'request.error', - function ($event) { - if ($event['response']->isClientError()) { - $event->stopPropagation(); - } - } - ); // Guzzle HTTP Client createRequest does funny things when a GET request // has attached data, so don't send the data if the method is GET. if ($this->getHttpMethod() == 'GET') { - $httpRequest = $this->httpClient->createRequest( - $this->getHttpMethod(), - $this->getEndpoint() . '?' . http_build_query($data), - array( - 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . $this->getToken(), - 'Content-type' => 'application/json', - ) - ); + $requestUrl = $this->getEndpoint() . '?' . http_build_query($data); + $body = null; } else { - $httpRequest = $this->httpClient->createRequest( - $this->getHttpMethod(), - $this->getEndpoint(), - array( - 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . $this->getToken(), - 'Content-type' => 'application/json', - ), - $this->toJSON($data) - ); + $body = $this->toJSON($data); + $requestUrl = $this->getEndpoint(); } // Might be useful to have some debug code here, PayPal especially can be @@ -163,11 +139,19 @@ function ($event) { // echo "Data == " . json_encode($data) . "\n"; try { - $httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35 - $httpResponse = $httpRequest->send(); + $httpResponse = $this->httpClient->request( + $this->getHttpMethod(), + $this->getEndpoint(), + array( + 'Accept' => 'application/json', + 'Authorization' => 'Bearer ' . $this->getToken(), + 'Content-type' => 'application/json', + ), + $body + ); // Empty response body should be parsed also as and empty array - $body = $httpResponse->getBody(true); - $jsonToArrayResponse = !empty($body) ? $httpResponse->json() : array(); + $body = (string) $httpResponse->getBody()->getContents(); + $jsonToArrayResponse = !empty($body) ? json_decode($body, true) : array(); return $this->response = $this->createResponse($jsonToArrayResponse, $httpResponse->getStatusCode()); } catch (\Exception $e) { throw new InvalidResponseException( diff --git a/src/Message/RestTokenRequest.php b/src/Message/RestTokenRequest.php index 635cf3e..3d036be 100644 --- a/src/Message/RestTokenRequest.php +++ b/src/Message/RestTokenRequest.php @@ -30,27 +30,19 @@ protected function getEndpoint() public function sendData($data) { - // don't throw exceptions for 4xx errors - $this->httpClient->getEventDispatcher()->addListener( - 'request.error', - function ($event) { - if ($event['response']->isClientError()) { - $event->stopPropagation(); - } - } - ); - - $httpRequest = $this->httpClient->createRequest( + $body = $data ? http_build_query($data, '', '&') : null; + $httpResponse = $this->httpClient->request( $this->getHttpMethod(), $this->getEndpoint(), - array('Accept' => 'application/json'), - $data + array( + 'Accept' => 'application/json', + 'Authorization' => 'Bearer ' . base64_encode("{$this->getClientId()}:{$this->getSecret()}"), + ), + $body ); - - $httpResponse = $httpRequest->setAuth($this->getClientId(), $this->getSecret())->send(); // Empty response body should be parsed also as and empty array - $body = $httpResponse->getBody(true); - $jsonToArrayResponse = !empty($body) ? $httpResponse->json() : array(); + $body = (string) $httpResponse->getBody()->getContents(); + $jsonToArrayResponse = !empty($body) ? json_decode($body, true) : array(); return $this->response = new RestResponse($this, $jsonToArrayResponse, $httpResponse->getStatusCode()); } } diff --git a/tests/ExpressGatewayTest.php b/tests/ExpressGatewayTest.php index 186f692..f8e8f9b 100644 --- a/tests/ExpressGatewayTest.php +++ b/tests/ExpressGatewayTest.php @@ -170,7 +170,7 @@ public function testCompletePurchaseHttpOptions() $response = $this->gateway->completePurchase(array( 'amount' => '10.00', - 'currency' => 'BYR', + 'currency' => 'EUR', ))->send(); $httpRequests = $this->getMockedRequests(); @@ -192,7 +192,7 @@ public function testCompletePurchaseCustomOptions() $response = $this->gateway->completePurchase(array( 'amount' => '10.00', - 'currency' => 'BYR', + 'currency' => 'EUR', 'token' => 'CUSTOM_TOKEN', 'payerid' => 'CUSTOM_PAYERID', ))->send(); diff --git a/tests/Message/RestAuthorizeResponseTest.php b/tests/Message/RestAuthorizeResponseTest.php index 5e1bb20..b3bfee9 100644 --- a/tests/Message/RestAuthorizeResponseTest.php +++ b/tests/Message/RestAuthorizeResponseTest.php @@ -11,7 +11,9 @@ class RestAuthorizeResponseTest extends TestCase public function testRestPurchaseWithoutCardSuccess() { $httpResponse = $this->getMockHttpResponse('RestPurchaseWithoutCardSuccess.txt'); - $response = new RestAuthorizeResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + + $response = new RestAuthorizeResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertTrue($response->isSuccessful()); $this->assertSame('PAY-3TJ47806DA028052TKTQGVYI', $response->getTransactionReference()); diff --git a/tests/Message/RestResponseTest.php b/tests/Message/RestResponseTest.php index c4e4d9d..ce852bb 100644 --- a/tests/Message/RestResponseTest.php +++ b/tests/Message/RestResponseTest.php @@ -9,7 +9,8 @@ class RestResponseTest extends TestCase public function testPurchaseSuccess() { $httpResponse = $this->getMockHttpResponse('RestPurchaseSuccess.txt'); - $response = new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + $response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertTrue($response->isSuccessful()); $this->assertSame('44E89981F8714392Y', $response->getTransactionReference()); @@ -19,7 +20,8 @@ public function testPurchaseSuccess() public function testPurchaseFailure() { $httpResponse = $this->getMockHttpResponse('RestPurchaseFailure.txt'); - $response = new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + $response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertFalse($response->isSuccessful()); $this->assertNull($response->getTransactionReference()); @@ -29,7 +31,9 @@ public function testPurchaseFailure() public function testCompletePurchaseSuccess() { $httpResponse = $this->getMockHttpResponse('RestCompletePurchaseSuccess.txt'); - $response = new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + + $response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertTrue($response->isSuccessful()); $this->assertSame('9EA05739TH369572R', $response->getTransactionReference()); @@ -39,7 +43,9 @@ public function testCompletePurchaseSuccess() public function testCompletePurchaseFailure() { $httpResponse = $this->getMockHttpResponse('RestCompletePurchaseFailure.txt'); - $response = new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + + $response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertFalse($response->isSuccessful()); $this->assertNull($response->getTransactionReference()); @@ -49,7 +55,9 @@ public function testCompletePurchaseFailure() public function testTokenFailure() { $httpResponse = $this->getMockHttpResponse('RestTokenFailure.txt'); - $response = new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + + $response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertFalse($response->isSuccessful()); $this->assertSame('Client secret does not match for this client', $response->getMessage()); @@ -58,7 +66,9 @@ public function testTokenFailure() public function testAuthorizeSuccess() { $httpResponse = $this->getMockHttpResponse('RestAuthorizationSuccess.txt'); - $response = new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + + $response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertTrue($response->isSuccessful()); $this->assertSame('58N7596879166930B', $response->getTransactionReference()); @@ -68,7 +78,9 @@ public function testAuthorizeSuccess() public function testCreateCardSuccess() { $httpResponse = $this->getMockHttpResponse('RestCreateCardSuccess.txt'); - $response = new RestResponse($this->getMockRequest(), $httpResponse->json(), $httpResponse->getStatusCode()); + $data = json_decode($httpResponse->getBody()->getContents(), true); + + $response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode()); $this->assertTrue($response->isSuccessful()); $this->assertSame('CARD-70E78145XN686604FKO3L6OQ', $response->getCardReference()); From 076dd968d31c017879bd0f9d710297deaa7ea940 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 28 Mar 2018 18:15:27 +0200 Subject: [PATCH 04/19] Update readme --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f9c29b6..595f5f9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Total Downloads](https://poser.pugx.org/omnipay/paypal/d/total.png)](https://packagist.org/packages/omnipay/paypal) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment -processing library for PHP 5.3+. This package implements PayPal support for Omnipay. +processing library for PHP. This package implements PayPal support for Omnipay. ## Installation @@ -17,11 +17,14 @@ to your `composer.json` file: ```json { "require": { - "omnipay/paypal": "~2.0" + "omnipay/paypal": "~3.0@dev" } } ``` +> Note: v3 is in development. See the [2.x branch](https://github.com/thephpleague/omnipay-paypal/tree/2.x) for the Omnipay 2.x version. + + And run composer to update your dependencies: $ curl -s http://getcomposer.org/installer | php From 9c0290986411dde790e896f4993a2049fa8adaef Mon Sep 17 00:00:00 2001 From: Tobias Vorwachs Date: Mon, 30 Apr 2018 19:55:19 +0200 Subject: [PATCH 05/19] Allow negativ amount for itens (#198) --- src/Message/AbstractRequest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index 819fa7a..532736c 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -38,6 +38,11 @@ abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest protected $liveEndpoint = 'https://api-3t.paypal.com/nvp'; protected $testEndpoint = 'https://api-3t.sandbox.paypal.com/nvp'; + + /** + * @var bool + */ + protected $negativeAmountAllowed = true; public function getUsername() { From f48c3c82908dae82fcd97e2bebffa2082098db2b Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 14 May 2018 20:58:03 +0200 Subject: [PATCH 06/19] Use expectException instead of setExpectedException --- tests/Message/ExpressAuthorizeRequestTest.php | 27 +++++++------------ .../ExpressInContextAuthorizeRequestTest.php | 21 ++++++--------- .../ExpressTransactionSearchRequestTest.php | 15 +++++------ 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/tests/Message/ExpressAuthorizeRequestTest.php b/tests/Message/ExpressAuthorizeRequestTest.php index 1b9b5fe..60ab238 100644 --- a/tests/Message/ExpressAuthorizeRequestTest.php +++ b/tests/Message/ExpressAuthorizeRequestTest.php @@ -3,6 +3,7 @@ namespace Omnipay\PayPal\Message; use Omnipay\Common\CreditCard; +use Omnipay\Common\Exception\InvalidRequestException; use Omnipay\PayPal\Message\ExpressAuthorizeRequest; use Omnipay\PayPal\Support\InstantUpdateApi\BillingAgreement; use Omnipay\PayPal\Support\InstantUpdateApi\ShippingOption; @@ -306,10 +307,8 @@ public function testDataWithCallbackAndNoDefaultShippingOption() 'shippingOptions' => $shippingOptions, ))); - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'One of the supplied shipping options must be set as default' - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('One of the supplied shipping options must be set as default'); $this->request->getData(); } @@ -321,10 +320,8 @@ public function testNoAmount() $this->request->initialize($baseData); - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'The amount parameter is required' - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('The amount parameter is required'); $this->request->getData(); } @@ -337,10 +334,8 @@ public function testAmountButNoReturnUrl() $this->request->initialize($baseData); - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'The returnUrl parameter is required' - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('The returnUrl parameter is required'); $this->request->getData(); } @@ -368,7 +363,7 @@ public function testBadCallbackConfiguration() // from the docblock on this exception - // Thrown when a request is invalid or missing required fields. // callback has been set but no shipping options so expect one of these: - $this->setExpectedException('\Omnipay\Common\Exception\InvalidRequestException'); + $this->expectException(InvalidRequestException::class); $this->request->getData(); } @@ -413,10 +408,8 @@ public function testGetDataWithBillingAgreementOptionalParameters() */ public function testGetDataWithBillingAgreementWrongPaymentType() { - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - "The 'paymentType' parameter can be only 'Any' or 'InstantOnly'" - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage("The 'paymentType' parameter can be only 'Any' or 'InstantOnly'"); $billingAgreement = new BillingAgreement(false, 'Some Stuff', 'BadType', 'Some custom annotation'); } diff --git a/tests/Message/ExpressInContextAuthorizeRequestTest.php b/tests/Message/ExpressInContextAuthorizeRequestTest.php index 8471fb0..017b0e9 100644 --- a/tests/Message/ExpressInContextAuthorizeRequestTest.php +++ b/tests/Message/ExpressInContextAuthorizeRequestTest.php @@ -3,6 +3,7 @@ namespace Omnipay\PayPal\Message; use Omnipay\Common\CreditCard; +use Omnipay\Common\Exception\InvalidRequestException; use Omnipay\PayPal\Message\ExpressInContextAuthorizeRequest; use Omnipay\PayPal\Support\InstantUpdateApi\ShippingOption; use Omnipay\Tests\TestCase; @@ -305,10 +306,8 @@ public function testDataWithCallbackAndNoDefaultShippingOption() 'shippingOptions' => $shippingOptions, ))); - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'One of the supplied shipping options must be set as default' - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('One of the supplied shipping options must be set as default'); $this->request->getData(); } @@ -320,10 +319,8 @@ public function testNoAmount() $this->request->initialize($baseData); - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'The amount parameter is required' - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('The amount parameter is required'); $this->request->getData(); } @@ -336,10 +333,8 @@ public function testAmountButNoReturnUrl() $this->request->initialize($baseData); - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'The returnUrl parameter is required' - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('The returnUrl parameter is required'); $this->request->getData(); } @@ -367,7 +362,7 @@ public function testBadCallbackConfiguration() // from the docblock on this exception - // Thrown when a request is invalid or missing required fields. // callback has been set but no shipping options so expect one of these: - $this->setExpectedException('\Omnipay\Common\Exception\InvalidRequestException'); + $this->expectException(InvalidRequestException::class); $this->request->getData(); } diff --git a/tests/Message/ExpressTransactionSearchRequestTest.php b/tests/Message/ExpressTransactionSearchRequestTest.php index c0164b5..0d8fd6c 100644 --- a/tests/Message/ExpressTransactionSearchRequestTest.php +++ b/tests/Message/ExpressTransactionSearchRequestTest.php @@ -2,6 +2,7 @@ namespace Omnipay\PayPal\Message; +use Omnipay\Common\Exception\InvalidRequestException; use Omnipay\Tests\TestCase; class ExpressTransactionSearchRequestTest extends TestCase @@ -73,10 +74,8 @@ public function testWithoutStartDate() { $this->request->initialize(array()); - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'The startDate parameter is required' - ); + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('The startDate parameter is required'); $this->request->getData(); } @@ -85,11 +84,9 @@ public function testAmountWithoutCurrency() { $this->request->setStartDate('2015-01-01'); $this->request->setAmount(150.00); - - $this->setExpectedException( - '\Omnipay\Common\Exception\InvalidRequestException', - 'The currency parameter is required' - ); + + $this->expectException(InvalidRequestException::class); + $this->expectExceptionMessage('The currency parameter is required'); $this->request->getData(); } From 477ab94789f8a994f52f63f5a20114aa35328575 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 14 May 2018 21:26:09 +0200 Subject: [PATCH 07/19] Prepare for v3 release --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6ed2f7b..1377e60 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "psr-4": { "Omnipay\\PayPal\\" : "src/" } }, "require": { - "omnipay/common": "^3@beta" + "omnipay/common": "^3" }, "require-dev": { "omnipay/tests": "^3", @@ -39,6 +39,5 @@ "dev-master": "3.0.x-dev" } }, - "minimum-stability": "dev", "prefer-stable": true } From 96152ae0cf4e0942a12d4c3d803437fb2bfe1017 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 14 May 2018 21:27:24 +0200 Subject: [PATCH 08/19] Update readme --- README.md | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 595f5f9..24528a4 100644 --- a/README.md +++ b/README.md @@ -11,24 +11,12 @@ processing library for PHP. This package implements PayPal support for Omnipay. ## Installation -Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it -to your `composer.json` file: - -```json -{ - "require": { - "omnipay/paypal": "~3.0@dev" - } -} -``` - -> Note: v3 is in development. See the [2.x branch](https://github.com/thephpleague/omnipay-paypal/tree/2.x) for the Omnipay 2.x version. - +Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `omnipay/paypal` with Composer: -And run composer to update your dependencies: +``` +composer require omnipay/paypal +``` - $ curl -s http://getcomposer.org/installer | php - $ php composer.phar update ## Basic Usage From 3f6b1cf1aff75c36a3cdced3d21e1c1de0288ac4 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 14 May 2018 21:28:51 +0200 Subject: [PATCH 09/19] Require omnipay itself --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 24528a4..31fcbee 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ processing library for PHP. This package implements PayPal support for Omnipay. ## Installation -Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `omnipay/paypal` with Composer: +Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `omnipay/omnipay` and `omnipay/paypal` with Composer: ``` -composer require omnipay/paypal +composer require omnipay/omnipay omnipay/paypal ``` From 43bc7c28bcc033c81d2897ffc347d848dbd4e484 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Tue, 15 May 2018 09:58:13 +0200 Subject: [PATCH 10/19] V3 allow5.6 (#200) * Allow 5.6 * Set lowest * Remove listener --- .travis.yml | 4 +++- phpunit.xml.dist | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29b8648..3f4469a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: php php: + - 5.6 + - 7.0 - 7.1 - 7.2 @@ -10,7 +12,7 @@ env: matrix: include: - - php: 7.1 + - php: 5.6 env: setup=lowest sudo: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a35b736..535809e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,9 +14,6 @@ ./tests/ - - - ./src From 18186c3f5825721f24c8100b8f7bab8472f6ae1b Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Tue, 15 May 2018 10:32:44 +0200 Subject: [PATCH 11/19] Update namespace --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 31fcbee..5c7823d 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ processing library for PHP. This package implements PayPal support for Omnipay. ## Installation -Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `omnipay/omnipay` and `omnipay/paypal` with Composer: +Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `league/omnipay` and `omnipay/paypal` with Composer: ``` -composer require omnipay/omnipay omnipay/paypal +composer require league/omnipay omnipay/paypal ``` From 519db61b32ff0c1e56cbec94762b970ee9674f65 Mon Sep 17 00:00:00 2001 From: Martin van de Belt Date: Tue, 15 May 2018 18:35:58 +0800 Subject: [PATCH 12/19] Authentication fix for getting a REST gateway access token (#201) --- src/Message/RestTokenRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Message/RestTokenRequest.php b/src/Message/RestTokenRequest.php index 3d036be..b368f5a 100644 --- a/src/Message/RestTokenRequest.php +++ b/src/Message/RestTokenRequest.php @@ -36,7 +36,7 @@ public function sendData($data) $this->getEndpoint(), array( 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . base64_encode("{$this->getClientId()}:{$this->getSecret()}"), + 'Authorization' => 'Basic ' . base64_encode("{$this->getClientId()}:{$this->getSecret()}"), ), $body ); From 57274ccf6f653740e2cc5b0859c2e40f08205de7 Mon Sep 17 00:00:00 2001 From: Martin Beukman Date: Thu, 7 Feb 2019 09:53:11 +0100 Subject: [PATCH 13/19] add webhooks functionality (#213) --- src/Message/RestCreateWebhookRequest.php | 66 +++++++ src/Message/RestListWebhooksRequest.php | 37 ++++ .../RestVerifyWebhookSignatureRequest.php | 170 ++++++++++++++++++ .../RestVerifyWebhookSignatureResponse.php | 31 ++++ src/RestGateway.php | 33 ++++ .../Message/RestCreateWebhookRequestTest.php | 60 +++++++ tests/Message/RestListWebhooksRequestTest.php | 30 ++++ .../RestVerifyWebhookSignatureRequestTest.php | 63 +++++++ ...RestVerifyWebhookSignatureResponseTest.php | 49 +++++ tests/RestGatewayTest.php | 45 ++++- 10 files changed, 582 insertions(+), 2 deletions(-) create mode 100644 src/Message/RestCreateWebhookRequest.php create mode 100755 src/Message/RestListWebhooksRequest.php create mode 100644 src/Message/RestVerifyWebhookSignatureRequest.php create mode 100644 src/Message/RestVerifyWebhookSignatureResponse.php create mode 100644 tests/Message/RestCreateWebhookRequestTest.php create mode 100644 tests/Message/RestListWebhooksRequestTest.php create mode 100644 tests/Message/RestVerifyWebhookSignatureRequestTest.php create mode 100644 tests/Message/RestVerifyWebhookSignatureResponseTest.php diff --git a/src/Message/RestCreateWebhookRequest.php b/src/Message/RestCreateWebhookRequest.php new file mode 100644 index 0000000..24842ef --- /dev/null +++ b/src/Message/RestCreateWebhookRequest.php @@ -0,0 +1,66 @@ + \array_map( + function ($value) { + return ['name' => $value]; + }, + $this->getEventTypes() + ), + 'url' => $this->getUrl(), + ]; + } + + /** + * @return array + */ + public function getEventTypes() + { + return $this->getParameter('event_types') ?: []; + } + + /** + * @inheritDoc + */ + public function getEndpoint() + { + return parent::getEndpoint().'/notifications/webhooks'; + } + + /** + * @return string|null + */ + public function getUrl() + { + return $this->getParameter('webhook_url'); + } + + /** + * @param array $eventTypes + * + * @return $this + */ + public function setEventTypes(array $eventTypes) + { + return $this->setParameter('event_types', $eventTypes); + } + + /** + * @param string $url + * + * @return $this + */ + public function setUrl($url) + { + return $this->setParameter('webhook_url', $url); + } +} diff --git a/src/Message/RestListWebhooksRequest.php b/src/Message/RestListWebhooksRequest.php new file mode 100755 index 0000000..30a67a0 --- /dev/null +++ b/src/Message/RestListWebhooksRequest.php @@ -0,0 +1,37 @@ +getParameter('auth_algo'); + } + + /** + * @return string + */ + public function getCertUrl() + { + return $this->getParameter('cert_url'); + } + + /** + * @inheritDoc + */ + public function getData() + { + return [ + 'transmission_id' => $this->getTransmissionId(), + 'auth_algo' => $this->getAuthAlgo(), + 'cert_url' => $this->getCertUrl(), + 'transmission_sig' => $this->getTransmissionSig(), + 'transmission_time' => $this->getTransmissionTime(), + 'webhook_event' => $this->getWebhookEvent(), + 'webhook_id' => $this->getWebhookId(), + ]; + } + + /** + * @inheritDoc + */ + public function getEndpoint() + { + return parent::getEndpoint().'/notifications/verify-webhook-signature'; + } + + /** + * @return string + */ + public function getTransmissionId() + { + return $this->getParameter('transmission_id'); + } + + /** + * @return string + */ + public function getTransmissionSig() + { + return $this->getParameter('transmission_sig'); + } + + /** + * @return string + */ + public function getTransmissionTime() + { + return $this->getParameter('transmission_time'); + } + + /** + * @return string + */ + public function getWebhookEvent() + { + return $this->getParameter('webhook_event'); + } + + /** + * @return string + */ + public function getWebhookId() + { + return $this->getParameter('webhook_id'); + } + + /** + * @param string $authAlgo + * + * @return $this + */ + public function setAuthAlgo($authAlgo) + { + return $this->setParameter('auth_algo', $authAlgo); + } + + /** + * @param string $certUrl + * + * @return $this + */ + public function setCertUrl($certUrl) + { + return $this->setParameter('cert_url', $certUrl); + } + + /** + * @param string $transmissionId + * + * @return $this + */ + public function setTransmissionId($transmissionId) + { + return $this->setParameter('transmission_id', $transmissionId); + } + + /** + * @param string $transmissionSig + * + * @return $this + */ + public function setTransmissionSig($transmissionSig) + { + return $this->setParameter('transmission_sig', $transmissionSig); + } + + /** + * @param string $transmissionTime + * + * @return $this + */ + public function setTransmissionTime($transmissionTime) + { + return $this->setParameter('transmission_time', $transmissionTime); + } + + /** + * @param array $webhookEvent + * + * @return $this + */ + public function setWebhookEvent(array $webhookEvent) + { + return $this->setParameter('webhook_event', $webhookEvent); + } + + /** + * @param string $webhookId + * + * @return $this + */ + public function setWebhookId($webhookId) + { + return $this->setParameter('webhook_id', $webhookId); + } + + /** + * @param $data + * @param $statusCode + * + * @return RestVerifyWebhookSignatureResponse + */ + protected function createResponse($data, $statusCode) + { + return $this->response = new RestVerifyWebhookSignatureResponse($this, $data, $statusCode); + } +} diff --git a/src/Message/RestVerifyWebhookSignatureResponse.php b/src/Message/RestVerifyWebhookSignatureResponse.php new file mode 100644 index 0000000..96d54d3 --- /dev/null +++ b/src/Message/RestVerifyWebhookSignatureResponse.php @@ -0,0 +1,31 @@ +getVerificationStatus(); + } + + /** + * The status of the signature verification. Value is `SUCCESS` or `FAILURE`. + * + * @return string + */ + public function getVerificationStatus() + { + return $this->data['verification_status']; + } +} diff --git a/src/RestGateway.php b/src/RestGateway.php index 7013053..d6ae4f3 100644 --- a/src/RestGateway.php +++ b/src/RestGateway.php @@ -9,6 +9,9 @@ use Omnipay\PayPal\Message\ProAuthorizeRequest; use Omnipay\PayPal\Message\CaptureRequest; use Omnipay\PayPal\Message\RefundRequest; +use Omnipay\PayPal\Message\RestCreateWebhookRequest; +use Omnipay\PayPal\Message\RestListWebhooksRequest; +use Omnipay\PayPal\Message\RestVerifyWebhookSignatureRequest; /** * PayPal Pro Class using REST API @@ -416,6 +419,16 @@ public function completePurchase(array $parameters = array()) return $this->createRequest('\Omnipay\PayPal\Message\RestCompletePurchaseRequest', $parameters); } + /** + * @param array $parameters + * + * @return RestCreateWebhookRequest + */ + public function createWebhook(array $parameters = []) + { + return $this->createRequest(RestCreateWebhookRequest::class, $parameters); + } + // TODO: Update a payment resource https://developer.paypal.com/docs/api/#update-a-payment-resource // @@ -710,6 +723,26 @@ public function searchTransaction(array $parameters = array()) return $this->createRequest('\Omnipay\PayPal\Message\RestSearchTransactionRequest', $parameters); } + /** + * @param array $parameters + * + * @return RestListWebhooksRequest + */ + public function listWebhooks(array $parameters = []) + { + return $this->createRequest(RestListWebhooksRequest::class, $parameters); + } + + /** + * @param array $parameters + * + * @return RestVerifyWebhookSignatureRequest + */ + public function verifyWebhookSignature(array $parameters = []) + { + return $this->createRequest(RestVerifyWebhookSignatureRequest::class, $parameters); + } + // TODO: Update an agreement // TODO: Retrieve an agreement // TODO: Set outstanding agreement amounts diff --git a/tests/Message/RestCreateWebhookRequestTest.php b/tests/Message/RestCreateWebhookRequestTest.php new file mode 100644 index 0000000..8ab06fd --- /dev/null +++ b/tests/Message/RestCreateWebhookRequestTest.php @@ -0,0 +1,60 @@ +getHttpClient(); + $request = $this->getHttpRequest(); + $this->request = new RestCreateWebhookRequest($client, $request); + } + + public function testGetData() + { + $event1 = 'PAYMENT.AUTHORIZATION.CREATED'; + $event2 = 'PAYMENT.AUTHORIZATION.VOIDED'; + $url = 'https://foo.bar/baz'; + $this->request->initialize( + [ + 'event_types' => [$event1, $event2], + 'url' => $url, + ] + ); + + $this->assertEquals( + [ + 'event_types' => [['name' => $event1], ['name' => $event2]], + 'url' => $url, + ], + $this->request->getData() + ); + } + + public function testGetEndpoint() + { + $this->assertStringEndsWith('/notifications/webhooks', $this->request->getEndpoint()); + } + + public function testGetEventTypes() + { + $value = ['PAYMENT.AUTHORIZATION.CREATED']; + $this->request->setEventTypes($value); + self::assertSame($value, $this->request->getEventTypes()); + } + + public function testGetUrl() + { + $value = 'https://foo.bar/baz'; + $this->request->setUrl($value); + self::assertSame($value, $this->request->getUrl()); + } +} diff --git a/tests/Message/RestListWebhooksRequestTest.php b/tests/Message/RestListWebhooksRequestTest.php new file mode 100644 index 0000000..7e822c8 --- /dev/null +++ b/tests/Message/RestListWebhooksRequestTest.php @@ -0,0 +1,30 @@ +getHttpClient(); + $request = $this->getHttpRequest(); + $this->request = new RestListWebhooksRequest($client, $request); + } + + public function testEndpoint() + { + $this->assertStringEndsWith('/notifications/webhooks', $this->request->getEndpoint()); + } + + public function testGetData() + { + $this->assertEmpty($this->request->getData()); + } +} diff --git a/tests/Message/RestVerifyWebhookSignatureRequestTest.php b/tests/Message/RestVerifyWebhookSignatureRequestTest.php new file mode 100644 index 0000000..629d2d6 --- /dev/null +++ b/tests/Message/RestVerifyWebhookSignatureRequestTest.php @@ -0,0 +1,63 @@ +getHttpClient(); + $request = $this->getHttpRequest(); + $this->request = new RestVerifyWebhookSignatureRequest($client, $request); + } + + public function testGetData() + { + $data = [ + 'transmission_id' => 'foo', + 'auth_algo' => 'bar', + 'cert_url' => 'baz', + 'transmission_sig' => 'qux', + 'transmission_time' => 'foobar', + 'webhook_event' => ['bar' => 'baz'], + 'webhook_id' => 'barbaz', + ]; + + $this->request->initialize($data); + + $this->assertEquals($data, $this->request->getData()); + } + + public function testGettersAndSetters() { + $authAlgo = 'foo'; + $certUrl = 'bar'; + $transmissionId = 'baz'; + $transmissionTime = 'qux'; + $transmissionSig = 'foobar'; + $webhookEvent = ['bar' => 'baz']; + $webhookId = 'barfoo'; + + $this->request->setAuthAlgo($authAlgo); + $this->request->setCertUrl($certUrl); + $this->request->setTransmissionId($transmissionId); + $this->request->setTransmissionTime($transmissionTime); + $this->request->setTransmissionSig($transmissionSig); + $this->request->setWebhookEvent($webhookEvent); + $this->request->setWebhookId($webhookId); + + $this->assertEquals($authAlgo, $this->request->getAuthAlgo()); + $this->assertEquals($certUrl,$this->request->getCertUrl()); + $this->assertEquals($transmissionId, $this->request->getTransmissionId()); + $this->assertEquals($transmissionTime, $this->request->getTransmissionTime()); + $this->assertEquals($transmissionSig, $this->request->getTransmissionSig()); + $this->assertEquals($webhookEvent, $this->request->getWebhookEvent()); + $this->assertEquals($webhookId, $this->request->getWebhookId()); + } +} diff --git a/tests/Message/RestVerifyWebhookSignatureResponseTest.php b/tests/Message/RestVerifyWebhookSignatureResponseTest.php new file mode 100644 index 0000000..a9a1e87 --- /dev/null +++ b/tests/Message/RestVerifyWebhookSignatureResponseTest.php @@ -0,0 +1,49 @@ +getMockRequest(), + ['verification_status' => 'SUCCESS'] + ); + + $this->assertSame('SUCCESS', $response->getVerificationStatus()); + } + + public function testIsSuccessfulWillReturnFalseIfParentCheckIsSuccesfullButVerificationFailed() + { + $response = new RestVerifyWebhookSignatureResponse( + $this->getMockRequest(), + ['verification_status' => 'FAILED'] + ); + + $this->assertFalse($response->isSuccessful()); + } + + public function testIsSuccessfulWillReturnFalseIfParentCheckIsUnsuccesfull() + { + $response = new RestVerifyWebhookSignatureResponse( + $this->getMockRequest(), + ['verification_status' => 'foobar'], + 400 + ); + + $this->assertFalse($response->isSuccessful()); + } + + public function testIsSuccessfulWillReturnTrueIfEverythingIsOk() + { + $response = new RestVerifyWebhookSignatureResponse( + $this->getMockRequest(), + ['verification_status' => 'SUCCESS'] + ); + + $this->assertTrue($response->isSuccessful()); + } +} diff --git a/tests/RestGatewayTest.php b/tests/RestGatewayTest.php index 5df0bea..dbfa1f7 100644 --- a/tests/RestGatewayTest.php +++ b/tests/RestGatewayTest.php @@ -2,8 +2,11 @@ namespace Omnipay\PayPal; -use Omnipay\Tests\GatewayTestCase; use Omnipay\Common\CreditCard; +use Omnipay\PayPal\Message\RestCreateWebhookRequest; +use Omnipay\PayPal\Message\RestListWebhooksRequest; +use Omnipay\PayPal\Message\RestVerifyWebhookSignatureRequest; +use Omnipay\Tests\GatewayTestCase; class RestGatewayTest extends GatewayTestCase { @@ -218,6 +221,15 @@ public function testCreateCard() $this->assertNull($response->getMessage()); } + public function testCreateWebhook() + { + $request = $this->gateway->createWebhook([]); + + $this->assertInstanceOf(RestCreateWebhookRequest::class, $request); + $this->assertSame('https://api.paypal.com/v1/notifications/webhooks', $request->getEndpoint()); + $this->assertEquals(['event_types' => [], 'url' => null], $request->getData()); + } + public function testPayWithSavedCard() { $this->setMockHttpResponse('RestCreateCardSuccess.txt'); @@ -277,7 +289,7 @@ public function testRefundCapture() $this->assertSame('abc123', $request->getTransactionReference()); $endPoint = $request->getEndpoint(); $this->assertSame('https://api.paypal.com/v1/payments/capture/abc123/refund', $endPoint); - + $request->setAmount('15.99'); $request->setCurrency('BRL'); $request->setDescription('Test Description'); @@ -300,4 +312,33 @@ public function testVoid() $data = $request->getData(); $this->assertEmpty($data); } + + public function testListWebhooks() + { + $request = $this->gateway->listWebhooks([]); + + $this->assertInstanceOf(RestListWebhooksRequest::class, $request); + $this->assertSame('https://api.paypal.com/v1/notifications/webhooks', $request->getEndpoint()); + $this->assertEmpty($request->getData()); + } + + public function testVerifyWebhook() + { + $request = $this->gateway->verifyWebhookSignature([]); + + $this->assertInstanceOf(RestVerifyWebhookSignatureRequest::class, $request); + $this->assertSame('https://api.paypal.com/v1/notifications/verify-webhook-signature', $request->getEndpoint()); + $this->assertEquals( + [ + 'transmission_id' => null, + 'auth_algo' => null, + 'cert_url' => null, + 'transmission_sig' => null, + 'transmission_time' => null, + 'webhook_event' => null, + 'webhook_id' => null, + ], + $request->getData() + ); + } } From 2028cc68b49a8c023f5a411fbaa61eef58e78851 Mon Sep 17 00:00:00 2001 From: Frank Verhoeven Date: Mon, 4 Mar 2019 15:14:13 +0100 Subject: [PATCH 14/19] Adds content to the success message 'mock' (#225) --- tests/Mock/RestGenericSubscriptionSuccess.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Mock/RestGenericSubscriptionSuccess.txt b/tests/Mock/RestGenericSubscriptionSuccess.txt index e099ab1..dc0ec05 100644 --- a/tests/Mock/RestGenericSubscriptionSuccess.txt +++ b/tests/Mock/RestGenericSubscriptionSuccess.txt @@ -5,3 +5,5 @@ Paypal-Debug-Id: 217a9ddefd384 SERVER_INFO: identitysecuretokenserv:v1.oauth2.token&CalThreadId=91&TopLevelTxnStartTime=146fbfe679a&Host=slcsbidensectoken502.slc.paypal.com&pid=29059 CORRELATION-ID: 217a9ddefd384 Date: Thu, 03 Jul 2014 11:31:32 GMT + +{} From b500e0b17648958414df88e6cbc32cc2b341f1c2 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 5 Mar 2019 09:34:12 +1300 Subject: [PATCH 15/19] Add support for referrer code to Rest Gateway (#226) Referrer code is otherwise called BNCode or partner attribution id in paypal-land. I chose referrer code as something generic https://developer.paypal.com/docs/integration/direct/payments/# --- src/Message/AbstractRestRequest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Message/AbstractRestRequest.php b/src/Message/AbstractRestRequest.php index f354037..db8fcd1 100644 --- a/src/Message/AbstractRestRequest.php +++ b/src/Message/AbstractRestRequest.php @@ -62,6 +62,24 @@ abstract class AbstractRestRequest extends \Omnipay\Common\Message\AbstractReque */ protected $payerId = null; + protected $referrerCode; + + /** + * @return string + */ + public function getReferrerCode() + { + return $this->referrerCode; + } + + /** + * @param string $referrerCode + */ + public function setReferrerCode($referrerCode) + { + $this->referrerCode = $referrerCode; + } + public function getClientId() { return $this->getParameter('clientId'); @@ -146,6 +164,7 @@ public function sendData($data) 'Accept' => 'application/json', 'Authorization' => 'Bearer ' . $this->getToken(), 'Content-type' => 'application/json', + 'PayPal-Partner-Attribution-Id' => $this->getReferrerCode(), ), $body ); From dbd850839b63a1aa9d5aaae4f6d710d1cd3f0e84 Mon Sep 17 00:00:00 2001 From: Marco Hillger Date: Wed, 15 Jan 2020 11:33:47 +0100 Subject: [PATCH 16/19] allow negative items for REST API (#231) --- src/Message/AbstractRestRequest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Message/AbstractRestRequest.php b/src/Message/AbstractRestRequest.php index db8fcd1..8a9dbe0 100644 --- a/src/Message/AbstractRestRequest.php +++ b/src/Message/AbstractRestRequest.php @@ -64,6 +64,11 @@ abstract class AbstractRestRequest extends \Omnipay\Common\Message\AbstractReque protected $referrerCode; + /** + * @var bool + */ + protected $negativeAmountAllowed = true; + /** * @return string */ From 93e55fc7f9865994da5684d04889e1cd7fa06a0f Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 31 Oct 2022 15:34:58 +0100 Subject: [PATCH 17/19] Test on GH Actions (#260) * Test on GH Actions * Update composer.json * Update composer.json * Fix tests * Update run-tests.yml * Update run-tests.yml * Update run-tests.yml * Update composer.json --- .github/workflows/run-tests.yml | 47 +++++++++++++++++++ composer.json | 11 +++-- tests/ExpressGatewayTest.php | 2 +- tests/ExpressInContextGatewayTest.php | 2 +- tests/Message/CaptureRequestTest.php | 2 +- tests/Message/ExpressAuthorizeRequestTest.php | 2 +- .../ExpressCompleteAuthorizeRequestTest.php | 2 +- .../ExpressCompletePurchaseRequestTest.php | 2 +- .../ExpressFetchCheckoutRequestTest.php | 2 +- .../ExpressInContextAuthorizeRequestTest.php | 2 +- .../ExpressTransactionSearchRequestTest.php | 2 +- tests/Message/ExpressVoidRequestTest.php | 2 +- tests/Message/FetchTransactionRequestTest.php | 2 +- tests/Message/ProAuthorizeRequestTest.php | 2 +- tests/Message/ProPurchaseRequestTest.php | 2 +- tests/Message/RefundRequestTest.php | 2 +- tests/Message/RestAuthorizeRequestTest.php | 2 +- .../RestCancelSubscriptionRequestTest.php | 2 +- .../RestCompletePurchaseRequestTest.php | 2 +- .../RestCompleteSubscriptionRequestTest.php | 2 +- tests/Message/RestCreateCardRequestTest.php | 2 +- tests/Message/RestCreatePlanRequestTest.php | 2 +- .../RestCreateSubscriptionRequestTest.php | 2 +- .../Message/RestCreateWebhookRequestTest.php | 2 +- tests/Message/RestDeleteCardRequestTest.php | 2 +- .../Message/RestFetchPurchaseRequestTest.php | 2 +- .../RestFetchTransactionRequestTest.php | 2 +- tests/Message/RestListPlanRequestTest.php | 2 +- tests/Message/RestListWebhooksRequestTest.php | 2 +- .../RestReactivateSubscriptionRequestTest.php | 2 +- .../RestSearchTransactionRequestTest.php | 2 +- .../RestSuspendSubscriptionRequestTest.php | 2 +- tests/Message/RestUpdatePlanRequestTest.php | 2 +- .../RestVerifyWebhookSignatureRequestTest.php | 2 +- tests/ProGatewayTest.php | 2 +- tests/RestGatewayTest.php | 2 +- 36 files changed, 89 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..e9229c0 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,47 @@ +name: Unit Tests + +on: + push: + branches: + - master + pull_request: + branches: + - "*" + schedule: + - cron: '0 0 * * *' + +jobs: + php-tests: + runs-on: ubuntu-latest + timeout-minutes: 15 + env: + COMPOSER_NO_INTERACTION: 1 + + strategy: + matrix: + php: [8.1, 8.0, 7.4, 7.3, 7.2] + dependency-version: [prefer-lowest, prefer-stable] + + name: P${{ matrix.php }} - ${{ matrix.dependency-version }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: composer:v2 + + - name: Install dependencies + run: | + composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress + + - name: Execute Unit Tests + run: composer test + + - name: Check Code Style + run: composer check-style + if: ${{ matrix.dependency-version == 'prefer-stable' }} diff --git a/composer.json b/composer.json index 1377e60..100c82d 100644 --- a/composer.json +++ b/composer.json @@ -27,17 +27,22 @@ "psr-4": { "Omnipay\\PayPal\\" : "src/" } }, "require": { + "php": "^7.2|^8.0", "omnipay/common": "^3" }, "require-dev": { - "omnipay/tests": "^3", - "squizlabs/php_codesniffer": "^3", - "phpro/grumphp": "^0.14" + "omnipay/tests": "^4.1.2", + "squizlabs/php_codesniffer": "^3" }, "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } }, + "scripts": { + "test": "phpunit", + "check-style": "phpcs -p --standard=PSR2 src/", + "fix-style": "phpcbf -p --standard=PSR2 src/" + }, "prefer-stable": true } diff --git a/tests/ExpressGatewayTest.php b/tests/ExpressGatewayTest.php index f8e8f9b..9721f4a 100644 --- a/tests/ExpressGatewayTest.php +++ b/tests/ExpressGatewayTest.php @@ -21,7 +21,7 @@ class ExpressGatewayTest extends GatewayTestCase */ protected $voidOptions; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/ExpressInContextGatewayTest.php b/tests/ExpressInContextGatewayTest.php index b1a0b79..cfc5f86 100644 --- a/tests/ExpressInContextGatewayTest.php +++ b/tests/ExpressInContextGatewayTest.php @@ -21,7 +21,7 @@ class ExpressInContextGatewayTest extends GatewayTestCase */ protected $voidOptions; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/CaptureRequestTest.php b/tests/Message/CaptureRequestTest.php index 104ebd6..f68f8f8 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 { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/ExpressAuthorizeRequestTest.php b/tests/Message/ExpressAuthorizeRequestTest.php index 60ab238..e3913d8 100644 --- a/tests/Message/ExpressAuthorizeRequestTest.php +++ b/tests/Message/ExpressAuthorizeRequestTest.php @@ -16,7 +16,7 @@ class ExpressAuthorizeRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/ExpressCompleteAuthorizeRequestTest.php b/tests/Message/ExpressCompleteAuthorizeRequestTest.php index a2f8c27..f61090e 100644 --- a/tests/Message/ExpressCompleteAuthorizeRequestTest.php +++ b/tests/Message/ExpressCompleteAuthorizeRequestTest.php @@ -12,7 +12,7 @@ class ExpressCompleteAuthorizeRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); diff --git a/tests/Message/ExpressCompletePurchaseRequestTest.php b/tests/Message/ExpressCompletePurchaseRequestTest.php index 87345a2..fb8de02 100644 --- a/tests/Message/ExpressCompletePurchaseRequestTest.php +++ b/tests/Message/ExpressCompletePurchaseRequestTest.php @@ -12,7 +12,7 @@ class ExpressCompletePurchaseRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); diff --git a/tests/Message/ExpressFetchCheckoutRequestTest.php b/tests/Message/ExpressFetchCheckoutRequestTest.php index 8d94e1c..5b85df5 100644 --- a/tests/Message/ExpressFetchCheckoutRequestTest.php +++ b/tests/Message/ExpressFetchCheckoutRequestTest.php @@ -12,7 +12,7 @@ class ExpressFetchCheckoutRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); diff --git a/tests/Message/ExpressInContextAuthorizeRequestTest.php b/tests/Message/ExpressInContextAuthorizeRequestTest.php index 017b0e9..a5cb73f 100644 --- a/tests/Message/ExpressInContextAuthorizeRequestTest.php +++ b/tests/Message/ExpressInContextAuthorizeRequestTest.php @@ -15,7 +15,7 @@ class ExpressInContextAuthorizeRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/ExpressTransactionSearchRequestTest.php b/tests/Message/ExpressTransactionSearchRequestTest.php index 0d8fd6c..ec8191d 100644 --- a/tests/Message/ExpressTransactionSearchRequestTest.php +++ b/tests/Message/ExpressTransactionSearchRequestTest.php @@ -12,7 +12,7 @@ class ExpressTransactionSearchRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/ExpressVoidRequestTest.php b/tests/Message/ExpressVoidRequestTest.php index 91f8a05..2fc4130 100644 --- a/tests/Message/ExpressVoidRequestTest.php +++ b/tests/Message/ExpressVoidRequestTest.php @@ -12,7 +12,7 @@ class ExpressVoidRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/FetchTransactionRequestTest.php b/tests/Message/FetchTransactionRequestTest.php index 8ac7873..642ed44 100644 --- a/tests/Message/FetchTransactionRequestTest.php +++ b/tests/Message/FetchTransactionRequestTest.php @@ -12,7 +12,7 @@ class FetchTransactionRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); diff --git a/tests/Message/ProAuthorizeRequestTest.php b/tests/Message/ProAuthorizeRequestTest.php index 6e9af31..5767694 100644 --- a/tests/Message/ProAuthorizeRequestTest.php +++ b/tests/Message/ProAuthorizeRequestTest.php @@ -12,7 +12,7 @@ class ProAuthorizeRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/ProPurchaseRequestTest.php b/tests/Message/ProPurchaseRequestTest.php index 9f88c10..d406a2d 100644 --- a/tests/Message/ProPurchaseRequestTest.php +++ b/tests/Message/ProPurchaseRequestTest.php @@ -12,7 +12,7 @@ class ProPurchaseRequestTest 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 036f6d2..4604b7d 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 { $client = $this->getHttpClient(); diff --git a/tests/Message/RestAuthorizeRequestTest.php b/tests/Message/RestAuthorizeRequestTest.php index 5f0f962..89f1b56 100644 --- a/tests/Message/RestAuthorizeRequestTest.php +++ b/tests/Message/RestAuthorizeRequestTest.php @@ -12,7 +12,7 @@ class RestAuthorizeRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/RestCancelSubscriptionRequestTest.php b/tests/Message/RestCancelSubscriptionRequestTest.php index 7d6397d..4ebaa34 100644 --- a/tests/Message/RestCancelSubscriptionRequestTest.php +++ b/tests/Message/RestCancelSubscriptionRequestTest.php @@ -10,7 +10,7 @@ class RestCancelSubscriptionRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestCancelSubscriptionRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestCompletePurchaseRequestTest.php b/tests/Message/RestCompletePurchaseRequestTest.php index 4dfbf98..bad9162 100644 --- a/tests/Message/RestCompletePurchaseRequestTest.php +++ b/tests/Message/RestCompletePurchaseRequestTest.php @@ -14,7 +14,7 @@ class RestCompletePurchaseRequestTest extends TestCase private $request; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/RestCompleteSubscriptionRequestTest.php b/tests/Message/RestCompleteSubscriptionRequestTest.php index 9c014f8..b72ac55 100644 --- a/tests/Message/RestCompleteSubscriptionRequestTest.php +++ b/tests/Message/RestCompleteSubscriptionRequestTest.php @@ -10,7 +10,7 @@ class RestCompleteSubscriptionRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestCompleteSubscriptionRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestCreateCardRequestTest.php b/tests/Message/RestCreateCardRequestTest.php index 0574a0d..8e6d6df 100644 --- a/tests/Message/RestCreateCardRequestTest.php +++ b/tests/Message/RestCreateCardRequestTest.php @@ -13,7 +13,7 @@ class RestCreateCardRequestTest extends TestCase /** @var CreditCard */ protected $card; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/RestCreatePlanRequestTest.php b/tests/Message/RestCreatePlanRequestTest.php index b6a50b2..d1159cf 100644 --- a/tests/Message/RestCreatePlanRequestTest.php +++ b/tests/Message/RestCreatePlanRequestTest.php @@ -10,7 +10,7 @@ class RestCreatePlanRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestCreatePlanRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestCreateSubscriptionRequestTest.php b/tests/Message/RestCreateSubscriptionRequestTest.php index 2ae9cd5..dc8e894 100644 --- a/tests/Message/RestCreateSubscriptionRequestTest.php +++ b/tests/Message/RestCreateSubscriptionRequestTest.php @@ -10,7 +10,7 @@ class RestCreateSubscriptionRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestCreateSubscriptionRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestCreateWebhookRequestTest.php b/tests/Message/RestCreateWebhookRequestTest.php index 8ab06fd..c4b92c2 100644 --- a/tests/Message/RestCreateWebhookRequestTest.php +++ b/tests/Message/RestCreateWebhookRequestTest.php @@ -11,7 +11,7 @@ final class RestCreateWebhookRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestDeleteCardRequestTest.php b/tests/Message/RestDeleteCardRequestTest.php index e17620a..90cd68d 100644 --- a/tests/Message/RestDeleteCardRequestTest.php +++ b/tests/Message/RestDeleteCardRequestTest.php @@ -13,7 +13,7 @@ class RestDeleteCardRequestTest extends TestCase /** @var CreditCard */ private $card; - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/Message/RestFetchPurchaseRequestTest.php b/tests/Message/RestFetchPurchaseRequestTest.php index 8bf27d9..e4c8c55 100644 --- a/tests/Message/RestFetchPurchaseRequestTest.php +++ b/tests/Message/RestFetchPurchaseRequestTest.php @@ -9,7 +9,7 @@ class RestFetchPurchaseRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestFetchPurchaseRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestFetchTransactionRequestTest.php b/tests/Message/RestFetchTransactionRequestTest.php index 9ba5a38..0623265 100644 --- a/tests/Message/RestFetchTransactionRequestTest.php +++ b/tests/Message/RestFetchTransactionRequestTest.php @@ -9,7 +9,7 @@ class RestFetchTransactionRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestFetchTransactionRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestListPlanRequestTest.php b/tests/Message/RestListPlanRequestTest.php index ba1867e..4a99fef 100644 --- a/tests/Message/RestListPlanRequestTest.php +++ b/tests/Message/RestListPlanRequestTest.php @@ -9,7 +9,7 @@ class RestListPlanRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestListPlanRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestListWebhooksRequestTest.php b/tests/Message/RestListWebhooksRequestTest.php index 7e822c8..e5e5d1f 100644 --- a/tests/Message/RestListWebhooksRequestTest.php +++ b/tests/Message/RestListWebhooksRequestTest.php @@ -11,7 +11,7 @@ final class RestListWebhooksRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestReactivateSubscriptionRequestTest.php b/tests/Message/RestReactivateSubscriptionRequestTest.php index c8301f4..0f8571e 100644 --- a/tests/Message/RestReactivateSubscriptionRequestTest.php +++ b/tests/Message/RestReactivateSubscriptionRequestTest.php @@ -10,7 +10,7 @@ class RestReactivateSubscriptionRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestReactivateSubscriptionRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestSearchTransactionRequestTest.php b/tests/Message/RestSearchTransactionRequestTest.php index e66b200..ab7ffd5 100644 --- a/tests/Message/RestSearchTransactionRequestTest.php +++ b/tests/Message/RestSearchTransactionRequestTest.php @@ -10,7 +10,7 @@ class RestSearchTransactionRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestSearchTransactionRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestSuspendSubscriptionRequestTest.php b/tests/Message/RestSuspendSubscriptionRequestTest.php index 19d88fc..6cda5ed 100644 --- a/tests/Message/RestSuspendSubscriptionRequestTest.php +++ b/tests/Message/RestSuspendSubscriptionRequestTest.php @@ -10,7 +10,7 @@ class RestSuspendSubscriptionRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestSuspendSubscriptionRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestUpdatePlanRequestTest.php b/tests/Message/RestUpdatePlanRequestTest.php index a682f15..1b12f6c 100644 --- a/tests/Message/RestUpdatePlanRequestTest.php +++ b/tests/Message/RestUpdatePlanRequestTest.php @@ -10,7 +10,7 @@ class RestUpdatePlanRequestTest extends TestCase /** @var \Omnipay\PayPal\Message\RestUpdatePlanRequest */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RestVerifyWebhookSignatureRequestTest.php b/tests/Message/RestVerifyWebhookSignatureRequestTest.php index 629d2d6..b61b1d8 100644 --- a/tests/Message/RestVerifyWebhookSignatureRequestTest.php +++ b/tests/Message/RestVerifyWebhookSignatureRequestTest.php @@ -11,7 +11,7 @@ final class RestVerifyWebhookSignatureRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp() : void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/ProGatewayTest.php b/tests/ProGatewayTest.php index 9754836..76c7938 100644 --- a/tests/ProGatewayTest.php +++ b/tests/ProGatewayTest.php @@ -7,7 +7,7 @@ class ProGatewayTest extends GatewayTestCase { - public function setUp() + public function setUp() : void { parent::setUp(); diff --git a/tests/RestGatewayTest.php b/tests/RestGatewayTest.php index dbfa1f7..9febb27 100644 --- a/tests/RestGatewayTest.php +++ b/tests/RestGatewayTest.php @@ -19,7 +19,7 @@ class RestGatewayTest extends GatewayTestCase /** @var array */ public $subscription_options; - public function setUp() + public function setUp() : void { parent::setUp(); From 10d01e9875350af8214c6ad24d1c46757d3a6563 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 31 Oct 2022 15:35:09 +0100 Subject: [PATCH 18/19] Delete .travis.yml --- .travis.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3f4469a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: php - -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - -env: - global: - - setup=basic - -matrix: - include: - - php: 5.6 - env: setup=lowest - -sudo: false - -before_install: - - travis_retry composer self-update - -install: - - if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi - - if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi - -script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text From 67c96faa173124b4517989c2d6f1d1915afa0d27 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 31 Oct 2022 15:35:48 +0100 Subject: [PATCH 19/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c7823d..8d70713 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **PayPal driver for the Omnipay PHP payment processing library** -[![Build Status](https://travis-ci.org/thephpleague/omnipay-paypal.png?branch=master)](https://travis-ci.org/thephpleague/omnipay-paypal) +[![Unit Tests](https://github.com/thephpleague/omnipay-paypal/actions/workflows/run-tests.yml/badge.svg)](https://github.com/thephpleague/omnipay-paypal/actions/workflows/run-tests.yml) [![Latest Stable Version](https://poser.pugx.org/omnipay/paypal/version.png)](https://packagist.org/packages/omnipay/paypal) [![Total Downloads](https://poser.pugx.org/omnipay/paypal/d/total.png)](https://packagist.org/packages/omnipay/paypal)