Jump to content

nativepaul

Members
  • Content count

    3
  • Joined

  • Last visited

Profile Information

  • Real Name
    Paul Seele
  1. nativepaul

    Updated RBS Worldpay Form Module

    I managed to fix my callback issue. I think it has something to do with the fact that I'm running the WPOSC version of OSCommerce. So I'm not sure what code was causing the problem but if anyone else is using WP OSCommerce for Wordpress then perhaps they'll find it useful. This is the complete code I used in catalog/ext/modules/payment/worldpay/junior_callback.php <?php /* $Id: junior_callback.php 1807 2008-01-13 00:50:08Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2008 osCommerce Released under the GNU General Public License */ if (isset($_POST['M_sid']) && !empty($_POST['M_sid'])) { chdir('../../../../'); require ('includes/application_top.php'); if ($_POST['transStatus'] == 'Y') { $pass = false; if (isset($_POST['M_hash']) && !empty($_POST['M_hash']) && ($_POST['M_hash'] == md5($_POST['M_sid'] . $_POST['M_cid'] . $_POST['cartId'] . $_POST['M_lang'] . number_format($_POST['amount'], 2) . MODULE_PAYMENT_WORLDPAY_JUNIOR_MD5_PASSWORD))) { $pass = true; } if (isset($_POST['callbackPW']) && ($_POST['callbackPW'] != MODULE_PAYMENT_WORLDPAY_JUNIOR_CALLBACK_PASSWORD)) { $pass = false; } if (tep_not_null(MODULE_PAYMENT_WORLDPAY_JUNIOR_CALLBACK_PASSWORD) && !isset($_POST['callbackPW'])) { $pass = false; } if ($pass == true) { include('includes/languages/' . basename($_POST['M_lang']) . '/modules/payment/worldpay_junior.php'); $order_query = tep_db_query("select orders_status, currency, currency_value from " . TABLE_ORDERS . " where orders_id = '" . (int)$_POST['cartId'] . "' and customers_id = '" . (int)$_POST['M_cid'] . "'"); if (tep_db_num_rows($order_query) > 0) { $order = tep_db_fetch_array($order_query); if ($order['orders_status'] == MODULE_PAYMENT_WORLDPAY_JUNIOR_PREPARE_ORDER_STATUS_ID) { $order_status_id = (MODULE_PAYMENT_WORLDPAY_JUNIOR_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_WORLDPAY_JUNIOR_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID); tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . $order_status_id . "', last_modified = now() where orders_id = '" . (int)$_POST['cartId'] . "'"); $sql_data_array = array('orders_id' => $_POST['cartId'], 'orders_status_id' => $order_status_id, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'WorldPay: Transaction Verified'); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); if (MODULE_PAYMENT_WORLDPAY_JUNIOR_TESTMODE == 'True') { $sql_data_array = array('orders_id' => $_POST['cartId'], 'orders_status_id' => $order_status_id, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_WARNING_DEMO_MODE); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); } ?> <style> .pageHeading { font-family: Verdana, Arial, sans-serif; font-size: 20px; font-weight: bold; color: #9a9a9a; } .main { font-family: Verdana, Arial, sans-serif; font-size: 11px; line-height: 1.5; } </style> <p class="pageHeading"><?php echo STORE_NAME; ?></p> <p class="main" align="center"><?php echo MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_SUCCESSFUL_TRANSACTION; ?></p> <form action="<?php echo tep_href_link(FILENAME_CHECKOUT_PROCESS, tep_session_name() . '=' . $_POST['M_sid'] . '&hash=' . $_POST['M_hash'], 'SSL', false); ?>" method="post"> <div align="center"> <input name="submit" type="submit" value="<?php echo sprintf(MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_CONTINUE_BUTTON, addslashes(STORE_NAME)); ?>" /> </div> </form> <p> </p> <WPDISPLAY ITEM=banner> <?php } } } }else{ include('includes/languages/' . basename($_POST['M_lang']) . '/modules/payment/worldpay_junior.php'); ?> <style> .pageHeading { font-family: Verdana, Arial, sans-serif; font-size: 20px; font-weight: bold; color: #9a9a9a; } .main { font-family: Verdana, Arial, sans-serif; font-size: 11px; line-height: 1.5; } </style> <p align="center" class="pageHeading"><?php echo STORE_NAME; ?></p> <p class="main" align="center"><?php echo MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_UNSUCCESSFUL_TRANSACTION;?></p> <form action="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $_POST['M_sid'] . '&hash=' . $_POST['M_hash'], 'SSL', false); ?>" method="post"> <div align="center"> <input name="submit" type="submit" value="<?php echo sprintf(MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_CONTINUE_BUTTON, addslashes(STORE_NAME)); ?>" /> </div> </form> <p align="center"> </p> <div align="center"> <WPDISPLAY ITEM=banner> </div> <?php } } ?> Now I just need to make it look better.
  2. nativepaul

    Updated RBS Worldpay Form Module

    Thanks for the quick response Peter. Check. Going directly to the callback page returns a clear white page. Check. The field doesn't include the http:// Check. I saw the other discussion about this here. So I tried creating a simple form as described. <p class="pageHeading"><?php echo STORE_NAME; ?></p> <p class="main" align="center"><?php echo MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_SUCCESSFUL_TRANSACTION; ?></p> <META http-equiv="refresh" content="4;URL=http://xxxxx/store/checkout_process.php?osCsid=<?php echo $_POST['M_sid']; ?>&hash=<?php echo $_POST['hash']; ?>"> <p align="center"> <a href ="http://xxxxx/store/checkout_process.php?osCsid=<?php echo $_POST['M_sid']; ?>&hash=<?php echo $_POST['hash']; ?>">If you are not automatically returned after 5 seconds - Click here to return to the store to complete your order</a> </p> <WPDISPLAY ITEM=banner> That does at least go back to the confirmation page. Although I'd rather use your system to deal with canceled payments.
  3. nativepaul

    Updated RBS Worldpay Form Module

    Hi Pete Thanks for working on this. I installed your new files but the callback function still isn't working. I tried both links to the callback page: http://<WPDISPLAY ITEM=MC_callback> http://xxx/store/ext/modules/payment/worldpay/junior_callback.php Neither of those return to the store confirmation page. Although I do get confirmation emails from RBS saying that the payment went through. RBS told me that the system will automatically remove any script tags on the callback page. So I ran a test with a plain html page as the callback response page. After processing a test transaction RBS redirected to the html page. So how do we make the callback function work properly?
×