Exemple #1
0
        public async Task Weryfikuj(int?_p24_merchant_id, int?_p24_pos_id, string _p24_session_id, int?_p24_amount, string _p24_currency, int?_p24_order_id, int?_p24_method, string _p24_statement, string _p24_sign)
        {
            var    Platnosc = _repo.PobierzPlatnosc_session_id(_p24_session_id);
            string dd       = Platnosc.SessionId + "|" + p24_merchant_id.ToString() + "|" + (Platnosc.Zamowienie.Cena_Brutto * 100).ToString("0.##") + "|" + p24_currency + "|" + crc_sandbox;
            var    values   = new Dictionary <string, string>
            {
                { "p24_session_id", _p24_session_id },
                { "p24_merchant_id", _p24_merchant_id.ToString() },
                { "p24_pos_id", _p24_pos_id.ToString() },
                { "p24_sign", GetMd5Hash(dd) },
                { "p24_amount", (Platnosc.Zamowienie.Cena_Brutto * 100).ToString("0.##") },
                { "p24_currency", _p24_currency },
                { "p24_order_id", _p24_order_id.ToString() }
            };
            var    content   = new FormUrlEncodedContent(values);
            string odpowiedz = await Wyslij_formularz(url_sand_veryfikacja, new FormUrlEncodedContent(values));

            var slownik = odpowiedz.Split('&')
                          .Select(x => x.Split('='))
                          .ToDictionary(x => x[0], x => x[1]);

            if (slownik["error"] == "0")
            {
                Platnosc.Status             = Status.Potwierdzono;
                Platnosc.Data_potwierdzenia = DateTime.Now;
            }
            else
            {
                Platnosc.Status             = Status.Blad;
                Platnosc.Data_potwierdzenia = DateTime.Now;
                Platnosc.blad = odpowiedz;
            }
            _repo.Aktualizuj_Platnosc(Platnosc);
            _repo.SaveChanges();
        }