class PaymentExecuteAccess in Payment 8.2
Provides an event that is dispatched when access is checked for payment execution.
Hierarchy
- class \Drupal\payment\Event\PaymentExecuteAccess extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of PaymentExecuteAccess
See also
\Drupal\payment\Event\PaymentEvents::PAYMENT_EXECUTE_ACCESS
4 files declare their use of PaymentExecuteAccess
- EventDispatcherCollectionTest.php in tests/
src/ Unit/ EventDispatcherCollectionTest.php - PaymentExecuteAccessTest.php in tests/
src/ Unit/ Event/ PaymentExecuteAccessTest.php - SymfonyEventDispatcher.php in src/
SymfonyEventDispatcher.php - SymfonyEventDispatcherTest.php in tests/
src/ Unit/ SymfonyEventDispatcherTest.php
File
- src/
Event/ PaymentExecuteAccess.php, line 18
Namespace
Drupal\payment\EventView source
class PaymentExecuteAccess extends Event {
/**
* The access check result.
*
* @var \Drupal\Core\Access\AccessResultInterface
*/
protected $accessResult;
/**
* The account to check access for.
*
* @var \Drupal\payment\Entity\PaymentInterface
*/
protected $account;
/**
* The payment.
*
* @var \Drupal\payment\Entity\PaymentInterface
*/
protected $payment;
/**
* The payment method.
*
* @var \Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface
*/
protected $paymentMethod;
/**-
* Constructs a new instance.
*
* @param \Drupal\payment\Entity\PaymentInterface $payment
* The payment for which the context will be resumed
* @param \Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface $payment_method
*
* @param \Drupal\Core\Session\AccountInterface
*/
public function __construct(PaymentInterface $payment, PaymentMethodInterface $payment_method, AccountInterface $account) {
$this->accessResult = new AccessResultAllowed();
$this->payment = $payment;
$this->paymentMethod = $payment_method;
$this->account = $account;
}
/**
* Gets the payment for which execution access is checked.
*
* @return \Drupal\payment\Entity\PaymentInterface
* $payment->getPaymentMethod() contains the method currently configured,
* but NOT the method that $payment should be tested against, which is
* $payment_method.
*/
public function getPayment() {
return $this->payment;
}
/**
* Gets the payment method that should execute the payment.
*
* @return \Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface
*/
public function getPaymentMethod() {
return $this->paymentMethod;
}
/**
* Gets the account for which to check access.
*
* @return \Drupal\Core\Session\AccountInterface
*/
public function getAccount() {
return $this->account;
}
/**
* Gets the access check result.
*
* @return \Drupal\Core\Access\AccessResultInterface
*/
public function getAccessResult() {
return $this->accessResult;
}
/**
* Sets an access check result.
*
* @param \Drupal\Core\Access\AccessResultInterface
*
* @return $this
*/
public function setAccessResult(AccessResultInterface $access_result) {
$this->accessResult = $this->accessResult
->orIf($access_result);
return $this;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PaymentExecuteAccess:: |
protected | property | The access check result. | |
PaymentExecuteAccess:: |
protected | property | The account to check access for. | |
PaymentExecuteAccess:: |
protected | property | The payment. | |
PaymentExecuteAccess:: |
protected | property | The payment method. | |
PaymentExecuteAccess:: |
public | function | Gets the access check result. | |
PaymentExecuteAccess:: |
public | function | Gets the account for which to check access. | |
PaymentExecuteAccess:: |
public | function | Gets the payment for which execution access is checked. | |
PaymentExecuteAccess:: |
public | function | Gets the payment method that should execute the payment. | |
PaymentExecuteAccess:: |
public | function | Sets an access check result. | |
PaymentExecuteAccess:: |
public | function |