You are here

public function PayPalPaymentECPaymentMethodController::loadAuthentication in PayPal for Payment 7

Loads authentication information.

Parameters

mixed $value: The value $property must have when loading the authentication information.

string $property: The property to select by. Must be either "pid" or "token".

Return value

string|false The token, or FALSE in case of failure.

1 call to PayPalPaymentECPaymentMethodController::loadAuthentication()
PayPalPaymentECPaymentMethodController::execute in paypal_payment_ec/includes/PayPalPaymentECPaymentMethodController.inc
Execute a payment.

File

paypal_payment_ec/includes/PayPalPaymentECPaymentMethodController.inc, line 291

Class

PayPalPaymentECPaymentMethodController
A PayPal Express Checkout payment method.

Code

public function loadAuthentication($value, $property = 'pid') {

  /** @var DatabaseStatementPrefetch $statement */
  $statement = db_select('paypal_payment_ec_payment', 'mpet')
    ->fields('mpet')
    ->condition($property, $value)
    ->execute();
  $statement
    ->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'PayPalPaymentECAuthentication');
  $authentication = $statement
    ->fetch();
  if ($authentication && $authentication->created + self::PAYPAL_TOKEN_LIFETIME > REQUEST_TIME) {
    return $authentication;
  }
  else {
    return FALSE;
  }
}