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

https://bitbucket.org/dgough/annamaria-daneswood-25102012 · PHP · 118 lines · 79 code · 11 blank · 28 comment · 9 complexity · 6c68df32da182c1de938bf90909989dc MD5 · raw file

  1. <?php
  2. /**
  3. * Dandomain Order Confirmation Handler
  4. *
  5. * @version $Id: checkout.dandomain_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. global $mosConfig_secret;
  21. $sessionid = vmGet( $_GET, "sessionid" );
  22. $cookievals = base64_decode( $sessionid );
  23. $orderID = substr( $cookievals, 0, 8 );
  24. $order_id = intval( $orderID );
  25. $virtuemartcookie = substr( $cookievals, 8, 32 );
  26. $remote_ip_md5 = substr( $cookievals, 40, 32 );
  27. $md5_check = substr( $cookievals, 72, 32 );
  28. // Check Validity of the Page Load using the MD5 Check
  29. $submitted_hashbase = $orderID . $virtuemartcookie . $remote_ip_md5;
  30. // OK! VALID...
  31. if( !$my->id ) {
  32. mosNotAuth();
  33. echo '<br />';
  34. include( PAGEPATH. 'checkout.login_form.php');
  35. echo '<br /><br />';
  36. }
  37. elseif( $md5_check === md5( $submitted_hashbase . $mosConfig_secret . ENCODE_KEY) ) {
  38. $qv = "SELECT order_id, order_number FROM #__{vm}_orders ";
  39. $qv .= "WHERE order_id='".$order_id."' AND user_id='".$my->id."'";
  40. $dbo = new ps_DB;
  41. $dbo->query($qv);
  42. if($dbo->next_record()) {
  43. $d['order_id'] = $dbo->f("order_id");
  44. if( empty($_GET['errorcode']) ) {
  45. // UPDATE THE ORDER STATUS to 'VALID'
  46. $d['order_status'] = PBS_VERIFIED_STATUS;
  47. // Setting this to "Y" = yes is required by Danish Law
  48. $d['notify_customer'] = "Y";
  49. $d['include_comment'] = "Y";
  50. // Notifying the customer about the transaction key and
  51. // the order Status Update
  52. $d['order_comment'] = str_replace('{transactionnumber}',urldecode($_REQUEST['transact']),$VM_LANG->_('VM_CHECKOUT_PBS_APPROVED_ORDERCOMMENT'));
  53. require_once ( CLASSPATH . 'ps_order.php' );
  54. $ps_order= new ps_order;
  55. $ps_order->order_status_update($d);
  56. ?>
  57. <img src="<?php echo IMAGEURL ?>ps_image/button_ok.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_SUCCESS'); ?>" border="0" />
  58. <h2><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS') ?></h2>
  59. <?php
  60. }
  61. else {
  62. // the Payment wasn't successful. Maybe the Payment couldn't
  63. // be verified and is pending
  64. // UPDATE THE ORDER STATUS to 'INVALID'
  65. $d['order_status'] = PBS_INVALID_STATUS;
  66. // Setting this to "Y" = yes is required by Danish Law
  67. $d['notify_customer'] = "Y";
  68. // Notifying the customer about the transaction key and
  69. // the order Status Update
  70. $d['order_comment'] = str_replace('{transactionnumber}',urldecode($_REQUEST['transact']),$VM_LANG->_('VM_CHECKOUT_PBS_NOTAPPROVED_ORDERCOMMENT'));
  71. require_once ( CLASSPATH . 'ps_order.php' );
  72. $ps_order= new ps_order;
  73. $ps_order->order_status_update($d);
  74. ?>
  75. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  76. <h2><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') ?></h2>
  77. <?php
  78. switch (intval(urldecode($_GET['errorcode']))) {
  79. case 0: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_0'); break;
  80. case 1: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_1'); break;
  81. case 2: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_2'); break;
  82. case 3: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_3'); break;
  83. case 4: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_4'); break;
  84. case 5: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_5'); break;
  85. case 6: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_6'); break;
  86. default: echo $VM_LANG->_('VM_CHECKOUT_DD_ERROR_DEFAULT'); break;
  87. }
  88. }
  89. ?>
  90. <br />
  91. <p><a href="<?php @$sess->purl( SECUREURL."index.php?option=com_virtuemart&page=account.order_details&order_id=$order_id" ) ?>">
  92. <?php echo $VM_LANG->_('PHPSHOP_ORDER_LINK') ?></a>
  93. </p>
  94. <?php
  95. }
  96. else {
  97. ?>
  98. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  99. <span class="message"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') . ' (' . $VM_LANG->_('VM_CHECKOUT_ORDERNOTFOUND') . ')'; ?></span><?php
  100. }
  101. }
  102. else {
  103. ?>
  104. <img src="<?php echo IMAGEURL ?>ps_image/button_cancel.png" align="center" alt="<?php echo $VM_LANG->_('VM_CHECKOUT_FAILURE'); ?>" border="0" />
  105. <span class="message"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_ERROR') . ' (' . $VM_LANG->_('VM_CHECKOUT_MD5_FAILED') . ')'; ?></span><?php
  106. }
  107. ?>