Esempio n. 1
0
        /// <summary>
        ///     Initializes the Content Type of the Request.
        /// </summary>
        /// <param name="initialParamList">Param List.</param>
        /// <remarks>
        ///     This method initializes the content type of the
        ///     parameter list in the member mContentType.
        ///     <para>Allowed content types are:</para>
        ///     <list type="table">
        ///         <listheader>
        ///             <term>Content Type</term>
        ///             <description>Expected Value</description>
        ///         </listheader>
        ///         <item>
        ///             <term>Name Value Pair</term>
        ///             <description>text/namevalue</description>
        ///         </item>
        ///         <item>
        ///             <term>XML Pay</term>
        ///             <description>text/xml</description>
        ///         </item>
        ///     </list>
        ///     <para>Maps to HTTP Header <code>CONTENT-TYPE</code></para>
        /// </remarks>
        private void InitializeContentType(string initialParamList)
        {
            Logger.Instance.Log("PayPal.Payments.Communication.PaymentState.InitializeContentType(String): Entered.",
                                PayflowConstants.SeverityDebug);

            if (initialParamList != null)
            {
                initialParamList = initialParamList.TrimStart(' ');
                var index = initialParamList.IndexOf(PayflowConstants.XmlId);
                if (index >= 0 && initialParamList.IndexOf("<") == 0)
                {
                    Connection.IsXmlPayRequest = true;
                    _mContentType      = PayflowConstants.XmlContentType;
                    _pfProXmlNameSpace = PayflowUtility.GetXmlNameSpace(initialParamList);
                }
                else
                {
                    Connection.IsXmlPayRequest = false;
                    _mContentType = PayflowConstants.NvContentType;
                }
            }

            Logger.Instance.Log(
                "PayPal.Payments.Communication.PaymentState.InitializeContentType(String): ContentType = " +
                _mContentType,
                PayflowConstants.SeverityInfo);
            Logger.Instance.Log("PayPal.Payments.Communication.PaymentState.InitializeContentType(String): Exiting.",
                                PayflowConstants.SeverityDebug);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the Content Type of the Request.
        /// </summary>
        /// <param name="InitialParamList">Param List.</param>
        /// <remarks>This method initializes the content type of the
        /// parameter list in the member mContentType.
        /// <para>Allowed content types are:</para>
        /// <list type="table">
        /// <listheader>
        /// <term>Content Type</term>
        /// <description>Expected Value</description>
        /// </listheader>
        /// <item>
        /// <term>Name Value Pair</term>
        /// <description>text/namevalue</description>
        /// </item>
        /// <item>
        /// <term>XML Pay</term>
        /// <description>text/xml</description>
        /// </item>
        /// </list>
        /// <para>Maps to HTTP Header <code>CONTENT-TYPE</code></para>
        /// </remarks>
        private void InitializeContentType(String InitialParamList)
        {
            Logger.Instance.Log("PayPal.Payments.Communication.PaymentState.InitializeContentType(String): Entered.",
                                PayflowConstants.SEVERITY_DEBUG);

            if (InitialParamList != null)
            {
                InitialParamList = InitialParamList.TrimStart(new char[1] {
                    ' '
                });
                int Index = InitialParamList.IndexOf(PayflowConstants.XML_ID);
                if (Index >= 0 && InitialParamList.IndexOf("<") == 0)
                {
                    mConnection.IsXmlPayRequest = true;
                    mContentType      = PayflowConstants.XML_CONTENT_TYPE;
                    PFProXmlNameSpace = PayflowUtility.GetXmlNameSpace(InitialParamList);
                }
                else
                {
                    mConnection.IsXmlPayRequest = false;
                    mContentType = PayflowConstants.NV_CONTENT_TYPE;
                }
            }
            Logger.Instance.Log("PayPal.Payments.Communication.PaymentState.InitializeContentType(String): ContentType = " + mContentType,
                                PayflowConstants.SEVERITY_INFO);
            Logger.Instance.Log("PayPal.Payments.Communication.PaymentState.InitializeContentType(String): Exiting.",
                                PayflowConstants.SEVERITY_DEBUG);
        }