Beispiel #1
0
        public async Task <DocumentInformationResponse> GetDocument(DocumentInformationRequest request)
        {
            var accountInfo = _auth.GenerateSecurityInformation();

            request.AddAccountInfo(accountInfo);

            InfoDocumentoClient client = new InfoDocumentoClient();
            var result = await client.infoDocumentoXMLAsync(request.BuildRequest());

            return(_deserializer.Deserialize <DocumentInformationResponse>(result));
        }
        public void DocumentInformationRequest_Serialization()
        {
            IComponentSerializer       serializer = new XmlComponentSerializer();
            DocumentInformationRequest request    = new DocumentInformationRequest(serializer);

            AccountInfo accountInfo = new AccountInfo("user", "123", "yyyyMMddHHmmss");

            request.AddAccountInfo(accountInfo)
            .AddClientId(_settings.ClientId)
            .AddDocumentNumber("12345");

            var result = request.BuildRequest();

            string expectedResult = "<BODY><INFOCUENTA><USUARIO>user</USUARIO><CLAVE>123</CLAVE><FECHA>yyyyMMddHHmmss</FECHA></INFOCUENTA>" +
                                    "<DOCUMENTO><REGISTRO><CABECERA><ID_CLIENTE>" + _settings.ClientId + "</ID_CLIENTE><NUMERO_DOCUMENTO>12345</NUMERO_DOCUMENTO></CABECERA></REGISTRO></DOCUMENTO></BODY>";

            Assert.AreEqual(result, expectedResult);
        }