/** * {@inheritdoc} */ public function execute(PaymentInterface $payment = NULL) { if ($payment) { $status = $this->paymentStatusType->getPluginManager()->createInstance($this->configuration['payment_status_plugin_id']); $payment->setPaymentStatus($status); } }
/** * @covers ::resumeContextAccess * * @dataProvider providerTestResumeContextAccess */ public function testResumeContextAccess($expected, $payment_owner_id, $account_id) { $account = $this->getMock(AccountInterface::class); $account->expects($this->atLeastOnce())->method('id')->willReturn($account_id); $this->payment->expects($this->atLeastOnce())->method('getOwnerId')->willReturn($payment_owner_id); $access = $this->sut->resumeContextAccess($account); $this->assertInstanceOf(AccessResultInterface::class, $access); $this->assertSame($expected, $access->isAllowed()); }
/** * @covers ::submitForm */ function testSubmitForm() { $this->logger->expects($this->atLeastOnce())->method('info'); $this->payment->expects($this->once())->method('delete'); $form = []; $form_state = $this->getMock(FormStateInterface::class); $form_state->expects($this->once())->method('setRedirect')->with('<front>'); $this->sut->submitForm($form, $form_state); }
/** * {@inheritdoc} */ public function execute(PaymentInterface $payment = NULL) { if ($payment) { $payment->unsetLineItem($this->configuration['line_item_name']); } }
/** * Returns the title for the payment edit page. * * @param \Drupal\payment\Entity\PaymentInterface $payment * * @return string */ public function title(PaymentInterface $payment) { return $this->t('Edit payment #@payment_id', ['@payment_id' => $payment->id()]); }
/** * Checks if the user has access to resume a payment's context. * * @param \Drupal\payment\Entity\PaymentInterface $payment * * @return \Drupal\Core\Access\AccessResultInterface */ public function access(PaymentInterface $payment) { return AccessResult::allowedIf($payment->getPaymentType()->resumeContextAccess($this->currentUser)); }
/** * Completes a payment. * * @param \Drupal\payment\Entity\PaymentInterface $payment * * @return \Symfony\Component\HttpFoundation\Response */ public function execute(PaymentInterface $payment) { return $payment->getPaymentMethod()->getPaymentExecutionResult()->getCompletionResponse()->getResponse(); }