From 2e855f0c139306e7b5c6557fc798cb44d743c9c6 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 26 May 2017 03:31:50 +0200 Subject: [PATCH] saves the payment --- .../Haircut/HairCutCommandController.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Yavsc/Controllers/Haircut/HairCutCommandController.cs b/Yavsc/Controllers/Haircut/HairCutCommandController.cs index aa805009..bb01ce55 100644 --- a/Yavsc/Controllers/Haircut/HairCutCommandController.cs +++ b/Yavsc/Controllers/Haircut/HairCutCommandController.cs @@ -24,6 +24,7 @@ namespace Yavsc.Controllers using System.Globalization; using Microsoft.AspNet.Mvc.Rendering; using System.Collections.Generic; + using Yavsc.Models.Messaging; public class HairCutCommandController : CommandController { @@ -64,16 +65,28 @@ namespace Yavsc.Controllers SetViewBagPaymentUrls(id); return View (command); } - public async Task Confirmation([FromRoute] long id, string token, string PayerID) + public async Task PaymentConfirmation([FromRoute] long id, string token, string PayerID) { HairCutQuery command = await GetQuery(id); if (command == null) { return HttpNotFound(); } + var paymentInfo = await _context.ConfirmPayment( User.GetUserId(), PayerID, token ); + ViewData["paymentinfo"] = paymentInfo; + command.Regularisation = paymentInfo.DbContent; + command.PaymentId = token; + await _context.SaveChangesAsync (User.GetUserId()); + SetViewBagPaymentUrls(id); - var paymentinfo = await _context.ConfirmPayment( User.GetUserId(), PayerID, token ); - return View (paymentinfo); + ViewData ["Notify"] = new List { + new Notification { + title= "Paiment PayPal", + body = "Votre paiment a été accépté." + } + } ; + + return View ("Details",command); } private void SetViewBagPaymentUrls(long id)