Skip to content
Snippets Groups Projects
Commit 7a1fe799 authored by Jonathan Sacksick's avatar Jonathan Sacksick Committed by Jonathan Sacksick
Browse files

Issue #3273582 by jsacksick, OwilliwO: Void pending manual payment.

parent 497e7c22
Branches
Tags
2 merge requests!235Issue #3115150 by mbovan: Submitting add to cart form with empty quantity...,!205Issue #3349465 by tBKoT, jsacksick, bojanz: Update several VAT rates and setup...
......@@ -157,30 +157,36 @@ class Manual extends PaymentGatewayBase implements ManualPaymentGatewayInterface
* {@inheritdoc}
*/
public function buildPaymentOperations(PaymentInterface $payment) {
$payment_state = $payment->getState()->getId();
$operations = [];
$operations['receive'] = [
'title' => $this->t('Receive'),
'page_title' => $this->t('Receive payment'),
'plugin_form' => 'receive-payment',
'access' => $payment_state == 'pending',
'access' => $payment->getState()->getId() === 'pending',
];
$operations['void'] = [
'title' => $this->t('Void'),
'page_title' => $this->t('Void payment'),
'plugin_form' => 'void-payment',
'access' => $payment_state == 'pending',
'access' => $this->canVoidPayment($payment),
];
$operations['refund'] = [
'title' => $this->t('Refund'),
'page_title' => $this->t('Refund payment'),
'plugin_form' => 'refund-payment',
'access' => in_array($payment_state, ['completed', 'partially_refunded']),
'access' => $this->canRefundPayment($payment),
];
return $operations;
}
/**
* {@inheritdoc}
*/
public function canVoidPayment(PaymentInterface $payment) {
return $payment->getState()->getId() === 'pending';
}
/**
* {@inheritdoc}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment