Ejegg has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/372412 )
Change subject: Merge branch 'master' into deployment
......................................................................
Merge branch 'master' into deployment
8d356a3 Ingenico WX audit parsing
c188e2e Add AuditParser interface, other audit cleanup
0bc903e Ingenico WX audit: flag recurring transactions
d6124ce Fix 'Only variables should be passed by reference'
7d4fa8f Update config documentation in README
ed95063 Approve and Cancel payment
Change-Id: I59773bb398665f75e6e8e7aac9224ea1c9525ebe
---
D PaymentProviders/Amazon/Tests/phpunit/AuditTest.php
D PaymentProviders/Ingenico/Tests/Data/chargeback.xml.gz
D PaymentProviders/Ingenico/Tests/Data/donation.xml.gz
D PaymentProviders/Ingenico/Tests/Data/paymentApproved.response
D PaymentProviders/Ingenico/Tests/Data/paymentCanceled.response
D PaymentProviders/Ingenico/Tests/Data/recurring.xml.gz
D PaymentProviders/Ingenico/Tests/Data/refund.xml.gz
D PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
D PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
9 files changed, 0 insertions(+), 352 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig
refs/changes/12/372412/1
diff --git a/PaymentProviders/Amazon/Tests/phpunit/AuditTest.php
b/PaymentProviders/Amazon/Tests/phpunit/AuditTest.php
deleted file mode 100644
index cc9529c..0000000
--- a/PaymentProviders/Amazon/Tests/phpunit/AuditTest.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<<<<<<< HEAD (c501f5 Merge branch 'master' into deployment)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Amazon\Tests;
-
-use SmashPig\Core\Context;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-use SmashPig\PaymentProviders\Amazon\Audit\AmazonAudit;
-
-/**
- * Verify Amazon audit file processor functions
- */
-class AuditTest extends BaseSmashPigUnitTestCase {
- public function setUp() {
- parent::setUp();
- $ctx = Context::get();
- $config = AmazonTestConfiguration::instance(
$ctx->getGlobalConfiguration() );
- $ctx->setProviderConfiguration( $config );
- }
-
- /**
- * Normal donation
- */
- public function testProcessDonation() {
- $processor = new AmazonAudit();
- $output = $processor->parseFile( __DIR__ .
'/../Data/audit/2015-10-01-SETTLEMENT_DATA_371273040777777.csv' );
- $this->assertEquals( 1, count( $output ), 'Should have found
one donation' );
- $actual = $output[0];
- $expected = array(
- 'gateway' => 'amazon',
- 'date' => 1443723034,
- 'gross' => '10.00',
- 'contribution_tracking_id' => '87654321',
- 'currency' => 'USD',
- 'gateway_txn_id' => 'P01-1488694-1234567-C034811',
- 'log_id' => '87654321-0',
- 'payment_method' => 'amazon',
- 'fee' => '0.59',
- );
- $this->assertEquals( $expected, $actual, 'Did not parse
donation correctly' );
- }
-
- /**
- * Now try a refund
- */
- public function testProcessRefund() {
- $processor = new AmazonAudit();
- $output = $processor->parseFile( __DIR__ .
'/../Data/audit/2015-10-06-REFUND_DATA_414749300022222.csv' );
- $this->assertEquals( 1, count( $output ), 'Should have found
one refund' );
- $actual = $output[0];
- $expected = array(
- 'gateway' => 'amazon',
- 'date' => 1444087249,
- 'gross' => '1.00',
- 'gateway_parent_id' => 'P01-4968629-7654321-C070794',
- 'gross_currency' => 'USD',
- 'type' => 'refund',
- 'gateway_refund_id' => 'P01-4968629-7654321-R017571',
- );
- $this->assertEquals( $expected, $actual, 'Did not parse refund
correctly' );
- }
-
- /**
- * And a chargeback
- */
- public function testProcessChargeback() {
- $processor = new AmazonAudit();
- $output = $processor->parseFile( __DIR__ .
'/../Data/audit/2015-10-06-REFUND_DATA_414749300033333.csv' );
- $this->assertEquals( 1, count( $output ), 'Should have found
one chargeback' );
- $actual = $output[0];
- $expected = array(
- 'gateway' => 'amazon',
- 'date' => 1444087249,
- 'gross' => '1.00',
- 'gateway_parent_id' => 'P01-4968629-2345678-C070794',
- 'gross_currency' => 'USD',
- 'gateway_refund_id' => 'P01-4968629-2345678-R017571',
- 'type' => 'chargeback',
- );
- $this->assertEquals( $expected, $actual, 'Did not parse
chargeback correctly' );
- }
-}
->>>>>>> BRANCH (b6c543 Merge "Approve and Cancel payment")
diff --git a/PaymentProviders/Ingenico/Tests/Data/chargeback.xml.gz
b/PaymentProviders/Ingenico/Tests/Data/chargeback.xml.gz
deleted file mode 100644
index b38a947..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/chargeback.xml.gz
+++ /dev/null
Binary files differ
diff --git a/PaymentProviders/Ingenico/Tests/Data/donation.xml.gz
b/PaymentProviders/Ingenico/Tests/Data/donation.xml.gz
deleted file mode 100644
index ebb1109..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/donation.xml.gz
+++ /dev/null
Binary files differ
diff --git a/PaymentProviders/Ingenico/Tests/Data/paymentApproved.response
b/PaymentProviders/Ingenico/Tests/Data/paymentApproved.response
deleted file mode 100644
index ac311f9..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/paymentApproved.response
+++ /dev/null
@@ -1,42 +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
-
-{
- "payment": {
- "id": "000000850010000188180000200001",
- "paymentOutput": {
- "amountOfMoney": {
- "amount": 2890,
- "currencyCode": "EUR"
- },
- "references": {
- "paymentReference": "0"
- },
- "paymentMethod": "card",
- "cardPaymentMethodSpecificOutput": {
- "paymentProductId": 1,
- "authorisationCode": "123456",
- "card": {
- "cardNumber": "************7977",
- "expiryDate": "1220"
- },
- "fraudResults": {
- "avsResult": "0",
- "cvvResult": "M",
- "fraudServiceResult": "no-advice"
- }
- }
- },
- "status": "CAPTURE_REQUESTED",
- "statusOutput": {
- "isCancellable": false,
- "statusCode": 800,
- "statusCodeChangeDateTime": "20140627140735",
- "isAuthorized": true
- }
- }
-}
\ No newline at end of file
diff --git a/PaymentProviders/Ingenico/Tests/Data/paymentCanceled.response
b/PaymentProviders/Ingenico/Tests/Data/paymentCanceled.response
deleted file mode 100644
index b64fe66..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/paymentCanceled.response
+++ /dev/null
@@ -1,45 +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
-
-{
- "payment": {
- "id": "000000850010000188180000200001",
- "paymentOutput": {
- "amountOfMoney": {
- "amount": 2890,
- "currencyCode": "EUR"
- },
- "references": {
- "merchantReference": "merchantReference",
- "paymentReference": "0"
- },
- "paymentMethod": "card",
- "cardPaymentMethodSpecificOutput": {
- "paymentProductId": 1,
- "authorisationCode": "726747",
- "card": {
- "cardNumber": "************7977",
- "expiryDate": "1220"
- },
- "fraudResults": {
- "avsResult": "0",
- "cvvResult": "0",
- "fraudServiceResult": "no-advice"
- }
- }
- },
- "status": "CANCELLED",
- "statusOutput": {
- "isCancellable": false,
- "statusCode": 99999,
- "statusCodeChangeDateTime": "20150223153431"
- }
- },
- "cardPaymentMethodSpecificOutput": {
- "voidResponseId": "0"
- }
-}
diff --git a/PaymentProviders/Ingenico/Tests/Data/recurring.xml.gz
b/PaymentProviders/Ingenico/Tests/Data/recurring.xml.gz
deleted file mode 100644
index 72f441c..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/recurring.xml.gz
+++ /dev/null
Binary files differ
diff --git a/PaymentProviders/Ingenico/Tests/Data/refund.xml.gz
b/PaymentProviders/Ingenico/Tests/Data/refund.xml.gz
deleted file mode 100644
index 8fc709c..0000000
--- a/PaymentProviders/Ingenico/Tests/Data/refund.xml.gz
+++ /dev/null
Binary files differ
diff --git a/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
b/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
deleted file mode 100644
index 5b68013..0000000
--- a/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-
-namespace SmashPig\PaymentProviders\Ingenico\Tests;
-
-use SmashPig\PaymentProviders\Ingenico\Audit\IngenicoAudit;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Audit
- * @group Ingenico
- */
-class AuditTest extends BaseSmashPigUnitTestCase {
- /**
- * Normal donation
- */
- public function testProcessDonation() {
- $processor = new IngenicoAudit();
- $output = $processor->parseFile( __DIR__ .
'/../Data/donation.xml.gz' );
- $this->assertEquals( 1, count( $output ), 'Should have found
one donation' );
- $actual = $output[0];
- $expected = array(
- 'gateway' => 'globalcollect', // TODO: switch to
ingenico for Connect
- 'gross' => 3.00,
- 'contribution_tracking_id' => '5551212',
- 'currency' => 'USD',
- 'order_id' => '987654321',
- 'installment' => 1,
- 'gateway_txn_id' => '987654321',
- 'payment_method' => 'cc',
- 'payment_submethod' => 'visa',
- 'date' => 1501368968,
- 'user_ip' => '111.222.33.44',
- 'first_name' => 'Arthur',
- 'last_name' => 'Aardvark',
- 'street_address' => '1111 Fake St',
- 'city' => 'Denver',
- 'country' => 'US',
- 'email' => '[email protected]',
- );
- $this->assertEquals( $expected, $actual, 'Did not parse
donation correctly' );
- }
-
- /**
- * Recurring donation
- */
- public function testProcessRecurring() {
- $processor = new IngenicoAudit();
- $output = $processor->parseFile( __DIR__ .
'/../Data/recurring.xml.gz' );
- $this->assertEquals( 1, count( $output ), 'Should have found
one recurring donation' );
- $actual = $output[0];
- $expected = array(
- 'gateway' => 'globalcollect', // TODO: switch to
ingenico for Connect
- 'gross' => 3.00,
- 'contribution_tracking_id' => '5551212',
- 'currency' => 'USD',
- 'order_id' => '987654321',
- 'installment' => 3,
- 'recurring' => 1,
- 'gateway_txn_id' => '987654321',
- 'payment_method' => 'cc',
- 'payment_submethod' => 'visa',
- 'date' => 1501368968,
- 'user_ip' => '111.222.33.44',
- 'first_name' => 'Arthur',
- 'last_name' => 'Aardvark',
- 'street_address' => '1111 Fake St',
- 'city' => 'Denver',
- 'country' => 'US',
- 'email' => '[email protected]',
- );
- $this->assertEquals( $expected, $actual, 'Did not parse
donation correctly' );
- }
-
- /**
- * Now try a refund
- */
- public function testProcessRefund() {
- $processor = new IngenicoAudit();
- $output = $processor->parseFile( __DIR__ .
'/../Data/refund.xml.gz' );
- $this->assertEquals( 1, count( $output ), 'Should have found
one refund' );
- $actual = $output[0];
- $expected = array(
- 'gateway' => 'globalcollect', // TODO: switch to
ingenico for Connect
- 'contribution_tracking_id' => '5551212',
- 'date' => 1500942220,
- 'gross' => 100,
- 'gateway_parent_id' => '123456789',
- 'installment' => 1,
- 'gross_currency' => 'USD',
- 'type' => 'refund',
- );
- $this->assertEquals( $expected, $actual, 'Did not parse refund
correctly' );
- }
-
- /**
- * And a chargeback
- */
- public function testProcessChargeback() {
- $processor = new IngenicoAudit();
- $output = $processor->parseFile( __DIR__ .
'/../Data/chargeback.xml.gz' );
- $this->assertEquals( 1, count( $output ), 'Should have found
one chargeback' );
- $actual = $output[0];
- $expected = array(
- 'gateway' => 'globalcollect', // TODO: switch to
ingenico for Connect
- 'contribution_tracking_id' => '5551212',
- 'date' => 1495023569,
- 'gross' => 200,
- 'gateway_parent_id' => '5167046621',
- 'installment' => 1,
- 'gross_currency' => 'USD',
- 'type' => 'chargeback',
- );
- $this->assertEquals( $expected, $actual, 'Did not parse
chargeback correctly' );
- }
-}
diff --git
a/PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
b/PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
deleted file mode 100644
index 564496c..0000000
--- a/PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<<<<<<< HEAD (c501f5 Merge branch 'master' into deployment)
-=======
-<?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']);
- }
-
- public function testApprovePayment(){
- $paymentId = '000000850010000188180000200001';
- $params = array(
- "directDebitPaymentMethodSpecificInput" => array(
- "dateCollect" => Date("Ymd"),
- ),
- );
- $this->setUpResponse(__DIR__ .
'/../Data/paymentApproved.response', 200);
- $this->curlWrapper->expects( $this->once() )
- ->method( 'execute' )->with(
-
$this->equalTo("https://api-sandbox.globalcollect.com/v1/1234/payments/$paymentId/approve"),
- $this->equalTo('POST')
- );
- $response = $this->provider->approvePayment($paymentId,
$params);
- $this->assertEquals($paymentId, $response['payment']['id']);
- }
-
- public function testCancelPayment(){
- $paymentId = '000000850010000188180000200001';
- $this->setUpResponse(__DIR__ .
'/../Data/paymentCanceled.response', 200);
- $this->curlWrapper->expects( $this->once() )
- ->method( 'execute' )->with(
-
$this->equalTo("https://api-sandbox.globalcollect.com/v1/1234/payments/$paymentId/cancel"),
- $this->equalTo('POST')
- );
- $response = $this->provider->cancelPayment($paymentId);
- $this->assertEquals($paymentId, $response['payment']['id']);
- }
-}
->>>>>>> BRANCH (b6c543 Merge "Approve and Cancel payment")
--
To view, visit https://gerrit.wikimedia.org/r/372412
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59773bb398665f75e6e8e7aac9224ea1c9525ebe
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits