You are here

public function PaymentMethodBasicController::validate in Payment 7

Validate a payment against a payment method and this controller. Don't call directly. Use PaymentMethod::validate() instead.

Parameters

Payment $payment:

PaymentMethod $payment_method:

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

Overrides PaymentMethodController::validate

See also

PaymentMethod::validate()

File

modules/paymentmethodbasic/paymentmethodbasic.module, line 115
Hook implementations and shared functions.

Class

PaymentMethodBasicController
A basic payment method controller.

Code

public function validate(Payment $payment, PaymentMethod $payment_method, $strict) {

  // This payment method controller does not have a minimum amount, so when
  // the parent throws such an exception, catch it and do nothing.
  try {
    parent::validate($payment, $payment_method, $strict);
  } catch (PaymentValidationAmountBelowMinimumException $e) {
  }
}