Ejemplo n.º 1
0
        public string GenerateResponseForRequest(IPNRequest request)
        {
            var hash = string.Empty;
              var now = DateTime.Now.ToString("yyyyMMddHHmmss");
              var hashStr = new StringBuilder();

              if (request.Products.Length > 0) {
            AppendToHashString(hashStr, request.Products[0].Id);
            AppendToHashString(hashStr, request.Products[0].Name);
            AppendToHashString(hashStr, request.Date);
            AppendToHashString(hashStr, now);

            hash = hashStr.ToString().HashWithSignature(SignatureKey);
              }

              return string.Format("<{0}>{1}|{2}</{0}>", IPNRequest.ROOT_ELEMENT_NAME, now, hash);
        }
Ejemplo n.º 2
0
        public string GenerateResponseForRequest(IPNRequest request)
        {
            var hash    = string.Empty;
            var now     = DateTime.Now.ToString("yyyyMMddHHmmss");
            var hashStr = new StringBuilder();

            if (request.Products.Length > 0)
            {
                AppendToHashString(hashStr, request.Products[0].Id);
                AppendToHashString(hashStr, request.Products[0].Name);
                AppendToHashString(hashStr, request.Date);
                AppendToHashString(hashStr, now);

                hash = hashStr.ToString().HashWithSignature(SignatureKey);
            }

            return(string.Format("<{0}>{1}|{2}</{0}>", IPNRequest.ROOT_ELEMENT_NAME, now, hash));
        }
Ejemplo n.º 3
0
        public IPNRequest ParseRequest(NameValueCollection parameters)
        {
            var xmlStr = IPNRequest.ConvertRequestFormToXml(parameters);

            return(ParseRequest(xmlStr));
        }