You are here

function _uc_recurring_hosted_paypal_ipn_order in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 modules/uc_recurring_hosted/uc_recurring_hosted.paypal_ipn.inc \_uc_recurring_hosted_paypal_ipn_order()

Loads the order object associated with either a WPS or WPP IPN.

Return value

Ubercart Order object.

1 call to _uc_recurring_hosted_paypal_ipn_order()
uc_recurring_hosted_paypal_ipn in modules/uc_recurring_hosted/uc_recurring_hosted.paypal_ipn.inc
Handle IPN callbacks for PayPal recurring payments

File

modules/uc_recurring_hosted/uc_recurring_hosted.paypal_ipn.inc, line 213
Handle paypal IPN callbacks for recurring payments

Code

function _uc_recurring_hosted_paypal_ipn_order($ipn) {
  if (!isset($ipn->invoice) && !isset($ipn->rp_invoice_id)) {
    watchdog('uc_recurring_hosted', 'IPN attempted with invalid order ID.', array(), WATCHDOG_ERROR);
    return FALSE;
  }
  if (isset($ipn->rp_invoice_id)) {

    // We are using wpp, use rp_invoice_id
    $order_id = intval($_POST['rp_invoice_id']);
  }
  elseif (isset($ipn->invoice)) {
    if (($len = strpos($_POST['invoice'], '-')) > 0) {
      $order_id = intval(substr($_POST['invoice'], 0, $len));
    }
    else {
      $order_id = intval($_POST['invoice']);
    }
  }
  return uc_order_load($order_id);
}