/// <summary>
        /// Verifies IPN
        /// </summary>
        /// <param name="formString">Form string</param>
        /// <returns>
        /// A task that represents the asynchronous operation
        /// The task result contains the result, Values
        /// </returns>
        public async Task <(bool result, Dictionary <string, string> values)> VerifyIpnAsync(string formString)
        {
            var response = WebUtility.UrlDecode(await _PaytmHttpClient.VerifyIpnAsync(formString));
            var success  = response.Trim().Equals("VERIFIED", StringComparison.OrdinalIgnoreCase);

            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            foreach (var l in formString.Split('&'))
            {
                var line     = l.Trim();
                var equalPox = line.IndexOf('=');
                if (equalPox >= 0)
                {
                    values.Add(line[0..equalPox], line[(equalPox + 1)..]);
Ejemplo n.º 2
0
        /// <summary>
        /// Verifies IPN
        /// </summary>
        /// <param name="formString">Form string</param>
        /// <param name="values">Values</param>
        /// <returns>Result</returns>
        public bool VerifyIpn(string formString, out Dictionary <string, string> values)
        {
            var response = WebUtility.UrlDecode(_paytmHttpClient.VerifyIpnAsync(formString).Result);
            var success  = response.Trim().Equals("VERIFIED", StringComparison.OrdinalIgnoreCase);

            values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            foreach (var l in formString.Split('&'))
            {
                var line     = l.Trim();
                var equalPox = line.IndexOf('=');
                if (equalPox >= 0)
                {
                    values.Add(line.Substring(0, equalPox), line.Substring(equalPox + 1));
                }
            }

            return(success);
        }