You are here

commerce_no_payment.module in Commerce No Payment 7.2

Same filename and directory in other branches
  1. 7 commerce_no_payment.module

Provides a payment method for Drupal Commerce for orders that do not require a payment (free stuff).

File

commerce_no_payment.module
View source
<?php

/**
 * @file
 * Provides a payment method for Drupal Commerce for orders that do not require a payment (free stuff).
 */

/**
 * An absolute parent status: a payment for which all money has been transferred.
 */
define('COMMERCE_NO_PAYMENT_MIGRATE_PER_RUN', 100);

/**
 * Implements hook_commerce_payment_method_info().
 */
function commerce_no_payment_commerce_payment_method_info() {
  $payment_methods = array();
  $payment_methods['commerce_no_payment'] = array(
    'title' => t('No payment required'),
    'description' => t('Does a complete payment transaction with no payment required.'),
    'active' => TRUE,
  );
  return $payment_methods;
}

/**
 * Counts the number of Commerce No Payment Commerce Payment transactions.
 *
 * @return int
 */
function commerce_no_payment_commerce_payment_transaction_count($commerce_payment_method) {
  return db_select('commerce_payment_transaction')
    ->condition('payment_method', $commerce_payment_method)
    ->condition('instance_id', $commerce_payment_method . '|commerce_payment_' . $commerce_payment_method)
    ->countQuery()
    ->execute()
    ->fetchField();
}

Functions

Namesort descending Description
commerce_no_payment_commerce_payment_method_info Implements hook_commerce_payment_method_info().
commerce_no_payment_commerce_payment_transaction_count Counts the number of Commerce No Payment Commerce Payment transactions.

Constants

Namesort descending Description
COMMERCE_NO_PAYMENT_MIGRATE_PER_RUN An absolute parent status: a payment for which all money has been transferred.