You are here

function payment_commerce_payment_finish in Payment for Drupal Commerce 7

Same name and namespace in other branches
  1. 7.2 payment_commerce.module \payment_commerce_payment_finish()

Implements Payment::finish_callback.

1 string reference to 'payment_commerce_payment_finish'
payment_commerce_payment_create in ./payment_commerce.module
Create a Payment for a Commerce order.

File

./payment_commerce.module, line 157
Hook implementations and shared functions.

Code

function payment_commerce_payment_finish(Payment $payment) {
  payment_commerce_redirect_pane($payment);
  $order = commerce_order_load($payment->context_data['order_id']);
  if (payment_status_is_or_has_ancestor($payment
    ->getStatus()->status, PAYMENT_STATUS_FAILED)) {
    $view = '';
    if (payment_access('view', $payment)) {
      $view = ' ' . l(t('View payment'), 'payment/' . $payment->pid) . '.';
    }
    drupal_set_message(t('Your payment failed.') . $view);
  }
  drupal_goto(commerce_checkout_order_uri($order));
}