saves the payment

main
Paul Schneider 9 years ago
parent d430a9483e
commit 2e855f0c13
1 changed files with 16 additions and 3 deletions

@ -24,6 +24,7 @@ namespace Yavsc.Controllers
using System.Globalization; using System.Globalization;
using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.Mvc.Rendering;
using System.Collections.Generic; using System.Collections.Generic;
using Yavsc.Models.Messaging;
public class HairCutCommandController : CommandController public class HairCutCommandController : CommandController
{ {
@ -64,16 +65,28 @@ namespace Yavsc.Controllers
SetViewBagPaymentUrls(id); SetViewBagPaymentUrls(id);
return View (command); return View (command);
} }
public async Task<IActionResult> Confirmation([FromRoute] long id, string token, string PayerID) public async Task<IActionResult> PaymentConfirmation([FromRoute] long id, string token, string PayerID)
{ {
HairCutQuery command = await GetQuery(id); HairCutQuery command = await GetQuery(id);
if (command == null) if (command == null)
{ {
return HttpNotFound(); 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); SetViewBagPaymentUrls(id);
var paymentinfo = await _context.ConfirmPayment( User.GetUserId(), PayerID, token ); ViewData ["Notify"] = new List<Notification> {
return View (paymentinfo); new Notification {
title= "Paiment PayPal",
body = "Votre paiment a été accépté."
}
} ;
return View ("Details",command);
} }
private void SetViewBagPaymentUrls(long id) private void SetViewBagPaymentUrls(long id)

Loading…