You are here

class PayPalPaymentPPSPaymentMethodController in PayPal for Payment 7

A PayPal Payments Standard payment method.

Hierarchy

Expanded class hierarchy of PayPalPaymentPPSPaymentMethodController

10 string references to 'PayPalPaymentPPSPaymentMethodController'
PayPalPaymentPPSPaymentExecution::testPaymentExecution in paypal_payment_pps/tests/PayPalPaymentPPSPaymentExecution.test
Tests payment execution.
PayPalPaymentPPSPaymentExecution::testSandboxPaymentExecution in paypal_payment_pps/tests/PayPalPaymentPPSPaymentExecution.test
Tests payment execution using the sandbox server.
PayPalPaymentPPSPaymentMethodCRUD::testCRUD in paypal_payment_pps/tests/PayPalPaymentPPSPaymentMethodCRUD.test
Tests CRUD.
PayPalPaymentPPSPaymentMethodUI::testUI in paypal_payment_pps/tests/PayPalPaymentPPSPaymentMethodUI.test
Tests PayPalPaymentPPSPaymentMethodController::payment_method_configuration_form_elements_callback.
paypal_payment_pps_entity_load in paypal_payment_pps/paypal_payment_pps.module
Implements hook_entity_load().

... See full list

File

paypal_payment_pps/includes/PayPalPaymentPPSPaymentMethodController.inc, line 10

View source
class PayPalPaymentPPSPaymentMethodController extends PaymentMethodController implements PayPalPaymentIPNPaymentMethodControllerInterface {

  /**
   * Automatic funds capture.
   */
  const CAPTURE_AUTOMATIC = 0;

  /**
   * Manual funds capture.
   */
  const CAPTURE_MANUAL = 1;

  /**
   * The production server URL.
   */
  const SERVER_URL = 'https://www.paypal.com/cgi-bin/webscr';

  /**
   * The sandbox server URL.
   */
  const SANDBOX_SERVER_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

  /**
   * {@inheritdoc}
   */
  public $controller_data_defaults = array(
    'email_address' => '',
    'server' => self::SERVER_URL,
    'capture' => self::CAPTURE_AUTOMATIC,
  );

  /**
   * {@inheritdoc}
   */
  public $payment_method_configuration_form_elements_callback = 'paypal_payment_pps_payment_method_configuration_form_elements';

  /**
   * Constructs a new instance.
   */
  public function __construct() {
    $currency_codes = array(
      'AUD',
      'BRL',
      'CAD',
      'CHF',
      'CZK',
      'DKK',
      'EUR',
      'GBP',
      'HKD',
      'HUF',
      'ILS',
      'JPY',
      'MXN',
      'MYR',
      'NOK',
      'NZD',
      'PHP',
      'PLN',
      'SEK',
      'SGD',
      'THB',
      'TRY',
      'TWD',
      'USD',
    );
    $this->currencies = array_fill_keys($currency_codes, array());
    $this->title = 'PayPal Payments Standard';
  }

  /**
   * {@inheritdoc}
   */
  public function validate(Payment $payment, PaymentMethod $payment_method, $strict) {
  }

  /**
   * {@inheritdoc}
   */
  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);
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function PayPalValidateIPNVariables(Payment $payment, array $ipn_variables) {

    // PayPal treats email addresses case-insensitively and returns them in
    // lowercase in $ipn_variables['business']. Therefore we must perform
    // a case-insensitive comparison.
    return strtolower($ipn_variables['business']) == strtolower($payment->method->controller_data['email_address']);
  }

  /**
   * {@inheritdoc}
   */
  public static function PayPalProcessIPN(Payment $payment, array $ipn_variables) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PaymentMethodController::$currencies public property An array with ISO 4217 currency codes that this controller supports.
PaymentMethodController::$description public property A human-readable plain text description of this payment method controller.
PaymentMethodController::$name public property The machine name.
PaymentMethodController::$payment_configuration_form_elements_callback public property The function name of the payment configuration form elements. 1
PaymentMethodController::$title public property The human-readable plain text title.
PaymentMethodController::descendants static function Returns an array with the names of all available payment method controllers that inherit of this one.
PayPalPaymentPPSPaymentMethodController::$controller_data_defaults public property Default values for the controller_data property of a PaymentMethod that uses this controller. Overrides PaymentMethodController::$controller_data_defaults
PayPalPaymentPPSPaymentMethodController::$payment_method_configuration_form_elements_callback public property The function name of the payment method configuration form elements. Overrides PaymentMethodController::$payment_method_configuration_form_elements_callback
PayPalPaymentPPSPaymentMethodController::CAPTURE_AUTOMATIC constant Automatic funds capture.
PayPalPaymentPPSPaymentMethodController::CAPTURE_MANUAL constant Manual funds capture.
PayPalPaymentPPSPaymentMethodController::execute public function Execute a payment. Overrides PaymentMethodController::execute
PayPalPaymentPPSPaymentMethodController::PayPalProcessIPN public static function Processes an IPN for a payment. Overrides PayPalPaymentIPNPaymentMethodControllerInterface::PayPalProcessIPN
PayPalPaymentPPSPaymentMethodController::PayPalValidateIPNVariables public static function Validates IPN message variables for a payment. Overrides PayPalPaymentIPNPaymentMethodControllerInterface::PayPalValidateIPNVariables
PayPalPaymentPPSPaymentMethodController::SANDBOX_SERVER_URL constant The sandbox server URL.
PayPalPaymentPPSPaymentMethodController::SERVER_URL constant The production server URL.
PayPalPaymentPPSPaymentMethodController::validate public function Validate a payment against a payment method and this controller. Don't call directly. Use PaymentMethod::validate() instead. Overrides PaymentMethodController::validate
PayPalPaymentPPSPaymentMethodController::__construct public function Constructs a new instance.