You are here

class PaymentMethod in Payment 7

Payment method configuration.

Hierarchy

Expanded class hierarchy of PaymentMethod

See also

Payment

PaymentMethodController

1 string reference to 'PaymentMethod'
payment_entity_info in ./payment.module
Implements hook_entity_info().

File

./payment.classes.inc, line 492
The API and related functions for executing and managing payments.

View source
class PaymentMethod extends PaymentCommon {

  /**
   * The payment method controller this merchant uses.
   *
   * @var PaymentMethodController
   */
  public $controller = NULL;

  /**
   * Information about this payment method that is specific to its controller.
   *
   * @var mixed[]
   */
  public $controller_data = array();

  /**
   * Whether this payment method is enabled and can be used.
   *
   * @var boolean
   */
  public $enabled = TRUE;

  /**
   * The entity's unique machine name.
   *
   * @var string
   */
  public $name = '';

  /**
   * The machine name of the module that created this payment method.
   *
   * @var string
   */
  public $module = 'payment';

  /**
   * The unique internal ID.
   *
   * @var integer
   */
  public $pmid = 0;

  /**
   * One of Entity API's ENTITY_* constants for exportable entities.
   *
   * @see entity_has_status()
   *
   * @var integer
   */
  public $status = ENTITY_CUSTOM;

  /**
   * The specific human-readable title, e.g. "Paypal WPS".
   *
   * @var string
   */
  public $title_specific = '';

  /**
   * The generic human-readable title, e.g. "Paypal".
   *
   * @var string
   */
  public $title_generic = '';

  /**
   * The UID of the user this payment method belongs to.
   *
   * @var integer
   */
  public $uid = NULL;

  /**
   * {@inheritdoc}
   */
  function __construct(array $properties = array()) {
    global $user;
    parent::__construct($properties);
    if (is_null($this->uid)) {

      // Cast non-string scalars to their original types, because some backends
      // store/return all variables as strings.
      $this->uid = (int) $user->uid;
    }
  }

  /**
   * Validate a payment against this payment method.
   *
   * @param Payment $payment
   * @param boolean $strict
   *   Whether to validate everything a payment method needs or to validate the
   *   most important things only. Useful when finding available payment methods,
   *   for instance, which does not require unimportant things to be a 100%
   *   valid.
   *
   * @throws PaymentValidationException
   */
  function validate(Payment $payment, $strict = TRUE) {
    $this->controller
      ->validate($payment, $this, $strict);
    module_invoke_all('payment_validate', $payment, $this, $strict);
    if (module_exists('rules')) {
      rules_invoke_event('payment_validate', $payment, $this, $strict);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PaymentMethod::$controller public property The payment method controller this merchant uses.
PaymentMethod::$controller_data public property Information about this payment method that is specific to its controller.
PaymentMethod::$enabled public property Whether this payment method is enabled and can be used. 1
PaymentMethod::$module public property The machine name of the module that created this payment method. 1
PaymentMethod::$name public property The entity's unique machine name. 1
PaymentMethod::$pmid public property The unique internal ID. 1
PaymentMethod::$status public property One of Entity API's ENTITY_* constants for exportable entities.
PaymentMethod::$title_generic public property The generic human-readable title, e.g. "Paypal".
PaymentMethod::$title_specific public property The specific human-readable title, e.g. "Paypal WPS".
PaymentMethod::$uid public property The UID of the user this payment method belongs to.
PaymentMethod::validate function Validate a payment against this payment method.
PaymentMethod::__construct function Overrides PaymentCommon::__construct 1