You are here

commerce_worldpay.module in Commerce Worldpay 8

Same filename and directory in other branches
  1. 8.2 commerce_worldpay.module

Provides a Worldpay Business Gateway payment method for Drupal Commerce.

File

commerce_worldpay.module
View source
<?php

define('WORLDPAY_BG_SERVER_TEST', 'Test');
define('WORLDPAY_BG_SERVER_LIVE', 'Live');

// Default URLs for WorldPay transaction.
define('C_WORLDPAY_BG_DEF_SERVER_LIVE', 'https://secure.worldpay.com/wcc/purchase');
define('C_WORLDPAY_BG_DEF_SERVER_TEST', 'https://secure-test.worldpay.com/wcc/purchase');

// This is WorldPay custom variable name, used to hold the repsone URL.
define('C_WORLDPAY_BG_RESPONSE_URL_TOKEN', 'MC_callback');

/**
 * @file
 * Provides a Worldpay Business Gateway payment method for Drupal Commerce.
 */

/**
 * Implements hook_theme().
 */
function commerce_worldpay_theme() {
  $common_vars = [
    'installation_id' => NULL,
    'order_id' => NULL,
    'transaction_id' => NULL,
    'return_url' => NULL,
  ];
  return [
    'commerce_worldpay_success' => [
      'variables' => $common_vars,
      'template' => 'commerce-worldpay-success',
    ],
    'commerce_worldpay_cancel' => [
      'variables' => $common_vars,
      'template' => 'commerce-worldpay-cancel',
    ],
  ];
}