You are here

public static function PayPalPaymentIPNController::PID in PayPal for Payment 7

Extracts a Payment PID from a PayPa invoice ID.

Parameters

string $invoice_id:

Return value

integer|false The PID, or FALSE if the invoice ID did not contain a valid PID.

See also

PayPalPaymentController::invoiceID()

4 calls to PayPalPaymentIPNController::PID()
PayPalPaymentIPNController::process in paypal_payment_ipn/includes/PayPalPaymentIPNController.inc
Processes an IPN.
PayPalPaymentIPNController::validate in paypal_payment_ipn/includes/PayPalPaymentIPNController.inc
Validates the contents of IPN variables.
PayPalPaymentIPNControllerTest::testPID in paypal_payment_ipn/tests/PayPalPaymentIPNControllerTest.test
Tests PID().
PayPalPaymentIPNControllerTest::testValidate in paypal_payment_ipn/tests/PayPalPaymentIPNControllerTest.test
Tests validate().

File

paypal_payment_ipn/includes/PayPalPaymentIPNController.inc, line 212

Class

PayPalPaymentIPNController
Provides IPN functionality.

Code

public static function PID($invoice_id) {
  $fragments = explode('-', $invoice_id);
  if (count($fragments) == 3) {
    list(, $hash, $pid) = $fragments;
    return $hash == self::hashPID($pid) ? (int) $pid : FALSE;
  }
  return FALSE;
}