public function execute() { $gateway_opts = array('batch_mode' => true, 'external_data' => array('payment_method' => 'rtbt', 'payment_submethod' => 'rtbt_ideal', 'country' => 'NL', 'currency_code' => 'EUR', 'amount' => 1)); $this->output("Querying available banks.\n"); $adapter = new GlobalCollectAdapter($gateway_opts); $result = $adapter->do_transaction('GET_DIRECTORY'); if ($result->getErrors()) { $this->error("API call failed:" . implode(', ', $result->getErrors())); return; } $this->output("Barbarically raw response:\n" . $result->getRawResponse()); }
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 execute() { $this->donationData = $this->extractRequestParams(); $this->gateway = $this->donationData['gateway']; // If you want to test with fake data, pass a 'test' param set to true. // You still have to set the gateway you are testing though. // It looks like this only works if the Test global variable for that gateway is true. if (array_key_exists('test', $this->donationData) && $this->donationData['test']) { $this->populateTestData(); } else { // If we need to do any local data munging do it here. } $method = $this->donationData['payment_method']; $submethod = $this->donationData['payment_submethod']; if ($this->gateway == 'payflowpro') { $gatewayObj = new PayflowProAdapter(); switch ($method) { // TODO: add other payment methods default: $result = $gatewayObj->do_transaction('Card'); } } elseif ($this->gateway == 'globalcollect') { $gatewayObj = new GlobalCollectAdapter(); switch ($method) { // TODO: add other payment methods case 'cc': $result = $gatewayObj->do_transaction('INSERT_ORDERWITHPAYMENT'); break; default: $result = $gatewayObj->do_transaction('TEST_CONNECTION'); } } else { $this->dieUsage("Invalid gateway <<<{$gateway}>>> passed to Donation API.", 'unknown_gateway'); } //$normalizedData = $gatewayObj->getData_Unstaged_Escaped(); $outputResult = array(); $outputResult['message'] = $result['message']; $outputResult['status'] = $result['status']; if (array_key_exists('data', $result)) { if (array_key_exists('PAYMENT', $result['data']) && array_key_exists('RETURNURL', $result['data']['PAYMENT'])) { $outputResult['returnurl'] = $result['data']['PAYMENT']['RETURNURL']; } if (array_key_exists('FORMACTION', $result['data'])) { $outputResult['formaction'] = $result['data']['FORMACTION']; } if (array_key_exists('RESPMSG', $result['data'])) { $outputResult['responsemsg'] = $result['data']['RESPMSG']; } if (array_key_exists('ORDERID', $result['data'])) { $outputResult['orderid'] = $result['data']['ORDERID']; } } if ($result['errors']) { $outputResult['errors'] = $result['errors']; } if ($this->donationData) { $this->getResult()->addValue(null, 'request', $this->donationData); } $this->getResult()->addValue(null, 'result', $outputResult); /* $this->getResult()->setIndexedTagName( $result, 'response' ); $this->getResult()->addValue( 'data', 'result', $result ); */ }
public function do_transaction($transaction) { switch ($transaction) { case 'SET_PAYMENT': case 'CANCEL_PAYMENT': self::log($this->getData_Unstaged_Escaped('contribution_tracking_id') . ": CVV: " . $this->getData_Unstaged_Escaped('cvv_result') . ": AVS: " . $this->getData_Unstaged_Escaped('avs_result')); //and then go on, unless you're testing, in which case: // return "NOPE"; // break; //and then go on, unless you're testing, in which case: // return "NOPE"; // break; default: $ret = parent::do_transaction($transaction); return $ret; break; } }
protected function curl_transaction($data) { $this->curled[] = $data; return parent::curl_transaction($data); }
/** * Do the antifraud checks here instead. */ protected function post_process_get_orderstatus() { // TODO: Let's parse this into a "not so final status" attribute. $status_response = $this->transaction_response->getData(); $action = $this->findCodeAction('GET_ORDERSTATUS', 'STATUSID', $status_response['STATUSID']); // Don't bother unless we expect to be able to finalize this payment. if ($action === FinalStatus::PENDING_POKE) { $this->logger->info('Final status is PENDING_POKE, running fraud filters'); parent::post_process_get_orderstatus(); } else { $this->logger->info("Skipping fraud filters for final status {$action}."); } }