public function execute() { global $wgGlobalCollectGatewayEnableCustomFilters; // don't run fraud checks for refunds $wgGlobalCollectGatewayEnableCustomFilters = false; $isUnsubscribing = $this->getOption('unsubscribe'); $filename = $this->getOption('file'); if (!($file = fopen($filename, 'r'))) { $this->error('Could not find refund file: ' . $filename, true); } while ($refund = fgetcsv($file)) { if (count($refund) !== 6) { $this->error('Refund lines must have exactly 6 fields: order_id, merchant_reference, effort_id, payment_submethod, currency_code, amount', true); } $oid = $refund[0]; $effort_id = $refund[2]; $gateway_opts = array('batch_mode' => true, 'external_data' => array('order_id' => $oid, 'merchant_reference' => $refund[1], 'effort_id' => $effort_id, 'payment_method' => 'cc', 'payment_submethod' => $refund[3], 'currency_code' => $refund[4], 'amount' => $refund[5])); $this->output("Refunding transaction {$oid}\n"); $adapter = new GlobalCollectAdapter($gateway_opts); // FIXME: effort_id is clobbered in setGatewayDefaults $adapter->addRequestData(array('effort_id' => $effort_id)); $result = $adapter->doRefund(); if ($result->isFailed()) { $this->error("Failed refunding transaction {$oid}"); } else { $this->output("Successfully refunded transaction {$oid}\n"); } if ($isUnsubscribing) { $result = $adapter->cancelSubscription(); if ($result->isFailed()) { $this->error("Failed cancelling subscription {$oid}"); } else { $this->output("Successfully cancelled subscription {$oid}\n"); } } } fclose($file); }
public function addRequestData($dataArray) { parent::addRequestData($dataArray); $this->reAddHardData(); }