You are here

uc_2checkout.module in Ubercart 8.4

Integrates 2Checkout.com's redirected payment service.

File

payment/uc_2checkout/uc_2checkout.module
View source
<?php

/**
 * @file
 * Integrates 2Checkout.com's redirected payment service.
 */
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function uc_2checkout_help($route_name, RouteMatchInterface $route_match) {

  // Provide information and instructions on the payment method
  // add and edit forms.
  if ($route_name == 'entity.uc_payment_method.add_form' && $route_match
    ->getRawParameter('plugin_id') == '2checkout') {
    return '<p>' . t('To accept PayPal payments in 2Checkout, please ensure that demo mode is disabled and your store currency is one of USD, AUD, CAD, EUR or GBP.') . '</p>';
  }
  elseif ($route_name == 'entity.uc_payment_method.edit_form' && $route_match
    ->getParameter('uc_payment_method')
    ->getPlugin()
    ->getPluginId() == '2checkout') {
    return '<p>' . t('To accept PayPal payments in 2Checkout, please ensure that demo mode is disabled and your store currency is one of USD, AUD, CAD, EUR or GBP.') . '</p>';
  }
}

/**
 * Implements hook_ucga_display().
 */
function uc_2checkout_ucga_display() {

  // Tell UC Google Analytics to display the e-commerce JS on the custom
  // order completion page for this module.
  $route_match = \Drupal::routeMatch();
  if ($route_match
    ->getRouteName() == 'uc_2checkout.complete') {
    return TRUE;
  }
}

Functions