/ Forside/ Teknologi / Udvikling / PHP / Spørgsmål
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
Hjælp - fejl i betalingsmodul
Fra : anetteogjesper
Vist : 529 gange
135 point
Dato : 10-01-06 15:12

Hej

Jeg har fået en ny side hos surftown med betalingsmodul. Det er faktisk meget godt, men deres betalingsmodul virker ikke korrekt. Når man logger ind og skal betale, viser den nemlig ikke dankort betalingen, så der er noget galt med koden et aller andet sted. Jeg har skrevet til surftown flere gange, men der er nu gået en uge og de har ikke fundet ud af noget.
Jeg indsætter lige koden, hvor jeg tror fejlen er og neden under en kode der virker:
Kode
<?php
/*
$Id: cc.php,v 1.53 2003/02/04 09:55:01 project3000 Exp $

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

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/


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

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

$this->code = 'stpgw';
$this->title = MODULE_PAYMENT_STPGW_TEXT_TITLE;
$this->description = MODULE_PAYMENT_STPGW_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_STPGW_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_STPGW_STATUS == 'True') ? true : false);

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

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

$this->form_action_url = 'https://pay.surftown.com/PaymentWindow/PaymentWindow.aspx';
}

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

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_STPGW_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_STPGW_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;

$theamount = str_replace(array('.'),'',round(str_replace(array(','),'',$order->info['total']) *
                   str_replace(array(','),'',$order->info['currency_value']),2));
$theamount = 100 * round($order->info['total'] * $order->info['currency_value'],2);
$process_button_string =
   tep_draw_hidden_field('merchantID', MODULE_PAYMENT_STPGW_MERCHANT_ID) .
   tep_draw_hidden_field('amount', $theamount) .
   tep_draw_hidden_field('currency', $order->info['currency']) .
   tep_draw_hidden_field('clientZip', $order->customer['postcode']) .
   tep_draw_hidden_field('clientCity', $order->customer['city']) .
   tep_draw_hidden_field('clientCountry', $order->customer['country']['iso_code_2']) .
   tep_draw_hidden_field('clientPhone', $order->customer['telephone']) .
   tep_draw_hidden_field('clientEmailDomain', substr($order->customer['email_address'],strpos($order->customer['email_address'],'@')+1)) .
   tep_draw_hidden_field('sessionID', tep_session_id());
return $process_button_string;
}

function before_process() {
return false;
}

function after_process() {
global $insert_id, $HTTP_POST_VARS;

// disable mail support
/* if ( (defined('MODULE_PAYMENT_STPGW_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_STPGW_EMAIL)) ) {
$message = 'Order #' . $insert_id . "\n\n" . 'Surftown Payment Gateway order reference: ' . $HTTP_POST_VARS['shopOrderID'] . "\n\n"; */
/*
tep_mail('', MODULE_PAYMENT_STPGW_EMAIL, 'Extra Order Info: #' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } */
tep_db_query("UPDATE stpgw_orders SET oscom_order_id = $insert_id WHERE stpgw_order_id = '$HTTP_POST_VARS[shopOrderID]'");
}

function get_error() {
global $HTTP_GET_VARS;

$error = array('title' => MODULE_PAYMENT_STPGW_TEXT_ERROR,
'error' => MODULE_PAYMENT_STPGW_TEXT_ERROR_MESSAGE);

return $error;
}

function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_STPGW_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 Surftown Payment Gateway Module', 'MODULE_PAYMENT_STPGW_STATUS', 'True', 'Do you want to accept payments via the Surftown Payment Gateway?', '6', '0', '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 ('Sort order of display.', 'MODULE_PAYMENT_STPGW_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_STPGW_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_STPGW_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())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Surftown Merchant ID.', 'MODULE_PAYMENT_STPGW_MERCHANT_ID', '0', 'Your merchant ID on the Surftown Payment Gateway.', '6', '0' , now())");
/* tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Surftown Payment Gateway E-Mail Address', 'MODULE_PAYMENT_STPGW_EMAIL', '', 'If an e-mail address is entered, the internal Surftown order reference will be sent to the e-mail address', '6', '0', now())"); */
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Surftown Payment Gateway Process Page Password', 'MODULE_PAYMENT_STPGW_PASSWORD', '', 'A password for the Surftown Payment Gateway processing page, which prevents unauthorized registration of payments. You must set the same password in the Surftown Payment Gateway administration interface.', '6', '0', now())");
tep_db_query("CREATE TABLE IF NOT EXISTS stpgw_orders (stpgw_order_id varchar(20), oscom_order_id int, error_code int, error_descr varchar(255),amount int, currency varchar(3))");
}

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

