PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/administrator/components/com_virtuemart/html/checkout.wannafind_result.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 126 lines | 87 code | 11 blank | 28 comment | 10 complexity | a079dbf8f1c3cb9100ee6dcc29e6ff56 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Wannafind Order Confirmation Handler
  4. *
  5. * @version $Id: checkout.wannafind_result.php 1122 2008-01-07 14:52:31Z thepisu $
  6. * @package VirtueMart
  7. * @subpackage html
  8. * @copyright Copyright (C) 2004-2007 soeren - All rights reserved.
  9. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
  10. * VirtueMart is free software. This version may have been modified pursuant
  11. * to the GNU General Public License, and as distributed it includes or
  12. * is derivative of works licensed under the GNU General Public License or
  13. * other free or open source software licenses.
  14. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
  15. *
  16. * http://virtuemart.net
  17. */
  18. if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
  19. require_once( CLASSPATH ."payment/ps_pbs.cfg.php");
  20. $sessionid = vmGet( $_REQUEST, "sessionid" );
  21. $accept = vmGet( $_REQUEST, "accept", "0" );
  22. $transacknum = vmGet( $_REQUEST, "transacknum" );
  23. $cookievals = base64_decode( $sessionid );
  24. $orderID = substr( $cookievals, 0, 8 );
  25. $order_id = intval( $orderID );
  26. $virtuemartcookie = substr( $cookievals, 8, 32 );
  27. $remote_ip_md5 = substr( $cookievals, 40, 32 );
  28. $md5_check = substr( $cookievals, 72, 32 );
  29. // Check Validity of the Page Load using the MD5 Check
  30. $submitted_hashbase = $orderID . $virtuemartcookie . $remote_ip_md5;
  31. // OK! VALID...
  32. if( !$my->id ) {
  33. mosNotAuth();
  34. echo '<br />';
  35. include( PAGEPATH. 'checkout.login_form.php');
  36. echo '<br /><br />';
  37. }
  38. elseif( $md5_check === md5( $submitted_hashbase . $mosConfig_secret . ENCODE_KEY) ) {
  39. $qv = "SELECT order_id, order_number FROM #__{vm}_orders ";
  40. $qv .= "WHERE order_id='".$order_id."' AND user_id='".$my->id."'";
  41. $dbo = new ps_DB;
  42. $dbo->query($qv);
  43. if($dbo->next_record()) {
  44. $d['order_id'] = $dbo->f("order_id");
  45. if( empty($_REQUEST['errorcode']) && $accept == "1" ) {
  46. // UPDATE THE ORDER STATUS to 'VALID'
  47. $d['order_status'] = PBS_VERIFIED_STATUS;
  48. // Setting this to "Y" = yes is required by Danish Law
  49. $d['notify_customer'] = "Y";
  50. $d['include_comment'] = "Y";
  51. // Notifying the customer about the transaction key and
  52. // the order Status Update
  53. $d['order_comment'] = str_replace('{transactionnumber}',urldecode($transacknum),$VM_LANG->_('VM_CHECKOUT_PBS_APPROVED_ORDERCOMMENT'));
  54. require_once ( CLASSPATH . 'ps_order.php' );
  55. $ps_order= new ps_order;
  56. $ps_order->order_status_update($d);
  57. ?>
  58. <img src="<?php echo IMAGEURL ?>ps_image/button_ok.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_SUCCESS'); ?>" border="0" />
  59. <h2><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS') ?></h2>
  60. <?php
  61. }
  62. elseif( $accept == "0" ) {
  63. // the Payment wasn't successful. Maybe the Payment couldn't
  64. // be verified and is pending
  65. // UPDATE THE ORDER STATUS to 'INVALID'
  66. $d['order_status'] = PBS_INVALID_STATUS;
  67. // Setting this to "Y" = yes is required by Danish Law
  68. $d['notify_customer'] = "Y";
  69. $d['include_comment'] = "Y";
  70. // Notifying the customer about the transaction key and
  71. // the order Status Update
  72. $d['order_comment'] = str_replace('{transactionnumber}',urldecode($transacknum),$VM_LANG->_('VM_CHECKOUT_PBS_NOTAPPROVED_ORDERCOMMENT'));
  73. require_once ( CLASSPATH . 'ps_order.php' );
  74. $ps_order= new ps_order;
  75. $ps_order->order_status_update($d);
  76. ?>
  77. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  78. <h2><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') ?></h2>
  79. <?php
  80. switch (urldecode($_REQUEST['errorcode'])) {
  81. case 1: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_1'); break;
  82. case 2: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_2'); break;
  83. case 3: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_3'); break;
  84. case 4: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_4'); break;
  85. case 5: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_5'); break;
  86. case 6: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_6'); break;
  87. case 7: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_7'); break;
  88. case 8: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_8'); break;
  89. case 9: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_9'); break;
  90. case 10: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_10'); break;
  91. case 11: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_11'); break;
  92. case 12: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_12'); break;
  93. case 13: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_13'); break;
  94. default: echo $VM_LANG->_('VM_CHECKOUT_WF_ERROR_DEFAULT');
  95. }
  96. }
  97. ?>
  98. <br />
  99. <p><a href="<?php @$sess->purl( SECUREURL."index.php?option=com_virtuemart&page=account.order_details&order_id=$order_id" ) ?>">
  100. <?php echo $VM_LANG->_('PHPSHOP_ORDER_LINK') ?></a>
  101. </p>
  102. <?php
  103. }
  104. else {
  105. ?>
  106. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  107. <span class="message"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') . ' (' . $VM_LANG->_('VM_CHECKOUT_ORDERNOTFOUND') . ')'; ?></span><?php
  108. }
  109. }
  110. else{
  111. ?>
  112. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  113. <span class="message"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') . ' (' . $VM_LANG->_('VM_CHECKOUT_MD5_FAILED') . ')'; ?></span><?php
  114. }
  115. ?>