예제 #1
0
        public static NameValueCollection CreatePostDataArray(TokenServiceCreateTokenRequest request, string secretKey)
        {
            NameValueCollection collection = new NameValueCollection();

            collection.Add("merchant", request.MERCHANT);
            collection.Add("refNo", request.REFNO);
            collection.Add("timestamp", request.TIMESTAMP);
            collection.Add("signature", CreateSignature(request, secretKey));
            return(collection);
        }
예제 #2
0
        public static string CreateSignature(TokenServiceCreateTokenRequest request, string secretKey)
        {
            string HASHED_CONTENT = string.Empty;
            var    hashString     = Helper.GetLengthAsByte(request.MERCHANT) + request.MERCHANT;

            hashString    += Helper.GetLengthAsByte(request.REFNO) + request.REFNO;
            hashString    += Helper.GetLengthAsByte(request.TIMESTAMP) + request.TIMESTAMP;
            HASHED_CONTENT = Helper.CreateSha256Hash(hashString, secretKey);
            return(HASHED_CONTENT);
        }
예제 #3
0
        public static string Execute(TokenServiceCreateTokenRequest request, Options options)
        {
            var nameValueCollection = CreatePostDataArray(request, options.SecretKey);

            return(HttpCaller.PostDataArrayReturnString(options.Url, nameValueCollection));
        }