41 global $conf, $langs, $db;
43 dol_syslog(
"Paybox.lib::print_paybox_redirect", LOG_DEBUG);
46 $PBX_IDENTIFIANT =
"2";
47 if (!empty($conf->global->PAYBOX_PBX_IDENTIFIANT)) {
48 $PBX_IDENTIFIANT = $conf->global->PAYBOX_PBX_IDENTIFIANT;
50 $IBS_SITE =
"1999888";
51 if (!empty($conf->global->PAYBOX_IBS_SITE)) {
52 $IBS_SITE = $conf->global->PAYBOX_IBS_SITE;
55 if (!empty($conf->global->PAYBOX_IBS_RANG)) {
56 $IBS_RANG = $conf->global->PAYBOX_IBS_RANG;
59 if ($CURRENCY ==
'EUR') {
62 if ($CURRENCY ==
'USD') {
67 if ($conf->global->PAYBOX_CGI_URL_V1) {
68 $URLPAYBOX = $conf->global->PAYBOX_CGI_URL_V1;
70 if ($conf->global->PAYBOX_CGI_URL_V2) {
71 $URLPAYBOX = $conf->global->PAYBOX_CGI_URL_V2;
74 if (empty($IBS_DEVISE)) {
75 dol_print_error(
'',
"Paybox setup param PAYBOX_IBS_DEVISE not defined");
78 if (empty($URLPAYBOX)) {
79 dol_print_error(
'',
"Paybox setup param PAYBOX_CGI_URL_V1 and PAYBOX_CGI_URL_V2 undefined");
82 if (empty($IBS_SITE)) {
86 if (empty($IBS_RANG)) {
91 $conf->global->PAYBOX_HASH =
'sha512';
95 $IBS_TOTAL = $PRICE * 100;
97 $IBS_PORTEUR = $EMAIL;
98 $IBS_RETOUR =
"montant:M;ref:R;auto:A;trans:T";
100 $IBS_EFFECTUE = $urlok;
101 $IBS_ANNULE = $urlko;
102 $IBS_REFUSE = $urlko;
103 $IBS_BKGD =
"#FFFFFF";
106 if (preg_match(
'/^FR/i', $langs->defaultlang)) {
109 if (preg_match(
'/^ES/i', $langs->defaultlang)) {
112 if (preg_match(
'/^IT/i', $langs->defaultlang)) {
115 if (preg_match(
'/^DE/i', $langs->defaultlang)) {
118 if (preg_match(
'/^NL/i', $langs->defaultlang)) {
121 if (preg_match(
'/^SE/i', $langs->defaultlang)) {
125 $PBX_SOURCE =
'HTML';
126 $PBX_TYPEPAIEMENT =
'CARTE';
127 $PBX_HASH = $conf->global->PAYBOX_HASH;
130 $msg =
"PBX_IDENTIFIANT=".$PBX_IDENTIFIANT.
131 "&PBX_MODE=".$IBS_MODE.
132 "&PBX_SITE=".$IBS_SITE.
133 "&PBX_RANG=".$IBS_RANG.
134 "&PBX_TOTAL=".$IBS_TOTAL.
135 "&PBX_DEVISE=".$IBS_DEVISE.
136 "&PBX_CMD=".$IBS_CMD.
137 "&PBX_PORTEUR=".$IBS_PORTEUR.
138 "&PBX_RETOUR=".$IBS_RETOUR.
139 "&PBX_EFFECTUE=".$IBS_EFFECTUE.
140 "&PBX_ANNULE=".$IBS_ANNULE.
141 "&PBX_REFUSE=".$IBS_REFUSE.
142 "&PBX_TXT=".$IBS_TXT.
143 "&PBX_BKGD=".$IBS_BKGD.
144 "&PBX_WAIT=".$IBS_WAIT.
145 "&PBX_LANGUE=".$IBS_LANG.
146 "&PBX_OUTPUT=".$IBS_OUTPUT.
147 "&PBX_SOURCE=".$PBX_SOURCE.
148 "&PBX_TYPEPAIEMENT=".$PBX_TYPEPAIEMENT;
149 "&PBX_HASH=".$PBX_HASH;
150 "&PBX_TIME=".$PBX_TIME;
152 $binKey = pack(
"H*",
dol_decode($conf->global->PAYBOX_HMAC_KEY));
154 $hmac = strtoupper(hash_hmac($PBX_HASH, $msg, $binKey));
161 dol_syslog(
"IBS_TOTAL: $IBS_TOTAL", LOG_DEBUG);
162 dol_syslog(
"IBS_DEVISE: $IBS_DEVISE", LOG_DEBUG);
164 dol_syslog(
"IBS_PORTEUR: $IBS_PORTEUR", LOG_DEBUG);
165 dol_syslog(
"IBS_RETOUR: $IBS_RETOUR", LOG_DEBUG);
166 dol_syslog(
"IBS_EFFECTUE: $IBS_EFFECTUE", LOG_DEBUG);
167 dol_syslog(
"IBS_ANNULE: $IBS_ANNULE", LOG_DEBUG);
168 dol_syslog(
"IBS_REFUSE: $IBS_REFUSE", LOG_DEBUG);
172 dol_syslog(
"IBS_OUTPUT: $IBS_OUTPUT", LOG_DEBUG);
173 dol_syslog(
"PBX_IDENTIFIANT: $PBX_IDENTIFIANT", LOG_DEBUG);
174 dol_syslog(
"PBX_SOURCE: $PBX_SOURCE", LOG_DEBUG);
175 dol_syslog(
"PBX_TYPEPAIEMENT: $PBX_TYPEPAIEMENT", LOG_DEBUG);
183 print
'</head>'.
"\n";
188 print
'<form action="'.$URLPAYBOX.
'" NAME="Submit" method="POST">'.
"\n";
191 print
'<!-- Param for Paybox v2 -->'.
"\n";
192 print
'<input type="hidden" name="PBX_IDENTIFIANT" value="'.$PBX_IDENTIFIANT.
'">'.
"\n";
193 print
'<input type="hidden" name="PBX_MODE" value="'.$IBS_MODE.
'">'.
"\n";
194 print
'<input type="hidden" name="PBX_SITE" value="'.$IBS_SITE.
'">'.
"\n";
195 print
'<input type="hidden" name="PBX_RANG" value="'.$IBS_RANG.
'">'.
"\n";
196 print
'<input type="hidden" name="PBX_TOTAL" value="'.$IBS_TOTAL.
'">'.
"\n";
197 print
'<input type="hidden" name="PBX_DEVISE" value="'.$IBS_DEVISE.
'">'.
"\n";
198 print
'<input type="hidden" name="PBX_CMD" value="'.$IBS_CMD.
'">'.
"\n";
199 print
'<input type="hidden" name="PBX_PORTEUR" value="'.$IBS_PORTEUR.
'">'.
"\n";
200 print
'<input type="hidden" name="PBX_RETOUR" value="'.$IBS_RETOUR.
'">'.
"\n";
201 print
'<input type="hidden" name="PBX_EFFECTUE" value="'.$IBS_EFFECTUE.
'">'.
"\n";
202 print
'<input type="hidden" name="PBX_ANNULE" value="'.$IBS_ANNULE.
'">'.
"\n";
203 print
'<input type="hidden" name="PBX_REFUSE" value="'.$IBS_REFUSE.
'">'.
"\n";
204 print
'<input type="hidden" name="PBX_TXT" value="'.$IBS_TXT.
'">'.
"\n";
205 print
'<input type="hidden" name="PBX_BKGD" value="'.$IBS_BKGD.
'">'.
"\n";
206 print
'<input type="hidden" name="PBX_WAIT" value="'.$IBS_WAIT.
'">'.
"\n";
207 print
'<input type="hidden" name="PBX_LANGUE" value="'.$IBS_LANG.
'">'.
"\n";
208 print
'<input type="hidden" name="PBX_OUTPUT" value="'.$IBS_OUTPUT.
'">'.
"\n";
209 print
'<input type="hidden" name="PBX_SOURCE" value="'.$PBX_SOURCE.
'">'.
"\n";
210 print
'<input type="hidden" name="PBX_TYPEPAIEMENT" value="'.$PBX_TYPEPAIEMENT.
'">'.
"\n";
211 print
'<input type="hidden" name="PBX_HASH" value="'.$PBX_HASH.
'">'.
"\n";
212 print
'<input type="hidden" name="PBX_TIME" value="'.$PBX_TIME.
'">'.
"\n";
214 print
'<input type="hidden" name="PBX_HMAC" value="'.$hmac.
'">'.
"\n";
215 print
'</form>'.
"\n";
219 print
'<script type="text/javascript">'.
"\n";
220 print
' document.Submit.submit();'.
"\n";
221 print
'</script>'.
"\n";
223 print
'</body></html>'.
"\n";
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG)
Create a redirect form to paybox form.