Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Urgent issue with EWAY Contrib (non ssl version)


_indie_

Recommended Posts

Hi, I'm working on a site for a client which is using oscommerce for its storefront. The script works well, but this eway module has issues.

 

When an order is placed in oscommerce, no records are kept if the order was paid for through eway. No email is sent to the shop owner to alert him to a new order. Payment is received, but information about the order is missing. The customer's account in oscommerce is present but shows no orders in its history.

 

Since a non ssl version is important to this client, I need to get this contribution working as opposed to switching to the other on that relies on ssl and xml. Any help would be appreciated, as would any confirmation that other people have experienced the same issues.

 

Thanks.

Link to comment
Share on other sites

I've yet to resolve this issue. Anyone who uses this contrib, please let me know if you're having similar issues.

 

I've emailed the site of the contrib author, but haven't had any response yet.

 

This is the source code for the contrib, maybe someone with sharper eyes than mine will see something wrong or out of place.

 

Thanks.

 

<?php
/*
 $Id: eway.php,v 1.39 2003/01/29 19:57:15 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce
 Modified by Solutions In A Box www.siab.com.au for Eway.com.au

 Released under the GNU General Public License
*/

 class eway {
var $code, $title, $description, $enabled;

// class constructor
function eway() {
  global $order;

  $this->code = 'eway';
  $this->title = MODULE_PAYMENT_EWAY_TEXT_TITLE;
  $this->description = MODULE_PAYMENT_EWAY_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_PAYMENT_EWAY_SORT_ORDER;
  $this->enabled = ((MODULE_PAYMENT_EWAY_STATUS == 'True') ? true : false);

  if ((int)MODULE_PAYMENT_EWAY_ORDER_STATUS_ID > 0) {
	$this->order_status = MODULE_PAYMENT_EWAY_ORDER_STATUS_ID;
  }

  if (is_object($order)) $this->update_status();

  $this->form_action_url = 'https://www.eway.com.au/gateway/payment.asp';
}

// class methods
function update_status() {
  global $order;

  if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_EWAY_ZONE > 0) ) {
	$check_flag = false;
	$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_EWAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
	while ($check = tep_db_fetch_array($check_query)) {
	  if ($check['zone_id'] < 1) {
		$check_flag = true;
		break;
	  } elseif ($check['zone_id'] == $order->billing['zone_id']) {
		$check_flag = true;
		break;
	  }
	}

	if ($check_flag == false) {
	  $this->enabled = false;
	}
  }
}

function javascript_validation() {
  return false;
}

function selection() {
  return array('id' => $this->code,
			   'module' => $this->title);
}

function pre_confirmation_check() {
  return false;
}

function confirmation() {
  return false;
}

function process_button() {
  global $order, $currencies, $currency;

  if (MODULE_PAYMENT_EWAY_CURRENCY == 'Selected Currency') {
	$my_currency = $currency;
  } else {
	$my_currency = substr(MODULE_PAYMENT_EWAY_CURRENCY, 5);
  }
  if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
	$my_currency = 'AUD';
  }
  $process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
						   tep_draw_hidden_field('ewayCustomerID', MODULE_PAYMENT_EWAY_ID) .

			   /*remove this line when going live, its for testing only*/				   
			//   tep_draw_hidden_field('ewayOption3', 'TRUE') .

						   tep_draw_hidden_field('ewayCustomerInvoiceDescription', STORE_NAME) .
						   tep_draw_hidden_field('ewayTotalAmount', number_format(100*($order->info[total]),0,'.','')) .
			   tep_draw_hidden_field('ewayURL', tep_href_link('eway_confirm.php', '', 'SSL'));

  return $process_button_string;
}

function before_process() {
  return false;
}

function after_process() {
  return false;
}

function output_error() {
  return false;
}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_EWAY_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Eway Module', 'MODULE_PAYMENT_EWAY_STATUS', 'True', 'Do you want to accept Eway payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Eway Customer Number', 'MODULE_PAYMENT_EWAY_ID', '87654321', 'Number given by Eway', '6', '4', now())");


  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_EWAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_EWAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_EWAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
}

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
  return array('MODULE_PAYMENT_EWAY_STATUS', 'MODULE_PAYMENT_EWAY_ID', 'MODULE_PAYMENT_EWAY_CURRENCY', 'MODULE_PAYMENT_EWAY_ZONE', 'MODULE_PAYMENT_EWAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_EWAY_SORT_ORDER');
}
 }
?>

Link to comment
Share on other sites

On searching this forum further, I've turned up the same issue in other threads. Here's a few:

 

http://www.oscommerce.com/forums/index.php?showtopic=273337

http://www.oscommerce.com/forums/index.php?showtopic=254735

http://www.oscommerce.com/forums/index.php?showtopic=254637

 

THIS EWAY CONTRIB SHOULD BE REMOVED UNTIL IT IS REPAIRED. IT DOES NOT WORK.

Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...

Hey guys we figured out why it does not work. I have spent days going over and over the code only to find that if you turn the SSL from true to false in the config file. That it works and processes the payment and also stores it to the database and confirms that the payment has been made. If you have any quesitons PM me

 

Kind Regards,

Callum

Link to comment
Share on other sites

  • 1 month later...

Not sure whether this has been pointed out before, but there is a problem in /eway_payment.php that causes the successful return from eway to not continue processing, but to return the generic 'Credit Card Error!' message.

 

/includes/modules/payment/eway.php has the following 'before_process' function:

 

	function before_process() {
  global $HTTP_GET_VARS;
  if ((!isset($HTTP_GET_VARS['authcode'])) || ($HTTP_GET_VARS['authcode'] == "") || ($HTTP_GET_VARS['status'] == "False") || ($HTTP_GET_VARS['order_id'] == '') || (!isset($HTTP_GET_VARS['order_id']))) {
    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_EWAY_TEXT_ERROR), 'SSL', true, false));
  }
}

 

This requires that the current page's GET vars include 'authcode', 'status' and 'order_id'. However, these are not passed to the $Success_Page in /eway_payment.php:

 

    header("Location:$Success_Page?osCsid=$response_trxn_Option1&order_id=$response_trxn_number");

 

When I changed the header() function in /eway_payment.php to include these vars, then the successful eway txn was processed through osC correctly:

 

    header("Location:$Success_Page?osCsid=$response_trxn_Option1&order_id=$response_trxn_number&authcode=$response_trxn_AuthCode&status=$response_trxn_status");

 

Cheers

Tony

Link to comment
Share on other sites

  • 6 months later...

I have a similar problem and the change to

header("Location:$Success_Page?osCsid=$response_trxn_Option1&order_id=$response_trxn_number&authcode=$response_trxn_AuthCode&status=$response_trxn_status");

has not worked

Link to comment
Share on other sites

  • 3 months later...

The issue could be with register globals being on. I had this problem with a store that was moved to PHP 5, and in the eway_confirm.php file the following line was relying on register_globals:

 

if($ewayTrxnStatus == "True")

 

Changing it to:

 

$ewayTrxnStatus = $_POST["ewayTrxnStatus"];
if($ewayTrxnStatus == "True")

 

Fixed the problem for me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...