X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fpayment%2Fmoney%2Fbplccyberplus.inc.php;h=225c33728eefdbd8eb62670a2589840d9a4bc8d2;hb=b46de52d000ee3dd77726bff9236d8f624160458;hp=ae8fdbbfae4fcc30eae8ba35c3059f17f40550e7;hpb=9b947ed0b79a856d8702a054f374da0c897c5226;p=platal.git diff --git a/modules/payment/money/bplccyberplus.inc.php b/modules/payment/money/bplccyberplus.inc.php index ae8fdbb..225c337 100644 --- a/modules/payment/money/bplccyberplus.inc.php +++ b/modules/payment/money/bplccyberplus.inc.php @@ -19,6 +19,20 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ +/** Card numbers for tests. + * Non 3D-Secure shop: + * 4970 1000 0000 0003 Payment accepted (authorized) + * 3D-Secure shop: + * 4970 1000 0000 0000 Payment accepted, with user authentication. + * 4970 1000 0000 0001 Payment accepted, without user authentication (non 3D-Secure user). + * 4970 1000 0000 0002 Must contact card issuer (which must force transaction). Succesful authentication. + * 4970 1000 0000 0006 Technical issue while computing payment warranty. + * 4970 1000 0000 0007 Technical issue during user authentication. + * 4970 1000 0000 0097 Payment refused due to 3D-Secure authentication failure (user failed to authenticate). + * 4970 1000 0000 0098 Payment refused (user credit limit overrun). + * 4970 1000 0000 0099 Payment refused (invalid credit card visual cryptogramm). +*/ + class BPLCCyberPlus { // {{{ properties @@ -34,11 +48,11 @@ class BPLCCyberPlus function BPLCCyberPlus($val) { - // SVA : nombre de chiffres après la virgule dépendant de currency ? + // Improvement: number of digits after the coma might depend from the currency. $this->val = 100 * strtr(sprintf("%.02f", (float)$val), '.', ','); } - // }}} + // }}} // {{{ function form() function prepareform(&$pay) @@ -46,22 +60,19 @@ class BPLCCyberPlus global $globals, $platal; $log = S::v('log'); - $url_return = str_replace("https://","http://", $globals->baseurl) - . '/' . $platal->ns . "payment/cyber2_return/"; - - // on constuit la reference de la transaction + // Transaction's reference computation. $prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id(); $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 - - // contenu du formulaire + $trans_date = date("YmdHis", $ts); + $trans_id = date("His", $ts); // FIXME : check for duplicates + + // Form's content. $this->urlform = "https://systempay.cyberpluspaiement.com/vads-payment/"; $this->infos['commercant'] = Array( 'vads_site_id' => $globals->money->cyperplus_account, 'vads_return_mode' => 'NONE', - 'vads_url_return' => $url_return); + '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'), @@ -69,18 +80,18 @@ class BPLCCyberPlus $this->infos['commande'] = Array( 'vads_amount' => $this->val, 'vads_currency' => '978', # Euro - 'vads_payment_config' => 'SINGLE', - 'vads_trans_date' => $trans_date, + 'vads_payment_config' => 'SINGLE', + 'vads_trans_date' => $trans_date, 'vads_trans_id' => $trans_id, 'vads_order_id' => $fullref, 'vads_order_info' => Env::v('comment')); $this->infos['divers'] = Array( 'vads_version' => 'V2', - 'vads_ctx_mode' => 'TEST', + 'vads_ctx_mode' => $globals->money->cyperplus_prod, 'vads_page_action' => 'PAYMENT', 'vads_action_mode' => 'INTERACTIVE'); - - // calcul de la clé d'acceptation en entrée + + // Entry key computation. $all_params = array_merge($this->infos['commercant'],$this->infos['client'],$this->infos['commande'],$this->infos['divers']); ksort($all_params); $this->infos['divers']['signature'] = sha1(join('+',$all_params).'+'.$globals->money->cyperplus_key);