Beispiel #1
0
        public static string BuildTrData(Request request, string redirectURL, BraintreeService service)
        {
            var dateString = DateTime.Now.ToUniversalTime().ToString("yyyyMMddHHmmss");

            var trContent = new QueryString().
                Append("api_version", service.ApiVersion).
                Append("public_key", service.PublicKey).
                Append("redirect_url", redirectURL).
                Append("time", dateString).
                Append("kind", request.Kind()).
                ToString();

            string requestQueryString = request.ToQueryString();

            if (requestQueryString.Length > 0)
            {
                trContent += "&" + requestQueryString;
            }

            var signatureService = new SignatureService {
              Key = service.PrivateKey,
              Hasher = new Sha1Hasher()
            };
            return signatureService.Sign(trContent);
        }
        protected virtual QueryString AppendRequest(string parent, Request request)
        {
            if (request == null)
            {
                return this;
            }
            string requestQueryString = request.ToQueryString(parent);
            if (requestQueryString.Length > 0)
            {
                if (builder.Length > 0)
                {
                    builder.Append("&");
                }

                builder.Append(requestQueryString);
            }
            return this;
        }
Beispiel #3
0
        public static String BuildTrData(Request request, String redirectURL, BraintreeService service)
        {
            String dateString = DateTime.Now.ToUniversalTime().ToString("yyyyMMddHHmmss");

            String trContent = new QueryString().
                Append("api_version", service.ApiVersion).
                Append("public_key", service.PublicKey).
                Append("redirect_url", redirectURL).
                Append("time", dateString).
                Append("kind", request.Kind()).
                ToString();

            String requestQueryString = request.ToQueryString();

            if (requestQueryString.Length > 0)
            {
                trContent += "&" + requestQueryString;
            }

            String trHash = new Crypto().HmacHash(service.PrivateKey, trContent);
            return trHash + "|" + trContent;
        }
 public virtual string TrData(Request trData, string redirectURL)
 {
     return TrUtil.BuildTrData(trData, redirectURL, new BraintreeService(Configuration));
 }
 public string BuildTrData(Request request, string redirectURL)
 {
     return TrUtil.BuildTrData(request, redirectURL, service);
 }