public override void HandleIPN(PaypalContext paypalContext)
 {
     if (paypalContext.PaymentInformation.PaymentStatusType == PaymentStatusType.Refunded)
     {
         var customer = new PlanCustomer
         {
             Email = paypalContext.BuyerInformation.PayerEmail
         };
         int count;
         if (!int.TryParse(paypalContext.BasicInformation.ItemNumber, out count))
         {
             count = 0;
         }
         var product = new PlanProduct
         {
             Name  = paypalContext.BasicInformation.ItemName,
             Count = count
         };
         this.PlanService.QuitProPlan(customer, product);
         this.MailService.SendOpsNotification("Refund from Pro!", $"Welcome to join us - from FewBox {paypalContext.BasicInformation.ItemName} team.", new List <string> {
             paypalContext.BuyerInformation.PayerEmail
         });
         this.Logger.LogDebug($"Refund from {customer.Email}");
     }
     else
     {
         this.Approver.HandleIPN(paypalContext);
     }
 }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            PlanProduct planProduct = db.PlanProducts.Find(id);

            db.PlanProducts.Remove(planProduct);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "Id,PlanId,ProductId,TargetNumber")] PlanProduct planProduct)
        {
            if (ModelState.IsValid)
            {
                db.Entry(planProduct).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.PlanId    = new SelectList(db.Plans, "Id", "Name", planProduct.PlanId);
            ViewBag.ProductId = new SelectList(db.Products, "Id", "Code", planProduct.ProductId);

            return(View(planProduct));
        }
Exemplo n.º 4
0
        // GET: PlanProducts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlanProduct planProduct = db.PlanProducts.Find(id);

            if (planProduct == null)
            {
                return(HttpNotFound());
            }
            return(View(planProduct));
        }
Exemplo n.º 5
0
        // GET: PlanProducts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlanProduct planProduct = db.PlanProducts.Find(id);

            if (planProduct == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PlanId    = new SelectList(db.Plans, "Id", "Name", planProduct.PlanId);
            ViewBag.ProductId = new SelectList(db.Products, "Id", "Code", planProduct.ProductId);
            return(View(planProduct));
        }
Exemplo n.º 6
0
        // GET: PlanProducts/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlanProduct planProduct = db.PlanProducts.Find(id);

            if (planProduct == null)
            {
                return(HttpNotFound());
            }
            Product product = planProduct.Product;

            List <Part> productParts = product.Parts.ToList();

            //List<Part> parts = db.Parts.ToList();
            //ViewBag.product = product;
            ViewBag.productParts = productParts;
            //ViewBag.parts = parts;

            return(View(planProduct));
        }