Esempio n. 1
0
        public ValidationParams GetValidEUParam(XDocument soapRes)
        {
            var nameTable = new NameTable();
            var nsManager = new XmlNamespaceManager(nameTable);

            nsManager.AddNamespace("x", "urn:ec.europa.eu:taxud:vies:services:checkVat:types");
            nsManager.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");

            var valParam = new ValidationParams()
            {
                valid   = (string)soapRes.XPathSelectElement("//soap:Body/x:checkVatResponse/x:valid", nsManager),
                name    = (string)soapRes.XPathSelectElement("//soap:Body/x:checkVatResponse/x:name", nsManager),
                address = (string)soapRes.XPathSelectElement("//soap:Body/x:checkVatResponse/x:address", nsManager),
                cCode   = (string)soapRes.XPathSelectElement("//soap:Body/x:checkVatResponse/x:countryCode", nsManager),
                vatNum  = (string)soapRes.XPathSelectElement("//soap:Body/x:checkVatResponse/x:vatNumber", nsManager)
            };

            return(valParam);
        }
        internal (string userResponse, bool foundError) ValidateVatInformation(string countryCode, string vatNumber, string clientName, string clientAddress, ValidationParams valParam, bool messageOnSuccess = true)
        {
            var  userResponse = string.Empty;
            bool foundError   = false;

            if (valParam.valid == "true")
            {