Example #1
0
 /// <summary>
 /// Executes the payment and returns view with purchase information 
 /// </summary>
 /// <param name="mod">model containing payment information</param>
 /// <returns>View(model)</returns>
 public ActionResult Complete(Purchase mod)
 {
     Purchase model = mod;
     APIContext apiContext = GetAPIContext();
     Payment pymnt = Payment.Get(apiContext, model.PaymentId);
     PaymentExecution pymntExecution = new PaymentExecution();
     pymntExecution.payer_id = model.PayerID;
     Payment executedPayment = pymnt.Execute(apiContext, pymntExecution);
     return View(model);
 }
Example #2
0
 /// <summary>
 /// parses the paypal paymentID and PayerId from address and finds the payment information to be displayed int the 
 /// view for the user to confirm or cancel the purchase
 /// </summary>
 /// <returns>View(Payment)</returns>
 public ActionResult Confirm()
 {
     Purchase model = new Purchase();
     if (ModelState.IsValid)
     {                
         string paymentId = Request.QueryString["paymentId"];
         string PayerID = Request.QueryString["PayerID"];
         model.PayerID = PayerID;
         model.PaymentId = paymentId;
         APIContext apiContext = GetAPIContext();
         Payment pymnt = Payment.Get(apiContext, paymentId);                
         model.FirstName = pymnt.payer.payer_info.first_name;
         model.LastName = pymnt.payer.payer_info.last_name;
         model.size = pymnt.transactions[0].item_list.items[0].description;
         model.photoName = pymnt.transactions[0].item_list.items[0].name;
         model.Price = Convert.ToDecimal(pymnt.transactions[0].amount.total);
         model.PaymentMethod = pymnt.payer.payment_method;
         model.City = pymnt.payer.payer_info.billing_address.city;
         model.State = pymnt.payer.payer_info.billing_address.state;
         model.Line1 = pymnt.payer.payer_info.billing_address.line1;
         model.Line2 = pymnt.payer.payer_info.billing_address.line2;
         model.postalCode = pymnt.payer.payer_info.billing_address.postal_code;
     }
     return View(model);
 }