Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Updating History/New Payment Module HELP


taramj22

Recommended Posts

Posted

Hi. I've added DXGPC as a payment module to my website. The module works fine - it goes through the payment process and I can make a payment, and I am brought back to the success page - but then my shopping cart does not update and my account history does not update to show I purchased the product. It doesn't even show up in my administration area that I have made the purchase. Can you look at the module and tell me what I need to fix??

 

Here is the code:

<?php

 

/*

 

$Id: DXGPC.php,v 1.3 2004/04/12

 

written by Sal

 

osCommerce, Open Source E-Commerce Solutions

 

http://www.oscommerce.com

 

 

 

Released under the GNU General Public License

 

 

 

We are modifying the paypal payment modual for our interface.

 

 

 

Here are some variables being used below.

 

MODULE_PAYMENT_DXGPC_STATUS switch used to turn module on and off.

 

MODULE_PAYMENT_DXGPC_ID GPC ID

 

MODULE_PAYMENT_DXGPC_BUSINESSNAME Added this for Bussiness name field in form post

 

MODULE_PAYMENT_DXGPC_CURRENCY currency you are paid in

 

MODULE_PAYMENT_DXGPC_ORDER_STATUS_ID Sounds like a pending ID variable or final

 

MODULE_PAYMENT_DXGPC_SORT_ORDER Determins where in list this payment option sets.

 

The above variables are set into the MySQL database by the install function below.

 

*/

 

 

 

class dxgpc {

 

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

 

 

 

 

 

function dxgpc()

{

 

global $order;

 

 

 

$this->code = 'dxgpc';

 

$this->title = MODULE_PAYMENT_DXGPC_TEXT_TITLE;

 

$this->description = MODULE_PAYMENT_DXGPC_TEXT_DESCRIPTION ;

 

$this->sort_order = MODULE_PAYMENT_DXGPC_SORT_ORDER;

 

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

 

 

 

if ((int)MODULE_PAYMENT_DXGPC_ORDER_STATUS_ID > 0) {

 

$this->order_status = MODULE_PAYMENT_DXGPC_ORDER_STATUS_ID;

 

}

 

 

 

if (is_object($order)) {

$this->update_status();

}

 

 

 

$this->form_action_url = 'https://dxgpc.dxinone.vu/DXGPC/DXGPC.Payment.Initiate.asp';

 

}

 

 

 

// class methods

 

function update_status()

{

global $order;

}

 

 

 

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' => MODULE_PAYMENT_DXGPC_TEXT_DESCRIPTION);

 

}

 

 

 

// This is where the magic happens. When customer clicks to submit payment, they will be redirected to payment companies web site.

 

 

 

function process_button()

