[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: WX audit files: get at least date from sparse refunds

2017-08-28 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373702 )

Change subject: WX audit files: get at least date from sparse refunds
..


WX audit files: get at least date from sparse refunds

We'll need to do more work in the CRM layer to find the order ID by
contribution_tracking_id.

Bug: T173875
Change-Id: I0b27295a245f50eb96356c33d16173a4559a9566
---
M PaymentProviders/Ingenico/Audit/IngenicoAudit.php
A PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz
M PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
3 files changed, 25 insertions(+), 0 deletions(-)

Approvals:
  Mepps: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/PaymentProviders/Ingenico/Audit/IngenicoAudit.php 
b/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
index 0ec05d2..09000ec 100644
--- a/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
+++ b/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
@@ -40,6 +40,8 @@
'OrderID' => 'gateway_parent_id',
'EffortID' => 'installment',
'DebitedCurrency' => 'gross_currency',
+   'DateDue' => 'date',
+   // Order matters. Prefer TransactionDateTime if it is present.
'TransactionDateTime' => 'date',
);
 
diff --git a/PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz 
b/PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz
new file mode 100644
index 000..0b29176
--- /dev/null
+++ b/PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz
Binary files differ
diff --git a/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
index e63f1a3..3ef 100644
--- a/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
+++ b/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
@@ -114,4 +114,27 @@
);
$this->assertEquals( $expected, $actual, 'Did not parse 
chargeback correctly' );
}
+
+   /**
+* We get some refunds in a weird sparse format with OrderID zero and no
+* TransactionDateTime. At least get the ct_id and a date out of them.
+*/
+   public function testProcessSparseRefund() {
+   $processor = new IngenicoAudit();
+   $output = $processor->parseFile( __DIR__ . 
'/../Data/sparseRefund.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' => '48987654',
+   'date' => 1503964800,
+   'gross' => 15,
+   'gateway_parent_id' => '0', // We'll need to find it by 
ct_id
+   'gateway_refund_id' => '0', // And we'll need to fill 
in this field
+   'installment' => '', // EffortID came in blank too
+   'gross_currency' => 'EUR',
+   'type' => 'refund',
+   );
+   $this->assertEquals( $expected, $actual, 'Did not parse refund 
correctly' );
+   }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0b27295a245f50eb96356c33d16173a4559a9566
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg 
Gerrit-Reviewer: Mepps 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: WX audit files: get at least date from sparse refunds

2017-08-24 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/373702 )

Change subject: WX audit files: get at least date from sparse refunds
..

WX audit files: get at least date from sparse refunds

We'll need to do more work in the CRM layer to find the order ID by
contribution_tracking_id.

Bug: T173875
Change-Id: I0b27295a245f50eb96356c33d16173a4559a9566
---
M PaymentProviders/Ingenico/Audit/IngenicoAudit.php
A PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz
M PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
3 files changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/02/373702/1

diff --git a/PaymentProviders/Ingenico/Audit/IngenicoAudit.php 
b/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
index 0ec05d2..09000ec 100644
--- a/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
+++ b/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
@@ -40,6 +40,8 @@
'OrderID' => 'gateway_parent_id',
'EffortID' => 'installment',
'DebitedCurrency' => 'gross_currency',
+   'DateDue' => 'date',
+   // Order matters. Prefer TransactionDateTime if it is present.
'TransactionDateTime' => 'date',
);
 
diff --git a/PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz 
b/PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz
new file mode 100644
index 000..0b29176
--- /dev/null
+++ b/PaymentProviders/Ingenico/Tests/Data/sparseRefund.xml.gz
Binary files differ
diff --git a/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
index e63f1a3..3ef 100644
--- a/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
+++ b/PaymentProviders/Ingenico/Tests/phpunit/AuditTest.php
@@ -114,4 +114,27 @@
);
$this->assertEquals( $expected, $actual, 'Did not parse 
chargeback correctly' );
}
+
+   /**
+* We get some refunds in a weird sparse format with OrderID zero and no
+* TransactionDateTime. At least get the ct_id and a date out of them.
+*/
+   public function testProcessSparseRefund() {
+   $processor = new IngenicoAudit();
+   $output = $processor->parseFile( __DIR__ . 
'/../Data/sparseRefund.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' => '48987654',
+   'date' => 1503964800,
+   'gross' => 15,
+   'gateway_parent_id' => '0', // We'll need to find it by 
ct_id
+   'gateway_refund_id' => '0', // And we'll need to fill 
in this field
+   'installment' => '', // EffortID came in blank too
+   'gross_currency' => 'EUR',
+   'type' => 'refund',
+   );
+   $this->assertEquals( $expected, $actual, 'Did not parse refund 
correctly' );
+   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b27295a245f50eb96356c33d16173a4559a9566
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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