You are here

public function PayflowLink::onCancel in Commerce PayPal 8

Processes the "cancel" request.

Allows the payment gateway to clean up any data added to the $order, set a message for the customer.

Parameters

\Drupal\commerce_order\Entity\OrderInterface $order: The order.

\Symfony\Component\HttpFoundation\Request $request: The request.

Overrides OffsitePaymentGatewayBase::onCancel

File

src/Plugin/Commerce/PaymentGateway/PayflowLink.php, line 406

Class

PayflowLink
Provides the PayPal Payflow Link payment gateway.

Namespace

Drupal\commerce_paypal\Plugin\Commerce\PaymentGateway

Code

public function onCancel(OrderInterface $order, Request $request) {

  // Display a message indicating the customer canceled payment.
  $this->messenger
    ->addMessage($this
    ->t('You have canceled payment at PayPal but may resume the checkout process here when you are ready.'));

  // Remove the payment information from the order data array.
  $order
    ->unsetData('commerce_payflow');
}