You are here

function commerce_payleap_get_log_message in Commerce Payleap 7

Build log message.

2 calls to commerce_payleap_get_log_message()
commerce_payleap_transaction_process in ./commerce_payleap.module
Proceed to the payment and record a transaction.
commerce_payleap_transaction_request in ./commerce_payleap.module
Process a Void or Force transaction.

File

./commerce_payleap.module, line 487
Implements PayLeap payment services for use in Drupal Commerce.

Code

function commerce_payleap_get_log_message($response, $type) {

  // Build a meaningful response message.
  $status = !$response['status'] ? t('@type : REJECTED', array(
    '@type' => $type,
  )) : t('@type : ACCEPTED', array(
    '@type' => $type,
  )) . ': ' . check_plain($response['msg']);
  $avs = !empty($response['xml']->GetAVSResult) ? (string) $response['xml']->GetAVSResult : FALSE;
  $cvv = !empty($response['xml']->GetCVResult) ? (string) $response['xml']->GetCVResult : FALSE;
  $message = array(
    $status,
    $avs ? t('AVS response: @avs', array(
      '@avs' => commerce_payleap_avs_response($avs),
    )) : '',
    $cvv ? t('CVV match: @cvv', array(
      '@cvv' => commerce_payleap_cvv_response($cvv),
    )) : '',
  );
  return $message;
}