示例#1
0
        /// <summary>
        ///     Parses response
        /// </summary>
        /// <param name="response">Response string</param>
        private void ParseResponse(string response)
        {
            //Pass a new context object to the validator. We do not mean to
            //validate request here. We just need to parse it and populate
            //the response hashtable.
            var respContext = new Context();

            //Check newly created context for fatal error. If the newly created
            //context has fatal error, it means that, there is a problem with the
            //message file. So we'll have manually assign the result,respmsg value.
            //Add following values in hashtable manually
            //RESULT=<Code for E_UNKNOWN_STATE>
            //RESPMSG=<Message for E_UNKNOWN_STATE>, <Response String>
            if (respContext.HighestErrorLvl == PayflowConstants.SeverityFatal)
            {
                var result  = PayflowUtility.LocateValueForName(response, PayflowConstants.ParamResult, false);
                var respMsg = PayflowUtility.LocateValueForName(response, PayflowConstants.ParamRespmsg, false);
                if (_mResponseHashTable == null)
                {
                    _mResponseHashTable = new Hashtable();
                }

                _mResponseHashTable.Add(PayflowConstants.IntlParamFullresponse, _mResponseString);
                _mResponseHashTable.Add(PayflowConstants.ParamResult, result);
                _mResponseHashTable.Add(PayflowConstants.ParamRespmsg, respMsg);
            }
            else
            {
                _mResponseHashTable = ParameterListValidator.ParseNvpList(response, ref respContext, true);
                respContext         = null;
                if (_mResponseHashTable != null)
                {
                    _mResponseHashTable.Add(PayflowConstants.IntlParamFullresponse, response);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Parses response
        /// </summary>
        /// <param name="Response">Response string</param>
        private void ParseResponse(String Response)
        {
            //Pass a new context object to the validator. We do not mean to
            //validate request here. We just need to parse it and populate
            //the response hashtable.
            Context RespContext = new Context();

            //Check newly created context for fatal error. If the newly created
            //context has fatal error, it means that, there is a problem with the
            //message file. So we'll have manually assign the result,respmsg value.
            //Add following values in hashtable manually
            //RESULT=<Code for E_UNKNOWN_STATE>
            //RESPMSG=<Message for E_UNKNOWN_STATE>, <Response String>
            if (RespContext.HighestErrorLvl == PayflowConstants.SEVERITY_FATAL)
            {
                String Result  = PayflowUtility.LocateValueForName(Response, PayflowConstants.PARAM_RESULT, false);
                String RespMsg = PayflowUtility.LocateValueForName(Response, PayflowConstants.PARAM_RESPMSG, false);
                if (mResponseHashTable == null)
                {
                    mResponseHashTable = new Hashtable();
                }

                mResponseHashTable.Add(PayflowConstants.INTL_PARAM_FULLRESPONSE, mResponseString);
                mResponseHashTable.Add(PayflowConstants.PARAM_RESULT, Result);
                mResponseHashTable.Add(PayflowConstants.PARAM_RESPMSG, RespMsg);
            }
            else
            {
                mResponseHashTable = ParameterListValidator.ParseNVPList(Response, ref RespContext, true);
                RespContext        = null;
                if (mResponseHashTable != null)
                {
                    mResponseHashTable.Add(PayflowConstants.INTL_PARAM_FULLRESPONSE, Response);
                }
            }
        }