Unavailable.php in Payment 8.2
File
src/Plugin/Payment/Type/Unavailable.php
View source
<?php
namespace Drupal\payment\Plugin\Payment\Type;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\payment\EventDispatcherInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Unavailable extends PaymentTypeBase {
public function __construct(array $configuration, $plugin_id, array $plugin_definition, EventDispatcherInterface $event_dispatcher, TranslationInterface $string_translation) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $event_dispatcher);
$this->stringTranslation = $string_translation;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('payment.event_dispatcher'), $container
->get('string_translation'));
}
public function resumeContextAccess(AccountInterface $account) {
return AccessResult::forbidden();
}
protected function doGetResumeContextResponse() {
throw new NotFoundHttpException();
}
public function getPaymentDescription() {
return new TranslatableMarkup('Unavailable');
}
}