Index: trunk/eCard/eCardMVC/Platnosci/Controllers/MerchantController.cs
===================================================================
--- trunk/eCard/eCardMVC/Platnosci/Controllers/MerchantController.cs (revision 951)
+++ trunk/eCard/eCardMVC/Platnosci/Controllers/MerchantController.cs (revision 952)
@@ -15,7 +15,4 @@
     public class MerchantController : Controller
     {
-        public const string BAD_HASH = "zlyHash";                  //b³êdne has³o - odpowied z eCard
-        public const string HASH_ERROR_INFO = "payment not exist";
-
         private readonly IRepository<vPlatnosciEcard> _repVPayment;
         private readonly IRepository<PlatnosciEcard> _repPayment; 
@@ -28,5 +25,5 @@
             _repVPayment = new Repository<vPlatnosciEcard>(new DataContext());
             _repPayment = new Repository<PlatnosciEcard>(new DataContext());
-            _funkcjePlatnosci = new FunkcjePlatnosci();
+            _funkcjePlatnosci = new FunkcjePlatnosci(_repPayment);
             _translateManager = new Translation();
             _eCardData = new eCardData(_repPayment);
@@ -36,6 +33,6 @@
             _repVPayment = repVPayment;
             _repPayment = repPayment;
-            _funkcjePlatnosci = new FunkcjePlatnosci();
             _translateManager = translate;
+            _funkcjePlatnosci = new FunkcjePlatnosci(_repPayment, _translateManager);            
             _eCardData = ecardData;
         }
@@ -47,36 +44,18 @@
             var id1 = Convert.ToInt32(payer.Id_faktury);
             var platnosc = _repVPayment.Find(p => p.ID_faktury == id1).SingleOrDefault();
-                 
-            if (platnosc == null) 
-                return View("Error1", IsError("brakdanych", 0));
-            
-            if (!_funkcjePlatnosci.UserIdentity(platnosc, ControllerContext.HttpContext.User.Identity.Name))
-                return View("Error1", IsError("weryfikacja", 0));
+
+            var errorViewData = _funkcjePlatnosci.IsError(platnosc, ControllerContext.HttpContext.User.Identity.Name);
+            if (!String.IsNullOrEmpty(errorViewData.Error)) 
+                return View("Error1", errorViewData);
 
             var merchant = _eCardData.CreateMerchantData(platnosc, payer, language, Session.SessionID);
             
-            if (merchant != null) merchant.IsValid();
-            
             if (merchant == null || (merchant != null && (!String.IsNullOrEmpty(merchant.Error))))
-                return View("Error1", IsError("error_hash", payer.Id_faktury));
+                return View("Error1", _funkcjePlatnosci.InitErrorViewData(_translateManager.Translate("tlumaczenia", "error_hash"), payer.Id_faktury));
             
             var adres = _eCardData.GetUrl(merchant);
             Response.Redirect(adres);           
             return new EmptyResult();          
-        }         
-        public ErrorViewData IsError(string errortxt, int idFaktury)
-        {
-            if (errortxt == "brakdanych")
-                errortxt = _translateManager.Translate("tlumaczenia", "brakdanych");
-            else if (errortxt == "weryfikacja")
-                errortxt = _translateManager.Translate("tlumaczenia", "weryfikacja");
-            else if (errortxt == "error_hash")
-                errortxt = _translateManager.Translate("tlumaczenia", "error_hash");
-            else if (errortxt == "error_hash")
-                errortxt = _translateManager.Translate("tlumaczenia", "error_hash");
-
-            return _funkcjePlatnosci.InitErrorViewData(errortxt, idFaktury);
-        }
-        
+        } 
     }
 }
