public function PaymentMethodBase::executePayment in Payment 8.2
Executes the payment.
When executing a payment, it may be authorized, or authorized and captured. After calling this method, more action may be required depending on the return value of self::getPaymentExecutionResult(). This method MUST set the payment's status to "payment_pending" before it performs any payment-method-specific logic.
Return value
\Drupal\payment\OperationResultInterface
Overrides PaymentMethodInterface::executePayment
See also
self::executePaymentAccess
File
- src/
Plugin/ Payment/ Method/ PaymentMethodBase.php, line 228
Class
- PaymentMethodBase
- A base payment method plugin.
Namespace
Drupal\payment\Plugin\Payment\MethodCode
public function executePayment() {
if (!$this
->getPayment()) {
throw new \LogicException('Trying to execute a non-existing payment. A payment must be set trough self::setPayment() first.');
}
$this->eventDispatcher
->preExecutePayment($this
->getPayment());
$this->payment
->setPaymentStatus($this->paymentStatusManager
->createInstance('payment_pending'));
$this
->doExecutePayment();
$this
->getPayment()
->save();
return $this
->getPaymentExecutionResult();
}