paymentok.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/public/paybox/paymentok.php
  20. * \ingroup paybox
  21. * \brief File to show page after a successful payment
  22. * \author Laurent Destailleur
  23. */
  24. define("NOLOGIN",1); // This means this output page does not require to be logged.
  25. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
  26. require '../../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  29. // Security check
  30. if (empty($conf->paybox->enabled)) accessforbidden('',1,1,1);
  31. $langs->load("main");
  32. $langs->load("other");
  33. $langs->load("dict");
  34. $langs->load("bills");
  35. $langs->load("companies");
  36. $langs->load("paybox");
  37. $langs->load("paypal");
  38. /*$source=GETPOST('source');
  39. $ref=GETPOST('ref');
  40. $PAYBOXTOKEN=GETPOST('TOKEN');
  41. if (empty($PAYBOXTOKEN)) $PAYBOXTOKEN=GETPOST('token');
  42. $PAYBOXPAYERID=GETPOST('PAYERID');
  43. if (empty($PAYBOXPAYERID)) $PAYBOXPAYERID=GETPOST('PayerID');
  44. */
  45. $PAYBOXFULLTAG=GETPOST('FULLTAG');
  46. if (empty($PAYBOXFULLTAG)) $PAYBOXFULLTAG=GETPOST('fulltag');
  47. /*
  48. * Actions
  49. */
  50. /*
  51. * View
  52. */
  53. dol_syslog("Callback url when a PayBox payment was done. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_paybox');
  54. $tracepost = "";
  55. foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
  56. dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
  57. llxHeaderPayBox($langs->trans("PaymentForm"));
  58. // Show message
  59. print '<span id="dolpaymentspan"></span>'."\n";
  60. print '<div id="dolpaymentdiv" align="center">'."\n";
  61. // Get on url call
  62. /*
  63. $token = $PAYBOXTOKEN;
  64. */
  65. $fulltag = $PAYBOXFULLTAG;
  66. /*$payerID = $PAYBOXPAYERID;
  67. // Set by newpayment.php
  68. $paymentType = $_SESSION['PaymentType'];
  69. $currencyCodeType = $_SESSION['currencyCodeType'];
  70. $FinalPaymentAmt = $_SESSION["Payment_Amount"];
  71. // From env
  72. $ipaddress = $_SESSION['ipaddress'];
  73. dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag);
  74. */
  75. // Send an email
  76. if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag))
  77. {
  78. $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
  79. $from=$conf->global->MAILING_EMAIL_FROM;
  80. require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
  81. $mailfile = new CMailFile(
  82. 'New subscription payed',
  83. $sendto,
  84. $from,
  85. 'New subscription payed '.$fulltag
  86. );
  87. $result=$mailfile->sendfile();
  88. if ($result)
  89. {
  90. dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paybox');
  91. }
  92. else
  93. {
  94. dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paybox');
  95. }
  96. }
  97. print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
  98. if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK;
  99. print "\n</div>\n";
  100. html_print_paybox_footer($mysoc,$langs);
  101. llxFooterPayBox();
  102. $db->close();
  103. ?>