You are here

function uc_cybersource_tax_test in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_cybersource/uc_cybersource.module \uc_cybersource_tax_test()
  2. 7.3 payment/uc_cybersource/uc_cybersource.module \uc_cybersource_tax_test()
1 string reference to 'uc_cybersource_tax_test'
uc_cybersource_menu in payment/uc_cybersource/uc_cybersource.module
Implementation of hook_menu().

File

payment/uc_cybersource/uc_cybersource.module, line 684
A module used for CyberSource's Silent Order POST method of payment.

Code

function uc_cybersource_tax_test($order_id) {
  if ($order = uc_order_load($order_id)) {

    // Fetch the taxes for the order.
    $data = uc_cybersource_calculate_tax($order);

    // Build an item list for the taxes.
    $items = array();
    foreach ($data as $tax) {
      $items[] = t('@tax: @amount', array(
        '@tax' => $tax['name'],
        '@amount' => uc_currency_format($tax['amount']),
      ));
    }

    // Display a message if there are no taxes.
    if (empty($items)) {
      $items[] = t('No taxes returned for this order.');
    }
    return theme('item_list', $items);
  }
  else {
    return t('Order not found.');
  }
}