function keys() {
return array('MODULE_PAYMENT_STPGW_STATUS', 'MODULE_PAYMENT_STPGW_ZONE', 'MODULE_PAYMENT_STPGW_ORDER_STATUS_ID', 'MODULE_PAYMENT_STPGW_SORT_ORDER','MODULE_PAYMENT_STPGW_MERCHANT_ID', 'MODULE_PAYMENT_STPGW_PASSWORD');
}
}
?>


Denne koder virker:
Kode
<?php

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

// class constructor
function banktransfer() {
$this->code = 'banktransfer';
$this->title = MODULE_PAYMENT_BANKTRANSFER_TEXT_TITLE;
$this->description = MODULE_PAYMENT_BANKTRANSFER_TEXT_DESCRIPTION;
$this->email_footer = MODULE_PAYMENT_BANKTRANSFER_TEXT_EMAIL_FOOTER;
$this->enabled = (( MODULE_PAYMENT_BANKTRANSFER_STATUS == 'True') ? true : false);
}

// 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 array('title' => ' <tr>' . "\n" . ' <td class="main">&nbsp;' . MODULE_PAYMENT_BANKTRANSFER_TEXT_DESCRIPTION . '&nbsp;</td>' . "\n" . ' </tr>' . "\n");
}

function process_button() {
return false;
}

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_BANKTRANSFER_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, date_added) values ('Allow Bank Transfer Payment', 'MODULE_PAYMENT_BANKTRANSFER_STATUS', 'True', 'Do you want to accept Bank Transfer Order payments?', '6', '1', now());");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Sort Code', 'MODULE_PAYMENT_BANKTRANSFER_SORTCODE', '00-00-00', 'Bank sort code in the format 00-00-00', '6', '1', now());");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Account No.', 'MODULE_PAYMENT_BANKTRANSFER_ACCNUM', '12345678', 'Bank Account No.', '6', '1', now());");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Account Name', 'MODULE_PAYMENT_BANKTRANSFER_ACCNAM', 'Fred Bloggs', 'Bank account name', '6', '1', now());");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Name', 'MODULE_PAYMENT_BANKTRANSFER_BANKNAM', 'The Bank', 'Bank Name', '6', '1', now());");
}

function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_BANKTRANSFER_STATUS'");
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_BANKTRANSFER_SORTCODE'");
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_BANKTRANSFER_ACCNUM'");
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_BANKTRANSFER_ACCNAM'");
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_BANKTRANSFER_BANKNAM'");
}

function keys() {
$keys = array('MODULE_PAYMENT_BANKTRANSFER_STATUS', 'MODULE_PAYMENT_BANKTRANSFER_SORTCODE', 'MODULE_PAYMENT_BANKTRANSFER_ACCNUM', 'MODULE_PAYMENT_BANKTRANSFER_ACCNAM', 'MODULE_PAYMENT_BANKTRANSFER_BANKNAM');

return $keys;
}
}
?>


 
 
Annuller spørgsmålet
Fra : anetteogjesper


Dato : 21-01-06 14:19

Jeg har desværre ikke modtaget et gyldigt svar, og annullerer derfor dette spørgsmål

Du har følgende muligheder
Dette spørgsmål er blevet annulleret, det er derfor ikke muligt for at tilføje flere kommentarer.
Søg
Reklame
Statistik
Spørgsmål : 177413
Tips : 31962
Nyheder : 719565
Indlæg : 6407798
Brugere : 218875

Månedens bedste
Årets bedste
Sidste års bedste