You are here

function pay_node_pay_transaction_create in Pay 6

Same name and namespace in other branches
  1. 7 modules/pay_node/pay_node.module \pay_node_pay_transaction_create()

Implementation of hook_pay_transaction_create().

File

modules/pay_node/pay_node.module, line 165

Code

function pay_node_pay_transaction_create(&$transaction, $values = array()) {
  if (isset($values['pay_node_nid']) && ($nid = $values['pay_node_nid'])) {

    // Verify that this node actually has a pay form and is the correct one.
    if (!($pay_form = pay_node_form_load($nid))) {
      return;
    }
    if ($pay_form->pfid != $transaction->pfid) {
      return;
    }

    // Store a relationship between the transaction and the node it came from.
    $record = array(
      'nid' => $nid,
      'pxid' => $transaction->pxid,
    );
    drupal_write_record('pay_transaction_node', $record);
  }
}