class PaymentMethodBasicController in Payment 7
A basic payment method controller.
This controller always executes payments successfully, does not require payment-specific information and does not transfer any money. It can be useful to create a "collect on delivery" payment method, for instance.
Hierarchy
- class \PaymentMethodController
- class \PaymentMethodBasicController
Expanded class hierarchy of PaymentMethodBasicController
11 string references to 'PaymentMethodBasicController'
- PaymentmethodbasicTestPaymentMethodBasicControllerWebTestCase::testCRUD in modules/
paymentmethodbasic/ tests/ paymentmethodbasic_test/ tests/ PaymentmethodbasicTestPaymentMethodBasicControllerWebTestCase.test - Test CRUD functionality.
- paymentmethodbasic_entity_load in modules/
paymentmethodbasic/ paymentmethodbasic.module - Implements hook_entity_load().
- paymentmethodbasic_payment_method_controller_info in modules/
paymentmethodbasic/ paymentmethodbasic.module - Implements hook_payment_method_controller_info().
- paymentmethodbasic_payment_method_defaults in modules/
paymentmethodbasic/ paymentmethodbasic.install - Returns default payment methods.
- paymentmethodbasic_payment_method_delete in modules/
paymentmethodbasic/ paymentmethodbasic.module - Implements hook_ENTITY_TYPE_ACTION().
File
- modules/
paymentmethodbasic/ paymentmethodbasic.module, line 88 - Hook implementations and shared functions.
View source
class PaymentMethodBasicController extends PaymentMethodController {
public $controller_data_defaults = array(
'message' => '',
'status' => PAYMENT_STATUS_SUCCESS,
'text_format' => '',
);
public $payment_method_configuration_form_elements_callback = 'paymentmethodbasic_payment_method_configuration_form_elements';
public $payment_configuration_form_elements_callback = 'paymentmethodbasic_payment_configuration_form_elements';
function __construct() {
$this->title = t('Basic');
$this->description = t("A 'dumb' payment method type that always successfully executes payments, but never actually transfers money. It can be useful for <em>collect on delivery</em>, for instance.");
}
/**
* Implements PaymentMethodController::execute().
*/
function execute(Payment $payment) {
$payment
->setStatus(new PaymentStatusItem($payment->method->controller_data['status']));
}
/**
* {@inheritdoc}
*/
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) {
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PaymentMethodBasicController:: |
public | property |
Default values for the controller_data property of a PaymentMethod that
uses this controller. Overrides PaymentMethodController:: |
|
PaymentMethodBasicController:: |
public | property |
The function name of the payment configuration form elements. Overrides PaymentMethodController:: |
|
PaymentMethodBasicController:: |
public | property |
The function name of the payment method configuration form elements. Overrides PaymentMethodController:: |
|
PaymentMethodBasicController:: |
function |
Implements PaymentMethodController::execute(). Overrides PaymentMethodController:: |
||
PaymentMethodBasicController:: |
public | function |
Validate a payment against a payment method and this controller. Don't
call directly. Use PaymentMethod::validate() instead. Overrides PaymentMethodController:: |
|
PaymentMethodBasicController:: |
function | |||
PaymentMethodController:: |
public | property | An array with ISO 4217 currency codes that this controller supports. | |
PaymentMethodController:: |
public | property | A human-readable plain text description of this payment method controller. | |
PaymentMethodController:: |
public | property | The machine name. | |
PaymentMethodController:: |
public | property | The human-readable plain text title. | |
PaymentMethodController:: |
static | function | Returns an array with the names of all available payment method controllers that inherit of this one. |