You are here

class Unavailable in Payment 8.2

Same name in this branch
  1. 8.2 src/Plugin/Payment/Method/Unavailable.php \Drupal\payment\Plugin\Payment\Method\Unavailable
  2. 8.2 src/Plugin/Payment/Type/Unavailable.php \Drupal\payment\Plugin\Payment\Type\Unavailable

A payment method controller that essentially disables payment methods.

This is a 'placeholder' controller that returns defaults and doesn't really do anything else. It is used when no working controller is available for a payment method, so other modules don't have to check for that.

Plugin annotation


@PaymentMethod(
  active = FALSE,
  id = "payment_unavailable",
  label = @Translation("Unavailable"),
  module = "payment"
)

Hierarchy

Expanded class hierarchy of Unavailable

1 file declares its use of Unavailable
UnavailableTest.php in tests/src/Unit/Plugin/Payment/Method/UnavailableTest.php
5 string references to 'Unavailable'
PaymentForm::getPaymentDescription in modules/payment_form/src/Plugin/Payment/Type/PaymentForm.php
Returns the description of the payment this plugin is of.
PaymentListBuilder::buildRow in src/Entity/Payment/PaymentListBuilder.php
{@inheritdnoc}
PaymentReference::getPaymentDescription in modules/payment_reference/src/Plugin/Payment/Type/PaymentReference.php
Returns the description of the payment this plugin is of.
PaymentUnitTest::testLabel in tests/src/Kernel/PaymentUnitTest.php
Tests label().
Unavailable::getPaymentDescription in src/Plugin/Payment/Type/Unavailable.php
Returns the description of the payment this plugin is of.

File

src/Plugin/Payment/Method/Unavailable.php, line 30

Namespace

Drupal\payment\Plugin\Payment\Method
View source
class Unavailable extends PluginBase implements PaymentMethodInterface {

  /**
   * The payment this payment method is for.
   *
   * @var \Drupal\payment\Entity\PaymentInterface
   */
  protected $payment;

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getConfiguration() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function setConfiguration(array $configuration) {
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  protected function getSupportedCurrencies() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getPaymentExecutionResult() {
    return new OperationResult();
  }

  /**
   * {@inheritdoc}
   */
  public function executePaymentAccess(AccountInterface $account) {
    return AccessResult::forbidden();
  }

  /**
   * {@inheritdoc}
   */
  public function executePayment() {
    throw new \RuntimeException('This plugin cannot execute payments.');
  }

  /**
   * Gets the payment this payment method is for.
   *
   * @return \Drupal\payment\Entity\PaymentInterface
   */
  public function getPayment() {
    return $this->payment;
  }

  /**
   * Gets the payment this payment method is for.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *
   * @return $this
   */
  public function setPayment(PaymentInterface $payment) {
    $this->payment = $payment;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getPluginLabel() {
    return $this->pluginDefinition['label'];
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92
Unavailable::$payment protected property The payment this payment method is for.
Unavailable::buildConfigurationForm public function
Unavailable::calculateDependencies public function
Unavailable::defaultConfiguration public function
Unavailable::executePayment public function Executes the payment. Overrides PaymentMethodInterface::executePayment
Unavailable::executePaymentAccess public function Checks if the payment can be executed. Overrides PaymentMethodInterface::executePaymentAccess
Unavailable::getConfiguration public function
Unavailable::getPayment public function Gets the payment this payment method is for. Overrides PaymentAwareInterface::getPayment
Unavailable::getPaymentExecutionResult public function Gets the payment execution status. Overrides PaymentMethodInterface::getPaymentExecutionResult
Unavailable::getPluginLabel public function
Unavailable::getSupportedCurrencies protected function
Unavailable::setConfiguration public function
Unavailable::setPayment public function Gets the payment this payment method is for. Overrides PaymentAwareInterface::setPayment
Unavailable::submitConfigurationForm public function
Unavailable::validateConfigurationForm public function