Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

setting order status doesn't work


jloyzaga

Recommended Posts

The code below is supposed to call the payment gateway module but doesn't set the order status - its ms1 - can someone tell me what needs changing?

 

<?php

/*

$Id: commbank.php,v 2.1 2003/01/05

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class commbank {

var $code, $title, $description, $enabled;

 

// class constructor

function commbank() {

$this->code = 'commbank';

$this->title = MODULE_PAYMENT_COMMBANK_TEXT_TITLE;

$this->description = MODULE_PAYMENT_COMMBANK_TEXT_DESCRIPTION;

$this->enabled = ((MODULE_PAYMENT_COMMBANK_STATUS == 'True') ? true : false);

$this->order_status = '4';

$this->form_action_url = '/cgi-bin/Perl_3party_DO.cgi';

}

 

// class methods

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 $HTTP_POST_VARS, $order, $currencies, $currency;

 

switch (MODULE_PAYMENT_COMMBANK_TEST_STATUS) {

case 'false':

$test_status = 'false';

break;

case 'live':

$test_status = 'live';

break;

case 'true':

default:

$test_status = 'true';

break;

}

 

 

$process_button_string = tep_draw_hidden_field('HostName', '127.0.0.1') .

tep_draw_hidden_field('Port', '9050') .

tep_draw_hidden_field('MerchantTxnRef', '') .

tep_draw_hidden_field('MerchantID', MODULE_PAYMENT_COMMBANK_MERCHANT_ID) .

tep_draw_hidden_field('OrderInfo', 'Perl-3Party Example') .

tep_draw_hidden_field('PurchaseAmount', (number_format(($order->info['total']),2)*100)) .

tep_draw_hidden_field('Locale', 'en') .

tep_draw_hidden_field('ReturnURL', 'http://arkmusic.com.au/cgi-bin/Perl_3party_DR.cgi?DR=${DR}') .

tep_draw_hidden_field('AVS_Address', '') .

tep_draw_hidden_field('EnableAVS', '') .

tep_draw_hidden_field('AVS_City', '') .

tep_draw_hidden_field('AVS_State', '') .

tep_draw_hidden_field('AVS_Zip', '') .

tep_draw_hidden_field('AVS_CountryCode', '') .

tep_draw_hidden_field('AVS_AcceptLevel', '') .

tep_draw_hidden_field('merchid', MODULE_PAYMENT_COMMBANK_MERCHANT_ID) .

tep_draw_hidden_field('amt', number_format(($order->info['total']),2)) .

tep_draw_hidden_field('mtid', time()) .

tep_draw_hidden_field('successurl', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', true)) .

tep_draw_hidden_field('failurl', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL', false)) .

tep_draw_hidden_field('curr', MODULE_PAYMENT_COMMBANK_CURRENCY) .

tep_draw_hidden_field('name', $order->billing['firstname'] . ' ' . $order->billing['lastname']) .

tep_draw_hidden_field('email', $order->customer['email_address']);

 

return $process_button_string;

}

 

function before_process() {

return false;

}

 

function after_process() {

return false;

}

 

function get_error() {

global $HTTP_GET_VARS;

 

if (isset($HTTP_GET_VARS['message']) && (strlen($HTTP_GET_VARS['message']) > 0)) {

$error = stripslashes(urldecode($HTTP_GET_VARS['message']));

} else {

$error = MODULE_PAYMENT_COMMBANK_TEXT_ERROR_MESSAGE;

}

 

return array('title' => MODULE_PAYMENT_COMMBANK_TEXT_ERROR,

'error' => $error);

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_COMMBANK_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 ('Allow CommBank', 'MODULE_PAYMENT_COMMBANK_STATUS', '1', 'Do you want to accept Commonwealth Bank of Australia payments?', '7', '1', '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 ('CommBank ID', 'MODULE_PAYMENT_COMMBANK_ID', 'Enter Your CommBank ID', 'Your CommBank ID.', '7', '2', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_COMMBANK_MERCHANT_ID', 'Enter Your Merchant ID Here', 'Your Merchant ID.', '7', '3', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('CommBank Currency', 'MODULE_PAYMENT_COMMBANK_CURRENCY', 'AUD', 'The currency COMMBANK should charge in.', '7', '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 ('Host ID', 'MODULE_PAYMENT_COMMBANK_HOST', 'Enter Your Host ID', 'Your Host ID.', '7', '6', 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_CC_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '7', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

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 ('CommBank Test Status', 'MODULE_PAYMENT_COMMBANK_TEST_STATUS', 'true', 'Transaction mode to use for the CommWeb Module - true/false/live', '7', '5', 'tep_cfg_select_option(array('true', 'false', 'live'), ', now())");

 

}

 

function remove() {

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

}

 

function keys() {

 

return array('MODULE_PAYMENT_COMMBANK_STATUS', 'MODULE_PAYMENT_COMMBANK_ID', 'MODULE_PAYMENT_COMMBANK_MERCHANT_ID', 'MODULE_PAYMENT_COMMBANK_CURRENCY', 'MODULE_PAYMENT_COMMBANK_TEST_STATUS', 'MODULE_PAYMENT_COMMBANK_HOST', '4');

return $keys;

}

}

?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...