Guest User

checkout.sips_cc_form.php

a guest
Feb 15th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. <?php
  2. if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
  3. /**
  4. * @version $Id: checkout.sips_cc_form.php Version 2.x Joomla 1.5 / Virtuemart 1.1
  5. * @package VirtueMart
  6. * @subpackage html
  7. * @author Valérie Isaksen <[email protected]>
  8. * @copyright Copyright (C) 2004-2005 Soeren Eberhardt. 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. * The ps_sips class, containing the payment processing code
  17. * for transactions with SIPS Payment Gateways
  18. *
  19. * For the Joomla >= 1.10 WINDOWS or Linux and SIPS 500 or 600
  20. *
  21. */
  22. mm_showMyFileName( __FILE__ );
  23.  
  24. require_once( CLASSPATH ."payment/ps_sips.cfg.php");
  25. require_once( CLASSPATH ."payment/ps_sips.php");
  26. $sips = new sips();
  27. $SIPS_LANG =& new ps_sips_Language();
  28. global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $ps_vendor_id , $vendor_country_2_code;
  29. global $VM_LANG, $Itemid;
  30.  
  31. $amount = $db->f("order_total")*100;
  32. $order_id = $db->f("order_id") % 1000000;
  33.  
  34.  
  35.  
  36. $parm="merchant_id=".SIPS_MERCHANT_ID;
  37. $parm.=" merchant_country=fr";
  38. $parm.=" amount=".$amount;
  39. $parm.=" currency_code=".$sips->getCurrencyIsoCode($db->f("order_currency"));
  40. $parm.=" pathfile=".$sips->getPathfileFileName();
  41. $parm.=" transaction_id=".substr(time(),-5,5).rand(0,9);//numéro unique sur la journée
  42. $parm.=" normal_return_url=".SECUREURL."index.php?page=checkout.sips_response&ItemId=".$Itemid."&option=".$option;
  43. $parm.=" cancel_return_url=".SECUREURL."index.php?page=checkout.sips_response&ItemId=".$Itemid."&option=".$option;
  44. $parm.=" automatic_response_url=".SECUREURL."index.php?page=checkout.sips_autoresponse&ItemId=".$Itemid."&option=".$option;
  45. $parm.=" language=".$sips->getLanguageCode($mosConfig_lang);
  46. $parm.=" merchant_language=".$sips->getLanguageCode($mosConfig_lang);
  47. $parm.=" payment_means=".SIPS_PAYMENT_MEANS;
  48. $parm.=" header_flag=".SIPS_HEADER_FLAG;
  49. $parm.=" capture_day=";
  50. $parm.=isset($sips_capture_n_day)? $sips_capture_n_day:SIPS_CAPTURE_DAY;
  51. $parm.=" capture_mode=";
  52. $parm.=isset($sips_capture_n_mode)? $sips_capture_n_mode:SIPS_CAPTURE_MODE;
  53.  
  54. $parm.=" block_align=".SIPS_BLOCK_ALIGN;
  55. $parm.=" block_order=".SIPS_BLOCK_ORDER;
  56. $parm.=" customer_id=".$db->f("user_id");
  57. $parm.=" customer_email=".$user->email;
  58. $parm.=" customer_ip_address=".$db->f("ip_address");
  59. if (isset($sips_data)) $parm.=" data=".$sips_data;
  60. $parm.=" return_context=".$ps_vendor_id;
  61. $parm.=" order_id=".$order_id;
  62. //
  63. if (SIPS_DEBUG ) {
  64. echo $parm;
  65. }
  66. if ($sips->getOSName()!='WIN') $parm=escapeshellcmd($parm);
  67. $bin_request = $sips->getBinRequest ("request");
  68. $result=exec("$bin_request $parm");
  69. $tableau = explode ("!", "$result");
  70. $code = $tableau[1];
  71. $error = $tableau[2];
  72. $message = $tableau[3];
  73.  
  74. if (( $code == "" ) && ( $error == "" ) )
  75. {
  76. alert_error ($SIPS_LANG->_('PS_SIPS_EXEC_REQ_NOT_FOUND').SIPS_CGI_BIN_PATH.$SIPS_LANG->_('PS_SIPS_EXEC_REQ_FILE')." ".$path_bin);
  77. if (file_exists($path_bin)) {
  78. print "Le fichier $path_bin existe";
  79. } else {
  80. print "Le fichier $path_bin n'existe pas";
  81. }
  82.  
  83. echo "<br />Accès de ".$path_bin." ".substr(sprintf('%o', fileperms($path_bin)), -4);
  84. }
  85.  
  86. // Erreur, affiche le message d'erreur
  87. else if ($code != 0){
  88. alert_error ($SIPS_LANG->_('PS_SIPS_ERROR_REQUEST')." ".$error);
  89. }
  90. else {
  91.  
  92. echo (" $message ");
  93.  
  94. }
  95.  
  96. /**
  97. * alert_error
  98. * affiche les messages d'alerte lors d'une erreur
  99. */
  100.  
  101. function alert_error ($message) {
  102. echo $message;
  103.  
  104. }
  105.  
  106.  
  107. ?>
Advertisement
Add Comment
Please, Sign In to add comment