You are here

public function PayPalPaymentPPSPaymentMethodController::execute in PayPal for Payment 7

Execute a payment.

Note that payments may be executed even if their owner is not logged into the site. This means that if you need to do access control in your execute() method, you cannot use global $user.

Parameters

Payment $payment:

Return value

boolean Whether the payment was successfully executed or not.

Overrides PaymentMethodController::execute

File

paypal_payment_pps/includes/PayPalPaymentPPSPaymentMethodController.inc, line 64

Class

PayPalPaymentPPSPaymentMethodController
A PayPal Payments Standard payment method.

Code

public function execute(Payment $payment) {
  entity_save('payment', $payment);
  $_SESSION['paypal_payment_pps_pid'] = $payment->pid;
  $url = 'paypal_payment_pps/redirect/' . $payment->pid;
  if (!empty($payment->contextObj)) {

    // Support for payment_context.
    $payment->contextObj
      ->redirect($url);
  }
  else {
    drupal_goto($url);
  }
}