You are here

function pay_method_direct::response_action in Pay 7

Same name and namespace in other branches
  1. 6 includes/handlers/pay_method_direct.inc \pay_method_direct::response_action()

Implement a 'response' action, which interprets the response from a direct payment gateway.

File

includes/handlers/pay_method_direct.inc, line 78
The base class for 'direct' payment activities, where payments are collected on third-party sites such as PayPal, and the responses are returned to Drupal on a URL callback.

Class

pay_method_direct
@file The base class for 'direct' payment activities, where payments are collected on third-party sites such as PayPal, and the responses are returned to Drupal on a URL callback.

Code

function response_action($values = array()) {

  // Copy the submitted/stored values from the previous activity.
  foreach ($this->activity
    ->history() as $previous) {
    if (in_array($previous->action, array(
      'pending',
      'authorize',
    )) && $previous->result) {
      $this
        ->__construct($previous->data);
      if ($previous->action == 'pending') {
        $this->activity->action = $previous->data['action'];
      }
    }
  }

  // Get a boolean response from the response parser.
  return $this
    ->direct_response($values) ? 'complete' : 'canceled';
}