jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/328858 )
Change subject: Batch look up order status for Ingenico
......................................................................
Batch look up order status for Ingenico
Change-Id: Ibc748223e3c7c2cd3d08925eb6b8853c3dc6d7af
---
A globalcollect_gateway/scripts/get_orderstatus.php
1 file changed, 66 insertions(+), 0 deletions(-)
Approvals:
Mepps: Looks good to me, approved
jenkins-bot: Verified
diff --git a/globalcollect_gateway/scripts/get_orderstatus.php
b/globalcollect_gateway/scripts/get_orderstatus.php
new file mode 100644
index 0000000..c339549
--- /dev/null
+++ b/globalcollect_gateway/scripts/get_orderstatus.php
@@ -0,0 +1,66 @@
+<?php
+
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+ $IP = __DIR__ . '/../../../..';
+}
+
+// If you get errors on this next line, set (and export) your MW_INSTALL_PATH
var.
+require_once "$IP/maintenance/Maintenance.php";
+
+// Look up status codes for a batch of transactions
+// Input file must be either a two column CSV with order ID and effort ID or
+// a single column with one order ID per line, which will assume effort ID = 1
+class IngenicoGetOrderStatusMaintenance extends Maintenance {
+ public function __construct() {
+ parent::__construct();
+
+ $this->addOption( 'file', 'Read order IDs in from a file',
+ true, true, 'f' );
+ }
+
+ public function execute() {
+ global $wgGlobalCollectGatewayEnableCustomFilters;
+
+ // don't run fraud checks
+ $wgGlobalCollectGatewayEnableCustomFilters = false;
+
+ $filename = $this->getOption( 'file' );
+ if ( !( $file = fopen( $filename, 'r' ) ) ) {
+ $this->error( 'Could not find order id file: ' .
$filename, true );
+ }
+ while ( $order = fgetcsv( $file ) ) {
+ $effort_id = 1;
+ if ( count( $order ) === 2 ) {
+ $effort_id = $order[1];
+ } elseif ( count( $order ) !== 1 ) {
+ $this->error( 'Input lines must have either one
or two columns', true );
+ }
+ $oid = $order[0];
+ $gateway_opts = array(
+ 'batch_mode' => true,
+ 'external_data' => array(
+ 'order_id' => $oid,
+ 'effort_id' => $effort_id,
+ 'payment_method' => 'cc',
+ 'payment_submethod' => 'visa',
+ 'currency_code' => 'USD',
+ 'amount' => 500,
+ ),
+ );
+
+ $this->output( "Looking up transaction $oid\n" );
+ $adapter = new GlobalCollectAdapter( $gateway_opts );
+ // FIXME: effort_id is clobbered in setGatewayDefaults
+ $adapter->addRequestData( array( 'effort_id' =>
$effort_id ) );
+ $result = $adapter->do_transaction( 'GET_ORDERSTATUS' );
+
+ // TODO: better formatting?
+ $this->output( print_r( $result->getData(), true ) );
+ }
+ fclose( $file );
+ }
+}
+
+$maintClass = 'IngenicoGetOrderStatusMaintenance';
+require_once RUN_MAINTENANCE_IF_MAIN;
--
To view, visit https://gerrit.wikimedia.org/r/328858
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc748223e3c7c2cd3d08925eb6b8853c3dc6d7af
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Mepps <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits