projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moving to GitHub.
[platal.git]
/
modules
/
payment
/
money
/
bplccyberplus.inc.php
diff --git
a/modules/payment/money/bplccyberplus.inc.php
b/modules/payment/money/bplccyberplus.inc.php
index
225c337
..
0b273a5
100644
(file)
--- a/
modules/payment/money/bplccyberplus.inc.php
+++ b/
modules/payment/money/bplccyberplus.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-20
08
Polytechnique.org *
+ * Copyright (C) 2003-20
14
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-49,23
+49,28
@@
class BPLCCyberPlus
function BPLCCyberPlus($val)
{
// Improvement: number of digits after the coma might depend from the currency.
function BPLCCyberPlus($val)
{
// Improvement: number of digits after the coma might depend from the currency.
- $this->val = 100 * strtr(
sprintf("%.02f", (float)$val), '.', ',
');
+ $this->val = 100 * strtr(
$val, ',', '.
');
}
// }}}
// {{{ function form()
}
// }}}
// {{{ function form()
- function prepareform(&$pay)
+ private static function replaceNonAlpha($string)
+ {
+ return trim(preg_replace('/\s\s+/', ' ', preg_replace('/[^a-zA-Z0-9]/', ' ', $string)));
+ }
+
+ function prepareform($pay, $user)
{
global $globals, $platal;
$log = S::v('log');
// Transaction's reference computation.
{
global $globals, $platal;
$log = S::v('log');
// Transaction's reference computation.
- $prefix =
($pay->flags->hasflag('unique')) ? str_pad("",15,"0") :
rand_url_id();
+ $prefix = rand_url_id();
$fullref = substr("$prefix-{$pay->id}",-12); // FIXME : check for duplicates
$ts = time();
$fullref = substr("$prefix-{$pay->id}",-12); // FIXME : check for duplicates
$ts = time();
- $trans_date = date("YmdHis", $ts);
- $trans_id = date("His", $ts); // FIXME : check for duplicates
+ $trans_date =
gm
date("YmdHis", $ts);
+ $trans_id =
gm
date("His", $ts); // FIXME : check for duplicates
// Form's content.
$this->urlform = "https://systempay.cyberpluspaiement.com/vads-payment/";
// Form's content.
$this->urlform = "https://systempay.cyberpluspaiement.com/vads-payment/";
@@
-74,9
+79,9
@@
class BPLCCyberPlus
'vads_return_mode' => 'NONE',
'vads_url_return' => $pay->url ? $pay->url : $globals->baseurl . '/' . $platal->ns);
$this->infos['client'] = Array(
'vads_return_mode' => 'NONE',
'vads_url_return' => $pay->url ? $pay->url : $globals->baseurl . '/' . $platal->ns);
$this->infos['client'] = Array(
- 'vads_cust_email' =>
S::user()
->bestEmail(),
- 'vads_cust_id' =>
S::v('uid'
),
- 'vads_cust_name' =>
replace_accent(S::user()->fullName()
));
+ 'vads_cust_email' =>
$user
->bestEmail(),
+ 'vads_cust_id' =>
$user->id(
),
+ 'vads_cust_name' =>
substr(self::replaceNonAlpha(replace_accent($user->shortName())), 0, 127
));
$this->infos['commande'] = Array(
'vads_amount' => $this->val,
'vads_currency' => '978', # Euro
$this->infos['commande'] = Array(
'vads_amount' => $this->val,
'vads_currency' => '978', # Euro
@@
-84,7
+89,8
@@
class BPLCCyberPlus
'vads_trans_date' => $trans_date,
'vads_trans_id' => $trans_id,
'vads_order_id' => $fullref,
'vads_trans_date' => $trans_date,
'vads_trans_id' => $trans_id,
'vads_order_id' => $fullref,
- 'vads_order_info' => Env::v('comment'));
+ 'vads_order_info' => substr(self::replaceNonAlpha(replace_accent(Env::v('comment'))), 0, 255),
+ 'vads_order_info2' => Post::i('display'));
$this->infos['divers'] = Array(
'vads_version' => 'V2',
'vads_ctx_mode' => $globals->money->cyperplus_prod,
$this->infos['divers'] = Array(
'vads_version' => 'V2',
'vads_ctx_mode' => $globals->money->cyperplus_prod,
@@
-102,5
+108,5
@@
class BPLCCyberPlus
$api = 'BPLCCyberPlus';
$api = 'BPLCCyberPlus';
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker
f
enc=utf-8:
?>
?>