Unavailable.php in Payment 8.2
File
src/Plugin/Payment/Method/Unavailable.php
View source
<?php
namespace Drupal\payment\Plugin\Payment\Method;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\payment\Entity\PaymentInterface;
use Drupal\payment\OperationResult;
class Unavailable extends PluginBase implements PaymentMethodInterface {
protected $payment;
public function calculateDependencies() {
return [];
}
public function defaultConfiguration() {
return [];
}
public function getConfiguration() {
return [];
}
public function setConfiguration(array $configuration) {
return $this;
}
protected function getSupportedCurrencies() {
return [];
}
public function getPaymentExecutionResult() {
return new OperationResult();
}
public function executePaymentAccess(AccountInterface $account) {
return AccessResult::forbidden();
}
public function executePayment() {
throw new \RuntimeException('This plugin cannot execute payments.');
}
public function getPayment() {
return $this->payment;
}
public function setPayment(PaymentInterface $payment) {
$this->payment = $payment;
return $this;
}
public function getPluginLabel() {
return $this->pluginDefinition['label'];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
return [];
}
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
}
}
Classes
Name |
Description |
Unavailable |
A payment method controller that essentially disables payment methods. |