Example #1
0
        private async Task <WsResult> SendSumm(string xmlPath, byte[] content)
        {
            var res = await _wsManager.SendSummary(xmlPath, content);

            var result = new WsResult
            {
                Success = res.Success
            };

            if (res.Success)
            {
                result.Code        = CodeStatus.EnviadoPorProcesar;
                result.Description = res.Ticket;
            }
            else
            {
                result.Code        = CodeStatus.ConErrores;
                result.Description = $"{res.Error.Code} - {res.Error.Description}";
            }
            return(result);
        }
Example #2
0
        private WsResult FromSunatResponse(SunatResponse response)
        {
            var res = new WsResult
            {
                Success = response.Success
            };

            if (res.Success)
            {
                var app = response.ApplicationResponse;
                res.Description   = app.Descripcion;
                res.ContentZipCdr = response.ContentZip;
                res.Code          = app.Codigo.Equals("0")
                    ? (app.Notas.Length == 0 ? CodeStatus.EnviadoAceptado : CodeStatus.EnviadoAceptadoConObs)
                    : CodeStatus.Rechazado;
            }
            else
            {
                res.Description = $"{response.Error.Code} - {response.Error.Description}";
                res.Code        = CodeStatus.ConErrores;
            }

            return(res);
        }