/** * Void an Authorized Transaction * * @param PaymentDBO $paymentDBO Previously authorized payment DBO * @return boolean False on a processing error */ function void(&$paymentDBO) { $message = $this->buildPOSTFields(array("x_login" => $this->getLoginID(), "x_version" => $this->getAPIVersion(), "x_delim_char" => $this->getDelimiter(), "x_delim_data" => "TRUE", "x_type" => "VOID", "x_method" => "CC", "x_tran_key" => $this->getTransactionKey(), "x_trans_id" => $paymentDBO->getTransaction1())); // Carry out the transaction $resp = $this->executeTransaction($message); // Parse the transaction response switch ($resp[AIM_RESP_CODE]) { case AIM_APPROVED: $paymentDBO->setStatus("Voided"); $paymentDBO->setTransaction1($resp[AIM_RESP_TRANSACTION_ID]); $paymentDBO->setTransaction2($resp[AIM_RESP_APPROVAL_CODE]); break; case AIM_DECLINED: $paymentDBO->setStatus("Declined"); $paymentDBO->setStatusMessage(substr($resp[AIM_RESP_REASON_TEXT], 0, 255)); break; case AIM_ERROR: default: log_error("AuthorizeAIM::void()", "An error occured while processing an Authorize.net transaction: " . $resp[AIM_RESP_REASON_TEXT]); return false; break; } return true; }