Guest Posted May 20, 2004 Share Posted May 20, 2004 Does anyone know how to stop pm2checkout asking for CC info twice ? (Once on site's checkout page, and again at 2CO page ?) or at least can pm2checkout auto populate the 2CO CC fields ? Thanks for the help Link to comment Share on other sites More sharing options...
Guest Posted May 20, 2004 Share Posted May 20, 2004 I forgot to mention that i have the latest contrib installed (May 16th i believe) and am a new customer to 2CO , so i use the new process URL Link to comment Share on other sites More sharing options...
Guest Posted May 20, 2004 Share Posted May 20, 2004 in order to prevent oscommerce from asking for credit card info and then have 2checkout ask for credit card info too - if i understood the question correctly - go into catlog/admin and under the payment modules, turn off the "credit card" module (i also turned off the cod module too) and just keep the 2checkout module. because i did not want "2checkout" to be what people saw under payment options on the checkout payment, i changed the displayed text to "credit card" in (i think) english->modules->pm2checkout look for the "define" text that says "2checkout", and just change it to "credit card" - or whatever you want it to say when a customer sees the checkout payment page. i'm not exactly sure if i gave the correct location of the file to change the text, but i believe that someone else posted a comment that describes where it is if you search "2checkout" eva Link to comment Share on other sites More sharing options...
Guest Posted May 21, 2004 Share Posted May 21, 2004 Hi, Thank you for your reply. The credit card module is off and i already have 2checkout renamed as credit card, but it still does ask for CC information on checkout page. It also seems that now whenever a customer tries to check out using CC it says parameter invalid, it worked fine for the first few orders, What give ? Thanks in advance. Link to comment Share on other sites More sharing options...
Guest Posted May 21, 2004 Share Posted May 21, 2004 hello gsmliberty, just one thought that occurred to me: since we both did the same thing (turned off the credit card module) and renamed the 2checkout module as "credit card" and mine works and yours doesn't, it makes me think that somehow the credit card module is still being sought somehow. did you by chance change any more than the define('MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE', 'Credit Card'); in home / public_html / catalog / includes / languages / english / modules / payment / pm2checkout.php ? when i look in admin i now see two "Credit Card" modules, but when i click on the second one it says "2checkout" in the right side bar. this may be too simple, but it was worth a shot - beyond this idea, it's a little over my head... hopefully it helps, eva Link to comment Share on other sites More sharing options...
GIZMO-XL Posted May 24, 2004 Share Posted May 24, 2004 OK all I have got email from the folks at 2CO.com a fix has now been added to the new system. If x_Receipt_Link_URL is there it will override any URL entered in on the account. Therefore all passbacks will be sent to the x_Receipt_Link_URL. So what this means is that in both the old version of the pm2checout.php and the new version of it you need to make sure you are sending this. This will override the return page setup on your account at 2Co.com and make sure the osCid is part of the url so you are not sent to a login page when you return from entering in your credit card info. Now for the next Item. If you are on the new servers at 2CO.com you need to use the new version because it will make it where your customers do not have to enter in credit card data twice. While users still on the old servers will use the version that shipped with 2.2 This should also correct the hash problem. :) :) :) :) :) Link to comment Share on other sites More sharing options...
jburton71 Posted May 24, 2004 Share Posted May 24, 2004 Could we see a code example of x_Receipt_Link_URL? Right nw I have my 2CO set to return to this URL: http://www.mysite.com/catalog/pm2checkout_process.php You are saying it doesn't matter what I have entered b/c x_Receipt_Link_URL will override it - but where is this x_Receipt_Link_URL at? I am a complete newbie to both osCommerce, 2CO and PHP but I am learning fast! I did manage to get the workaorund (minus the hash checking - it is commented out) mentioned earlier in the thread running. I am pretty sure that if I can see the fix I can implement it into my site. Thanks for any help you can give... Link to comment Share on other sites More sharing options...
GIZMO-XL Posted May 25, 2004 Share Posted May 25, 2004 Could we see a code example of x_Receipt_Link_URL? Right nw I have my 2CO set to return to this URL: http://www.mysite.com/catalog/pm2checkout_process.php You are saying it doesn't matter what I have entered b/c x_Receipt_Link_URL will override it - but where is this x_Receipt_Link_URL at? I am a complete newbie to both osCommerce, 2CO and PHP but I am learning fast! I did manage to get the workaorund (minus the hash checking - it is commented out) mentioned earlier in the thread running. I am pretty sure that if I can see the fix I can implement it into my site. Thanks for any help you can give... The following is the code for the new version of 2CO.com. <?php /* $Id: pm2checkout.php,v 1.19 2003/01/29 19:57:15 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License Updates May 13 2004 by http://www.rayservers.com Updates May 24, 2004 by Gizmo-XL to support the new 2CO.com servers */ class pm2checkout { var $code, $title, $description, $enabled; // class constructor function pm2checkout() { global $order; $this->code = 'pm2checkout'; $this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE; $this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_2CHECKOUT_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_2CHECKOUT_STATUS == 'True') ? true : false); $this->check_hash = ((MODULE_PAYMENT_2CHECKOUT_CHECK_HASH == 'True') ? true : false); $this->secret_word = MODULE_PAYMENT_2CHECKOUT_SECRET_WORD; $this->login_id = MODULE_PAYMENT_2CHECKOUT_LOGIN; if ((int)MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); // The following is used if you have the old 2checkout.com servers // $this->form_action_url = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c'; // The following is used if you are on the new @CO.com servers $this->form_action_url = 'https://www2.2checkout.com/2co/buyer/purchase'; } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_2CHECKOUT_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_2CHECKOUT_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() { global $order; $selection = array('id' => $this->code, 'module' => $this->title ); return $selection; } function pre_confirmation_check() { return false; } function confirmation() { global $HTTP_POST_VARS; if (DEFAULT_CURRENCY <> 'USD') $title = $this->title . MODULE_PAYMENT_2CHECKOUT_CURRENCY_CONVERSITION; else $title = $this->title; $confirmation = array('title' => $title); return $confirmation; } function process_button() { global $HTTP_POST_VARS, $order, $currency, $currencies; if (DEFAULT_CURRENCY <> 'USD') { $cOrderTotal = $currencies->get_value("USD") * $order->info['total']; } else $cOrderTotal = $order->info['total']; $process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) . tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) . tep_draw_hidden_field('x_invoice_num', date('YmdHis')) . tep_draw_hidden_field('demo', ((MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test') ? 'Y' : 'N')) . tep_draw_hidden_field('x_first_name', $order->customer['firstname']) . tep_draw_hidden_field('x_last_name', $order->customer['lastname']) . tep_draw_hidden_field('x_address', $order->customer['street_address']) . tep_draw_hidden_field('x_city', $order->customer['city']) . tep_draw_hidden_field('x_state', $order->customer['state']) . tep_draw_hidden_field('x_zip', $order->customer['postcode']) . tep_draw_hidden_field('x_country', $order->customer['country']['title']) . tep_draw_hidden_field('x_email', $order->customer['email_address']) . tep_draw_hidden_field('x_phone', $order->customer['telephone']) . tep_draw_hidden_field('x_ship_to_first_name', $order->delivery['firstname']) . tep_draw_hidden_field('x_ship_to_last_name', $order->delivery['lastname']) . tep_draw_hidden_field('x_ship_to_address', $order->delivery['street_address']) . tep_draw_hidden_field('x_ship_to_city', $order->delivery['city']) . tep_draw_hidden_field('x_ship_to_state', $order->delivery['state']) . tep_draw_hidden_field('x_ship_to_zip', $order->delivery['postcode']) . tep_draw_hidden_field('x_ship_to_country', $order->delivery['country']['title']) . tep_draw_hidden_field('x_receipt_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . tep_draw_hidden_field('x_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE')); return $process_button_string; } function before_process() { global $HTTP_POST_VARS; if ($HTTP_POST_VARS['x_response_code'] != '1') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE), 'SSL', true, false)); } // check the md4 hash if ($this->check_hash == true) { $compare_string = $this->secret_word . $this->login_id . $HTTP_POST_VARS['x_trans_id'] . $HTTP_POST_VARS['x_amount']; // make it md5 $compare_hash1 = md5($compare_string); // make all upper $compare_hash1 = strtoupper($compare_hash1); $compare_hash2 = $HTTP_POST_VARS['x_MD5_Hash']; if ($compare_hash1 != $compare_hash2) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_HASH_MESSAGE), 'SSL', true, false)); } } } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_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 2CheckOut Module', 'MODULE_PAYMENT_2CHECKOUT_STATUS', 'True', 'Do you want to accept 2CheckOut payments?', '6', '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 ('Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', '18157', 'Login/Store Number used for the 2CheckOut service', '6', '2', 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 Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Test', 'Transaction mode used for the 2Checkout service', '6', '3', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', 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 ('Merchant Notifications', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'True', 'Should 2CheckOut e-mail a receipt to the store owner?', '6', '4', '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_2CHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', 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_2CHECKOUT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', '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_2CHECKOUT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '7', '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 ('Check MD5 hash', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'False', 'Should the 2CheckOut MD5 hash facilty to be checked?', '6', '8', '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 ('Secret Word', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD', 'tango', 'Secret word for the 2CheckOut MD5 hash facility', '6', '9', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_2CHECKOUT_STATUS', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'MODULE_PAYMENT_2CHECKOUT_ZONE', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD'); } } ?> copy and paste this into a new file ftp it to your site. after you uninstal the one currently on your site and have backed it up. Once you have ftp the new file up install the module and you are good to go Hope this help's Link to comment Share on other sites More sharing options...
GIZMO-XL Posted May 25, 2004 Share Posted May 25, 2004 the above should also fix the MD5 Hash problems. It will also remove the credit card fields from OSC so all credit card information is entered at 2CO.com. If you turn on the MD5 Hash stuff on your 2CO.com account after the credit card is processed it will auto return to your site so you should not lose anymore orders because your customers don't click on the finish button. Hope this helps. Link to comment Share on other sites More sharing options...
jburton71 Posted May 25, 2004 Share Posted May 25, 2004 Thanks for the code... I uploaded it as pm2checkout.php... enabled the secret word in the 2CO module to match my word inside 2CO... removed the successfull and unsuccesfull URLs from my 2CO account in the look and feel section. When I made a test purchase the transaction went through but I was not redirected anywhere. So... I added this URL back into the look and feel section at 2CO for a successfull purchase - http://www.mysite.com/catalog/pm2checkout_process.php - and after a test purchase I was redirected but got the "error processing your card" message. So... I Just went back to the hack that was working for me before I tried this and it works ok. Not sure what I am doing wrong here? Is there a different URL I should use in the 2CO look and feel section - or maybe a better way to ask this is WHICH file is the URL for a successful purchase supposed to go to? I have the feeling that I am very close but I just can't figure it out? Link to comment Share on other sites More sharing options...
GIZMO-XL Posted May 25, 2004 Share Posted May 25, 2004 Just as a FYI when using the md5hash you can't test in demo mode it won't work without valid transaction id numbers Link to comment Share on other sites More sharing options...
RicherD Posted May 27, 2004 Share Posted May 27, 2004 Anyone still having problems with this? I'm using the pm2checkout.php posted above by Gizmo-XL, using Production mode, and with MD5 hash checking on. I have setup the return value in the "look and feel" area of 2CO.com, as well as sending it from the confirm order form... however I try it - it never makes any attempt to return to my store! I've tried various URL return values, but it won't budge an inch. When I reach the payment page, if I click back several times on the 2CO payment form, then click "continue shopping" from the 2CO shopping cart page, it does direct me back to my site - so the variable is in there somewhere. Anyone shed any light on this? Link to comment Share on other sites More sharing options...
GIZMO-XL Posted May 28, 2004 Share Posted May 28, 2004 I have sent them the feedback and they told me they are looking into it. They can't seem to locate the problem, but they told me they are working on it until they get it working. I myself am still on the old server so I can't do anymore testing. Does it work without turning on the md5hash? Will it return to the correct page in your store and not a login page? Link to comment Share on other sites More sharing options...
RicherD Posted May 28, 2004 Share Posted May 28, 2004 Hi, thanks for your response, I have a ticket open with 2CO tech support but I'm not holding my breath for a response, they seem to be moving very slowly on this. To answer your questions, it still doesn't work with the md5hash turned off, in demo mode, or in production mode. I've tried every conceivable combination - including sending the Approval Url, setting it in the admin area only, and doing both - and I've not once had it return after checking out! The only way I have made it "return" to my store is to click back several times once I reach the payment page (without entering any payment details), this returns me to the 2CO "shopping cart" page - when I click continue shopping, it takes me back to my confirm order page - without needing to login, all my items are still in the osC cart. All I can deduce from this is that the 2CO system *knows* where the Return URL is - but completely fails to redirect there after the payment page. The system just appears to be broken as far as I can tell... I even tried entering ebay.com as a Approval URL in the admin area, but it still does nothing - I think the claims made in a post above regarding connectivity problems (from 2CO support) are a red herring. Would be very interested to see anyone with osC successfully up and running on the new system... Link to comment Share on other sites More sharing options...
Fabien Posted May 28, 2004 Share Posted May 28, 2004 Hi, I have it working on the new 2checkout system using Shawn's code, at least with the md5hash turned off. I didn't try with md5hash on, because we are still on testing mode. However, the only way I found to have it work was by disabling the function before_process() sub-routine for the x_response_code. When allowing this sub-routine to run, no redirection take place after the order. Also : as I understand the previous posts, the x_receipt_link_url variable is suppose to overwrite what you have in the look and feel at your 2checkout account. Well, it's just not the case. Because my x_receipt_link_url refers to checkout_process.php but after placing an order I definitively get back to our shop via the pm2checkout_process.php file, which is what i have in the look and feel section. Regards, Fabien Link to comment Share on other sites More sharing options...
ELKO Posted May 28, 2004 Share Posted May 28, 2004 I have such problem: Payment passes, after it comes back on a page pm2checkout_payment.php, after it goes on checkout_payment.php but after it all-equally shows the report of "There has been an error processing your credit card. Please try again." and these baskets do not change. But payment passes !!! Who can say what parameters is not passed in pm2checkout_payment.php or in checkout_payment.php ??? Link to comment Share on other sites More sharing options...
RicherD Posted May 28, 2004 Share Posted May 28, 2004 Fabien: Would you mind posting up the code you're using for pm2checkout.php ? I tried commenting out the function you mentioned but I'm still having no joy... using test mode and md5hash checking off. Thanks Link to comment Share on other sites More sharing options...
Fabien Posted May 28, 2004 Share Posted May 28, 2004 Richer, You will find below my pm2checkout_process.php Note that my catalog folder it at the root of the site, not in the /catalog folder. So you should edit the action's URL according to your own setup. Of course also put your own domain name :D Last but not least, if your site is still under developement like ours, and you password protect it, remove the protection, otherwise the redirection will fail. I know it sounds like common sense, but you never know :P Test your pm2checkout_process.php page by calling it directly. It sould redirect you to http://www.Yourowndomain.com/login.php?osCsid=blablabla or http://www.Yourowndomain.com/shopping_cart.php depending if you already logged in or not. <html> <head> <title></title> <style type="text/css"> body {backgorund-color:#FFFFFF;} body, td, div {font-family: verdana, arial, sans-serif; font-size:14px;} </style> </head> <body onload="document.twocoprocessform.submit()"> <form name="twocoprocessform" method="POST" action="http://www.Yourowndomain.com/checkout_process.php"> <table cellpadding="0" width="100%" height="100%" cellspacing="0"> <tr> <td align="middle" style="height:100%; vertical-align:middle;"> <?php foreach ($_GET as $key => $val) { print "<input type=\"hidden\" name=\"$key\" value=\"$val\">\n"; } ?> Thank you... redirecting to http://www.Yourowndomain.com/checkout_proc...gt;<br>If the page fails to redirect click <input type="submit" value="here"> </td> </tr> </table> </form> </body> </html> Link to comment Share on other sites More sharing options...
salewit Posted May 28, 2004 Share Posted May 28, 2004 I know you guys are deep in the heat of this thing, but I have a quick question. I just signed up for 2checkout 10 minutes ago. I thought I was getting a credit card processor where the buyer enters his card info in OSC, then it gets approved by 2CO and OSC continues on. I don't want the user to see 2CO's site and/or have to enter info on their site. 2CO should be 100% transparent. Is this the case or am I missing something? If they are NOT transparent, I'm going to cancel and find someone else. Thx, Sam Link to comment Share on other sites More sharing options...
RicherD Posted May 28, 2004 Share Posted May 28, 2004 Thanks Fabien - but i was looking for the code for: includes/modules/payment/pm2checkout.php - the redirect page will be more of a concern when I can actually get it to return to my store :D @ Sam - the details are entered in on 2CO's secure pages - you can customise them slightly (header and footer) but it's no where near transparent. I've used trustcommerce.com's payment module before and it is totally seamless - it's fairly expensive to set up though... I'm sure there are many others that work similarly well. Link to comment Share on other sites More sharing options...
ELKO Posted May 28, 2004 Share Posted May 28, 2004 Last but not least, if your site is still under developement like ours, and you password protect it, remove the protection, otherwise the redirection will fail. I know it sounds like common sense, but you never know :P 2 Fabien: say please that means: Link to comment Share on other sites More sharing options...
Fabien Posted May 29, 2004 Share Posted May 29, 2004 Hello, As said before it's just Shawn's code minus the function before_process(). I also modified the function confirmation() and function process_button() because we don't use multi-currencies in the Shop. Only Euros. Fabien. <?php /* $Id: pm2checkout.php,v 1.19 2003/01/29 19:57:15 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License Updates May 13 2004 by http://www.rayservers.com Updates May 24, 2004 by Gizmo-XL to support the new 2CO.com servers */ class pm2checkout { var $code, $title, $description, $enabled; // class constructor function pm2checkout() { global $order; $this->code = 'pm2checkout'; $this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE; $this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_2CHECKOUT_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_2CHECKOUT_STATUS == 'True') ? true : false); $this->check_hash = ((MODULE_PAYMENT_2CHECKOUT_CHECK_HASH == 'True') ? true : false); $this->secret_word = MODULE_PAYMENT_2CHECKOUT_SECRET_WORD; $this->login_id = MODULE_PAYMENT_2CHECKOUT_LOGIN; if ((int)MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); // The following is used if you have the old 2checkout.com servers // $this->form_action_url = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c'; // The following is used if you are on the new @CO.com servers $this->form_action_url = 'https://www2.2checkout.com/2co/buyer/purchase'; } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_2CHECKOUT_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_2CHECKOUT_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() { global $order; $selection = array('id' => $this->code, 'module' => $this->title ); return $selection; } function pre_confirmation_check() { return false; } function confirmation() { global $HTTP_POST_VARS; $title = $this->title; $confirmation = array('title' => $title); return $confirmation; } function process_button() { global $HTTP_POST_VARS, $order, $currency, $currencies; $cOrderTotal = $order->info['total']; $process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) . tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) . tep_draw_hidden_field('x_invoice_num', date('YmdHis')) . tep_draw_hidden_field('demo', ((MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test') ? 'Y' : 'N')) . tep_draw_hidden_field('x_first_name', $order->customer['firstname']) . tep_draw_hidden_field('x_last_name', $order->customer['lastname']) . tep_draw_hidden_field('x_address', $order->customer['street_address']) . tep_draw_hidden_field('x_city', $order->customer['city']) . tep_draw_hidden_field('x_state', $order->customer['state']) . tep_draw_hidden_field('x_zip', $order->customer['postcode']) . tep_draw_hidden_field('x_country', $order->customer['country']['title']) . tep_draw_hidden_field('x_email', $order->customer['email_address']) . tep_draw_hidden_field('x_phone', $order->customer['telephone']) . tep_draw_hidden_field('x_ship_to_first_name', $order->delivery['firstname']) . tep_draw_hidden_field('x_ship_to_last_name', $order->delivery['lastname']) . tep_draw_hidden_field('x_ship_to_address', $order->delivery['street_address']) . tep_draw_hidden_field('x_ship_to_city', $order->delivery['city']) . tep_draw_hidden_field('x_ship_to_state', $order->delivery['state']) . tep_draw_hidden_field('x_ship_to_zip', $order->delivery['postcode']) . tep_draw_hidden_field('x_ship_to_country', $order->delivery['country']['title']) . tep_draw_hidden_field('x_receipt_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . tep_draw_hidden_field('x_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE')); return $process_button_string; } function before_process() { global $HTTP_POST_VARS; /* if ($HTTP_POST_VARS['x_response_code'] != '1') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE), 'SSL', true, false)); } */ // check the md4 hash if ($this->check_hash == true) { $compare_string = $this->secret_word . $this->login_id . $HTTP_POST_VARS['x_trans_id'] . $HTTP_POST_VARS['x_amount']; // make it md5 $compare_hash1 = md5($compare_string); // make all upper $compare_hash1 = strtoupper($compare_hash1); $compare_hash2 = $HTTP_POST_VARS['x_MD5_Hash']; if ($compare_hash1 != $compare_hash2) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_HASH_MESSAGE), 'SSL', true, false)); } } } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_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 2CheckOut Module', 'MODULE_PAYMENT_2CHECKOUT_STATUS', 'True', 'Do you want to accept 2CheckOut payments?', '6', '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 ('Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', '18157', 'Login/Store Number used for the 2CheckOut service', '6', '2', 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 Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Test', 'Transaction mode used for the 2Checkout service', '6', '3', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', 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 ('Merchant Notifications', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'True', 'Should 2CheckOut e-mail a receipt to the store owner?', '6', '4', '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_2CHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', 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_2CHECKOUT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', '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_2CHECKOUT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '7', '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 ('Check MD5 hash', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'False', 'Should the 2CheckOut MD5 hash facilty to be checked?', '6', '8', '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 ('Secret Word', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD', 'tango', 'Secret word for the 2CheckOut MD5 hash facility', '6', '9', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_2CHECKOUT_STATUS', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'MODULE_PAYMENT_2CHECKOUT_ZONE', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD'); } } ?> Link to comment Share on other sites More sharing options...
ELKO Posted May 29, 2004 Share Posted May 29, 2004 Many Thanks Fabien! This first that fully began to work. Link to comment Share on other sites More sharing options...
Guest Posted May 29, 2004 Share Posted May 29, 2004 hello everyone, along with everyone else, i too am very frustrated. i have a little news to share regarding 2co. i called their customer service number and expressed my frustration, and actually got a very good response. i was given the name of the the person responsible for ensuring that 2co's system works. his name is tony. i sent him the original checkout_process.php file and he tells me he is working on the problem. i exchanged emails with him on tuesday, and it isn't fixed yet (sat). however - i don't know how big of a production it will be to actually fix. unless they're bs-ing me - which i don't think is the case - i think they're genuinely looking to solve the problem - unfortunately, that doesn't help people who's stores are waiting to go live, or are unable to process current orders. my suggestion is to call their customer service number so they know from all of us that we need this thing fixed. just one idea - i found that i got a good response just by telling them that i am frustrated by this problem (could've added that it's costing me money), i would like to cancel my account and ask for my money back if the problem cannot be resolved, BUT that my preference is to have the problem solved. i think that having more people than just me on them waiting for a fix might help encourage a faster fix - sending in a support ticket didn't seem to get me the same support, although i think it's important to submit one and get a response before calling. thanks, eva Link to comment Share on other sites More sharing options...
Guest Posted May 29, 2004 Share Posted May 29, 2004 here's 2CO's info: * You can also call our Customer Service Support Center between 8:00 AM and 6:30 PM (Eastern Standard Time), Monday through Friday and 9:00 AM to 5:30 PM on Saturday. 1-877-294-0273 ????toll-free in U.S. & Canada 1-614-921-2450 ????international callers Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.