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() { $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; } }