- Data:
- 2009-11-24 12:21:39 (16 years ago)
- Lokalizacja:
- branches/Emisje
- Pliki:
-
- 2 zmodyfikowane
-
. (zmodyfikowane) (1 prop)
-
eCard/eCardMVC/Platnosci/Controllers/MerchantController.cs (zmodyfikowane) (7 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
branches/Emisje
- Property svn:mergeinfo
-
old new 1 /branches/Abonament:701-884 1 2 /branches/AutoShopper:815-818 2 3 /branches/ReklamaReorganizacja:568-731 3 4 /tags/BazaReklam_1.1.28:831 4 /trunk:774-8 685 /trunk:774-893
-
- Property svn:mergeinfo
-
branches/Emisje/eCard/eCardMVC/Platnosci/Controllers/MerchantController.cs
r868 r895 29 29 public const string KOD_POLSKA = "616"; //kod kraju Akceptanta - Polska 30 30 public const string KODOWANIE = "ISO-8859-2"; 31 private int ORDERNUMBER = 122; 31 32 32 33 private string merchantId; 33 34 private readonly PlatnosciDataContext _context; 34 private readonly IRepository PE_rep;35 private readonly IRepository<PlatnosciEcard> _rep; 35 36 private FunkcjePlatnosci _func; 36 37 37 38 public MerchantController() 38 39 { 39 _rep = new Repository PlatnosciEcard();40 _rep = new Repository<PlatnosciEcard>(new DataContext1()); 40 41 _context = new PlatnosciDataContext(); 41 42 _func = new FunkcjePlatnosci(); … … 43 44 public ActionResult Merchant(Payer payer, string language) 44 45 { 46 System.Diagnostics.Debug.WriteLine("MerchantController:Merchant:" + language); 45 47 language = _func.setLanguage(language); 46 48 47 49 int id1 = Convert.ToInt32(payer.Id_faktury); 48 vPlatnosciEcard platnosc = _ context.FindInvoiceById(id1).SingleOrDefault();49 50 if ( !_func.UserIdentity(platnosc, ControllerContext.HttpContext.User.Identity.Name))50 vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 51 52 if (platnosc == null) 51 53 { 52 ErrorViewData errorViewData = new ErrorViewData(); 53 errorViewData.error = HttpContext.GetGlobalResourceObject("tlumaczenia", "weryfikacja").ToString(); 54 ErrorViewData errorViewData = _func.InitErrorViewData(HttpContext.GetGlobalResourceObject("tlumaczenia", "brakdanych").ToString()); 55 return View("Error1", errorViewData); 56 } 57 else if (!_func.UserIdentity(platnosc, ControllerContext.HttpContext.User.Identity.Name)) 58 { 59 ErrorViewData errorViewData = _func.InitErrorViewData(HttpContext.GetGlobalResourceObject("tlumaczenia", "weryfikacja").ToString()); 54 60 return View("Error1", errorViewData); 55 61 } … … 64 70 65 71 string hash = GetHash(newPayment, systemKs); 72 hash = hash.Replace("\n",""); 73 if (hash == BAD_HASH || hash == "" ) return View("Error"); 66 74 67 hash = hash.Replace("\n",""); 68 if (hash == BAD_HASH || hash == "" ) 69 { 70 return View("Error"); //nie mo¿na po³¹czyæ siê z serverem p³atnoci. Proszê spróbowaæ jeszcze raz. 71 } 72 if (platnosc.SystemKsiegowyId == 1) 73 merchantId = "170906000"; 74 else 75 merchantId = "171485000"; 75 if (systemKs == "1") merchantId = "170906000"; 76 else merchantId = "171485000"; 76 77 77 string link = ConfigurationManager.AppSettings["StatusLink"]; 78 string LinkFail = link + "?status=fail"; 79 string LinkOk = link + "?status=ok"; 78 string LinkFail = ConfigurationManager.AppSettings["Strona"]; 79 LinkFail += "/" + language + ConfigurationManager.AppSettings["LinkFail"]; 80 LinkFail += "/" + newPayment.IDFaktury; 81 82 string LinkOk = ConfigurationManager.AppSettings["Strona"]; 83 LinkOk += "/" + language + ConfigurationManager.AppSettings["LinkOk"]; 84 LinkOk += "/" + newPayment.IDFaktury; ; 80 85 81 86 var merchantViewData = InitMerchantViewData(newPayment, hash, merchantId, LinkFail, LinkOk); 87 wyslij(merchantViewData, hash, merchantId); 82 88 return View(merchantViewData); 83 89 } … … 95 101 newPayment.SURNAME = payer.LastName; 96 102 newPayment.AUTODEPOSIT = true; 97 newPayment.LANGUAGE = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName.ToUpper(); //"PL";103 newPayment.LANGUAGE = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName.ToUpper(); 98 104 newPayment.CHARSET = KODOWANIE; 99 105 newPayment.COUNTRY = KOD_POLSKA; … … 124 130 125 131 //wartosci testowe 126 merchantViewData.nowaPlatnosc.ORDERNUMBER = 4;127 merchantViewData.nowaPlatnosc.ORDERDESCRIPTION = "22 ";132 merchantViewData.nowaPlatnosc.ORDERNUMBER = ORDERNUMBER; 133 merchantViewData.nowaPlatnosc.ORDERDESCRIPTION = "222"; 128 134 merchantViewData.nowaPlatnosc.AMOUNT = 300; 129 135 merchantViewData.nowaPlatnosc.CURRENCY = "985"; 130 merchantViewData.nowaPlatnosc.SESSIONID = " ";136 merchantViewData.nowaPlatnosc.SESSIONID = "ff"; 131 137 merchantViewData.merchantId = "171485000"; 132 138 merchantViewData.LinkFail = ""; … … 146 152 147 153 //dane testowe 148 string adres = "https://pay.ecard.pl/servlet/HS?orderNumber= 4";154 string adres = "https://pay.ecard.pl/servlet/HS?orderNumber="+ORDERNUMBER; 149 155 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(adres); 150 156 string dane = "&orderDescription=&amount=300¤cy=985&merchantId=171485000&password=ashSeth2"; … … 164 170 165 171 return strResponse; 166 } 172 } 173 private void wyslij(MerchantViewData m, string hash, string id) 174 { 175 string adres = "https://pay.ecard.pl/servlet/PSTEST?ORDERDESCRIPTION="+m.nowaPlatnosc.ORDERDESCRIPTION; 176 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(adres); 177 string dane = "&AMOUNT=300&CURRENCY=985&ORDERNUMBER="+ORDERNUMBER+"&NAME="+m.nowaPlatnosc.NAME+"&SURNAME="+m.nowaPlatnosc.SURNAME+"&LANGUAGE=PL&CHARSET=ISO-8859-2"; 178 dane += "&COUNTRY=616&PAYMENTTYPE=CARDS&JS=1&HASH=" + hash + "&MERCHANTID=171485000&AUTODEPOSIT=" + m.nowaPlatnosc.AUTODEPOSIT + "&LINKFAIL="; 179 dane += "&LINKOK=&SESSIONID="; 180 Response.Redirect(adres + dane); 181 } 167 182 } 168 183 }
