/// <summary> /// Page de confirmation de commande. affiche un récap et le bouton confirmation terminant le paiement... /// </summary> /// <returns></returns> public ActionResult Confirmation(string PayerID) { Session["payerId"] = PayerID; #region unusuedXpressCheckout /*ZONE à appeler en cas d'express checkout: */ //note: non utilisé pour le moment. cleanup code et validation fonctionnement avant. /* if ((bool)Session["ShortcutPaypalCheckout"]) { NVPAPICaller test = new NVPAPICaller(); string retMsg = ""; string token = ""; string payerId = ""; string shippingAddress = ""; //parser le string en objet interne token = Session["token"].ToString(); bool ret = test.GetShippingDetails(token, ref payerId, ref shippingAddress, ref retMsg); if (ret) { Session["payerId"] = payerId; Response.Write(shippingAddress); } else { Response.Redirect("APIError.aspx?" + retMsg); } }*/ /*fin de zone */ #endregion RecapitulatifCommandeModel model = new RecapitulatifCommandeModel { Pannier = (ShoppingCartModel)Session["PanierCommande"], Livraison = (LivraisonsModel)Session["InformationLivraison"], Paiement = (PaiementModel)Session["InformationPaiement"] }; return View(model); }
public ActionResult Confirmation(RecapitulatifCommandeModel model) { decimal finalPaymentAmount = decimal.Parse(Session["payment_amt"].ToString()); string token = Session["token"].ToString(); string payerId = Session["payerId"].ToString(); string returnedMsg = ""; if (Paypal.OrderConfirmation(token, payerId, finalPaymentAmount, ref returnedMsg) != "VALIDATED") { //enable to send email about paypal error, not used in this sample. //new SendMail.Paypal().Error(returnedMsg + " erreur survenue au moment de la confirmation du paiement."); return RedirectToAction("Index", "PaypalErrors", new { errorCode = returnedMsg }); } //if we are here everything is ok; ValidationStatus v = new ValidationStatus { Status = "Validated" }; return View("Thanks", v); }