{

 

global $order, $currencies, $currency, $customer_id;

 

 

 

// this appears to be for compatibility of multiple currencies.

 

if (MODULE_PAYMENT_DXGPC_CURRENCY == 'Selected Currency') {

 

$my_currency = $currency;

 

} else {

 

$my_currency = substr(MODULE_PAYMENT_DXGPC_CURRENCY, 5);

 

}

 

if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {

 

$my_currency = 'USD';

 

}

 

 

 

 

 

// these are the strings and variables to be passed to the payment website

 

// <input type="hidden" name="merchant_email" value="[email protected]">

 

 

 

$memo_string = "Payment for " . STORE_NAME . " at " . date('l dS \of F Y h:i:s A') .

" Customer id: " . $customer_id;

$parse_url = parse_url(tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'));

$oscid = substr($parse_url['query'],7);

$process_button_string = tep_draw_hidden_field('payment_id', $oscid) .

tep_draw_hidden_field('payment_type', '0') .

tep_draw_hidden_field('payment_dxgpcid',MODULE_PAYMENT_DXGPC_ID) .

 

//tep_draw_hidden_field('payment_memo',MODULE_PAYMENT_DXGPC_MEMO) .

tep_draw_hidden_field('payment_memo',$memo_string) .

tep_draw_hidden_field('payment_currency', $my_currency) .

tep_draw_hidden_field('payment_amount', number_format($order->info['total'], $currencies->get_decimal_places($my_currency))) .

 

tep_draw_hidden_field('success_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .

tep_draw_hidden_field('cancelled_url', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 

// return URL is where the customers browser is returned to.

 

// Notification URL is where DXGPC posts payment information, COMPLETED or INVALID

 

 

 

return $process_button_string;

}

 

 

 

// function before_process()

 

//This method is called before storing user's cart as an order.

 

// You can test here parameters to ensure no-one stores an order without paying

 

//You can stop processing in this point with a tep_redirect call.

 

 

 

function before_process()

{

 

/* if ($HTTP_POST_VARS["transaction_status"] == 'COMPLETED') {

//check to see if transaction_status is set to completed

 

return false;

// if True return a false flag

 

} else if ($HTTP_POST_VARS["transaction_status"] == 'INVALID') {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_DXGPC_FAILED), 'SSL', true, false));

 

} else {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode('IF you successfully sent payment with EMO, Now please select check or money order and finalize order.'), 'SSL', true, false));

 

}

// if the transaction wasn't completed don't continue with check out process.

 

*/ }

 

 

 

// Theory is that this is used to handle payment clean up details such as notifying shopping cart payment is confirmed(If possible).

 

function after_process()

{

 

return false;

 

}

 

 

 

// Probably to detect failed payment transaction of some sort.

 

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_DXGPC_STATUS'");

 

$this->_check = tep_db_num_rows($check_query);

 

}

 

return $this->_check;

 

 

 

}

 

 

 

 

 

// This is obviously setup configuration in the administration

 

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 DXGPC Module', 'MODULE_PAYMENT_DXGPC_STATUS', 'True', 'Do you want to accept DXGPC 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 ('DXGPC ID', 'MODULE_PAYMENT_DXGPC_ID', '118588', 'Your DXGPCID ID', '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 ('Business Name', 'MODULE_PAYMENT_DXGPC_BUSINESSNAME', 'My Business Name', 'The business name to use for the DXGPC service', '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 ('Payment Description', 'MODULE_PAYMENT_DXGPC_DESCRIPTION', 'merchandise and accesories', 'Description for payment', '6', '4', 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('Transaction Currency', 'MODULE_PAYMENT_DXGPC_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '6', 'tep_cfg_select_option(array(\'Selected Currency\',\'Only USD\',\'Only CAD\',\'Only EUR\',\'Only GBP\',\'Only JPY\'), ', 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_DXGPC_SORT_ORDER', '50', '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, set_function, use_function, date_added) values('Set Order Status', 'MODULE_PAYMENT_DXGPC_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())");

 

}

 

 

 

// Obviously to remove this payment option once installed.

 

function remove()

{

 

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

 

}

 

 

 

function keys()

{

 

return array('MODULE_PAYMENT_DXGPC_STATUS', 'MODULE_PAYMENT_DXGPC_ID', 'MODULE_PAYMENT_DXGPC_BUSINESSNAME', 'MODULE_PAYMENT_DXGPC_DESCRIPTION', 'MODULE_PAYMENT_DXGPC_CURRENCY', 'MODULE_PAYMENT_DXGPC_ORDER_STATUS_ID', 'MODULE_PAYMENT_DXGPC_SORT_ORDER');

 

}

 

}

 

?>

Posted

Have you tried the support thread for the module?? Best place to find help for a specific contribution.

The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Posted

If the payment module requires the passing of a session id between your site and the payment services provider then it is going to be very difficult to keep a session id between an ASP script and a PHP script.

 

Also, is this in the actual code? [email protected]

or are you just putting that in to mask your real e-mail address?

 

Vger

Posted
Have you tried the support thread for the module?? Best place to find help for a specific contribution.

 

The module I am using is one that does not come with OSCommerce so therefore there is no forum relating to this specific module. I don't understand ANY type of this coding stuff - wish it was like html. I was given this module by someone else, because I want to accept multiple e-currencies for payment.

Posted
If the payment module requires the passing of a session id between your site and the payment services provider then it is going to be very difficult to keep a session id between an ASP script and a PHP script.

 

Also, is this in the actual code? [email protected]

or are you just putting that in to mask your real e-mail address?

 

Vger

 

Why does it update okay for other payment modules - I would think that it would work pretty much the same with this one. I don't understand this at all!

 

Can anyone suggest a shopping cart platform that is EASY.... like, html format or something...or is there someone I can hire to set up parts of my oscommerce site for me?

 

As far as the email address....yes this is in the actual code, but that is easy to change. Not a big deal.

Archived

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

×
×
  • Create New...