public override ValidatePostProcessRequestResult ValidatePostProcessRequest(NameValueCollection queryString)
        {
            var retVal = new ValidatePostProcessRequestResult();

            if (queryString.AllKeys.Contains("x_split_tender_id") || queryString.AllKeys.Contains("x_trans_id"))
            {
                retVal.OuterId = queryString["x_split_tender_id"] ?? queryString["x_trans_id"];
            }
            else
            {
                return(retVal);
            }

            if (queryString.AllKeys.Contains("x_invoice_num") &&
                queryString.AllKeys.Contains("x_auth_code") &&
                queryString.AllKeys.Contains("x_amount") &&
                queryString.AllKeys.Contains("x_response_code") &&
                queryString.AllKeys.Contains("x_response_reason_code") &&
                queryString.AllKeys.Contains("x_response_reason_text") &&
                queryString.AllKeys.Contains("x_method") &&
                queryString.AllKeys.Contains("x_MD5_Hash"))
            {
                var hashMD5 = GetMD5Hash(TxnKey + ApiLogin + retVal.OuterId + queryString["x_amount"]);
                if (!string.IsNullOrEmpty(queryString["x_MD5_Hash"]) && !string.IsNullOrEmpty(hashMD5) && string.Equals(hashMD5, queryString["x_MD5_Hash"], StringComparison.OrdinalIgnoreCase))
                {
                    retVal.IsSuccess = true;
                }
            }

            return(retVal);
        }
Exemplo n.º 2
0
        public override ValidatePostProcessRequestResult ValidatePostProcessRequest(NameValueCollection queryString)
        {
            var retVal = new ValidatePostProcessRequestResult();

            retVal.OuterId = queryString["transact"];

            //calculate hash by transaction id, currency code and amount
            var md5Hash = CalculateResponseMD5Hash(queryString["transact"], queryString["currency"], queryString["amount"]);

            //compare calculated hash with the passed in response authkey field
            retVal.IsSuccess = md5Hash.Equals(queryString["authkey"]);

            return(retVal);
        }
Exemplo n.º 3
0
        public override ValidatePostProcessRequestResult ValidatePostProcessRequest(NameValueCollection queryString)
        {
            var retVal = new ValidatePostProcessRequestResult();

            var klarnaOrderId = queryString["klarna_order_id"];
            var sid           = queryString["sid"];

            if (!string.IsNullOrEmpty(klarnaOrderId) && !string.IsNullOrEmpty(sid))
            {
                retVal.IsSuccess = true;
                retVal.OuterId   = klarnaOrderId;
            }

            return(retVal);
        }
Exemplo n.º 4
0
        public override ValidatePostProcessRequestResult ValidatePostProcessRequest(NameValueCollection queryString)
        {
            var retVal = new ValidatePostProcessRequestResult();

            var klarnaOrder = queryString["klarna_order"];
            var sid         = queryString["sid"];

            if (!string.IsNullOrEmpty(klarnaOrder) && !string.IsNullOrEmpty(sid))
            {
                var outerId = HttpUtility.UrlDecode(klarnaOrder).Split('/').LastOrDefault();
                if (!string.IsNullOrEmpty(outerId))
                {
                    retVal.IsSuccess = true;
                    retVal.OuterId   = outerId;
                }
            }

            return(retVal);
        }
        public override ValidatePostProcessRequestResult ValidatePostProcessRequest(NameValueCollection queryString)
        {
            var retVal = new ValidatePostProcessRequestResult();

            var cancel = queryString["cancel"];
            var token  = queryString["token"];

            if (!string.IsNullOrEmpty(cancel) && !string.IsNullOrEmpty(token))
            {
                bool cancelValue;
                if (bool.TryParse(cancel, out cancelValue))
                {
                    retVal.IsSuccess = !cancelValue;
                    retVal.OuterId   = token;
                }
            }

            return(retVal);
        }