You are here

public function MolliePayment::getPaymentExecutionResult in Mollie Payment 8.2

Gets the payment execution status.

Return value

\Drupal\payment\OperationResultInterface

Overrides PaymentMethodBase::getPaymentExecutionResult

File

src/Plugin/Payment/Method/MolliePayment.php, line 204

Class

MolliePayment
A payment method using Mollie.

Namespace

Drupal\mollie_payment\Plugin\Payment\Method

Code

public function getPaymentExecutionResult() {

  // Get the Mollie client.
  $mollie_client = $this
    ->getMollieClient();

  // Load the Mollie transaction.
  $mollie_transaction_id = $this
    ->getPayment()
    ->get('mollie_payment_id')->value;
  $mollie_payment = $mollie_client->payments
    ->get($mollie_transaction_id);

  // Redirect visitor to Mollie.
  $response = new Response(Url::fromUri($mollie_payment
    ->getPaymentUrl()));
  return new OperationResult($response);
}