Paybox operationnel
This commit is contained in:
parent
397fb4ec63
commit
ed8e991677
@ -11,9 +11,11 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
|||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
protected $tranches=array(
|
protected $tranches=array(
|
||||||
'200' => array('montant' => 2000,'montantht' => 1667, 'tva' => 333, ),
|
'195' => array(
|
||||||
'500' => array('montant' => 5000,'montantht' => 4167, 'tva' => 833, ),
|
'200' => array('montant' => 2000,'montantht' => 1667, 'tva' => 333, ),
|
||||||
'1000' => array('montant' => 10000,'montantht' => 8333, 'tva' => 1667, ),
|
'500' => array('montant' => 5000,'montantht' => 4167, 'tva' => 833, ),
|
||||||
|
'1000' => array('montant' => 10000,'montantht' => 8333, 'tva' => 1667, ),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $maxcredit=2000;
|
protected $maxcredit=2000;
|
||||||
@ -41,7 +43,7 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
|||||||
$user = new Scores_Utilisateur();
|
$user = new Scores_Utilisateur();
|
||||||
$ok=$user->checkperm($this->libdroits);
|
$ok=$user->checkperm($this->libdroits);
|
||||||
if(!$ok){
|
if(!$ok){
|
||||||
$this->redirect('/');
|
$this->error('index','Fonction indisponible');
|
||||||
}
|
}
|
||||||
$ws = new WsScores();
|
$ws = new WsScores();
|
||||||
$customer_credit = $ws->getCredit();
|
$customer_credit = $ws->getCredit();
|
||||||
@ -52,10 +54,11 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
|||||||
}
|
}
|
||||||
$this->logger->info(print_r($user,1));
|
$this->logger->info(print_r($user,1));
|
||||||
if ($customer_credit === false and false) {
|
if ($customer_credit === false and false) {
|
||||||
|
$this->error('index','Compte indisponible');
|
||||||
$this->forward('soap', 'error');
|
$this->forward('soap', 'error');
|
||||||
}
|
}
|
||||||
//Récupération des Parametres
|
//Récupération des Parametres
|
||||||
$infos=array('user' => $user,'wscredit' => intval($customer_credit),'tranches' => $this->tranches);
|
$infos=array('user' => $user,'wscredit' => intval($customer_credit),'tranches' => $this->tranches[$user->getIdClient()]);
|
||||||
//var_dump($infos);die;
|
//var_dump($infos);die;
|
||||||
$this->view->infos=$infos;
|
$this->view->infos=$infos;
|
||||||
$this->view->submitValue='Commander';
|
$this->view->submitValue='Commander';
|
||||||
@ -65,48 +68,51 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
|||||||
{
|
{
|
||||||
//Validation
|
//Validation
|
||||||
$request = $this->getRequest('');
|
$request = $this->getRequest('');
|
||||||
$nb_credit=$request->getParam('nb_credit');
|
|
||||||
if(intval($nb_credit)==0){
|
|
||||||
$this->error(__LINE__);
|
|
||||||
}
|
|
||||||
if(!isset($this->tranches[$nb_credit])){
|
|
||||||
$this->error(__LINE__);
|
|
||||||
}
|
|
||||||
$user = new Scores_Utilisateur();
|
$user = new Scores_Utilisateur();
|
||||||
$ok=$user->checkperm($this->libdroits);
|
$ok=$user->checkperm($this->libdroits);
|
||||||
if(!$ok){
|
if(!$ok){
|
||||||
$this->error(__LINE__);
|
$this->error('paiement', __LINE__);
|
||||||
|
}
|
||||||
|
$nb_credit=$request->getParam('nb_credit');
|
||||||
|
if(intval($nb_credit)==0){
|
||||||
|
$this->error('paiement','Vous devez définir le nombre de crédits');
|
||||||
|
}
|
||||||
|
$idClient=$user->getIdClient();
|
||||||
|
if(intval($idClient)==0){
|
||||||
|
$this->error('paiement', __LINE__);
|
||||||
|
}
|
||||||
|
if(!isset($this->tranches[$idClient]) || !isset($this->tranches[$idClient][$nb_credit])){
|
||||||
|
$this->error('paiement', __LINE__);
|
||||||
}
|
}
|
||||||
//Parametrage
|
//Parametrage
|
||||||
|
|
||||||
$pbparam=array();
|
$pbparam=array();
|
||||||
$pbparams['cmdId']=implode('#',array($user->identity->id,time()));
|
$pbparams['cmdId']=implode('#',array($user->identity->id,time()));
|
||||||
$pbparams['email']=$user->identity->email;
|
$pbparams['email']=$user->identity->email;
|
||||||
$pbparams['montant']=$this->tranches[$nb_credit]['montant']/100;
|
$pbparams['montant']=$this->tranches[$idClient][$nb_credit]['montant']/100;
|
||||||
$pbparams['montantht']=$this->tranches[$nb_credit]['montantht']/100;
|
$pbparams['montantht']=$this->tranches[$idClient][$nb_credit]['montantht']/100;
|
||||||
$pbparams['tva']=$this->tranches[$nb_credit]['tva']/100;
|
$pbparams['tva']=$this->tranches[$idClient][$nb_credit]['tva']/100;
|
||||||
$ws = new WsScores();
|
$ws = new WsScores();
|
||||||
//$customer_credit = $ws->addCredit();
|
//$customer_credit = $ws->addCredit();
|
||||||
|
$insdata=array(
|
||||||
/*
|
'idClient' =>$user->identity->idClient,
|
||||||
$this->view->Siren = isset($session->CmdSiren)?$session->CmdSiren:'000000000';
|
'idCmd' => $pbparams['cmdId'],
|
||||||
$this->view->RaisonSociale = isset($session->CmdRaisonSociale)?$session->CmdRaisonSociale:'testdev';
|
'login' => $user->identity->username,
|
||||||
$this->view->AdresseL1 = isset($session->CmdAdresseL1)?$session->CmdAdresseL1:'';
|
'nbCredit' => $nb_credit,
|
||||||
$this->view->AdresseL2 = isset($session->CmdAdresseL2)?$session->CmdAdresseL2:'';
|
'amount' => $this->tranches[$idClient][$nb_credit]['montant'],
|
||||||
$this->montantht=20;
|
'amount_ht' => $this->tranches[$idClient][$nb_credit]['montantht'],
|
||||||
$this->montant=20;
|
'amount_tva' => $this->tranches[$idClient][$nb_credit]['tva'],
|
||||||
$this->tva=0;
|
'currency' => 'EUR',
|
||||||
//Lire la bdd
|
'valid' => 0,
|
||||||
//$commandM = new Application_Model_Command();
|
'date_sent' => Date('Y-m-d H:i:s'),
|
||||||
//$row = $commandM->fetchRow('cmdId="'.$cmdId.'"');
|
'date_received' => null,
|
||||||
|
'paybox_answer' => json_encode(array('user' => $user)),
|
||||||
$this->view->montant = $this->montantht." € HT" . " (".$this->montant." € TTC)";
|
'comment' => 'Beforecall',
|
||||||
|
|
||||||
$data = array(
|
|
||||||
'mt' => $this->montantht,
|
|
||||||
'tax' => $this->tva,
|
|
||||||
);
|
);
|
||||||
//$commandM->update($data, 'id='.$row->id);*/
|
/*@todo
|
||||||
|
$ws = new WsScores();
|
||||||
|
$customer_credit = $ws->addCredit($insdata);
|
||||||
|
*/
|
||||||
//Paybox
|
//Paybox
|
||||||
Zend_Loader::loadClass('Paybox_Config');
|
Zend_Loader::loadClass('Paybox_Config');
|
||||||
Zend_Loader::loadClass('Paybox_System');
|
Zend_Loader::loadClass('Paybox_System');
|
||||||
@ -121,6 +127,7 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
|||||||
$paybox->calculateHMAC();
|
$paybox->calculateHMAC();
|
||||||
//$_POST=$paybox->getFormParameters();
|
//$_POST=$paybox->getFormParameters();
|
||||||
//$this->redirect($paybox->getFormUrl());
|
//$this->redirect($paybox->getFormUrl());
|
||||||
|
$this->view->pbparams = $pbparams;
|
||||||
$this->view->PayboxUrl = $paybox->getFormUrl();
|
$this->view->PayboxUrl = $paybox->getFormUrl();
|
||||||
$this->view->PayboxValues = $paybox->getFormParameters();
|
$this->view->PayboxValues = $paybox->getFormParameters();
|
||||||
|
|
||||||
@ -189,8 +196,20 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public function footerAction(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private function error($ligne=0,$message=""){
|
private function error($ligne=0,$message=""){
|
||||||
echo $ligne;die;
|
switch($ligne){
|
||||||
|
case "index":
|
||||||
|
case "paiement":
|
||||||
|
$this->view->msg=$message;
|
||||||
|
throw new Exception($message);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo $ligne.' : '.$message;die;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,15 @@ div .credit{
|
|||||||
<div class="credit">
|
<div class="credit">
|
||||||
<p>
|
<p>
|
||||||
Le compte <?=isset($this->infos['user']->identity->username)?$this->infos['user']->identity->username:""?> détient actuellement <?=intval($this->infos['wscredit'])?> crédits.<br>
|
Le compte <?=isset($this->infos['user']->identity->username)?$this->infos['user']->identity->username:""?> détient actuellement <?=intval($this->infos['wscredit'])?> crédits.<br>
|
||||||
<?=$this->msg?>
|
|
||||||
</p>
|
</p>
|
||||||
|
<div id="message" class="alert alert-info"><?=$this->msg?></div>
|
||||||
</div>
|
</div>
|
||||||
<?php if(isset($this->infos) && isset($this->infos['tranches'])):?>
|
<?php if(isset($this->infos) && isset($this->infos['tranches'])):?>
|
||||||
<h2>Vos choix de commande</h2>
|
<h2>Vos choix de commande</h2>
|
||||||
<form action="<?=$this->url(array('controller'=>'index', 'action'=>'paiement'))?>" method="GET">
|
<form action="<?=$this->url(array('controller'=>'index', 'action'=>'paiement'))?>" method="GET" id="creditform">
|
||||||
<div class="credit">
|
<div class="credit">
|
||||||
<?php foreach($this->infos['tranches'] as $credit => $item):?>
|
<?php $ok=true;foreach($this->infos['tranches'] as $credit => $item):?>
|
||||||
<input type="radio" name="nb_credit" value="<?=$credit?>" /> <?=$credit?> Crédits (<?=$item['montant']/100?> Euros)
|
<input type="radio" name="nb_credit" value="<?=$credit?>" <?php if($ok){?>checked="checked"<?php }$ok=false;?> /> <?=$credit?> Crédits (<?=$item['montant']/100?> Euros)
|
||||||
<?php endforeach;?>
|
<?php endforeach;?>
|
||||||
</div>
|
</div>
|
||||||
<div class="submit">
|
<div class="submit">
|
||||||
@ -27,7 +27,11 @@ Le compte <?=isset($this->infos['user']->identity->username)?$this->infos['user'
|
|||||||
<input type="submit" class="button" value="<?php echo $this->submitValue?>" />
|
<input type="submit" class="button" value="<?php echo $this->submitValue?>" />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
<script>
|
||||||
|
$('#creditform').submit(function($data){
|
||||||
|
//@todo des vérifs si besoin
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,24 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
div .credit{
|
||||||
|
margin-left:25px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<div class="page-header">
|
<div id="center">
|
||||||
<h2>ACHAT de CREDITS <small>Mode de paiement</small></h2>
|
<h1>ACHAT de CREDITS <small>Confirmation</small></h1>
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php //if ( $this->CmdID ):?>
|
<?php //if ( $this->CmdID ):?>
|
||||||
|
<h2>Informations de la commande</h2>
|
||||||
<div class="row">
|
<div class="credit">
|
||||||
|
Identifiant de commande : <?=$this->pbparams['cmdId']?><br>
|
||||||
<div class="col-md-6">
|
Une fois le paiement effectué cliquer sur le bouton "Retour boutique" afin de
|
||||||
|
consulter vos documents, si la redirection automatique ne se fait pas.
|
||||||
<h3>Informations de la commande</h3>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<h2>Sélection du mode de paiement</h2>
|
||||||
|
<div class="credit">
|
||||||
<h3>Sélection du mode de paiement</h3>
|
|
||||||
|
|
||||||
<?php if ($this->PayboxValues) {?>
|
<?php if ($this->PayboxValues) {?>
|
||||||
<?=$this->PayboxVerif?>
|
<?=$this->PayboxVerif?>
|
||||||
<form method="post" action="<?=$this->PayboxUrl?>">
|
<form method="post" action="<?=$this->PayboxUrl?>">
|
||||||
@ -28,24 +27,15 @@
|
|||||||
<input type="hidden" name="<?=$field['name']?>" value="<?=$field['value']?>" />
|
<input type="hidden" name="<?=$field['name']?>" value="<?=$field['value']?>" />
|
||||||
<?php }?>
|
<?php }?>
|
||||||
|
|
||||||
<div>
|
|
||||||
Une fois le paiement effectué cliquer sur le bouton "Retour boutique" afin de
|
|
||||||
consulter vos documents, si la redirection automatique ne se fait pas.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary" value="Paiement"/>
|
<input type="submit" class="btn btn-primary" value="Paiement"/>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
<?php // }?>
|
<?php // }?>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php } else {?>
|
<?php } else {?>
|
||||||
|
|
||||||
<div class="alert alert-danger"><strong>Erreur !</strong> </div>
|
<div class="alert alert-danger"><strong>Erreur !</strong> </div>
|
||||||
|
|
||||||
<?php }?>
|
<?php }?>
|
||||||
|
</div>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
class Paybox_Config_Test
|
class Paybox_Config_Test
|
||||||
{
|
{
|
||||||
public $key = '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF';
|
//public $key = '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF';
|
||||||
//public $key = '249DE9DBD388E3430AC464ACFE23A668F1F3221432F96028468A5A0775AFEB8438C7F4DED096066109BBB5E1B2E22DC53D9D31181CC06DD4C6C1239110ADFFD7';
|
public $key = '249DE9DBD388E3430AC464ACFE23A668F1F3221432F96028468A5A0775AFEB8438C7F4DED096066109BBB5E1B2E22DC53D9D31181CC06DD4C6C1239110ADFFD7';
|
||||||
//public $key = 'E941B48379E0C65997F52FDA8DC920B358B1AAB99A6E3CCF584F97E6AC55FB3C701DE0CC0CCFAEC82A1B0AA865CCDA36A420C4043376BBAFB51790D8480E2F77';
|
//public $key = 'E941B48379E0C65997F52FDA8DC920B358B1AAB99A6E3CCF584F97E6AC55FB3C701DE0CC0CCFAEC82A1B0AA865CCDA36A420C4043376BBAFB51790D8480E2F77';
|
||||||
public $server = array(
|
public $server = array(
|
||||||
array(
|
array(
|
||||||
@ -19,7 +19,7 @@ class Paybox_Config_Test
|
|||||||
|
|
||||||
public $variables = array(
|
public $variables = array(
|
||||||
'SITE' => '5136925',
|
'SITE' => '5136925',
|
||||||
'RANG' => '001',
|
'RANG' => '01',
|
||||||
'IDENTIFIANT' => '533616985',
|
'IDENTIFIANT' => '533616985',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user