예제 #1
0
 public void Update(PaymentResponse payment)
 {
     if (payment != null)
     {
         Status          = payment.Status();
         ZaypayPaymentId = payment.PaymentId();
     }
 }
예제 #2
0
        public ActionResult Reporting()
        {
            NameValueCollection parameters = Request.QueryString;

            //check if all required params are there
            if (AllValuesPresent(ref parameters))
            {
                int priceSettingId = 0;
                int paymentId      = 0;
                int purchaseId     = 0;
                int payalogueId    = 0;

                Int32.TryParse(parameters["price_setting_id"], out priceSettingId);
                Int32.TryParse(parameters["payment_id"], out paymentId);
                Int32.TryParse(parameters["purchase_id"], out purchaseId);
                Int32.TryParse(parameters["payalogue_id"], out payalogueId);

                Purchase purchase = db.Purchases.Find(purchaseId);
                if (purchase != null && (purchase.ZaypayPaymentId == paymentId))
                {
                    Product product = purchase.Product;

                    if (product.PriceSettingId == priceSettingId && product.PayalogueId == payalogueId)
                    {
                        PriceSetting ps = new PriceSetting(product.PriceSettingId);

                        PaymentResponse response = ps.ShowPayment(purchase.ZaypayPaymentId);
                        string          status   = response.Status();

                        if (status == parameters["status"])
                        {
                            purchase.Status = status;
                            db.SaveChanges();
                        }
                    }
                }
            }
            else
            {
                LogEntry("Reporting Method in Purchase Controller ----  Values are missing --- the request had following query string :: " + parameters);
                System.Diagnostics.Debug.WriteLine("VAL NOT PRESENT");
            }
            return(Content("*ok*"));
        }