Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-mlc
kohinos
Commits
c3cf6ba9
Commit
c3cf6ba9
authored
Jun 03, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent balance < 0 after withdrawal
parent
8cc0d3ab
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
VERSION
VERSION
+1
-1
Retrait.php
src/Entity/Retrait.php
+6
-2
No files found.
VERSION
View file @
c3cf6ba9
1.1.
0
1.1.
1
src/Entity/Retrait.php
View file @
c3cf6ba9
...
@@ -24,7 +24,7 @@ namespace App\Entity;
...
@@ -24,7 +24,7 @@ namespace App\Entity;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Doctrine\ORM\Mapping
as
ORM
;
/**
/**
* Retrait => (Retrait de monnaie papier en échange de monnaie numérique)
* Retrait => (Retrait de monnaie papier en échange de monnaie numérique)
.
*
*
* Types de retraits :
* Types de retraits :
*
*
...
@@ -52,8 +52,11 @@ abstract class Retrait extends Flux
...
@@ -52,8 +52,11 @@ abstract class Retrait extends Flux
public
function
operate
(
$em
)
public
function
operate
(
$em
)
{
{
$compteExp
=
$this
->
getExpediteur
()
->
getCompte
()
-
$this
->
getMontant
();
$compteExp
=
$this
->
getExpediteur
()
->
getCompte
()
-
$this
->
getMontant
();
$compteDest
=
$this
->
getDestinataire
()
->
getEcompte
()
-
$this
->
getMontant
();
if
(
$compteExp
<
0
)
{
if
(
$compteExp
<
0
)
{
throw
new
\Exception
(
"[FLUX] Retrait impossible ! Montant supérieur au solde du comptoir !"
);
throw
new
\Exception
(
'[FLUX] Retrait impossible ! Montant supérieur au solde du comptoir !'
);
}
elseif
(
$compteDest
<
0
)
{
throw
new
\Exception
(
'[FLUX] Retrait impossible ! Montant supérieur au solde du demandeur !'
);
}
else
{
}
else
{
$this
->
getExpediteur
()
->
removeCompte
(
$this
->
getMontant
());
$this
->
getExpediteur
()
->
removeCompte
(
$this
->
getMontant
());
$this
->
getExpediteur
()
->
getGroupe
()
->
getSiege
()
->
addCompteNantie
(
$this
->
getMontant
());
$this
->
getExpediteur
()
->
getGroupe
()
->
getSiege
()
->
addCompteNantie
(
$this
->
getMontant
());
...
@@ -61,6 +64,7 @@ abstract class Retrait extends Flux
...
@@ -61,6 +64,7 @@ abstract class Retrait extends Flux
return
[
$this
->
getExpediteur
(),
$this
->
getDestinataire
(),
$this
->
getExpediteur
()
->
getGroupe
()
->
getSiege
()];
return
[
$this
->
getExpediteur
(),
$this
->
getDestinataire
(),
$this
->
getExpediteur
()
->
getGroupe
()
->
getSiege
()];
}
}
return
[];
return
[];
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment