<?php

/*

  osCommRes, Services Online
  http://www.oscommres.com

  Copyright (c) 2005 osCommRes

  Released under the GNU General Public License
  
  Freeway eCommerce from ZacWare
http://www.zac-ware.com/freeway

Copyright 2007 ZacWare Pty. Ltd
*/
// Set flag that this is a parent file
	define( '_FEXEC', 1 );

  require('includes/application_top.php');
  require(DIR_WS_CLASSES . 'currencies.php');

  $reserve_id=$HTTP_POST_VARS['reservation_id'];

  if (sizeof($reserve_id)<=0)
     tep_redirect(tep_href_link(FILENAME_PENDING_WAITLIST_PAYMENTS));

  if (!tep_session_is_registered('payment')) tep_session_register('payment');
  if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];

  tep_session_register('reservation_id');
  $reservation_id=$reserve_id;

  if (isset($HTTP_GET_VARS['events_id'])) $events_id= $HTTP_GET_VARS['events_id'];
// load the selected payment module

  require(DIR_WS_CLASSES . 'payment.php');

  $payment_modules = new payment($payment);

  if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment))) {
    tep_redirect(tep_href_link(FILENAME_PENDING_WAITLIST_PAYMENTS_CONFIRM, 'events_id=' . (int)$events_id . '&error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
  }

  tep_session_register('payment_page');
  tep_session_register('payment_params');
  $payment_page='waitlist';
  $payment_params='&events_id=' . (int)$events_id;
  if (is_array($payment_modules->modules)) {
    $payment_modules->pre_confirmation_check();
  }

  $payment_params='&events_id=' . (int)$events_id;
  if (isset($$payment->form_action_url)) {
    echo "<form name='edit_confirmation', action='" . $$payment->form_action_url . "' method=post>";
  } else {
    echo tep_draw_form('edit_confirmation', FILENAME_PENDING_WAITLIST_PAYMENTS_CONFIRM, 'events_id=' . (int)$events_id . '&action=update');
    echo '<input type="hidden" name="single" value="none">';
  }
  $amount=$HTTP_POST_VARS['amount'];
  $order_detail=array('info'=>array('total'=>$amount));
  $order=new objectInfo($order_detail);
  
  if (is_array($payment_modules->modules)) {
    echo $payment_modules->process_button();
  }
  echo '</form>';
?>
<script language=javascript>
   document.edit_confirmation.submit();
</script>

