-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace Payutc\Service; | ||
|
||
/** | ||
* MYACCOUNT.php | ||
* | ||
* Ce service permet la gestion du compte d'un utilisateur | ||
* (Visualisation de l'historique, Blocage/Déblocage de sa carte) | ||
*/ | ||
|
||
class MYACCOUNT extends \ServiceBase { | ||
|
||
public function __construct() { | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Recupere l'historique d'un utilisateur (+ son solde pour éviter une requete a casper) | ||
* @return array historique de l'utilisateur (+ son solde) | ||
*/ | ||
public function historique() { | ||
// On a une appli qui a les droits ? | ||
$this->checkRight(false, true, true, null); | ||
// On a un user ? | ||
if(!$this->user()) { | ||
throw new \Payutc\Exception\CheckRightException("Vous devez connecter un utilisateur ! (method loginCas)"); | ||
} | ||
|
||
// Verification de rechargement en cours (utile surout quand les notifications ne marchent pas (genre en dev)) | ||
$pl = new \Payutc\Bom\Payline($this->application()->getId(), $this->service_name); | ||
$pl->checkUser($this->user()); | ||
|
||
return array( | ||
"historique" => $this->user()->getHistorique(), | ||
"credit" => $this->user()->getCredit()); | ||
} | ||
|
||
/** | ||
* Definit le blocage de la carte de l'utilisateur (par lui même, en cas de perte par exemple) | ||
* @param int (0/1) | ||
*/ | ||
public function setSelfBlock($blocage) { | ||
// On a une appli qui a les droits ? | ||
$this->checkRight(false, true, true, null); | ||
// On a un user ? | ||
if(!$this->user()) { | ||
throw new \Payutc\Exception\CheckRightException("Vous devez connecter un utilisateur ! (method loginCas)"); | ||
} | ||
|
||
$this->user()->setSelfBlock($blocage); | ||
|
||
return $this->isBlockedMe(); | ||
} | ||
|
||
/** | ||
* Self-blocked ? | ||
* | ||
* @return isBlocked ? | ||
*/ | ||
public function isBlockedMe() { | ||
// On a une appli qui a les droits ? | ||
$this->checkRight(false, true, true, null); | ||
// On a un user ? | ||
if(!$this->user()) { | ||
throw new \Payutc\Exception\CheckRightException("Vous devez connecter un utilisateur ! (method loginCas)"); | ||
} | ||
|
||
return $this->user()->isBlockedMe(); | ||
} | ||
|
||
|
||
} |