예제 #1
0
        /// <summary>
        /// When overridden in a descendant class, serializes the object into XML according to Aadhaar API specification.
        /// </summary>
        /// <param name="name">The name of the element.</param>
        /// <returns>An instance of <see cref="XElement"/>.</returns>
        /// <exception cref="ArgumentNullException"><see cref="Uses"/> is null.</exception>
        protected override XElement SerializeXml(XName name)
        {
            ValidateNull(Uses, nameof(Uses));

            var authContext = base.SerializeXml(name);

            authContext.Add(new XAttribute("rc", AadhaarHelper.YesUpper),
                            Uses.ToXml("Uses"));

            if (AuthInfo != null)
            {
                authContext.Add(new XAttribute("info", AuthInfo.Encode()));
            }
            if (Token != null)
            {
                authContext.Add(Token.ToXml("Tkn"));
            }

            return(authContext);
        }