Skip to content

Instantly share code, notes, and snippets.

@EHLOVader
Created January 13, 2012 17:16
Show Gist options
  • Save EHLOVader/1607591 to your computer and use it in GitHub Desktop.
Save EHLOVader/1607591 to your computer and use it in GitHub Desktop.
/**
* Adds a log record to the order payment attempts log
* @param mixed $order Order object the payment attempt is belongs to
* @param string $message Log message
* @param bool $is_successful Indicates that the attempt was successful
* @param array $request_array An array containing data posted to the payment gateway
* @param array $response_array An array containing data received from the payment gateway
* @param string $response_text Raw gateway response text
* @param string $ccv_response_code Card code verification response code
* @param string $ccv_response_text Card code verification response text
* @param string $avs_response_code Address verification response code
* @param string $avs_response_text Address verification response text
*/
protected function log_payment_attempt($order, $message, $is_successful, $request_array, $response_array, $response_text, $ccv_response_code = null, $ccv_response_text = null, $avs_response_code = null, $avs_response_text = null)
{
$info = $this->get_info();
$record = Shop_PaymentLogRecord::create();
$record->order_id = $order->id;
$record->payment_method_name = $info['name'];
$record->message = $message;
$record->is_successful = $is_successful;
$record->request_data = $request_array;
$record->response_data = $response_array;
$record->raw_response_text = $response_text;
$record->ccv_response_code = $ccv_response_code;
$record->ccv_response_text = $ccv_response_text;
$record->avs_response_code = $avs_response_code;
$record->avs_response_text = $avs_response_text;
$record->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment