Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367797 )

Change subject: Merge branch 'master' into deployment
......................................................................

Merge branch 'master' into deployment

3a61cbf Curl Wrapper fix and use provider config
28035b9 Implement HostedCheckout
8da42bf Get HostedCheckout and Payment Status
55b029d Fix PayPal EC recurring profile created messages

Change-Id: I27a4514b3e92655f08893bca7f86ca252ba91b62
---
D PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response
D PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response
D PaymentProviders/Ingenico/Tests/Data/paymentStatus.response
D PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
D PaymentProviders/Ingenico/Tests/phpunit/HostedCheckoutProviderTest.php
D PaymentProviders/Ingenico/Tests/phpunit/IdealStatusProviderTest.php
D PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
D 
PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
D Tests/BaseSmashPigUnitTestCase.php
9 files changed, 0 insertions(+), 510 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/97/367797/1

diff --git a/PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response 
b/PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response
deleted file mode 100644
index 9d35135..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response
+++ /dev/null
@@ -1,51 +0,0 @@
-HTTP/1.1 200 OK
-Date: Mon, 30 Jan 2017 17:58:02 GMT
-Server: Apache/2.4.16 (Unix) OpenSSL/1.0.1t
-X-Powered-By: Servlet/3.0 JSP/2.2
-Transfer-Encoding: chunked
-Content-Type: application/json
-
-{
-  "createdPaymentOutput": {
-    "payment": {
-      "id": "000000891566072501680000200001",
-      "paymentOutput": {
-        "amountOfMoney": {
-          "amount": 2345,
-          "currencyCode": "USD"
-        },
-        "references": {
-          "paymentReference": "0"
-        },
-        "paymentMethod": "card",
-        "cardPaymentMethodSpecificOutput": {
-          "paymentProductId": 1,
-          "authorisationCode": "123456",
-          "card": {
-            "cardNumber": "************7977",
-            "expiryDate": "1220"
-          },
-          "fraudResults": {
-            "avsResult": "0",
-            "cvvResult": "M",
-            "fraudServiceResult": "no-advice"
-          }
-        }
-      },
-      "status": "PENDING_APPROVAL",
-      "statusOutput": {
-        "isCancellable": true,
-        "statusCode": 600,
-        "statusCodeChangeDateTime": "20140717145840",
-        "isAuthorized": true
-      }
-    },
-    "paymentCreationReferences": {
-      "additionalReference": "00000089156607250168",
-      "externalReference": "000000891566072501680000200001"
-    },
-    "tokens": ""
-  },
-  "status": "PAYMENT_CREATED"
-}
-
diff --git a/PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response 
b/PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response
deleted file mode 100644
index 15723b9..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response
+++ /dev/null
@@ -1,12 +0,0 @@
-HTTP/1.1 200 OK
-Date: Mon, 30 Jan 2017 17:58:02 GMT
-Server: Apache/2.4.16 (Unix) OpenSSL/1.0.1t
-X-Powered-By: Servlet/3.0 JSP/2.2
-Transfer-Encoding: chunked
-Content-Type: application/json
-
-{
-  "partialRedirectUrl": 
"poweredbyglobalcollect.com/pay8915-53ebca407e6b4a1dbd086aad4f10354d:8915-28e5b79c889641c8ba770f1ba576c1fe:9798f4c44ac6406e8288494332d1daa0",
-  "hostedCheckoutId": "8915-28e5b79c889641c8ba770f1ba576c1fe",
-  "RETURNMAC": "f5b66cf9-c64c-4c8d-8171-b47205c89a56"
-}
diff --git a/PaymentProviders/Ingenico/Tests/Data/paymentStatus.response 
b/PaymentProviders/Ingenico/Tests/Data/paymentStatus.response
deleted file mode 100644
index 216a1cb..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/paymentStatus.response
+++ /dev/null
@@ -1,43 +0,0 @@
-HTTP/1.1 200 OK
-Date: Mon, 30 Jan 2017 17:58:02 GMT
-Server: Apache/2.4.16 (Unix) OpenSSL/1.0.1t
-X-Powered-By: Servlet/3.0 JSP/2.2
-Transfer-Encoding: chunked
-Content-Type: application/json
-
-{
-  "id": "000000850010000188180000200001",
-  "paymentOutput":
-  {
-    "amountOfMoney":
-    {
-      "amount": 100,
-      "currencyCode": "EUR"
-    },
-    "references": {
-      "merchantReference": "AcmeOrder0001",
-      "paymentReference": "0"
-    },
-    "paymentMethod": "card",
-    "cardPaymentMethodSpecificOutput": {
-      "paymentProductId": 1,
-      "authorisationCode": "726747",
-      "card": {
-        "cardNumber": "************7977",
-        "expiryDate": "1220"
-      },
-      "fraudResults": {
-        "avsResult": "0",
-        "cvvResult": "0",
-        "fraudServiceResult": "no-advice"
-      }
-    }
-  },
-  "status": "PENDING_APPROVAL",
-  "statusOutput": {
-    "isCancellable": true,
-    "statusCode": 600,
-    "statusCodeChangeDateTime": "20140630154921",
-    "isAuthorized": true
-  }
-}
diff --git 
a/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
deleted file mode 100644
index f80a1e2..0000000
--- a/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<<<<<<< HEAD   (523d6d Merge branch 'master' into deployment)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Ingenico\Tests;
-
-use PHPUnit_Framework_MockObject_MockObject;
-use Psr\Cache\CacheItemPoolInterface;
-use SmashPig\Core\Cache\HashCacheItem;
-use SmashPig\Core\Context;
-use SmashPig\PaymentProviders\Ingenico\BankPaymentProvider;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Ingenico
- */
-class BankPaymentProviderTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $curlWrapper;
-
-       /**
-        * @var BankPaymentProvider
-        */
-       protected $provider;
-
-       /**
-        * @var CacheItemPoolInterface
-        */
-       protected $cache;
-
-       public function setUp() {
-               parent::setUp();
-
-               $this->setProviderConfiguration( 'ingenico' );
-
-               $globalConfig = Context::get()->getGlobalConfiguration();
-               $this->cache = $globalConfig->object( 'cache', true );
-               $this->cache->clear();
-
-               $this->provider = new BankPaymentProvider( array(
-                       'cache-parameters' => array(
-                               'duration' => 10,
-                               'key-base' => 'BLAH_BLAH'
-                       )
-               ) );
-       }
-
-       public function testGetBankList() {
-               $this->setUpResponse( __DIR__ . 
'/../Data/productDirectory.response', 200 );
-               $results = $this->provider->getBankList( 'NL', 'EUR' );
-               $this->assertEquals(
-                       array(
-                               'INGBNL2A' => 'Issuer Simulation V3 - ING'
-                       ),
-                       $results
-               );
-       }
-
-       public function testCacheBankList() {
-               $this->setUpResponse( __DIR__  . 
'/../Data/productDirectory.response', 200 );
-               $this->curlWrapper->expects( $this->once() )
-                       ->method( 'execute' );
-               $results = $this->provider->getBankList( 'NL', 'EUR' );
-               $this->assertEquals(
-                       array(
-                               'INGBNL2A' => 'Issuer Simulation V3 - ING'
-                       ),
-                       $results
-               );
-               $cachedResults = $this->provider->getBankList( 'NL', 'EUR' );
-               $this->assertEquals( $results, $cachedResults );
-       }
-
-       /**
-        * When the lookup returns 404 we should cache the emptiness
-        */
-       public function testCacheEmptyBankList() {
-               $this->setUpResponse( __DIR__ . 
'/../Data/emptyDirectory.response', 404 );
-               $this->curlWrapper->expects( $this->once() )
-                       ->method( 'execute' );
-               $results = $this->provider->getBankList( 'NL', 'COP' );
-               $this->assertEquals( array(), $results );
-               $cached = $this->cache->getItem( 'BLAH_BLAH_NL_COP_809' );
-               $this->assertTrue( $cached->isHit() );
-               $again = $this->provider->getBankList( 'NL', 'COP' );
-               $this->assertEquals( $results, $again );
-       }
-
-       public function testBustedCacheExpiration() {
-               $cacheItem = new HashCacheItem(
-                       'BLAH_BLAH_NL_EUR_809',
-                       array(
-                               'value' => array( 'STALE' => 'NotValid' ),
-                               'expiration' => time() - 100
-                       ),
-                       true
-               );
-               $this->cache->save( $cacheItem );
-               $this->setUpResponse( __DIR__ . 
'/../Data/productDirectory.response', 200 );
-               $this->curlWrapper->expects( $this->once() )
-                       ->method( 'execute' );
-               $results = $this->provider->getBankList( 'NL', 'EUR' );
-               $this->assertEquals(
-                       array(
-                               'INGBNL2A' => 'Issuer Simulation V3 - ING'
-                       ),
-                       $results
-               );
-       }
-}
->>>>>>> BRANCH (55b029 Fix PayPal EC recurring profile created messages)
diff --git 
a/PaymentProviders/Ingenico/Tests/phpunit/HostedCheckoutProviderTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/HostedCheckoutProviderTest.php
deleted file mode 100644
index 96c52bb..0000000
--- a/PaymentProviders/Ingenico/Tests/phpunit/HostedCheckoutProviderTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-namespace SmashPig\PaymentProviders\Ingenico\Tests;
-
-use PHPUnit_Framework_MockObject_MockObject;
-use SmashPig\PaymentProviders\Ingenico\HostedCheckoutProvider;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Ingenico
- */
-class HostedCheckoutProviderTest extends BaseSmashPigUnitTestCase {
-       /**
-        * @var HostedCheckoutProvider
-        */
-       protected $provider;
-
-       public function setUp(){
-               parent::setUp();
-               $this->setProviderConfiguration( 'ingenico' );
-               $this->provider = new HostedCheckoutProvider(array('subdomain' 
=> 'payments.test'));
-       }
-
-       public function testCreateHostedPayment() {
-               $params = array(
-                       array(
-                       "hostedCheckoutSpecificInput" => array(
-                               "locale" => "en_GB",
-                               "variant" => "testVariant"
-                               ),
-                       ),
-                       "order" => array(
-                               "amountOfMoney" => array(
-                                       "currencyCode" => "USD",
-                                       "amount" => 2345
-                               ),
-                               "customer" => array(
-                                       "billingAddress" => array(
-                                               "countryCode" => "US"
-                                       )
-                               )
-                       )
-               );
-               $expectedResponse = array(
-                       "partialRedirectUrl" => 
"poweredbyglobalcollect.com/pay8915-53ebca407e6b4a1dbd086aad4f10354d:8915-28e5b79c889641c8ba770f1ba576c1fe:9798f4c44ac6406e8288494332d1daa0",
-                       "hostedCheckoutId" => 
"8915-28e5b79c889641c8ba770f1ba576c1fe",
-                       "RETURNMAC" => "f5b66cf9-c64c-4c8d-8171-b47205c89a56"
-               );
-               $this->setUpResponse(__Dir__ . 
'/../Data/newHostedCheckout.response', 200);
-               $this->curlWrapper->expects( $this->once() )
-                       ->method( 'execute' )->with(
-                               
$this->equalTo('https://api-sandbox.globalcollect.com/v1/1234/hostedcheckouts'),
-                               $this->equalTo('POST')
-                       );
-               $response = $this->provider->createHostedPayment($params);
-               $this->assertEquals($expectedResponse, $response);
-       }
-
-       public function testGetHostedPaymentUrl() {
-               $partialRedirectUrl = 
"poweredbyglobalcollect.com/pay8915-53ebca407e6b4a1dbd086aad4f10354d:8915-28e5b79c889641c8ba770f1ba576c1fe";
-               $hostedPaymentUrl = 
$this->provider->getHostedPaymentUrl($partialRedirectUrl);
-               $expectedUrl = 'https://payments.test.' . $partialRedirectUrl;
-               $this->assertEquals($expectedUrl, $hostedPaymentUrl);
-       }
-
-       public function testGetHostedPaymentStatus(){
-               $hostedPaymentId = '8915-28e5b79c889641c8ba770f1ba576c1fe';
-               $this->setUpResponse(__DIR__ . 
"/../Data/hostedPaymentStatus.response", 200);
-               $this->curlWrapper->expects( $this->once() )
-                       ->method( 'execute' )->with(
-                               
$this->equalTo("https://api-sandbox.globalcollect.com/v1/1234/hostedcheckouts/$hostedPaymentId";),
-                               $this->equalTo('GET')
-                       );
-               $response = 
$this->provider->getHostedPaymentStatus($hostedPaymentId);
-               $this->assertEquals('PAYMENT_CREATED', $response['status']);
-
-       }
-}
diff --git 
a/PaymentProviders/Ingenico/Tests/phpunit/IdealStatusProviderTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/IdealStatusProviderTest.php
deleted file mode 100644
index 40aa0d0..0000000
--- a/PaymentProviders/Ingenico/Tests/phpunit/IdealStatusProviderTest.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<<<<<<< HEAD   (523d6d Merge branch 'master' into deployment)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Ingenico\Tests;
-
-use PHPUnit_Framework_MockObject_MockObject;
-use Psr\Cache\CacheItemPoolInterface;
-use SmashPig\Core\Context;
-use SmashPig\Core\Http\CurlWrapper;
-use SmashPig\PaymentProviders\Ingenico\IdealStatusProvider;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Ingenico
- */
-class IdealStatusProviderTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $curlWrapper;
-
-       /**
-        * @var IdealStatusProvider
-        */
-       protected $provider;
-
-       /**
-        * @var CacheItemPoolInterface
-        */
-       protected $cache;
-
-       public function setUp() {
-               parent::setUp();
-
-               $providerConfiguration = $this->setProviderConfiguration( 
'ingenico' );
-               $this->curlWrapper = $this->getMock( 
'\SmashPig\Core\Http\CurlWrapper' );
-               $providerConfiguration->overrideObjectInstance( 'curl/wrapper', 
$this->curlWrapper );
-
-               $globalConfig = Context::get()->getGlobalConfiguration();
-               $this->cache = $globalConfig->object( 'cache', true );
-               $this->cache->clear();
-
-               $this->provider = new IdealStatusProvider( array(
-                       'cache-parameters' => array(
-                               'duration' => 10,
-                               'key' => 'BLAH_BLAH'
-                       ),
-                       'availability-url' => 
'http://example.org/undocumented/api/GetIssuers'
-               ) );
-               $this->setUpResponse(__DIR__ . 
"/../Data/availability.response", 200);
-       }
-
-       public function testGetBankStatus() {
-               $results = $this->provider->getBankStatus();
-               $this->assertEquals(
-                       array(
-                               'ABNANL2A' => array(
-                                       'name' => 'ABN AMRO',
-                                       'availability' => '40',
-                               ),
-                               'INGBNL2A' => array(
-                                       'name' => 'Issuer Simulation V3 - ING',
-                                       'availability' => '100',
-                               )
-                       ),
-                       $results
-               );
-       }
-
-       public function testCacheBankStatus() {
-               $this->curlWrapper->expects( $this->once() )
-                       ->method( 'execute' );
-               $results = $this->provider->getBankStatus();
-               $this->assertEquals(
-                       array(
-                               'ABNANL2A' => array(
-                                       'name' => 'ABN AMRO',
-                                       'availability' => '40',
-                               ),
-                               'INGBNL2A' => array(
-                                       'name' => 'Issuer Simulation V3 - ING',
-                                       'availability' => '100',
-                               )
-                       ),
-                       $results
-               );
-               $cachedResults = $this->provider->getBankStatus();
-               $this->assertEquals( $results, $cachedResults );
-       }
-}
->>>>>>> BRANCH (55b029 Fix PayPal EC recurring profile created messages)
diff --git 
a/PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
deleted file mode 100644
index eaa54a6..0000000
--- a/PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-namespace SmashPig\PaymentProviders\Ingenico\Tests;
-
-use PHPUnit_Framework_MockObject_MockObject;
-use SmashPig\PaymentProviders\Ingenico\IngenicoPaymentProvider;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Ingenico
- */
-class IngenicoPaymentProviderTest extends BaseSmashPigUnitTestCase {
-       /**
-        * @var PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $provider;
-
-       public function setUp() {
-               parent::setUp();
-               $this->setProviderConfiguration( 'ingenico' );
-               $this->provider = 
$this->getMockForAbstractClass('\SmashPig\PaymentProviders\Ingenico\IngenicoPaymentProvider');
-       }
-
-       public function testGetPaymentStatus(){
-               $paymentId = '000000850010000188180000200001';
-               $this->setUpResponse(__DIR__ . 
'/../Data/paymentStatus.response', 200);
-               $this->curlWrapper->expects( $this->once() )
-                       ->method( 'execute' )->with(
-                               
$this->equalTo("https://api-sandbox.globalcollect.com/v1/1234/payments/$paymentId";),
-                               $this->equalTo('GET')
-                       );
-               $response = $this->provider->getPaymentStatus($paymentId);
-               $this->assertEquals($paymentId, $response['id']);
-       }
-}
\ No newline at end of file
diff --git 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
deleted file mode 100644
index 3d41894..0000000
--- 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
+++ /dev/null
@@ -1,24 +0,0 @@
-<<<<<<< HEAD   (523d6d Merge branch 'master' into deployment)
-=======
-{
-  "subscr_id": "I-88J1M3DLSF0",
-  "txn_type": "subscr_signup",
-  "contribution_tracking_id": "47017286",
-  "order_id": "47017286",
-  "email": "do...@generous.net",
-  "first_name": "Fezziwig",
-  "middle_name": "",
-  "last_name": "Fowl",
-  "frequency_interval": "1",
-  "frequency_unit": "month",
-  "installments": 0,
-  "country": "US",
-  "create_date": 1492533928,
-  "start_date": 1492533928,
-  "date": 1492533928,
-  "gateway": "paypal_ec",
-  "recurring": "1",
-  "gross": "140",
-  "currency": "JPY"
-}
->>>>>>> BRANCH (55b029 Fix PayPal EC recurring profile created messages)
diff --git a/Tests/BaseSmashPigUnitTestCase.php 
b/Tests/BaseSmashPigUnitTestCase.php
deleted file mode 100644
index f2e1a2e..0000000
--- a/Tests/BaseSmashPigUnitTestCase.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<<<<<<< HEAD   (523d6d Merge branch 'master' into deployment)
-=======
-<?php
-namespace SmashPig\Tests;
-
-use SmashPig\Core\Context;
-use SmashPig\Core\Http\CurlWrapper;
-use PHPUnit_Framework_TestCase;
-
-class BaseSmashPigUnitTestCase extends PHPUnit_Framework_TestCase {
-       /**
-        * @var PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $curlWrapper;
-
-       public function setUp() {
-               parent::setUp();
-               $globalConfig = TestingGlobalConfiguration::create();
-               TestingContext::init( $globalConfig );
-               $this->curlWrapper = $this->getMock( 
'\SmashPig\Core\Http\CurlWrapper' );
-               // TODO: create tables for all dbs/queues.
-               // Standard issue CurlWrapper mock would be nice too
-       }
-
-       public function tearDown() {
-               Context::set(); // Nullify the context for next run.
-       }
-
-       /**
-        * @param string $filepath Full path to file representing a
-        *  response (headers, blank line, body), which must use dos-style
-        *  \r\n line endings.
-        * @param integer $statusCode
-        */
-       protected function setUpResponse( $filepath, $statusCode ) {
-               $contents = file_get_contents( $filepath );
-               $header_size = strpos($contents, "\r\n\r\n") + 4;
-               $parsed = CurlWrapper::parseResponse(
-                       $contents, array( 'http_code' => $statusCode, 
'header_size' => $header_size)
-               );
-               $this->curlWrapper->method( 'execute' )->willReturn( $parsed );
-       }
-
-
-       protected function loadJson( $path ) {
-               return json_decode( file_get_contents( $path ), true );
-       }
-
-       /**
-        * @param $provider
-        * @return TestingProviderConfiguration
-        */
-       protected function setProviderConfiguration( $provider ) {
-               $ctx = Context::get();
-               $globalConfig = $ctx->getGlobalConfiguration();
-               $config = TestingProviderConfiguration::createForProvider( 
$provider, $globalConfig );
-               $ctx->setProviderConfiguration( $config );
-               $config->overrideObjectInstance( 'curl/wrapper', 
$this->curlWrapper );
-               return $config;
-       }
-}
->>>>>>> BRANCH (55b029 Fix PayPal EC recurring profile created messages)

-- 
To view, visit https://gerrit.wikimedia.org/r/367797
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I27a4514b3e92655f08893bca7f86ca252ba91b62
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg <ej...@ejegg.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to