You are here

function commerce_paypal_ipn_save in Commerce PayPal 7.2

Same name and namespace in other branches
  1. 7 commerce_paypal.module \commerce_paypal_ipn_save()

Saves an IPN with some meta data related to local processing.

Parameters

$ipn: An IPN array with additional parameters for the order_id and Commerce Payment transaction_id associated with the IPN.

Return value

The operation performed by drupal_write_record() on save; since the IPN is received by reference, it will also contain the serial numeric ipn_id used locally.

1 call to commerce_paypal_ipn_save()
commerce_paypal_process_ipn in ./commerce_paypal.module
Processes an incoming IPN.

File

./commerce_paypal.module, line 243
Implements PayPal payment services for use with Drupal Commerce.

Code

function commerce_paypal_ipn_save(&$ipn) {
  if (!empty($ipn['ipn_id']) && commerce_paypal_ipn_load($ipn['txn_id'])) {
    $ipn['changed'] = REQUEST_TIME;
    return drupal_write_record('commerce_paypal_ipn', $ipn, 'ipn_id');
  }
  else {
    $ipn['created'] = REQUEST_TIME;
    $ipn['changed'] = REQUEST_TIME;
    return drupal_write_record('commerce_paypal_ipn', $ipn);
  }
}