From 82f94f9027b967a7ffa73fd4e12025275fd88a6b Mon Sep 17 00:00:00 2001 From: hulivet1 Date: Thu, 5 Jan 2023 15:21:00 +0100 Subject: [PATCH] =?UTF-8?q?Impl=C3=A9mentation=20de=20l'API=20finie=20!!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/API/public/index.php | 1 + Sources/API/routes/Echeance.php | 125 ++++++++++++++++++++++++++ Sources/API/routes/Operation.php | 4 +- Sources/API/routes/Planification.php | 6 +- Sources/Data/ClientAPI.cs | 92 ++++++++++++++++++- Sources/Data/LoadOperation.cs | 2 +- Sources/Data/PersAPI.cs | 30 +++---- Sources/Data/insert.sql | 5 ++ Sources/Data/tables.sql | 13 ++- Sources/Modele/Echeance.cs | 2 +- Sources/Modele/IPersistanceManager.cs | 11 ++- Sources/Modele/Operation.cs | 2 +- Sources/Modele/TagOperation.cs | 1 + Sources/TestFonctionnel/Program.cs | 38 +++++++- 14 files changed, 293 insertions(+), 39 deletions(-) create mode 100644 Sources/API/routes/Echeance.php diff --git a/Sources/API/public/index.php b/Sources/API/public/index.php index 2a82b6e..2d7ce94 100644 --- a/Sources/API/public/index.php +++ b/Sources/API/public/index.php @@ -19,6 +19,7 @@ require __DIR__.'/../routes/Banque.php'; require __DIR__.'/../routes/Compte.php'; require __DIR__.'/../routes/Operation.php'; require __DIR__.'/../routes/Planification.php'; +require __DIR__.'/../routes/Echeance.php'; $app->run(); ?> \ No newline at end of file diff --git a/Sources/API/routes/Echeance.php b/Sources/API/routes/Echeance.php new file mode 100644 index 0000000..0edf00d --- /dev/null +++ b/Sources/API/routes/Echeance.php @@ -0,0 +1,125 @@ +addBodyParsingMiddleware(); +$app->addRoutingMiddleware(); +$app->addErrorMiddleware(true, true, true); + +/** +* @OA\Get(path="/api/Echeance", +* @OA\Response(response="200", description="Succes") +* @OA\Response(response="500", description="Bdd Error") +* ) +*/ + +$app->post('/Echeance/FromIdCompte/', function(Request $request, Response $response,array $args){ + $idCompte = $request->getParsedBody()["id"]; + $query = 'SELECT * FROM Echeancier WHERE compte=:id'; + + try{ + $db = new Database(); + $conn = $db->connect(); + + $stmt = $conn->prepare($query); + $stmt->bindValue(':id', $idCompte, PDO::PARAM_STR); + + $stmt->execute(); + $ope = $stmt->fetchAll(PDO::FETCH_OBJ); + + $db = null; + $response->getBody()->write(json_encode($ope)); + return $response + ->withHeader('content-type', 'application/json') + ->withStatus(200); + } catch(PDOException $e){ + $error = array("message" => $e->getMessage()); + + $response->getBody()->write(json_encode($error)); + return $response + ->withHeader('content-type', 'application/json') + ->withStatus(500); + } +}); + +$app->post('/Echeance/add/', function(Request $request, Response $response, array $args){ + $compte = $request->getParsedBody()["compte"]; + $nom = $request->getParsedBody()["nom"]; + $montant = $request->getParsedBody()["montant"]; + $dateO = $request->getParsedBody()["dateO"]; + $methodePayement = $request->getParsedBody()["methodePayement"]; + $isDebit = $request->getParsedBody()["isDebit"]; + $tag = $request->getParsedBody()["tag"]; + + $query = "INSERT INTO Echeancier (compte, nom, montant, dateO, methodePayement, isDebit, tag) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD ,:tag;"; + try{ + $db = new Database(); + $conn = $db->connect(); + + $stmt = $conn->prepare($query); + $stmt->bindValue(':compte', $compte, PDO::PARAM_STR); + $stmt->bindValue(':nom', $nom, PDO::PARAM_STR); + $stmt->bindValue(':montant', $montant, PDO::PARAM_STR); + $stmt->bindValue(':dateO', $dateO, PDO::PARAM_STR); + $stmt->bindValue(':methodePayement', $methodePayement, PDO::PARAM_STR); + $stmt->bindValue(':isD', $isDebit, PDO::PARAM_BOOL); + $stmt->bindValue(':tag', $tag, PDO::PARAM_STR); + + $result = $stmt->execute(); + + $db = null; + $response->getBody()->write(json_encode($result)); + return $response + ->withHeader('content-type', 'application/json') + ->withStatus(200); + } catch(PDOException $e){ + $error = array("message" => $e->getMessage()); + + $response->getBody()->write(json_encode($error)); + return $response + ->withHeader('content-type', 'application/json') + ->withStatus(500); + } +}); + +$app->delete('/Echeance/delete/', function (Request $request, Response $response, array $args) { + $compte = $request->getParsedBody()["compte"]; + $nom = $request->getParsedBody()["nom"]; + + $query = "DELETE FROM Echeancier WHERE compte=:compte AND nom=:nom"; + + try{ + $db = new Database(); + $conn = $db->connect(); + + $stmt = $conn->prepare($query); + $stmt->bindValue(':compte', $compte, PDO::PARAM_STR); + $stmt->bindValue(':nom', $nom, PDO::PARAM_STR); + + $result = $stmt->execute(); + + $db = null; + $response->getBody()->write(json_encode($result)); + return $response + ->withHeader('content-type', 'application/json') + ->withStatus(200); + + } catch(PDOException $e){ + $error = array("message" => $e->getMessage()); + + $response->getBody()->write(json_encode($error)); + return $response + ->withHeader('content-type', 'application/json') + ->withStatus(500); + } +}); + + + +?> \ No newline at end of file diff --git a/Sources/API/routes/Operation.php b/Sources/API/routes/Operation.php index f04585c..3d4096a 100644 --- a/Sources/API/routes/Operation.php +++ b/Sources/API/routes/Operation.php @@ -55,8 +55,9 @@ $app->post('/Operation/add/', function(Request $request, Response $response, arr $dateO = $request->getParsedBody()["dateO"]; $methodePayement = $request->getParsedBody()["methodePayement"]; $isDebit = $request->getParsedBody()["isDebit"]; + $tag = $request->getParsedBody()["tag"]; - $query = "INSERT INTO Operation (compte, nom, montant, dateO, methodePayement, isDebit) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD;"; + $query = "INSERT INTO Operation (compte, nom, montant, dateO, methodePayement, isDebit, tag) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD, :tag;"; try{ $db = new Database(); $conn = $db->connect(); @@ -68,6 +69,7 @@ $app->post('/Operation/add/', function(Request $request, Response $response, arr $stmt->bindValue(':dateO', $dateO, PDO::PARAM_STR); $stmt->bindValue(':methodePayement', $methodePayement, PDO::PARAM_STR); $stmt->bindValue(':isD', $isDebit, PDO::PARAM_BOOL); + $stmt->bindValue(':tag', $tag, PDO::PARAM_STR); $result = $stmt->execute(); diff --git a/Sources/API/routes/Planification.php b/Sources/API/routes/Planification.php index f6893ed..c753d96 100644 --- a/Sources/API/routes/Planification.php +++ b/Sources/API/routes/Planification.php @@ -55,9 +55,9 @@ $app->post('/Planification/add/', function(Request $request, Response $response, $dateO = $request->getParsedBody()["dateO"]; $methodePayement = $request->getParsedBody()["methodePayement"]; $isDebit = $request->getParsedBody()["isDebit"]; - $freq = $request->getParsedBody()["freq"]; + $tag = $request->getParsedBody()["tag"]; - $query = "INSERT INTO Planification (compte, nom, montant, dateO, methodePayement, isDebit, frequance) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD ,:freq;"; + $query = "INSERT INTO Planification (compte, nom, montant, dateO, methodePayement, isDebit, tag) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD ,:tag;"; try{ $db = new Database(); $conn = $db->connect(); @@ -69,7 +69,7 @@ $app->post('/Planification/add/', function(Request $request, Response $response, $stmt->bindValue(':dateO', $dateO, PDO::PARAM_STR); $stmt->bindValue(':methodePayement', $methodePayement, PDO::PARAM_STR); $stmt->bindValue(':isD', $isDebit, PDO::PARAM_BOOL); - $stmt->bindValue(':freq', $freq, PDO::PARAM_STR); + $stmt->bindValue(':tag', $tag, PDO::PARAM_STR); $result = $stmt->execute(); diff --git a/Sources/Data/ClientAPI.cs b/Sources/Data/ClientAPI.cs index 0b1ffea..a290bae 100644 --- a/Sources/Data/ClientAPI.cs +++ b/Sources/Data/ClientAPI.cs @@ -45,7 +45,13 @@ namespace Data private const string POST_ADD_PLANIFICATION_COMPTE_DATA_URL = ROOT_URL + "Planification/add/"; private const string DELETE_PLANIFICATION_COMPTE_DATA_URL = ROOT_URL + "Planification/delete/"; - //add all routes + //routes echeance + private const string POST_ECHEANCE_COMPTE_DATA_URL = ROOT_URL + "Echeance/FromIdCompte/"; + private const string POST_ADD_ECHEANCE_COMPTE_DATA_URL = ROOT_URL + "Echeance/add/"; + private const string DELETE_ECHEANCE_COMPTE_DATA_URL = ROOT_URL + "Echeance/delete/"; + + //routes utilitaire + private const string TEST_API_STATEMENT = ROOT_URL; private static HttpClient cli = new HttpClient(); @@ -288,7 +294,8 @@ namespace Data { "montant", operation.Montant.ToString() }, { "dateO", operation.DateOperation.ToString() }, { "methodePayement", operation.ModePayement.ToString() }, - { "isDebit", operation.IsDebit.ToString() } + { "isDebit", operation.IsDebit.ToString() }, + { "tag", operation.Tag.ToString() } }; HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_OPERATION_COMPTE_DATA_URL, dataBody); @@ -354,7 +361,7 @@ namespace Data { "dateO", planification.DateOperation.ToString() }, { "methodePayement", planification.ModePayement.ToString() }, { "isDebit", planification.IsDebit.ToString() }, - { "freq", planification.Frequance.ToString() } + { "tag", planification.Tag.ToString() } }; HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_PLANIFICATION_COMPTE_DATA_URL, dataBody); @@ -392,5 +399,84 @@ namespace Data } + + //Echeances + public static async Task> GetEcheanceAsync(string id) + { + var dataBody = new Dictionary { { "id", id } }; + HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ECHEANCE_COMPTE_DATA_URL, dataBody); + + if (reponse.IsSuccessStatusCode) + { + return JsonConvert.DeserializeObject>(await reponse.Content.ReadAsStringAsync()); + } + else + { + throw new HttpRequestException(reponse.StatusCode.ToString()); + } + + } + + public static async Task PostAddEcheanceInscritAsync(Compte compte, Echeance echeance) + { + var dataBody = new Dictionary + { + { "compte", compte.Identifiant }, + { "nom", echeance.IntituleOperation }, + { "montant", echeance.Montant.ToString() }, + { "dateO", echeance.DateOperation.ToString() }, + { "methodePayement", echeance.ModePayement.ToString() }, + { "isDebit", echeance.IsDebit.ToString() }, + { "tag", echeance.Tag.ToString() } + }; + HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_ECHEANCE_COMPTE_DATA_URL, dataBody); + + if (reponse.IsSuccessStatusCode) + { + return true; + } + else + { + throw new HttpRequestException(reponse.StatusCode.ToString()); + } + + } + + public static async Task DeleteEcheanceInscritAsync(string idCompte, string nomOpe) + { + var dataBody = new Dictionary { { "compte", idCompte }, { "nom", nomOpe } }; + + var reponse = + cli.SendAsync( + new HttpRequestMessage(HttpMethod.Delete, DELETE_ECHEANCE_COMPTE_DATA_URL) + { + Content = new FormUrlEncodedContent(dataBody) + }) + .Result; + + if (reponse.IsSuccessStatusCode) + { + return true; + } + else + { + throw new HttpRequestException(reponse.StatusCode.ToString()); + } + + } + + //Utilitaires + public static async Task GetStateApi() + { + HttpResponseMessage reponse = await cli.GetAsync(TEST_API_STATEMENT); + if (reponse.IsSuccessStatusCode) + { + return true; + } + else + { + return false; + } + } } } diff --git a/Sources/Data/LoadOperation.cs b/Sources/Data/LoadOperation.cs index 164c950..cd95fa0 100644 --- a/Sources/Data/LoadOperation.cs +++ b/Sources/Data/LoadOperation.cs @@ -99,7 +99,7 @@ namespace Data row = ""; } } - compteEnCoursDeSaisie.ajouterOperation(new Operation(intituleOperation, montant, dateOperation, modePayement, isDebit)); + compteEnCoursDeSaisie.ajouterOperation(new Operation(intituleOperation, montant, dateOperation, modePayement, TagOperation.None, isDebit)); } else { diff --git a/Sources/Data/PersAPI.cs b/Sources/Data/PersAPI.cs index 1ad86df..baad602 100644 --- a/Sources/Data/PersAPI.cs +++ b/Sources/Data/PersAPI.cs @@ -88,50 +88,46 @@ namespace Data { return ClientAPI.DeleteOperationInscritAsync(compte.Identifiant, operation.IntituleOperation).GetAwaiter().GetResult(); } - public IList RecupererOperation(Compte compte) + public IList RecupererOperation(Compte compte) { - return ClientAPI.GetCompteAsync(compte.Identifiant).GetAwaiter().GetResult(); + return ClientAPI.GetOperationAsync(compte.Identifiant).GetAwaiter().GetResult(); } //actions sur les Planifications public bool AjouterPlanification(Compte compte, Planification planification) { - throw new NotImplementedException(); + return ClientAPI.PostAddPlanificationInscritAsync(compte, planification).GetAwaiter().GetResult(); } public bool SupprimerPlanification(Compte compte, Planification planification) { - throw new NotImplementedException(); + return ClientAPI.DeletePlanificationInscritAsync(compte.Identifiant, planification.IntituleOperation).GetAwaiter().GetResult(); } - public IList RecupererPlanification(Compte compte) + public IList RecupererPlanification(Compte compte) { - throw new NotImplementedException(); + return ClientAPI.GetPlanificationAsync(compte.Identifiant).GetAwaiter().GetResult(); } //actions sur les EchĂ©ances - public bool AjouterEcheance(Compte compte) + public bool AjouterEcheance(Compte compte, Echeance echeance) { - throw new NotImplementedException(); + return ClientAPI.PostAddEcheanceInscritAsync(compte, echeance).GetAwaiter().GetResult(); } - public bool SupprimerEcheance(Compte compte) + public bool SupprimerEcheance(Compte compte, Echeance echeance) { - throw new NotImplementedException(); + return ClientAPI.DeleteEcheanceInscritAsync(compte.Identifiant, echeance.IntituleOperation).GetAwaiter().GetResult(); } - public bool ModifierEcheance(Compte compte) + public IList RecupererEcheance(Compte compte) { - throw new NotImplementedException(); - } - public IList RecupererEcheance(Compte compte) - { - throw new NotImplementedException(); + return ClientAPI.GetEcheanceAsync(compte.Identifiant).GetAwaiter().GetResult(); } //actions utilitaire public bool TestConnexion() { - throw new NotImplementedException(); + return ClientAPI.GetStateApi().GetAwaiter().GetResult(); } } } \ No newline at end of file diff --git a/Sources/Data/insert.sql b/Sources/Data/insert.sql index ef88998..c6b69d6 100644 --- a/Sources/Data/insert.sql +++ b/Sources/Data/insert.sql @@ -23,6 +23,7 @@ INSERT INtO Banque(nom,urlsite,urllogo) VALUES('BNP PARIBAS','mabanque','imagesi INSERT INtO Banque(nom,urlsite,urllogo) VALUES('CREDIT AGRICOLE','credit-agricole.fr','imageca'); INSERT INtO Banque(nom,urlsite,urllogo) VALUES('BANQUE POSTALE','labanquepostale.fr','imgbp'); INSERT INtO Banque(nom,urlsite,urllogo) VALUES('CAISSE D EPARGNE','caisse-epargne.fr','imgcaissedepargne'); +INSERT INtO Banque(nom,urlsite,urllogo) VALUES('ORANGE BANK','orange.fr','cpt'); INSERT INTO InscrBanque (nomBanque,idInscrit)VALUES('BNP PARIBAS','1'); @@ -35,3 +36,7 @@ INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','1'); INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','2'); INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','3'); INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','4'); + +INSERT INTO `Operation` (`id`, `compte`, `nom`, `montant`, `dateO`, `methodePayement`, `isDebit`, `tag`) VALUES (NULL, '1', 'JSP MAIS JAI PAYER', '500', '2023-01-02', 'Esp', '1', 'Divers'); +INSERT INTO `Planification` (`id`, `compte`, `nom`, `montant`, `dateO`, `methodePayement`, `isDebit`, `tag`) VALUES (NULL, '1', 'FAUT QUE JE PAYE', '100', '2023-01-30', 'Vir', '1', 'Energie'); +INSERT INTO `Echeancier` (`id`, `compte`, `nom`, `montant`, `dateO`, `methodePayement`, `isDebit`, `tag`) VALUES (NULL, '1', 'FAUT PAYER VITEEEE', '50', '2023-01-06', 'Vir', '1', 'Divers'); diff --git a/Sources/Data/tables.sql b/Sources/Data/tables.sql index 6d4aaf3..ef713b7 100644 --- a/Sources/Data/tables.sql +++ b/Sources/Data/tables.sql @@ -68,7 +68,9 @@ CREATE TABLE Echeancier dateO date, methodePayement varchar(20), isDebit boolean, - CONSTRAINT ck_ech CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre')), + tag varchar(30), + CONSTRAINT ck_methEch CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre', 'None')), + CONSTRAINT ck_tagEch CHECK (tag IN ('Alimentaire','Carburant','Habitation','Energie','Telephonie','Loisir','Restauration','Divers','Transport','Transaction','Santé')), FOREIGN KEY(compte) REFERENCES Compte(id) ); @@ -81,7 +83,9 @@ CREATE TABLE Operation dateO date, methodePayement varchar(20), isDebit boolean, - CONSTRAINT ck_methPaye CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre')), + tag varchar(30), + CONSTRAINT ck_methOpe CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre', 'None')), + CONSTRAINT ck_tagOpe CHECK (tag IN ('Alimentaire','Carburant','Habitation','Energie','Telephonie','Loisir','Restauration','Divers','Transport','Transaction','Santé')), FOREIGN KEY(compte) REFERENCES Compte(id) ); @@ -94,7 +98,8 @@ CREATE TABLE Planification dateO date, methodePayement varchar(20), isDebit boolean, - frequance numeric, - CONSTRAINT ck_pla CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre')), + tag varchar(30), + CONSTRAINT ck_methPla CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre', 'None')), + CONSTRAINT ck_tagPla CHECK (tag IN ('Alimentaire','Carburant','Habitation','Energie','Telephonie','Loisir','Restauration','Divers','Transport','Transaction','Santé')), FOREIGN KEY(compte) REFERENCES Compte(id) ); \ No newline at end of file diff --git a/Sources/Modele/Echeance.cs b/Sources/Modele/Echeance.cs index c59dc5e..060c5da 100644 --- a/Sources/Modele/Echeance.cs +++ b/Sources/Modele/Echeance.cs @@ -35,7 +35,7 @@ namespace Model public override string ToString() { - return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit; + return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + " " + Tag; } } diff --git a/Sources/Modele/IPersistanceManager.cs b/Sources/Modele/IPersistanceManager.cs index 38f38bd..cfbd58e 100644 --- a/Sources/Modele/IPersistanceManager.cs +++ b/Sources/Modele/IPersistanceManager.cs @@ -35,20 +35,19 @@ namespace Model //actions sur les OpĂ©rations bool AjouterOperation(Compte compte, Operation operation); bool SupprimerOperation(Compte compte, Operation operation); - IList RecupererOperation(Compte compte); + IList RecupererOperation(Compte compte); //actions sur les Planifications bool AjouterPlanification(Compte compte, Planification planification); bool SupprimerPlanification(Compte compte, Planification planification); - IList RecupererPlanification(Compte compte); + IList RecupererPlanification(Compte compte); //actions sur les EchĂ©ances - bool AjouterEcheance(Compte compte); - bool SupprimerEcheance(Compte compte); - bool ModifierEcheance(Compte compte); - IList RecupererEcheance(Compte compte); + bool AjouterEcheance(Compte compte, Echeance echeance); + bool SupprimerEcheance(Compte compte, Echeance echeance); + IList RecupererEcheance(Compte compte); //actions utilitaire diff --git a/Sources/Modele/Operation.cs b/Sources/Modele/Operation.cs index 80852ac..f0b6843 100644 --- a/Sources/Modele/Operation.cs +++ b/Sources/Modele/Operation.cs @@ -50,7 +50,7 @@ namespace Model public override string ToString() { - return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit; + return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + " " + Tag; } } } \ No newline at end of file diff --git a/Sources/Modele/TagOperation.cs b/Sources/Modele/TagOperation.cs index 7d65332..1718c6e 100644 --- a/Sources/Modele/TagOperation.cs +++ b/Sources/Modele/TagOperation.cs @@ -8,6 +8,7 @@ namespace Model { public enum TagOperation { + None, Alimentaire, Carburant, Habitation, diff --git a/Sources/TestFonctionnel/Program.cs b/Sources/TestFonctionnel/Program.cs index 282a10d..732f42c 100644 --- a/Sources/TestFonctionnel/Program.cs +++ b/Sources/TestFonctionnel/Program.cs @@ -31,6 +31,8 @@ foreach (Compte compte in comptes) Console.WriteLine("Test ClientAPI"); +Console.WriteLine("\n\nEtat API : " + ClientAPI.GetStateApi().GetAwaiter().GetResult()); + Console.WriteLine("\n\n\n----Inscrits----\n"); IList res = ClientAPI.GetInscritsAsync().GetAwaiter().GetResult(); @@ -159,7 +161,7 @@ foreach (Operation o in operations) Console.WriteLine("\n----Modifs----\n"); -rrrrrrr = ClientAPI.PostAddOperationInscritAsync(new Compte("1","PEL"), new Operation("test",100,DateTime.Now,MethodePayement.Cb,true)).GetAwaiter().GetResult(); +rrrrrrr = ClientAPI.PostAddOperationInscritAsync(new Compte("1","PEL"), new Operation("test",100,DateTime.Now,MethodePayement.Cb, TagOperation.Alimentaire, true)).GetAwaiter().GetResult(); Console.WriteLine("Add Ope On Compte : " + rrrrrrr + "\n"); Console.WriteLine("\n----Verif----\n"); @@ -191,7 +193,7 @@ foreach (Planification p in planifications) Console.WriteLine("\n----Modifs----\n"); -rrrrrrr = ClientAPI.PostAddPlanificationInscritAsync(new Compte("1", "PEL"), new Planification("test", 100, DateTime.Now, 30, MethodePayement.Cb, true)).GetAwaiter().GetResult(); +rrrrrrr = ClientAPI.PostAddPlanificationInscritAsync(new Compte("1", "PEL"), new Planification("test", 100, DateTime.Now, MethodePayement.Cb, TagOperation.Alimentaire, true)).GetAwaiter().GetResult(); Console.WriteLine("Add Pla On Compte : " + rrrrrrr + "\n"); Console.WriteLine("\n----Verif----\n"); @@ -211,4 +213,36 @@ planifications = ClientAPI.GetPlanificationAsync("1").GetAwaiter().GetResult(); foreach (Planification p in planifications) { Console.WriteLine(p); +} + +Console.WriteLine("\n\n\n----Echeances----\n"); + +IList echeances = ClientAPI.GetEcheanceAsync("1").GetAwaiter().GetResult(); +foreach (Echeance e in echeances) +{ + Console.WriteLine(e); +} + +Console.WriteLine("\n----Modifs----\n"); + +rrrrrrr = ClientAPI.PostAddEcheanceInscritAsync(new Compte("1", "PEL"), new Echeance("test", 100, DateTime.Now, MethodePayement.Cb, TagOperation.Alimentaire, true)).GetAwaiter().GetResult(); +Console.WriteLine("Add Ech On Compte : " + rrrrrrr + "\n"); + +Console.WriteLine("\n----Verif----\n"); +echeances = ClientAPI.GetEcheanceAsync("1").GetAwaiter().GetResult(); +foreach (Echeance e in echeances) +{ + Console.WriteLine(e); +} + +Console.WriteLine("\n----Modifs----\n"); + +rrrrrrr = ClientAPI.DeleteEcheanceInscritAsync("1", "test").GetAwaiter().GetResult(); +Console.WriteLine("Del Ech On Compte : " + rrrrrrr + "\n"); + +Console.WriteLine("\n----Verif----\n"); +echeances = ClientAPI.GetEcheanceAsync("1").GetAwaiter().GetResult(); +foreach (Echeance e in echeances) +{ + Console.WriteLine(e); } \ No newline at end of file