Beispiel #1
0
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// This method adds the passed error object in the array list contained by 
		/// the context object
		/// </summary>
		/// <param name="ErrObject">ErrorObject</param>
		/// <returns>Nothing</returns>
		/// <remarks>
		/// </remarks>
		/// -----------------------------------------------------------------------------
		internal void AddError(ErrorObject ErrObject)
		{
			if (mErrorObjects == null)
			{
				mErrorObjects = new ArrayList();
			}
			mErrorObjects.Insert(0,ErrObject);
			return;
		}
Beispiel #2
0
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// This method will check if the context contains a specific error message.This method 
		/// can be used for checking if the context is empty.
		/// </summary>
		///<param name="Error">Error Object</param>
		/// <returns>boolean value 'true' - If specific Error is present
		///			false in case of no errors.</returns>
		/// <remarks>
		/// </remarks>
		/// -----------------------------------------------------------------------------
		internal bool IsCommunicationErrorContained(ErrorObject Error)
		{
			if (IsErrorContained())
			{
				foreach (ErrorObject Err in mErrorObjects)
				{
					if (Err != null && Err.MessageCode.Equals(Error.MessageCode))
					{
						if (Err.MessageParams != null && Error.MessageParams != null)
						{
							if (Err.MessageParams[0].Equals(Error.MessageParams[0]))
							{
								return true;
							}
						}
						//return false;
					}
				}
				return false;
			}
			return false;
		}
Beispiel #3
0
        /// <summary>
        /// Parses FPS Xml String Data
        /// </summary>
        /// <param name="XmlData">Xml String Data</param>
        /// <returns>Rulelist</returns>
        private ArrayList ParseXmlData(String XmlData)
        {
            try
            {
                ArrayList   RuleList    = new ArrayList();
                XmlDocument FpsXmlRules = new XmlDocument();
                FpsXmlRules.LoadXml(XmlData);
                XmlNodeList RuleNodeList = FpsXmlRules.GetElementsByTagName(PayflowConstants.XML_PARAM_RULE);
                if (RuleNodeList != null && RuleNodeList.Count > 0)
                {
                    foreach (XmlNode RuleNode in RuleNodeList)
                    {
                        String TempValue;
                        Rule   FraudRule = new Rule();
                        TempValue = RuleNode.Attributes.GetNamedItem(PayflowConstants.XML_PARAM_NUM).Value;
                        if (TempValue != null)
                        {
                            FraudRule.Num = Int32.Parse(TempValue);
                        }
                        FraudRule.RuleId           = RuleNode.SelectSingleNode(PayflowConstants.XML_PARAM_RULEID).InnerText;
                        FraudRule.RuleAlias        = RuleNode.SelectSingleNode(PayflowConstants.XML_PARAM_RULEALIAS).InnerText;
                        FraudRule.RuleDescription  = RuleNode.SelectSingleNode(PayflowConstants.XML_PARAM_RULEDESCRIPTION).InnerText;
                        FraudRule.Action           = RuleNode.SelectSingleNode(PayflowConstants.XML_PARAM_ACTION).InnerText;
                        FraudRule.TriggeredMessage = RuleNode.SelectSingleNode(PayflowConstants.XML_PARAM_TRIGGEREDMESSAGE).InnerText;
                        XmlNode RuleVendorParamNode = RuleNode.SelectSingleNode(PayflowConstants.XML_PARAM_RULEVENDORPARMS);
                        if (RuleVendorParamNode != null)
                        {
                            XmlNodeList RuleParamList = RuleVendorParamNode.SelectNodes(PayflowConstants.XML_PARAM_RULEPARAMETER);
                            if (RuleParamList != null)
                            {
                                foreach (XmlNode RuleParamNode in RuleParamList)
                                {
                                    RuleParameter RuleParam = new RuleParameter();
                                    String        TempValue1;
                                    TempValue1 = RuleParamNode.Attributes.GetNamedItem(PayflowConstants.XML_PARAM_NUM).Value;
                                    if (TempValue1 != null)
                                    {
                                        RuleParam.Num = Int32.Parse(TempValue);
                                    }
                                    RuleParam.Name  = RuleParamNode.SelectSingleNode(PayflowConstants.XML_PARAM_NAME).InnerText;
                                    RuleParam.Type  = RuleParamNode.SelectSingleNode(PayflowConstants.XML_PARAM_VALUE).Attributes.GetNamedItem(PayflowConstants.XML_PARAM_TYPE).Value;
                                    RuleParam.Value = RuleParamNode.SelectSingleNode(PayflowConstants.XML_PARAM_VALUE).InnerText;
                                    FraudRule.RuleVendorParms.Add(RuleParam);
                                }
                            }
                        }
                        RuleList.Add(FraudRule);
                    }
                }

                return(RuleList);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception Ex)
            {
                ErrorObject         Error = new PayPal.Payments.Common.ErrorObject("Error While parsing XmlData", Ex.Message);
                DataObjectException DEx   = new DataObjectException(Error);
                throw DEx;
            }
            //catch
            //{
            //    ErrorObject Error = new PayPal.Payments.Common.ErrorObject("Error While parsing XmlData", "");
            //    DataObjectException DEx = new DataObjectException(Error);
            //    throw DEx;
            //}
        }