You are here

uc_recurring_mock_gateway.module in UC Recurring Payments and Subscriptions 6.2

Same filename and directory in other branches
  1. 7.2 test/uc_recurring_mock_gateway.module

Uc recurring implementation for the test gateway module.

File

test/uc_recurring_mock_gateway.module
View source
<?php

/**
 * @file
 * Uc recurring implementation for the test gateway module.
 */

/**
 * Implementation of hook_payment_method().
 */
function uc_recurring_mock_gateway_payment_method() {
  $methods[] = array(
    'id' => 'mock_gateway',
    'name' => t('Mock Recurring Payment Method'),
    'title' => 'Mock Gateway',
    'review' => t('Mock Gateway'),
    'desc' => t('Simulate payment function.'),
    'callback' => 'uc_recurring_method_mock_gateway',
    'weight' => 1,
    'checkout' => TRUE,
    'no_gateway' => TRUE,
  );
  return $methods;
}

/**
 * Implements hook_order
 */
function uc_recurring_mock_gateway_order($ops, $arg1, $arg2) {
  switch ($ops) {
    case 'submit':
      if ($arg1->payment_method == 'mock_gateway') {
        uc_payment_enter($arg1->order_id, 'mock_gateway', $arg1->order_total, 0, NULL, t('Inital order payment.'));
      }
      break;
  }
}

/**
 * Implementation of hook_recurring_info().
 */
function uc_recurring_mock_gateway_recurring_info() {
  $items['mock_gateway'] = array(
    'name' => t('Mock Gateway'),
    'payment method' => 'mock_gateway',
    'fee handler' => 'mock_gateway',
    'module' => 'UC recurring',
    'renew callback' => 'uc_recurring_mock_gateway_renew',
    'process callback' => 'uc_recurring_mock_gateway_process',
  );
  return $items;
}

/**
 * Handle recurring fee process callback
 */
function uc_recurring_mock_gateway_process($order, &$fee) {
  return TRUE;
}

/**
 * Handle recurring fee renew callback
 */
function uc_recurring_mock_gateway_renew($order, &$fee) {
  global $gateway_status;
  if ($gateway_status) {
    uc_payment_enter($fee->order_id, 'mock_gateway', $fee->fee_amount, 0, NULL, t('Recurring fee payment.'));
  }
  return $gateway_status;
}

Functions

Namesort descending Description
uc_recurring_mock_gateway_order Implements hook_order
uc_recurring_mock_gateway_payment_method Implementation of hook_payment_method().
uc_recurring_mock_gateway_process Handle recurring fee process callback
uc_recurring_mock_gateway_recurring_info Implementation of hook_recurring_info().
uc_recurring_mock_gateway_renew Handle recurring fee renew callback