Notice: Use of undefined constant ERROR - assumed 'ERROR' in commerce_ep_transaction() (line 137 of xxxxxxxxx/sites/all/modules/commerce_ep/commerce_ep.module).

if (!isset($key_test) && !isset($nordea_test)) {
    return drupal_set_message(t('Keys doesnt validate contact an administrator'), ERROR);
}

Shoud be:

if (!isset($key_test) && !isset($nordea_test)) {
    return drupal_set_message(t('Keys doesnt validate contact an administrator'), 'error');
 }

Comments

egontinno’s picture

Priority: Normal » Critical

Actually there are more problems when you come back from bank with cancelled payment. This module doesn't redirect when payment failed and doesn't log that failure. Customer is directed to order completed page, order status is marked "Pending" and invoice is sended as well. I call this critical bug, because customer can purchase goods without payment.
The following code will correct this error.

if (!isset($key_test) && !isset($nordea_test)) {
    $transaction = commerce_payment_transaction_new($payment_method['method_id'], $order->order_id);
    $wrapper = entity_metadata_wrapper('commerce_order', $order);
    $currency = $wrapper->commerce_order_total->currency_code->value();
    $transaction->instance_id = $payment_method['instance_id'];
    $transaction->amount = 0;
    $transaction->currency_code = $currency;
    $transaction->remote_status = t('Failure');
    $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
    $transaction->message = t("Keys doesn't validate or payment cancelled.");
    commerce_payment_transaction_save($transaction);
    
    drupal_set_message(t("Keys doesn't validate or payment cancelled."), 'error');
    
    $order->status = 'checkout_review';
    commerce_order_save($order);
    drupal_goto(commerce_checkout_order_uri($order));
    return FALSE;
  }
kaido.toomingas’s picture

Thank you! These will be on the next version. And generally you should you patch the code next time :).

kaido.toomingas’s picture

Status: Active » Closed (fixed)

Fixed