├── Thumbs.db
├── CHANGELOG.md
├── OpenInvoicePeru
├── .idea
│ └── .idea.Open Invoice Peru UBL 2.1
│ │ └── .idea
│ │ ├── .name
│ │ ├── vcs.xml
│ │ ├── indexLayout.xml
│ │ ├── misc.xml
│ │ └── .gitignore
├── OpenInvoicePeru.WebApi
│ ├── Global.asax
│ ├── Global.asax.cs
│ ├── index.html
│ ├── Filters
│ │ └── ValidateModelAttribute.cs
│ ├── App_Start
│ │ ├── WebApiConfig.cs
│ │ └── UnityWebApiActivator.cs
│ ├── Utils
│ │ └── QrHelper.cs
│ ├── Web.Debug.config
│ ├── Web.Release.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Controllers
│ │ ├── FirmarController.cs
│ │ ├── GenerarRetencionController.cs
│ │ ├── GenerarPercepcionController.cs
│ │ ├── GenerarGuiaRemisionController.cs
│ │ ├── GenerarComunicacionBajaController.cs
│ │ ├── GenerarNotaDebitoController.cs
│ │ ├── GenerarNotaCreditoController.cs
│ │ ├── ConsultarTicketController.cs
│ │ ├── EnviarDocumentoController.cs
│ │ ├── GenerarFacturaController.cs
│ │ ├── ConsultarConstanciaController.cs
│ │ ├── EnviarResumenController.cs
│ │ └── GenerarResumenDiarioController.cs
│ └── packages.config
├── OpenInvoicePeru.Xml
│ ├── NotaDebitoXml.cs
│ ├── NotaCreditoXml.cs
│ ├── IDocumentoXml.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenInvoicePeru.ClienteConsola
│ ├── certificado.pfx
│ ├── OpenInvoicePeru.ClienteConsola.csproj
│ └── RestHelper.cs
├── OpenInvoicePeru.Comun.Dto
│ ├── Contratos
│ │ └── IDocumentoElectronico.cs
│ ├── packages.config
│ ├── Intercambio
│ │ ├── TokenResponse.cs
│ │ ├── EnviarResumenResponse.cs
│ │ ├── RespuestaComunConArchivo.cs
│ │ ├── DocumentoResponse.cs
│ │ ├── RespuestaComun.cs
│ │ ├── ConsultaTicketRequest.cs
│ │ ├── EnviarDocumentoRequest.cs
│ │ ├── CrearTokenRequest.cs
│ │ ├── FirmadoResponse.cs
│ │ ├── ConsultaConstanciaRequest.cs
│ │ ├── EnviarDocumentoResponse.cs
│ │ ├── ValidaComprobanteRequest.cs
│ │ ├── FirmadoRequest.cs
│ │ ├── ValidaComprobanteResponse.cs
│ │ └── EnvioDocumentoComun.cs
│ ├── Modelos
│ │ ├── Compania.cs
│ │ ├── ResumenDiario.cs
│ │ ├── ComunicacionBaja.cs
│ │ ├── ResumenDiarioNuevo.cs
│ │ ├── Anticipo.cs
│ │ ├── Leyenda.cs
│ │ ├── Direccion.cs
│ │ ├── DocumentoBaja.cs
│ │ ├── DatoCredito.cs
│ │ ├── DocumentoResumenDetalle.cs
│ │ ├── DocumentoRelacionado.cs
│ │ ├── ItemRetencion.cs
│ │ ├── ItemPercepcion.cs
│ │ ├── Discrepancia.cs
│ │ ├── Contribuyente.cs
│ │ ├── DocumentoResumen.cs
│ │ ├── Negocio.cs
│ │ ├── DetalleGuia.cs
│ │ ├── GrupoResumenNuevo.cs
│ │ ├── DocumentoSunatBase.cs
│ │ ├── DatoAdicional.cs
│ │ ├── DocumentoRetencion.cs
│ │ ├── DocumentoPercepcion.cs
│ │ ├── ItemSunatBase.cs
│ │ ├── GrupoResumen.cs
│ │ └── GuiaRemision.cs
│ ├── OpenInvoicePeru.UBL21.3.0.0.nuspec
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenInvoicePeru.Servicio
│ ├── IServicioSunat.cs
│ ├── DocumentoSunat.cs
│ ├── IServicioSunatConsultas.cs
│ ├── RespuestaAsincrono.cs
│ ├── DatosDocumento.cs
│ ├── ParametrosConexion.cs
│ ├── RespuestaSincrono.cs
│ ├── IServicioSunatDocumentos.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenInvoicePeru.Estructuras
│ ├── SunatAggregateComponents
│ │ ├── SunatTransaction.cs
│ │ ├── AdditionalProperty.cs
│ │ ├── SunatCosts.cs
│ │ ├── SunatRoadTransport.cs
│ │ ├── BillingPayment.cs
│ │ ├── SUNATRetentionInformation.cs
│ │ ├── AdditionalMonetaryTotal.cs
│ │ ├── SUNATRetentionDocumentReference.cs
│ │ ├── AdditionalInformation.cs
│ │ ├── SunatEmbededDespatchAdvice.cs
│ │ └── VoidedDocumentsLine.cs
│ ├── CommonAggregateComponents
│ │ ├── AddressLine.cs
│ │ ├── PartyName.cs
│ │ ├── Country.cs
│ │ ├── ExternalReference.cs
│ │ ├── SellersItemIdentification.cs
│ │ ├── StandardItemIdentification.cs
│ │ ├── PlannedPickupTransportEvent.cs
│ │ ├── CommodityClassification.cs
│ │ ├── DespatchAddress.cs
│ │ ├── Despatch.cs
│ │ ├── MeasurementDimension.cs
│ │ ├── TaxScheme.cs
│ │ ├── DeliveryTerms.cs
│ │ ├── UsabilityPeriod.cs
│ │ ├── Price.cs
│ │ ├── TransportEquipment.cs
│ │ ├── DespatchLineItem.cs
│ │ ├── ExchangeRate.cs
│ │ ├── DigitalSignatureAttachment.cs
│ │ ├── PartyIdentification.cs
│ │ ├── PartyLegalEntity.cs
│ │ ├── PricingReference.cs
│ │ ├── OrderReference.cs
│ │ ├── SignatoryParty.cs
│ │ ├── Payment.cs
│ │ ├── AlternativeConditionPrice.cs
│ │ ├── CarrierParty.cs
│ │ ├── AdditionalItemProperty.cs
│ │ ├── PartyTaxScheme.cs
│ │ ├── AccountingSupplierParty.cs
│ │ ├── DespatchLine.cs
│ │ ├── SignatureCac.cs
│ │ ├── TransportHandlingUnit.cs
│ │ ├── Party.cs
│ │ ├── PostalAddress.cs
│ │ ├── Delivery.cs
│ │ ├── AgentParty.cs
│ │ ├── CompanyId.cs
│ │ ├── AllowanceCharge.cs
│ │ ├── BillingReference.cs
│ │ ├── RegistrationAddress.cs
│ │ ├── TaxSubtotal.cs
│ │ ├── Consignment.cs
│ │ ├── ShipmentStage.cs
│ │ ├── TaxCategory.cs
│ │ ├── Item.cs
│ │ ├── DiscrepancyResponse.cs
│ │ ├── InvoiceDocumentReference.cs
│ │ ├── TaxTotal.cs
│ │ ├── LegalMonetaryTotal.cs
│ │ ├── InvoiceLine.cs
│ │ └── Shipment.cs
│ ├── EstandarUbl
│ │ └── InfoCredits.cs
│ ├── CommonBasicComponents
│ │ ├── OrderTypeCode.cs
│ │ ├── InvoicedQuantity.cs
│ │ ├── PayableAmount.cs
│ │ └── PartyIdentificationID.cs
│ ├── CommonExtensionComponents
│ │ ├── UBLExtension.cs
│ │ ├── ExtensionContent.cs
│ │ └── UBLExtensions.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenInvoicePeru.RestService
│ ├── packages.config
│ ├── ApiSunatDto
│ │ ├── BaseResponseDto.cs
│ │ ├── TokenResponseDto.cs
│ │ ├── ValidacionRequest.cs
│ │ └── ValidacionResponse.cs
│ ├── IValidezComprobanteHelper.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenInvoicePeru.Firmado
│ ├── ICertificador.cs
│ ├── ISerializador.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── OpenInvoicePeru.Firmado.csproj
├── OpenInvoicePeru.Comun
│ ├── IEstructuraXml.cs
│ ├── Constantes
│ │ ├── Formatos.cs
│ │ ├── EspacioNombres.cs
│ │ └── ValoresUbl.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── OpenInvoicePeru.Comun.csproj
├── Open Invoice Peru.sln.DotSettings
├── Open Invoice Peru UBL 2.1.sln.DotSettings
└── OpenInvoicePeru.Servicio.Soap
│ ├── Service References
│ ├── Consultas
│ │ ├── OpenInvoicePeru.Servicio.Soap.Consultas.statusResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Consultas.sendBillResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Consultas.sendPackResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Consultas.getStatusResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Consultas.sendSummaryResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Consultas.getStatusCdrResponse.datasource
│ │ ├── Reference.svcmap
│ │ └── configuration.svcinfo
│ ├── Documentos
│ │ ├── OpenInvoicePeru.Servicio.Soap.Documentos.statusResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Documentos.sendBillResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Documentos.sendPackResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Documentos.getStatusResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.Documentos.sendSummaryResponse.datasource
│ │ ├── Reference.svcmap
│ │ ├── billService1.wsdl
│ │ ├── billService.xsd
│ │ ├── configuration.svcinfo
│ │ └── billService.wsdl
│ └── ConsultasSunat
│ │ ├── OpenInvoicePeru.Servicio.Soap.ConsultasSunat.statusResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.ConsultasSunat.getStatusResponse.datasource
│ │ ├── OpenInvoicePeru.Servicio.Soap.ConsultasSunat.getStatusCdrResponse.datasource
│ │ ├── billConsultService1.wsdl
│ │ ├── billConsultService.wsdl
│ │ ├── configuration.svcinfo
│ │ ├── billConsultService.xsd
│ │ └── Reference.svcmap
│ ├── app.config
│ └── Properties
│ └── AssemblyInfo.cs
├── openinvoiceperulogo.PNG
├── OpenInvoicePeru-logo-small.png
└── README.md
/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erickorlando/openinvoiceperu/HEAD/Thumbs.db
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erickorlando/openinvoiceperu/HEAD/CHANGELOG.md
--------------------------------------------------------------------------------
/OpenInvoicePeru/.idea/.idea.Open Invoice Peru UBL 2.1/.idea/.name:
--------------------------------------------------------------------------------
1 | Open Invoice Peru UBL 2.1
--------------------------------------------------------------------------------
/openinvoiceperulogo.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erickorlando/openinvoiceperu/HEAD/openinvoiceperulogo.PNG
--------------------------------------------------------------------------------
/OpenInvoicePeru-logo-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erickorlando/openinvoiceperu/HEAD/OpenInvoicePeru-logo-small.png
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="OpenInvoicePeru.WebApi.WebApiApplication" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Xml/NotaDebitoXml.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erickorlando/openinvoiceperu/HEAD/OpenInvoicePeru/OpenInvoicePeru.Xml/NotaDebitoXml.cs
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Xml/NotaCreditoXml.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erickorlando/openinvoiceperu/HEAD/OpenInvoicePeru/OpenInvoicePeru.Xml/NotaCreditoXml.cs
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.ClienteConsola/certificado.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erickorlando/openinvoiceperu/HEAD/OpenInvoicePeru/OpenInvoicePeru.ClienteConsola/certificado.pfx
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Contratos/IDocumentoElectronico.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Contratos
2 | {
3 | public interface IDocumentoElectronico
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/IServicioSunat.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public interface IServicioSunat
4 | {
5 | void Inicializar(ParametrosConexion parametros);
6 | }
7 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/TokenResponse.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public class TokenResponse : RespuestaComun
4 | {
5 | public string AccessToken { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/SunatTransaction.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
2 | {
3 | public class SunatTransaction
4 | {
5 | public string Id { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/DocumentoSunat.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public class DocumentoSunat
4 | {
5 | public string TramaXml { get; set; }
6 | public string NombreArchivo { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/.idea/.idea.Open Invoice Peru UBL 2.1/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/EnviarResumenResponse.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public class EnviarResumenResponse : RespuestaComunConArchivo
4 | {
5 | public string NroTicket { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/RespuestaComunConArchivo.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public abstract class RespuestaComunConArchivo : RespuestaComun
4 | {
5 | public string NombreArchivo { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.RestService/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/IServicioSunatConsultas.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public interface IServicioSunatConsultas : IServicioSunat
4 | {
5 | RespuestaSincrono ConsultarConstanciaDeRecepcion(DatosDocumento request);
6 | }
7 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/.idea/.idea.Open Invoice Peru UBL 2.1/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/AddressLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class AddressLine
7 | {
8 | public string Line { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/PartyName.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class PartyName
7 | {
8 | public string Name { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/RespuestaAsincrono.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public class RespuestaAsincrono
4 | {
5 | public string NumeroTicket { get; set; }
6 | public bool Exito { get; set; }
7 | public string MensajeError { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/.idea/.idea.Open Invoice Peru UBL 2.1/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Country.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class Country
7 | {
8 | public string IdentificationCode { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Xml/IDocumentoXml.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun;
2 | using OpenInvoicePeru.Comun.Dto.Contratos;
3 |
4 | namespace OpenInvoicePeru.Xml
5 | {
6 | public interface IDocumentoXml
7 | {
8 | IEstructuraXml Generar(IDocumentoElectronico request);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/ExternalReference.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class ExternalReference
7 | {
8 | public string Uri { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Firmado/ICertificador.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using OpenInvoicePeru.Comun.Dto.Intercambio;
3 |
4 | namespace OpenInvoicePeru.Firmado
5 | {
6 | public interface ICertificador
7 | {
8 | Task FirmarXml(FirmadoRequest request);
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/EstandarUbl/InfoCredits.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Estructuras.EstandarUbl
2 | {
3 | public class InfoCredits
4 | {
5 | public int NroCuota { get; set; }
6 | public decimal MontoCuota { get; set; }
7 | public string FechaCredito { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.RestService/ApiSunatDto/BaseResponseDto.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.RestService.ApiSunatDto
2 | {
3 | public class BaseResponseDto
4 | {
5 | public T Result { get; set; }
6 | public bool Success { get; set; }
7 | public string ErrorMessage { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/Compania.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class Compania : Contribuyente
6 | {
7 | [JsonProperty(Order = 5)]
8 | [JsonRequired]
9 | public string CodigoAnexo { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/SellersItemIdentification.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class SellersItemIdentification
7 | {
8 | public string Id { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/StandardItemIdentification.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class StandardItemIdentification
7 | {
8 | public string Id { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/DocumentoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public class DocumentoResponse : RespuestaComun
4 | {
5 | public string TramaXmlSinFirma { get; set; }
6 |
7 | public string ValoresParaQr { get; set; }
8 |
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/PlannedPickupTransportEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class PlannedPickupTransportEvent
7 | {
8 | public string LocationId { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/RespuestaComun.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public abstract class RespuestaComun
4 | {
5 | public bool Exito { get; set; }
6 |
7 | public string MensajeError { get; set; }
8 |
9 | public string Pila { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/CommodityClassification.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class CommodityClassification
7 | {
8 | public string ItemClassificationCode { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonBasicComponents/OrderTypeCode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonBasicComponents
4 | {
5 | [Serializable]
6 | public class OrderTypeCode
7 | {
8 | public string Name { get; set; }
9 |
10 | public string Value { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/DatosDocumento.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public class DatosDocumento
4 | {
5 | public string RucEmisor { get; set; }
6 | public string TipoComprobante { get; set; }
7 | public string Serie { get; set; }
8 | public int Numero { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/ConsultaTicketRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
4 | {
5 | public class ConsultaTicketRequest : EnvioDocumentoComun
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string NroTicket { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/DespatchAddress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class DespatchAddress
7 | {
8 | public string Id { get; set; }
9 | public string AddressLine { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonBasicComponents/InvoicedQuantity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonBasicComponents
4 | {
5 | [Serializable]
6 | public class InvoicedQuantity
7 | {
8 | public string UnitCode { get; set; }
9 |
10 | public decimal Value { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonBasicComponents/PayableAmount.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonBasicComponents
4 | {
5 | [Serializable]
6 | public class PayableAmount
7 | {
8 | public string CurrencyId { get; set; }
9 |
10 | public decimal Value { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/ParametrosConexion.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public class ParametrosConexion
4 | {
5 | public string Ruc { get; set; }
6 | public string UserName { get; set; }
7 | public string Password { get; set; }
8 | public string EndPointUrl { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun/IEstructuraXml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Comun
4 | {
5 | public interface IEstructuraXml
6 | {
7 | string UblVersionId { get; set; }
8 | string CustomizationId { get; set; }
9 | string Id { get; set; }
10 | IFormatProvider Formato { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonBasicComponents/PartyIdentificationID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonBasicComponents
4 | {
5 | [Serializable]
6 | public class PartyIdentificationId
7 | {
8 | public string SchemeId { get; set; }
9 |
10 | public string Value { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System.Web.Http;
2 |
3 | namespace OpenInvoicePeru.WebApi
4 | {
5 | public class WebApiApplication : System.Web.HttpApplication
6 | {
7 | protected void Application_Start()
8 | {
9 | GlobalConfiguration.Configure(WebApiConfig.Register);
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Despatch.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class Despatch
7 | {
8 | public DespatchAddress DespatchAddress { get; set; }
9 | public string Instructions { get; set; }
10 |
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/EnviarDocumentoRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
4 | {
5 | public class EnviarDocumentoRequest : EnvioDocumentoComun
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string TramaXmlFirmado { get; set; }
9 |
10 | }
11 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/ResumenDiario.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Comun.Dto.Modelos
5 | {
6 | public class ResumenDiario : DocumentoResumen
7 | {
8 | [JsonProperty(Required = Required.Always)]
9 | public List Resumenes { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/RespuestaSincrono.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public class RespuestaSincrono
4 | {
5 | public string ConstanciaDeRecepcion { get; set; }
6 | public bool Exito { get; set; }
7 | public string MensajeError { get; set; }
8 | public string CodigoRetorno { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/ComunicacionBaja.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Comun.Dto.Modelos
5 | {
6 | public class ComunicacionBaja : DocumentoResumen
7 | {
8 | [JsonProperty(Required = Required.Always)]
9 | public List Bajas { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/MeasurementDimension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class MeasurementDimension
7 | {
8 | public string AttributeId { get; set; }
9 | public decimal Measure { get; set; }
10 |
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/ResumenDiarioNuevo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Comun.Dto.Modelos
5 | {
6 | public class ResumenDiarioNuevo : DocumentoResumen
7 | {
8 | [JsonProperty(Required = Required.Always)]
9 | public List Resumenes { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/CrearTokenRequest.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
4 | {
5 | public class CrearTokenRequest
6 | {
7 | [Required]
8 | public string ClientId { get; set; }
9 |
10 | [Required]
11 | public string ClientSecret { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/Anticipo.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Modelos
2 | {
3 | public class Anticipo
4 | {
5 | public string TipoDocAnticipo { get; set; }
6 |
7 | public string DocAnticipo { get; set; }
8 |
9 | public string MonedaAnticipo { get; set; }
10 |
11 | public decimal MontoAnticipo { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/IServicioSunatDocumentos.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Servicio
2 | {
3 | public interface IServicioSunatDocumentos : IServicioSunat
4 | {
5 | RespuestaSincrono EnviarDocumento(DocumentoSunat request);
6 | RespuestaAsincrono EnviarResumen(DocumentoSunat request);
7 | RespuestaSincrono ConsultarTicket(string numeroTicket);
8 | }
9 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/TaxScheme.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class TaxScheme
7 | {
8 | public string Id { get; set; }
9 |
10 | public string Name { get; set; }
11 |
12 | public string TaxTypeCode { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/Leyenda.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class Leyenda
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string Codigo { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string Descripcion { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/AdditionalProperty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
4 | {
5 | [Serializable]
6 | public class AdditionalProperty
7 | {
8 | public string Id { get; set; }
9 |
10 | public string Name { get; set; }
11 |
12 | public string Value { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/.idea/.idea.Open Invoice Peru UBL 2.1/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /modules.xml
6 | /.idea.Open Invoice Peru UBL 2.1.iml
7 | /contentModel.xml
8 | /projectSettingsUpdater.xml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/Direccion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class Direccion
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string Ubigeo { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string DireccionCompleta { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/DeliveryTerms.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class DeliveryTerms
8 | {
9 | public string Id { get; set; }
10 | public PayableAmount Amount { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/UsabilityPeriod.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class UsabilityPeriod
7 | {
8 | public string StartDate { get; set; }
9 |
10 | public string EndDate { get; set; }
11 |
12 | public int DurationMeasure { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/FirmadoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public class FirmadoResponse : RespuestaComun
4 | {
5 | public string TramaXmlFirmado { get; set; }
6 |
7 | public string ResumenFirma { get; set; }
8 |
9 | public string ValorFirma { get; set; }
10 |
11 | public string CodigoQr { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/SunatCosts.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
4 | {
5 | [Serializable]
6 | public class SunatCosts
7 | {
8 | public SunatRoadTransport RoadTransport { get; set; }
9 |
10 | public SunatCosts()
11 | {
12 | RoadTransport = new SunatRoadTransport();
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.RestService/IValidezComprobanteHelper.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.RestService.ApiSunatDto;
2 |
3 | namespace OpenInvoicePeru.RestService
4 | {
5 | public interface IValidezComprobanteHelper
6 | {
7 | BaseResponseDto GenerarToken(string clientId, string clientSecret);
8 | ValidacionResponse Validar(string rucReceptor, string token, ValidacionRequest request);
9 | }
10 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DocumentoBaja.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class DocumentoBaja : DocumentoResumenDetalle
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string Correlativo { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string MotivoBaja { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonExtensionComponents/UBLExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonExtensionComponents
4 | {
5 | [Serializable]
6 | public class UblExtension
7 | {
8 | public ExtensionContent ExtensionContent { get; set; }
9 |
10 | public UblExtension()
11 | {
12 | ExtensionContent = new ExtensionContent();
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/SunatRoadTransport.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
4 | {
5 | [Serializable]
6 | public class SunatRoadTransport
7 | {
8 | public string LicensePlateId { get; set; }
9 |
10 | public string TransportAuthorizationCode { get; set; }
11 |
12 | public string BrandName { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/ConsultaConstanciaRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
4 | {
5 | public class ConsultaConstanciaRequest : EnvioDocumentoComun
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string Serie { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public int Numero { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | OpenInvoicePeru
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Price.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class Price
8 | {
9 | public PayableAmount PriceAmount { get; set; }
10 |
11 | public Price()
12 | {
13 | PriceAmount = new PayableAmount();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DatoCredito.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class DatoCredito
6 | {
7 | public int NroCuota { get; set; }
8 | public decimal MontoCuota { get; set; }
9 | public string FechaCredito { get; set; }
10 |
11 | public DatoCredito()
12 | {
13 | FechaCredito = DateTime.Today.ToString("yyyy-MM-dd");
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/TransportEquipment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class TransportEquipment
7 | {
8 | public string Id { get; set; }
9 | public string SizeTypeCode { get; set; }
10 |
11 | public Delivery Delivery { get; set; }
12 | public bool ReturnabilityIndicator { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/EnviarDocumentoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public class EnviarDocumentoResponse : RespuestaComunConArchivo
4 | {
5 | public string CodigoRespuesta { get; set; }
6 |
7 | public string MensajeRespuesta { get; set; }
8 |
9 | public string TramaZipCdr { get; set; }
10 |
11 | public string NroTicketCdr { get; set; }
12 |
13 | }
14 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/DespatchLineItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class DespatchLineItem
7 | {
8 | public string Description { get; set; }
9 |
10 | ///
11 | /// cac:SellersItemIdentification/cbc:ID
12 | ///
13 | public string SellersIdentificationId { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/ExchangeRate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class ExchangeRate
7 | {
8 | public string SourceCurrencyCode { get; set; }
9 |
10 | public string TargetCurrencyCode { get; set; }
11 |
12 | public decimal CalculationRate { get; set; }
13 |
14 | public string Date { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/DigitalSignatureAttachment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class DigitalSignatureAttachment
7 | {
8 | public ExternalReference ExternalReference { get; set; }
9 |
10 | public DigitalSignatureAttachment()
11 | {
12 | ExternalReference = new ExternalReference();
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/Open Invoice Peru.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/PartyIdentification.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class PartyIdentification
8 | {
9 | public PartyIdentificationId Id { get; set; }
10 |
11 | public PartyIdentification()
12 | {
13 | Id = new PartyIdentificationId();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/Open Invoice Peru UBL 2.1.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/PartyLegalEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class PartyLegalEntity
7 | {
8 | public string RegistrationName { get; set; }
9 | public RegistrationAddress RegistrationAddress { get; set; }
10 |
11 | public PartyLegalEntity()
12 | {
13 | RegistrationAddress = new RegistrationAddress();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Firmado/ISerializador.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using OpenInvoicePeru.Comun;
3 | using OpenInvoicePeru.Comun.Dto.Intercambio;
4 |
5 | namespace OpenInvoicePeru.Firmado
6 | {
7 | public interface ISerializador
8 | {
9 | Task GenerarXml(T objectToSerialize) where T : IEstructuraXml;
10 | Task GenerarZip(string tramaXml, string nombreArchivo);
11 | Task GenerarDocumentoRespuesta(string constanciaRecepcion);
12 | }
13 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DocumentoResumenDetalle.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public abstract class DocumentoResumenDetalle
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public int Id { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string TipoDocumento { get; set; }
12 |
13 | [JsonProperty(Required = Required.Always)]
14 | public string Serie { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonExtensionComponents/ExtensionContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.SunatAggregateComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonExtensionComponents
5 | {
6 | [Serializable]
7 | public class ExtensionContent
8 | {
9 | public AdditionalInformation AdditionalInformation { get; set; }
10 |
11 | public ExtensionContent()
12 | {
13 | AdditionalInformation = new AdditionalInformation();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonExtensionComponents/UBLExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonExtensionComponents
4 | {
5 | [Serializable]
6 | public class UblExtensions
7 | {
8 | public UblExtension Extension1 { get; set; }
9 |
10 | public UblExtension Extension2 { get; set; }
11 |
12 | public UblExtensions()
13 | {
14 | Extension1 = new UblExtension();
15 | Extension2 = new UblExtension();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/PricingReference.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class PricingReference
8 | {
9 | public List AlternativeConditionPrices { get; set; }
10 |
11 | public PricingReference()
12 | {
13 | AlternativeConditionPrices = new List();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.RestService/ApiSunatDto/TokenResponseDto.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.RestService.ApiSunatDto
4 | {
5 | public class TokenResponseDto
6 | {
7 | [JsonProperty(PropertyName = "access_token")]
8 | public string AccessToken { get; set; }
9 |
10 | [JsonProperty(PropertyName = "token_type")]
11 | public string TokenType { get; set; }
12 |
13 | [JsonProperty(PropertyName = "expires_in")]
14 | public int Expires { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/OrderReference.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class OrderReference
8 | {
9 | public string Id { get; set; }
10 |
11 | public OrderTypeCode OrderTypeCode { get; set; }
12 |
13 | public OrderReference()
14 | {
15 | OrderTypeCode = new OrderTypeCode();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/SignatoryParty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class SignatoryParty
7 | {
8 | public PartyIdentification PartyIdentification { get; set; }
9 |
10 | public PartyName PartyName { get; set; }
11 |
12 | public SignatoryParty()
13 | {
14 | PartyIdentification = new PartyIdentification();
15 | PartyName = new PartyName();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Payment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class Payment
8 | {
9 | public string PaidDate { get; set; }
10 |
11 | public int IdPayment { get; set; }
12 |
13 | public PayableAmount PaidAmount { get; set; }
14 |
15 | public Payment()
16 | {
17 | PaidAmount = new PayableAmount();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/AlternativeConditionPrice.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class AlternativeConditionPrice
8 | {
9 | public PayableAmount PriceAmount { get; set; }
10 |
11 | public string PriceTypeCode { get; set; }
12 |
13 | public AlternativeConditionPrice()
14 | {
15 | PriceAmount = new PayableAmount();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/CarrierParty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class CarrierParty
7 | {
8 | public PartyIdentification PartyIdentification { get; set; }
9 |
10 | public PartyLegalEntity PartyLegalEntity { get; set; }
11 |
12 | public CarrierParty()
13 | {
14 | PartyIdentification = new PartyIdentification();
15 | PartyLegalEntity = new PartyLegalEntity();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DocumentoRelacionado.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class DocumentoRelacionado
6 | {
7 | [JsonProperty(Order = 1, Required = Required.Always)]
8 | public string NroDocumento { get; set; }
9 |
10 | [JsonProperty(Order = 2, Required = Required.Always)]
11 | public string TipoDocumento { get; set; }
12 |
13 | [JsonProperty(Order = 3, Required = Required.AllowNull)]
14 | public string DescripcionTipoDocumento { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/ItemRetencion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class ItemRetencion : ItemSunatBase
6 | {
7 | [JsonProperty(Order = 8, Required = Required.Always)]
8 | public decimal ImporteSinRetencion { get; set; }
9 |
10 | [JsonProperty(Order = 10, Required = Required.Always)]
11 | public decimal ImporteRetenido { get; set; }
12 |
13 | [JsonProperty(Order = 11, Required = Required.Always)]
14 | public string FechaRetencion { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/ItemPercepcion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class ItemPercepcion : ItemSunatBase
6 | {
7 | [JsonProperty(Order = 8, Required = Required.Always)]
8 | public decimal ImporteSinPercepcion { get; set; }
9 |
10 | [JsonProperty(Order = 10, Required = Required.Always)]
11 | public decimal ImportePercibido { get; set; }
12 |
13 | [JsonProperty(Order = 11, Required = Required.Always)]
14 | public string FechaPercepcion { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/Discrepancia.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using Newtonsoft.Json;
3 |
4 | namespace OpenInvoicePeru.Comun.Dto.Modelos
5 | {
6 | public class Discrepancia
7 | {
8 | [JsonProperty(Required = Required.Always)]
9 | public string NroReferencia { get; set; }
10 |
11 | [JsonProperty(Required = Required.Always)]
12 | public string Tipo { get; set; }
13 |
14 | [JsonProperty(Required = Required.Always)]
15 | [StringLength(500)]
16 | public string Descripcion { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun/Constantes/Formatos.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Constantes
2 | {
3 | public static class Formatos
4 | {
5 | public const string FormatoFecha = "yyyy-MM-dd";
6 | public const string FormatoHora = "HH:mm:ss";
7 | public const string FormatoNumerico = "###0.#0";
8 | public const string FormatoNumericoExtenso = "###0.#######0";
9 | public const string EncodingIso = "UTF-8";
10 | public const string FaultCode = "";
11 | public const string Cultura = "es-PE";
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/AdditionalItemProperty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class AdditionalItemProperty
7 | {
8 | public string Name { get; set; }
9 |
10 | public string NameCode { get; set; }
11 |
12 | public string Value { get; set; }
13 |
14 | public UsabilityPeriod UsabilityPeriod { get; set; }
15 |
16 | public AdditionalItemProperty()
17 | {
18 | UsabilityPeriod = new UsabilityPeriod();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/PartyTaxScheme.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class PartyTaxScheme
7 | {
8 | public string RegistrationName { get; set; }
9 |
10 | public CompanyId CompanyId { get; set; }
11 |
12 | public RegistrationAddress RegistrationAddress { get; set; }
13 |
14 | public PartyTaxScheme()
15 | {
16 | CompanyId = new CompanyId();
17 | RegistrationAddress = new RegistrationAddress();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/AccountingSupplierParty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class AccountingSupplierParty
7 | {
8 | public Party Party { get; set; }
9 |
10 | public PartyTaxScheme PartyTaxScheme { get; set; }
11 |
12 | public string CustomerAssignedAccountId { get; set; }
13 |
14 | public string AdditionalAccountId { get; set; }
15 |
16 | public AccountingSupplierParty()
17 | {
18 | Party = new Party();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/ValidaComprobanteRequest.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
2 | {
3 | public class ValidaComprobanteRequest
4 | {
5 | public string RucEmisor { get; set; }
6 |
7 | public string RucReceptor { get; set; }
8 |
9 | public string TipoComprobante { get; set; }
10 |
11 | public string NumeroSerie { get; set; }
12 |
13 | public int Numero { get; set; }
14 |
15 | public string FechaEmision { get; set; }
16 |
17 | public decimal Monto { get; set; }
18 |
19 | public string Token { get; set; }
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/DespatchLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class DespatchLine
8 | {
9 | public int Id { get; set; }
10 |
11 | public InvoicedQuantity DeliveredQuantity { get; set; }
12 |
13 | ///
14 | /// cac:OrderLineReference/cbc:LineID
15 | ///
16 | public int OrderLineReferenceId { get; set; }
17 |
18 | public DespatchLineItem Item { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/SignatureCac.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class SignatureCac
7 | {
8 | public string Id { get; set; }
9 |
10 | public SignatoryParty SignatoryParty { get; set; }
11 |
12 | public DigitalSignatureAttachment DigitalSignatureAttachment { get; set; }
13 |
14 | public SignatureCac()
15 | {
16 | SignatoryParty = new SignatoryParty();
17 | DigitalSignatureAttachment = new DigitalSignatureAttachment();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/BillingPayment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
5 | {
6 | [Serializable]
7 | public class BillingPayment
8 | {
9 | public PartyIdentificationId Id { get; set; }
10 |
11 | public PayableAmount PaidAmount { get; set; }
12 |
13 | public string InstructionId { get; set; }
14 |
15 | public BillingPayment()
16 | {
17 | PaidAmount = new PayableAmount();
18 | Id = new PartyIdentificationId();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/TransportHandlingUnit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class TransportHandlingUnit
8 | {
9 | public string Id { get; set; }
10 |
11 | public List TransportEquipments { get; set; }
12 |
13 | public List MeasurementDimensions { get; set; }
14 |
15 | public TransportHandlingUnit()
16 | {
17 | TransportEquipments = new List();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/Contribuyente.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class Contribuyente
6 | {
7 |
8 | [JsonProperty(Order = 1, Required = Required.Always)]
9 | public string NroDocumento { get; set; }
10 |
11 | [JsonProperty(Order = 2, Required = Required.Always)]
12 | public string TipoDocumento { get; set; }
13 |
14 | [JsonProperty(Order = 3, Required = Required.Always)]
15 | public string NombreLegal { get; set; }
16 |
17 | [JsonProperty(Order = 4)]
18 | public string NombreComercial { get; set; }
19 |
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/FirmadoRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
4 | {
5 | public class FirmadoRequest
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string CertificadoDigital { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string PasswordCertificado { get; set; }
12 |
13 | [JsonProperty(Required = Required.Always)]
14 | public string TramaXmlSinFirma { get; set; }
15 |
16 | [JsonProperty(Required = Required.AllowNull)]
17 | public string ValoresQr { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/ValidaComprobanteResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
5 | {
6 | public class ValidaComprobanteResponse : RespuestaComun
7 | {
8 | public string CodigoEstadoComprobante { get; set; }
9 | public string CodigoEstadoRuc { get; set; }
10 | public string CodigoEstadoDomicilio { get; set; }
11 | public string Observaciones { get; set; }
12 |
13 | public string EstadoComprobante { get; set; }
14 | public string EstadoRuc { get; set; }
15 | public string EstadoDomicilio { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Filters/ValidateModelAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using System.Net.Http;
3 | using System.Web.Http.Controllers;
4 | using System.Web.Http.Filters;
5 |
6 | namespace OpenInvoicePeru.WebApi.Filters
7 | {
8 | public class ValidateModelAttribute : ActionFilterAttribute
9 | {
10 | public override void OnActionExecuting(HttpActionContext actionContext)
11 | {
12 | if (actionContext.ModelState.IsValid == false)
13 | {
14 | actionContext.Response = actionContext.Request.CreateErrorResponse(
15 | HttpStatusCode.BadRequest, actionContext.ModelState);
16 | }
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Party.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class Party
7 | {
8 | public PartyName PartyName { get; set; }
9 |
10 | public PostalAddress PostalAddress { get; set; }
11 |
12 | public PartyLegalEntity PartyLegalEntity { get; set; }
13 |
14 | public PartyIdentification PartyIdentification { get; set; }
15 |
16 | public Party()
17 | {
18 | PartyName = new PartyName();
19 | PostalAddress = new PostalAddress();
20 | PartyLegalEntity = new PartyLegalEntity();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DocumentoResumen.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | using OpenInvoicePeru.Comun.Dto.Contratos;
4 |
5 | namespace OpenInvoicePeru.Comun.Dto.Modelos
6 | {
7 | public abstract class DocumentoResumen : IDocumentoElectronico
8 | {
9 | [JsonProperty(Required = Required.Always)]
10 | public string IdDocumento { get; set; }
11 |
12 | [JsonProperty(Required = Required.Always)]
13 | public string FechaEmision { get; set; }
14 |
15 | [JsonProperty(Required = Required.Always)]
16 | public string FechaReferencia { get; set; }
17 |
18 | [JsonProperty(Required = Required.Always)]
19 | public Contribuyente Emisor { get; set; }
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/PostalAddress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class PostalAddress
7 | {
8 | public string Id { get; set; }
9 |
10 | public string StreetName { get; set; }
11 |
12 | public string CitySubdivisionName { get; set; }
13 |
14 | public string CityName { get; set; }
15 |
16 | public string CountrySubentity { get; set; }
17 |
18 | public string District { get; set; }
19 |
20 | public Country Country { get; set; }
21 |
22 | public PostalAddress()
23 | {
24 | Country = new Country();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/Negocio.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class Negocio : Contribuyente
6 | {
7 | [JsonProperty(Order = 6)]
8 | public string Ubigeo { get; set; }
9 |
10 | [JsonProperty(Order = 7)]
11 | public string Direccion { get; set; }
12 |
13 | [JsonProperty(Order = 8)]
14 | public string Urbanizacion { get; set; }
15 |
16 | [JsonProperty(Order = 9)]
17 | public string Departamento { get; set; }
18 |
19 | [JsonProperty(Order = 10)]
20 | public string Provincia { get; set; }
21 |
22 | [JsonProperty(Order = 11)]
23 | public string Distrito { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Delivery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class Delivery
8 | {
9 | public Despatch Despatch { get; set; }
10 | public Despatch DeliveryLocation { get; set; }
11 | public List DeliveryTerms { get; set; }
12 | public Shipment Shipment { get; set; }
13 |
14 | public Delivery()
15 | {
16 | Despatch = new Despatch();
17 | DeliveryLocation = new Despatch();
18 | DeliveryTerms = new List();
19 | Shipment = new Shipment();
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.ClienteConsola/OpenInvoicePeru.ClienteConsola.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | PreserveNewest
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DetalleGuia.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class DetalleGuia
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public int Correlativo { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string CodigoItem { get; set; }
12 |
13 | [JsonProperty(Required = Required.Always)]
14 | public string Descripcion { get; set; }
15 |
16 | [JsonProperty(Required = Required.Always)]
17 | public string UnidadMedida { get; set; }
18 |
19 | [JsonProperty(Required = Required.Always)]
20 | public decimal Cantidad { get; set; }
21 |
22 | public int LineaReferencia { get; set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/AgentParty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class AgentParty
7 | {
8 | public PartyIdentification PartyIdentification { get; set; }
9 |
10 | public PartyName PartyName { get; set; }
11 |
12 | public PostalAddress PostalAddress { get; set; }
13 |
14 | public PartyLegalEntity PartyLegalEntity { get; set; }
15 |
16 | public AgentParty()
17 | {
18 | PartyIdentification = new PartyIdentification();
19 | PartyName = new PartyName();
20 | PostalAddress = new PostalAddress();
21 | PartyLegalEntity = new PartyLegalEntity();
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/OpenInvoicePeru.Servicio.Soap.Consultas.statusResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Consultas.statusResponse, Service References.Consultas.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/CompanyId.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Comun.Constantes;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class CompanyId
8 | {
9 | public string SchemeId { get; set; }
10 |
11 | public string SchemeName { get; set; }
12 |
13 | public string SchemeAgencyName { get; set; }
14 |
15 | public string SchemeUri { get; set; }
16 |
17 | public string Value { get; set; }
18 |
19 | public CompanyId()
20 | {
21 | SchemeName = ValoresUbl.CompanySchemeName;
22 | SchemeAgencyName = ValoresUbl.SchemeAgencyName;
23 | SchemeUri = ValoresUbl.CompanySchemeUri;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/OpenInvoicePeru.Servicio.Soap.Consultas.sendBillResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Consultas.sendBillResponse, Service References.Consultas.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/OpenInvoicePeru.Servicio.Soap.Consultas.sendPackResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Consultas.sendPackResponse, Service References.Consultas.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/OpenInvoicePeru.Servicio.Soap.Documentos.statusResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Documentos.statusResponse, Service References.Documentos.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/OpenInvoicePeru.Servicio.Soap.Consultas.getStatusResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Consultas.getStatusResponse, Service References.Consultas.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/OpenInvoicePeru.Servicio.Soap.Documentos.sendBillResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Documentos.sendBillResponse, Service References.Documentos.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/OpenInvoicePeru.Servicio.Soap.Documentos.sendPackResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Documentos.sendPackResponse, Service References.Documentos.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/OpenInvoicePeru.Servicio.Soap.Consultas.sendSummaryResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Consultas.sendSummaryResponse, Service References.Consultas.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/OpenInvoicePeru.Servicio.Soap.Documentos.getStatusResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Documentos.getStatusResponse, Service References.Documentos.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/GrupoResumenNuevo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class GrupoResumenNuevo : GrupoResumen
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string IdDocumento { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string TipoDocumentoReceptor { get; set; }
12 |
13 | [JsonProperty(Required = Required.Always)]
14 | public string NroDocumentoReceptor { get; set; }
15 |
16 | [JsonProperty(Required = Required.Always)]
17 | public int CodigoEstadoItem { get; set; }
18 |
19 | public string DocumentoRelacionado { get; set; }
20 |
21 | public string TipoDocumentoRelacionado { get; set; }
22 | }
23 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/AllowanceCharge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class AllowanceCharge
8 | {
9 | public bool ChargeIndicator { get; set; }
10 |
11 | public PayableAmount Amount { get; set; }
12 |
13 | public string ReasonCode { get; set; }
14 |
15 | public decimal MultiplierFactorNumeric { get; set; }
16 |
17 | public PayableAmount BaseAmount { get; set; }
18 |
19 | public AllowanceCharge()
20 | {
21 | Amount = new PayableAmount();
22 | BaseAmount = new PayableAmount();
23 | ReasonCode = "00";
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/OpenInvoicePeru.Servicio.Soap.Consultas.getStatusCdrResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Consultas.getStatusCdrResponse, Service References.Consultas.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/OpenInvoicePeru.Servicio.Soap.ConsultasSunat.statusResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.ConsultasSunat.statusResponse, Service References.ConsultasSunat.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/OpenInvoicePeru.Servicio.Soap.Documentos.sendSummaryResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.Documentos.sendSummaryResponse, Service References.Documentos.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/OpenInvoicePeru.Servicio.Soap.ConsultasSunat.getStatusResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.ConsultasSunat.getStatusResponse, Service References.ConsultasSunat.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/BillingReference.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class BillingReference : IEquatable
7 | {
8 | public InvoiceDocumentReference InvoiceDocumentReference { get; set; }
9 |
10 | public BillingReference()
11 | {
12 | InvoiceDocumentReference = new InvoiceDocumentReference();
13 | }
14 |
15 | public bool Equals(BillingReference other)
16 | {
17 | return InvoiceDocumentReference.Equals(other.InvoiceDocumentReference);
18 | }
19 |
20 | public override int GetHashCode()
21 | {
22 | return InvoiceDocumentReference.GetHashCode();
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/OpenInvoicePeru.Servicio.Soap.ConsultasSunat.getStatusCdrResponse.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | OpenInvoicePeru.Servicio.Soap.ConsultasSunat.getStatusCdrResponse, Service References.ConsultasSunat.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.ClienteConsola/RestHelper.cs:
--------------------------------------------------------------------------------
1 | using RestSharp;
2 |
3 | namespace OpenInvoicePeru.ClienteConsola
4 | {
5 | public static class RestHelper
6 | where TRequest : class
7 | where TResponse : class, new()
8 | {
9 | public static TResponse Execute(string metodo, TRequest request)
10 | {
11 | var client = new RestClient("http://localhost/OpenInvoicePeru/api");
12 |
13 | var restRequest = new RestRequest(metodo, Method.POST)
14 | {
15 | RequestFormat = DataFormat.Json
16 | };
17 |
18 | restRequest.AddJsonBody(request);
19 |
20 | var restResponse = client.Execute(restRequest);
21 | return restResponse.Data;
22 | }
23 |
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/RegistrationAddress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class RegistrationAddress
7 | {
8 | public string AddressTypeCode { get; set; }
9 | public AddressLine AddressLine { get; set; }
10 | public string CitySubdivisionName { get; set; }
11 | public string CityName { get; set; }
12 | public string Id { get; set; }
13 | public string CountrySubentity { get; set; }
14 | public string District { get; set; }
15 | public Country Country { get; set; }
16 |
17 | public RegistrationAddress()
18 | {
19 | AddressLine = new AddressLine();
20 | Country = new Country();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/TaxSubtotal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class TaxSubtotal
8 | {
9 | public PayableAmount TaxableAmount { get; set; }
10 |
11 | public PayableAmount TaxAmount { get; set; }
12 |
13 | public TaxCategory TaxCategory { get; set; }
14 |
15 | public InvoicedQuantity BaseUnitMeasure { get; set; }
16 |
17 | public TaxSubtotal()
18 | {
19 | TaxableAmount = new PayableAmount();
20 | TaxAmount = new PayableAmount();
21 | TaxCategory = new TaxCategory();
22 | BaseUnitMeasure = new InvoicedQuantity();
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Intercambio/EnvioDocumentoComun.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Intercambio
4 | {
5 | public abstract class EnvioDocumentoComun
6 | {
7 | [JsonProperty(Required = Required.Always)]
8 | public string Ruc { get; set; }
9 |
10 | [JsonProperty(Required = Required.Always)]
11 | public string UsuarioSol { get; set; }
12 |
13 | [JsonProperty(Required = Required.Always)]
14 | public string ClaveSol { get; set; }
15 |
16 | [JsonProperty(Required = Required.Always)]
17 | public string IdDocumento { get; set; }
18 |
19 | [JsonProperty(Required = Required.Always)]
20 | public string TipoDocumento { get; set; }
21 |
22 | [JsonProperty(Required = Required.Always)]
23 | public string EndPointUrl { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.RestService/ApiSunatDto/ValidacionRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.RestService.ApiSunatDto
4 | {
5 | public class ValidacionRequest
6 | {
7 | [JsonProperty(PropertyName = "numRuc")]
8 | public string RucEmisor { get; set; }
9 |
10 | [JsonProperty(PropertyName = "codComp")]
11 | public string CodigoComprobante { get; set; }
12 |
13 | [JsonProperty(PropertyName="numeroSerie")]
14 | public string NumeroSerie { get; set; }
15 |
16 | [JsonProperty(PropertyName = "numero")]
17 | public int Numero { get; set; }
18 |
19 | [JsonProperty(PropertyName = "fechaEmision")]
20 | public string FechaEmision { get; set; }
21 |
22 | [JsonProperty(PropertyName = "monto")]
23 | public decimal Monto { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DocumentoSunatBase.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class DocumentoSunatBase
6 | {
7 | [JsonProperty(Order = 1, Required = Required.Always)]
8 | public string IdDocumento { get; set; }
9 |
10 | [JsonProperty(Order = 2, Required = Required.Always)]
11 | public string FechaEmision { get; set; }
12 |
13 | [JsonProperty(Order = 3, Required = Required.Always)]
14 | public Negocio Emisor { get; set; }
15 |
16 | [JsonProperty(Order = 4, Required = Required.Always)]
17 | public Negocio Receptor { get; set; }
18 |
19 | [JsonProperty(Order = 5, Required = Required.Always)]
20 | public string Moneda { get; set; }
21 |
22 | [JsonProperty(Order = 6)]
23 | public string Observaciones { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/App_Start/WebApiConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web.Http;
2 | using OpenInvoicePeru.WebApi.Filters;
3 | using Unity.AspNet.WebApi;
4 |
5 | namespace OpenInvoicePeru.WebApi
6 | {
7 | public static class WebApiConfig
8 | {
9 | public static void Register(HttpConfiguration config)
10 | {
11 | // Configuración y servicios de API web
12 | config.DependencyResolver = new UnityDependencyResolver(UnityConfig.Container);
13 | // Rutas de API web
14 | config.MapHttpAttributeRoutes();
15 |
16 | config.Filters.Add(new ValidateModelAttribute());
17 |
18 | config.Routes.MapHttpRoute(
19 | name: "DefaultApi",
20 | routeTemplate: "api/{controller}/{id}",
21 | defaults: new { id = RouteParameter.Optional }
22 | );
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/SUNATRetentionInformation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonAggregateComponents;
3 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
4 |
5 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
6 | {
7 | [Serializable]
8 | public class SunatRetentionInformation
9 | {
10 | public PayableAmount SunatRetentionAmount { get; set; }
11 |
12 | public string SunatRetentionDate { get; set; }
13 |
14 | public PayableAmount SunatNetTotalPaid { get; set; }
15 |
16 | public ExchangeRate ExchangeRate { get; set; }
17 |
18 | public SunatRetentionInformation()
19 | {
20 | SunatRetentionAmount = new PayableAmount();
21 | SunatNetTotalPaid = new PayableAmount();
22 | ExchangeRate = new ExchangeRate();
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DatoAdicional.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class DatoAdicional
6 | {
7 | [JsonProperty(Order = 1, Required = Required.Always)]
8 | public string Codigo { get; set; }
9 |
10 | [JsonProperty(Order = 2, Required = Required.AllowNull)]
11 | public string Nombre { get; set; }
12 |
13 | [JsonProperty(Order = 3, Required = Required.Always)]
14 | public string Contenido { get; set; }
15 |
16 | [JsonProperty(Order = 4, Required = Required.AllowNull)]
17 | public string FechaInicio { get; set; }
18 |
19 | [JsonProperty(Order = 5, Required = Required.AllowNull)]
20 | public string FechaFin { get; set; }
21 |
22 | [JsonProperty(Order = 6, Required = Required.AllowNull)]
23 | public int Duracion { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Consignment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class Consignment
7 | {
8 | public PlannedPickupTransportEvent PlannedPickupTransportEvent { get; set; }
9 | public string CarrierServiceInstructions { get; set; }
10 | public string Id { get; set; }
11 | public DeliveryTerms DeliveryTerms { get; set; }
12 | public TransportHandlingUnit TransportHandlingUnit { get; set; }
13 | public decimal DeclaredForCarriageValueAmount { get; set; }
14 |
15 | public Consignment()
16 | {
17 | DeliveryTerms = new DeliveryTerms();
18 | PlannedPickupTransportEvent = new PlannedPickupTransportEvent();
19 | TransportHandlingUnit = new TransportHandlingUnit();
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.RestService/ApiSunatDto/ValidacionResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace OpenInvoicePeru.RestService.ApiSunatDto
5 | {
6 | public class ValidacionResponse
7 | {
8 | public bool Success { get; set; }
9 | public string Message { get; set; }
10 | public Data Data { get; set; }
11 | }
12 |
13 | public class Data
14 | {
15 | [JsonProperty(PropertyName = "estadoCp")]
16 | public string EstadoComprobante { get; set; }
17 |
18 | [JsonProperty(PropertyName = "estadoRuc")]
19 | public string EstadoRuc { get; set; }
20 |
21 | [JsonProperty(PropertyName = "condDomiRuc")]
22 | public string CondicionDomicilio { get; set; }
23 |
24 | [JsonProperty(PropertyName = "observaciones")]
25 | public ICollection Observaciones { get; set; }
26 | }
27 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/AdditionalMonetaryTotal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
5 | {
6 | [Serializable]
7 | public class AdditionalMonetaryTotal
8 | {
9 | public string Id { get; set; }
10 |
11 | public PayableAmount PayableAmount { get; set; }
12 |
13 | public PayableAmount ReferenceAmount { get; set; }
14 |
15 | public PayableAmount TotalAmount { get; set; }
16 |
17 | ///
18 | /// Para el porcentaje de Detraccion.
19 | ///
20 | public decimal Percent { get; set; }
21 |
22 | public AdditionalMonetaryTotal()
23 | {
24 | PayableAmount = new PayableAmount();
25 | ReferenceAmount = new PayableAmount();
26 | TotalAmount = new PayableAmount();
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/ShipmentStage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.SunatAggregateComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class ShipmentStage
8 | {
9 | public int Id { get; set; }
10 |
11 | public CarrierParty CarrierParty { get; set; }
12 |
13 | public PartyIdentification DriverPerson { get; set; }
14 |
15 | public string TransportModeCode { get; set; }
16 |
17 | ///
18 | /// cac:TransitPeriod/cbc:StartDate
19 | /// >
20 | public DateTime TransitPeriodStartPeriod { get; set; }
21 |
22 | public SunatRoadTransport TransportMeans { get; set; }
23 |
24 | public ShipmentStage()
25 | {
26 | DriverPerson = new PartyIdentification();
27 | TransportMeans = new SunatRoadTransport();
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DocumentoRetencion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | using OpenInvoicePeru.Comun.Dto.Contratos;
4 | using System.Collections.Generic;
5 |
6 | namespace OpenInvoicePeru.Comun.Dto.Modelos
7 | {
8 | public class DocumentoRetencion : DocumentoSunatBase, IDocumentoElectronico
9 | {
10 | [JsonProperty(Order = 7, Required = Required.Always)]
11 | public string RegimenRetencion { get; set; }
12 |
13 | [JsonProperty(Order = 8, Required = Required.Always)]
14 | public decimal TasaRetencion { get; set; }
15 |
16 | [JsonProperty(Order = 9, Required = Required.Always)]
17 | public decimal ImporteTotalRetenido { get; set; }
18 |
19 | [JsonProperty(Order = 10, Required = Required.Always)]
20 | public decimal ImporteTotalPagado { get; set; }
21 |
22 | [JsonProperty(Order = 11, Required = Required.Always)]
23 | public List DocumentosRelacionados { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/DocumentoPercepcion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | using OpenInvoicePeru.Comun.Dto.Contratos;
4 | using System.Collections.Generic;
5 |
6 | namespace OpenInvoicePeru.Comun.Dto.Modelos
7 | {
8 | public class DocumentoPercepcion : DocumentoSunatBase, IDocumentoElectronico
9 | {
10 | [JsonProperty(Order = 7, Required = Required.Always)]
11 | public string RegimenPercepcion { get; set; }
12 |
13 | [JsonProperty(Order = 8, Required = Required.Always)]
14 | public decimal TasaPercepcion { get; set; }
15 |
16 | [JsonProperty(Order = 9, Required = Required.Always)]
17 | public decimal ImporteTotalPercibido { get; set; }
18 |
19 | [JsonProperty(Order = 10, Required = Required.Always)]
20 | public decimal ImporteTotalCobrado { get; set; }
21 |
22 | [JsonProperty(Order = 11, Required = Required.Always)]
23 | public List DocumentosRelacionados { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/TaxCategory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class TaxCategory
8 | {
9 | public decimal Percent { get; set; }
10 |
11 | public string TaxExemptionReasonCode { get; set; }
12 |
13 | public string TierRange { get; set; }
14 |
15 | public TaxScheme TaxScheme { get; set; }
16 |
17 | public PayableAmount PerUnitAmount { get; set; }
18 |
19 | ///
20 | /// Tipo de Afectacion del IGV
21 | /// S = Gravado
22 | /// E = Exonerado
23 | /// O = Inafecto
24 | ///
25 | public string Id { get; set; }
26 |
27 | public TaxCategory()
28 | {
29 | TaxScheme = new TaxScheme();
30 | PerUnitAmount = new PayableAmount();
31 | Percent = 18;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Item.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class Item
8 | {
9 | public string Description { get; set; }
10 |
11 | public SellersItemIdentification SellersItemIdentification { get; set; }
12 |
13 | public CommodityClassification CommodityClassification { get; set; }
14 |
15 | public StandardItemIdentification StandardItemIdentification { get; set; }
16 |
17 | public List AdditionalItemProperties { get; set; }
18 |
19 | public Item()
20 | {
21 | SellersItemIdentification = new SellersItemIdentification();
22 | CommodityClassification = new CommodityClassification();
23 | StandardItemIdentification = new StandardItemIdentification();
24 | AdditionalItemProperties = new List();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/SUNATRetentionDocumentReference.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonAggregateComponents;
3 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
4 |
5 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
6 | {
7 | [Serializable]
8 | public class SunatRetentionDocumentReference
9 | {
10 | public PartyIdentificationId Id { get; set; }
11 |
12 | public string IssueDate { get; set; }
13 |
14 | public PayableAmount TotalInvoiceAmount { get; set; }
15 |
16 | public Payment Payment { get; set; }
17 |
18 | public SunatRetentionInformation SunatRetentionInformation { get; set; }
19 |
20 | public SunatRetentionDocumentReference()
21 | {
22 | Id = new PartyIdentificationId();
23 | TotalInvoiceAmount = new PayableAmount();
24 | Payment = new Payment();
25 | SunatRetentionInformation = new SunatRetentionInformation();
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/DiscrepancyResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class DiscrepancyResponse : IEquatable
7 | {
8 | public string ReferenceId { get; set; }
9 |
10 | public string ResponseCode { get; set; }
11 |
12 | public string Description { get; set; }
13 |
14 | public DiscrepancyResponse()
15 | {
16 | ReferenceId = string.Empty;
17 | }
18 |
19 | public bool Equals(DiscrepancyResponse other)
20 | {
21 | if (string.IsNullOrEmpty(ReferenceId))
22 | return false;
23 |
24 | return ReferenceId.Equals(other.ReferenceId);
25 | }
26 |
27 | public override int GetHashCode()
28 | {
29 | if (string.IsNullOrEmpty(ReferenceId))
30 | return base.GetHashCode();
31 |
32 | return ReferenceId.GetHashCode();
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/InvoiceDocumentReference.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
4 | {
5 | [Serializable]
6 | public class InvoiceDocumentReference : IEquatable
7 | {
8 | public string Id { get; set; }
9 |
10 | public string DocumentTypeCode { get; set; }
11 | public string DocumentTypeDescription { get; set; }
12 |
13 | public InvoiceDocumentReference()
14 | {
15 | Id = string.Empty;
16 | }
17 |
18 | public bool Equals(InvoiceDocumentReference other)
19 | {
20 | if (other == null) return false;
21 |
22 | if (string.IsNullOrEmpty(Id))
23 | return false;
24 | return Id.Equals(other.Id);
25 | }
26 |
27 | public override int GetHashCode()
28 | {
29 | if (string.IsNullOrEmpty(Id))
30 | return base.GetHashCode();
31 |
32 | return Id.GetHashCode();
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/TaxTotal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
4 |
5 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
6 | {
7 | [Serializable]
8 | public class TaxTotal
9 | {
10 | public PayableAmount TaxAmount { get; set; }
11 |
12 | public TaxSubtotal TaxSubtotal { get; set; }
13 |
14 | public List TaxSubTotals { get; set; }
15 |
16 | ///
17 | /// Tipo de Afectacion del IGV
18 | /// S = Gravado
19 | /// E = Exonerado
20 | /// O = Inafecto
21 | ///
22 | public string TaxCategoryId { get; set; }
23 |
24 | public TaxCategory TaxCategory { get; set; }
25 |
26 | public TaxTotal()
27 | {
28 | TaxAmount = new PayableAmount();
29 | TaxSubtotal = new TaxSubtotal();
30 | TaxCategory = new TaxCategory();
31 | TaxSubTotals = new List();
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/AdditionalInformation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
5 | {
6 | [Serializable]
7 | public class AdditionalInformation
8 | {
9 | public List AdditionalMonetaryTotals { get; set; }
10 |
11 | public List AdditionalProperties { get; set; }
12 |
13 | public SunatEmbededDespatchAdvice SunatEmbededDespatchAdvice { get; set; }
14 |
15 | public SunatCosts SunatCosts { get; set; }
16 |
17 | public SunatTransaction SunatTransaction { get; private set; }
18 |
19 | public AdditionalInformation()
20 | {
21 | AdditionalMonetaryTotals = new List();
22 | AdditionalProperties = new List();
23 | SunatEmbededDespatchAdvice = new SunatEmbededDespatchAdvice();
24 | SunatTransaction = new SunatTransaction();
25 | SunatCosts = new SunatCosts();
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/ItemSunatBase.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class ItemSunatBase : DocumentoRelacionado
6 | {
7 | [JsonProperty(Order = 3, Required = Required.Always)]
8 | public string FechaEmision { get; set; }
9 |
10 | [JsonProperty(Order = 4, Required = Required.Always)]
11 | public decimal ImporteTotal { get; set; }
12 |
13 | [JsonProperty(Order = 5, Required = Required.Always)]
14 | public string MonedaDocumentoRelacionado { get; set; }
15 |
16 | [JsonProperty(Order = 6, Required = Required.Always)]
17 | public int NumeroPago { get; set; }
18 |
19 | [JsonProperty(Order = 7, Required = Required.Always)]
20 | public decimal ImporteTotalNeto { get; set; }
21 |
22 | [JsonProperty(Order = 9, Required = Required.Always)]
23 | public string FechaPago { get; set; }
24 |
25 | [JsonProperty(Order = 12)]
26 | public decimal TipoCambio { get; set; }
27 |
28 | [JsonProperty(Order = 13)]
29 | public string FechaTipoCambio { get; set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/GrupoResumen.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace OpenInvoicePeru.Comun.Dto.Modelos
4 | {
5 | public class GrupoResumen : DocumentoResumenDetalle
6 | {
7 | public int CorrelativoInicio { get; set; }
8 |
9 | public int CorrelativoFin { get; set; }
10 |
11 | [JsonProperty(Required = Required.Always)]
12 | public string Moneda { get; set; }
13 |
14 | [JsonProperty(Required = Required.Always)]
15 | public decimal TotalVenta { get; set; }
16 |
17 | public decimal TotalDescuentos { get; set; }
18 |
19 | [JsonProperty(Required = Required.Always)]
20 | public decimal TotalIgv { get; set; }
21 |
22 | public decimal TotalIsc { get; set; }
23 |
24 | public decimal TotalOtrosImpuestos { get; set; }
25 |
26 | public decimal TotalImpuestoBolsas { get; set; }
27 |
28 | public decimal Gravadas { get; set; }
29 |
30 | public decimal Exoneradas { get; set; }
31 |
32 | public decimal Inafectas { get; set; }
33 |
34 | public decimal Exportacion { get; set; }
35 |
36 | public decimal Gratuitas { get; set; }
37 | }
38 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/LegalMonetaryTotal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
3 |
4 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
5 | {
6 | [Serializable]
7 | public class LegalMonetaryTotal
8 | {
9 | public PayableAmount PayableAmount { get; set; }
10 |
11 | public PayableAmount AllowanceTotalAmount { get; set; }
12 |
13 | public PayableAmount ChargeTotalAmount { get; set; }
14 |
15 | public PayableAmount PrepaidAmount { get; set; }
16 |
17 | public PayableAmount TaxInclusiveAmount { get; set; }
18 |
19 | public PayableAmount LineExtensionAmount { get; set; }
20 |
21 | public PayableAmount PayableRoundingAmount { get; set; }
22 |
23 | public LegalMonetaryTotal()
24 | {
25 | PayableAmount = new PayableAmount();
26 | AllowanceTotalAmount = new PayableAmount();
27 | ChargeTotalAmount = new PayableAmount();
28 | PrepaidAmount = new PayableAmount();
29 | TaxInclusiveAmount = new PayableAmount();
30 | LineExtensionAmount = new PayableAmount();
31 | PayableRoundingAmount = new PayableAmount();
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/SunatEmbededDespatchAdvice.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenInvoicePeru.Estructuras.CommonAggregateComponents;
3 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
4 |
5 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
6 | {
7 | [Serializable]
8 | public class SunatEmbededDespatchAdvice
9 | {
10 | public PostalAddress DeliveryAddress { get; set; }
11 |
12 | public PostalAddress OriginAddress { get; set; }
13 |
14 | public AccountingSupplierParty SunatCarrierParty { get; set; }
15 |
16 | public AgentParty DriverParty { get; set; }
17 |
18 | public SunatRoadTransport SunatRoadTransport { get; set; }
19 |
20 | public string TransportModeCode { get; set; }
21 |
22 | public InvoicedQuantity GrossWeightMeasure { get; set; }
23 |
24 | public SunatEmbededDespatchAdvice()
25 | {
26 | DeliveryAddress = new PostalAddress();
27 | OriginAddress = new PostalAddress();
28 | SunatCarrierParty = new AccountingSupplierParty();
29 | DriverParty = new AgentParty();
30 | SunatRoadTransport = new SunatRoadTransport();
31 | GrossWeightMeasure = new InvoicedQuantity();
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Utils/QrHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing.Imaging;
3 | using System.IO;
4 | using ZXing;
5 | using ZXing.QrCode;
6 |
7 | namespace OpenInvoicePeru.WebApi.Utils
8 | {
9 | ///
10 | /// Helper
11 | ///
12 | public static class QrHelper
13 | {
14 | ///
15 | /// Permite generar la imagen para QR en formato PNG.
16 | ///
17 | /// Trama a generar
18 | public static string GenerarImagenQr(string parameter)
19 | {
20 | if (parameter == null) throw new ArgumentNullException(nameof(parameter));
21 |
22 | var barcodeWriter = new BarcodeWriter
23 | {
24 | Format = BarcodeFormat.QR_CODE,
25 | Options = new QrCodeEncodingOptions
26 | {
27 | Width = 800,
28 | Height = 800
29 | }
30 | };
31 |
32 | using (var mem = new MemoryStream())
33 | {
34 | var imagen = barcodeWriter.Write(parameter);
35 | imagen.Save(mem, ImageFormat.Png);
36 |
37 | return Convert.ToBase64String(mem.ToArray());
38 | }
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
21 |
22 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
22 |
23 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Xml/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenInvoicePeru.Xml")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenInvoicePeru.Xml")]
12 | [assembly: AssemblyCopyright("Copyright © 2016")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("eda74dc8-b11b-4c7c-b604-0763b210e7d4")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenInvoicePeru.Comun")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenInvoicePeru.Comun")]
12 | [assembly: AssemblyCopyright("Copyright © 2016")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("c6d3447f-6aed-4da5-b28c-7c0356f2f4a8")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenInvoicePeru.Estructuras")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenInvoicePeru.Estructuras")]
12 | [assembly: AssemblyCopyright("Copyright © 2016")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("e6926288-913c-43e2-92b5-3e05a058312f")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenInvoicePeru.Servicio")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenInvoicePeru.Servicio")]
12 | [assembly: AssemblyCopyright("Copyright © 2016")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("25d6b9af-55a6-4e7f-a061-52a492ccdb6e")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenInvoicePeru.Servicio.Soap")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenInvoicePeru.Servicio.Soap")]
12 | [assembly: AssemblyCopyright("Copyright © 2016")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("f608fea2-ec58-4df7-81d6-960f6e1daed2")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/App_Start/UnityWebApiActivator.cs:
--------------------------------------------------------------------------------
1 | using System.Web.Http;
2 |
3 | using Unity.AspNet.WebApi;
4 |
5 | [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(OpenInvoicePeru.WebApi.UnityWebApiActivator), nameof(OpenInvoicePeru.WebApi.UnityWebApiActivator.Start))]
6 | [assembly: WebActivatorEx.ApplicationShutdownMethod(typeof(OpenInvoicePeru.WebApi.UnityWebApiActivator), nameof(OpenInvoicePeru.WebApi.UnityWebApiActivator.Shutdown))]
7 |
8 | namespace OpenInvoicePeru.WebApi
9 | {
10 | ///
11 | /// Provides the bootstrapping for integrating Unity with WebApi when it is hosted in ASP.NET.
12 | ///
13 | public static class UnityWebApiActivator
14 | {
15 | ///
16 | /// Integrates Unity when the application starts.
17 | ///
18 | public static void Start()
19 | {
20 | // Use UnityHierarchicalDependencyResolver if you want to use
21 | // a new child container for each IHttpController resolution.
22 | // var resolver = new UnityHierarchicalDependencyResolver(UnityConfig.Container);
23 | var resolver = new UnityDependencyResolver(UnityConfig.Container);
24 |
25 | GlobalConfiguration.Configuration.DependencyResolver = resolver;
26 | }
27 |
28 | ///
29 | /// Disposes the Unity container when the application is shut down.
30 | ///
31 | public static void Shutdown()
32 | {
33 | UnityConfig.Container.Dispose();
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Firmado/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenInvoicePeru.FirmadoSunat")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenInvoicePeru.FirmadoSunat")]
12 | [assembly: AssemblyCopyright("Copyright © Erick Orlando 2016")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("1cfd1d28-d342-413d-a6e1-7616cb9708e2")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.1.0.1026")]
35 | [assembly: AssemblyFileVersion("1.1.0.1026")]
36 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/OpenInvoicePeru.UBL21.3.0.0.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | OpenInvoicePeru.UBL21
5 | 3.0.0
6 | OpenInvoicePeru DTO UBL 2.1
7 | Erick Orlando
8 | Erick Orlando
9 | false
10 | Objetos de Transferencia de Datos para la API REST de OpenInvoicePeru. Estas clases permiten enviar los JSON adecuados para la Facturacion Electronica SUNAT de OpenInvoicePeru. Se requiere mínimo .NET 4.5
11 | Objetos DTO para la API REST de OpenInvoicePeru UBL 2.1
12 | - Se agrega campo de para declarar explicitamente LineExtensionAmount y TaxInclusiveAmount en la cabecera y el Campo BaseImponible en los detalles, que permitiran colocar explicitamente el valor en la etiqueta TaxableAmount para el calculo de impuestos
13 | Erick Orlando © 2021
14 | es-PE
15 | openinvoiceperu facturacion electronica sunat electronic billing ubl
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.RestService/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("OpenInvoicePeru.RestService")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("OpenInvoicePeru.RestService")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("1c98a37d-b5e2-4ebb-8212-9e31a506dc79")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/InvoiceLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
4 |
5 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
6 | {
7 | [Serializable]
8 | public class InvoiceLine
9 | {
10 | public int Id { get; set; }
11 |
12 | public InvoicedQuantity CreditedQuantity { get; set; }
13 |
14 | public InvoicedQuantity InvoicedQuantity { get; set; }
15 |
16 | public InvoicedQuantity DebitedQuantity { get; set; }
17 |
18 | public PayableAmount LineExtensionAmount { get; set; }
19 |
20 | public PricingReference PricingReference { get; set; }
21 |
22 | public AllowanceCharge AllowanceCharge { get; set; }
23 |
24 | public int BillingReference { get; set; }
25 |
26 | public List TaxTotals { get; set; }
27 |
28 | public Item Item { get; set; }
29 |
30 | public Price Price { get; set; }
31 |
32 | public Delivery Delivery { get; set; }
33 |
34 | public InvoiceLine()
35 | {
36 | CreditedQuantity = new InvoicedQuantity();
37 | InvoicedQuantity = new InvoicedQuantity();
38 | DebitedQuantity = new InvoicedQuantity();
39 | LineExtensionAmount = new PayableAmount();
40 | PricingReference = new PricingReference();
41 | AllowanceCharge = new AllowanceCharge();
42 | TaxTotals = new List();
43 | Item = new Item();
44 | Price = new Price();
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/CommonAggregateComponents/Shipment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
4 |
5 | namespace OpenInvoicePeru.Estructuras.CommonAggregateComponents
6 | {
7 | [Serializable]
8 | public class Shipment
9 | {
10 | public Consignment Consignment { get; set; }
11 |
12 | public string HandlingCode { get; set; }
13 |
14 | public string Information { get; set; }
15 |
16 | public bool SplitConsignmentIndicator { get; set; }
17 |
18 | public InvoicedQuantity GrossWeightMeasure { get; set; }
19 |
20 | public int TotalTransportHandlingUnitQuantity { get; set; }
21 |
22 | public List ShipmentStages { get; set; }
23 |
24 | public PostalAddress DeliveryAddress { get; set; }
25 |
26 | public TransportHandlingUnit TransportHandlingUnit { get; set; }
27 |
28 | public PostalAddress OriginAddress { get; set; }
29 |
30 | ///
31 | /// cac:FirstArrivalPortLocation/cbc:ID
32 | /// >
33 | public string FirstArrivalPortLocationId { get; set; }
34 |
35 | public string Id { get; set; }
36 |
37 | public Shipment()
38 | {
39 | Consignment = new Consignment();
40 | GrossWeightMeasure = new InvoicedQuantity();
41 | ShipmentStages = new List();
42 | DeliveryAddress = new PostalAddress();
43 | TransportHandlingUnit = new TransportHandlingUnit();
44 | OriginAddress = new PostalAddress();
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // La información general sobre un ensamblado se controla mediante el siguiente
5 | // conjunto de atributos. Cambie los valores de estos atributos para modificar la información
6 | // asociada a un ensamblado.
7 | [assembly: AssemblyTitle("OpenInvoicePeru API REST")]
8 | [assembly: AssemblyDescription("API REST para la generacion, envio y recepcion de documentos electronicos SUNAT")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Erick Orlando")]
11 | [assembly: AssemblyProduct("OpenInvoicePeru.WebApi")]
12 | [assembly: AssemblyCopyright("Copyright © 2016")]
13 | [assembly: AssemblyTrademark("Erick Orlando")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Si ComVisible se establece en false, los componentes COM no verán los
17 | // tipos de este ensamblado. Si necesita obtener acceso a un tipo de este ensamblado desde
18 | // COM, establezca el atributo ComVisible en true en este tipo.
19 | [assembly: ComVisible(false)]
20 |
21 | // El siguiente GUID es para el Id. typelib cuando este proyecto esté expuesto a COM
22 | [assembly: Guid("82d7b299-2366-480a-b8fd-3f3b04ad3afa")]
23 |
24 | // La información de versión de un ensamblado consta de los siguientes cuatro valores:
25 | //
26 | // Versión principal
27 | // Versión secundaria
28 | // Número de compilación
29 | // Revisión
30 | //
31 | // Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
32 | // mediante el carácter '*', como se muestra a continuación:
33 | [assembly: AssemblyVersion("1.1.0.1026")]
34 | [assembly: AssemblyFileVersion("1.1.0.1026")]
35 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/Reference.svcmap:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 | true
6 | true
7 |
8 | false
9 | false
10 | false
11 |
12 |
13 | true
14 | Auto
15 | true
16 | true
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("OpenInvoicePeru DTO")]
9 | [assembly: AssemblyDescription("Objetos de Transferencia de Datos para la API REST de OpenInvoicePeru. Estas clases permiten enviar los JSON adecuados para la Facturacion Electronica SUNAT de OpenInvoicePeru. Se requiere mínimo .NET 4.0")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Erick Orlando")]
12 | [assembly: AssemblyProduct("OpenInvoicePeru.DataTransfersObjects")]
13 | [assembly: AssemblyCopyright("Copyright © 2016-2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("54eb4da6-9a5b-4faf-9699-a5876fabd6c5")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("3.0.0.0")]
36 | [assembly: AssemblyFileVersion("3.0.0.0")]
37 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/billConsultService1.wsdl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Estructuras/SunatAggregateComponents/VoidedDocumentsLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using OpenInvoicePeru.Estructuras.CommonAggregateComponents;
4 | using OpenInvoicePeru.Estructuras.CommonBasicComponents;
5 |
6 | namespace OpenInvoicePeru.Estructuras.SunatAggregateComponents
7 | {
8 | [Serializable]
9 | public class VoidedDocumentsLine
10 | {
11 | public int LineId { get; set; }
12 |
13 | public string DocumentTypeCode { get; set; }
14 |
15 | public string DocumentSerialId { get; set; }
16 |
17 | public int DocumentNumberId { get; set; }
18 |
19 | public string VoidReasonDescription { get; set; }
20 |
21 | // A partir de aqui son los datos para el resumen diario.
22 | public string Id { get; set; }
23 |
24 | public int StartDocumentNumberId { get; set; }
25 |
26 | public int EndDocumentNumberId { get; set; }
27 |
28 | public PayableAmount TotalAmount { get; set; }
29 |
30 | public List BillingPayments { get; set; }
31 |
32 | public AllowanceCharge AllowanceCharge { get; set; }
33 |
34 | public List TaxTotals { get; set; }
35 |
36 | public AccountingSupplierParty AccountingCustomerParty { get; set; }
37 |
38 | public BillingReference BillingReference { get; set; }
39 |
40 | public int? ConditionCode { get; set; }
41 |
42 | public VoidedDocumentsLine()
43 | {
44 | TotalAmount = new PayableAmount();
45 | BillingPayments = new List();
46 | AllowanceCharge = new AllowanceCharge();
47 | TaxTotals = new List();
48 | AccountingCustomerParty = new AccountingSupplierParty();
49 | BillingReference = new BillingReference();
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/FirmarController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Web.Http;
4 | using OpenInvoicePeru.Comun.Dto.Intercambio;
5 | using OpenInvoicePeru.Firmado;
6 | using OpenInvoicePeru.WebApi.Utils;
7 | using Swashbuckle.Swagger.Annotations;
8 |
9 | namespace OpenInvoicePeru.WebApi.Controllers
10 | {
11 | ///
12 | public class FirmarController : ApiController
13 | {
14 | private readonly ICertificador _certificador;
15 |
16 | ///
17 | public FirmarController(ICertificador certificador)
18 | {
19 | _certificador = certificador;
20 | }
21 |
22 | ///
23 | /// Firma el Documento XML con el Certificado Digital.
24 | ///
25 | [HttpPost]
26 | [SwaggerResponse(200, "OK", typeof(FirmadoResponse))]
27 | [SwaggerResponse(400, "Bad Request", typeof(string))]
28 | [SwaggerResponse(209, "Conflicts", typeof(string))]
29 | public async Task Post([FromBody]FirmadoRequest request)
30 | {
31 | var response = new FirmadoResponse();
32 |
33 | try
34 | {
35 | response = await _certificador.FirmarXml(request);
36 | response.Exito = true;
37 | if (!string.IsNullOrEmpty(request.ValoresQr))
38 | response.CodigoQr = QrHelper.GenerarImagenQr($"{request.ValoresQr}{response.ResumenFirma}");
39 | }
40 | catch (Exception ex)
41 | {
42 | response.MensajeError = ex.Message;
43 | response.Pila = ex.StackTrace;
44 | response.Exito = false;
45 | }
46 |
47 | return Ok(response);
48 | }
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Consultas/configuration.svcinfo:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/billConsultService.wsdl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarRetencionController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | public class GenerarRetencionController : ApiController
14 | {
15 | private readonly IDocumentoXml _documentoXml;
16 | private readonly ISerializador _serializador;
17 |
18 | ///
19 | public GenerarRetencionController(ISerializador serializador)
20 | {
21 | _serializador = serializador;
22 | _documentoXml = new RetencionXml();
23 | }
24 |
25 | ///
26 | /// Genera el XML para la Retencion
27 | ///
28 | [HttpPost]
29 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
30 | [SwaggerResponse(400, "Bad Request", typeof(string))]
31 | [SwaggerResponse(209, "Conflicts", typeof(string))]
32 | public async Task Post([FromBody] DocumentoRetencion documento)
33 | {
34 | var response = new DocumentoResponse();
35 | try
36 | {
37 | var invoice = _documentoXml.Generar(documento);
38 | response.TramaXmlSinFirma = await _serializador.GenerarXml(invoice);
39 | response.Exito = true;
40 | }
41 | catch (Exception ex)
42 | {
43 | response.MensajeError = ex.Message;
44 | response.Pila = ex.StackTrace;
45 | response.Exito = false;
46 | }
47 |
48 | return Ok(response);
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarPercepcionController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | public class GenerarPercepcionController : ApiController
14 | {
15 | private readonly IDocumentoXml _documentoXml;
16 | private readonly ISerializador _serializador;
17 |
18 | ///
19 | public GenerarPercepcionController(ISerializador serializador)
20 | {
21 | _serializador = serializador;
22 | _documentoXml = new PercepcionXml();
23 | }
24 |
25 | ///
26 | /// Genera el XML para la Percepcion
27 | ///
28 | [HttpPost]
29 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
30 | [SwaggerResponse(400, "Bad Request", typeof(string))]
31 | [SwaggerResponse(209, "Conflicts", typeof(string))]
32 | public async Task Post([FromBody] DocumentoPercepcion documento)
33 | {
34 | var response = new DocumentoResponse();
35 | try
36 | {
37 | var invoice = _documentoXml.Generar(documento);
38 | response.TramaXmlSinFirma = await _serializador.GenerarXml(invoice);
39 | response.Exito = true;
40 | }
41 | catch (Exception ex)
42 | {
43 | response.MensajeError = ex.Message;
44 | response.Pila = ex.StackTrace;
45 | response.Exito = false;
46 | }
47 |
48 | return Ok(response);
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarGuiaRemisionController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | public class GenerarGuiaRemisionController : ApiController
14 | {
15 |
16 | private readonly IDocumentoXml _documentoXml;
17 | private readonly ISerializador _serializador;
18 |
19 | ///
20 | public GenerarGuiaRemisionController(ISerializador serializador)
21 | {
22 | _serializador = serializador;
23 | _documentoXml = new GuiaRemisionXml();
24 | }
25 |
26 | ///
27 | /// Genera el XML para la Guia de Remision.
28 | ///
29 | [HttpPost]
30 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
31 | [SwaggerResponse(400, "Bad Request", typeof(string))]
32 | [SwaggerResponse(209, "Conflicts", typeof(string))]
33 | public async Task Post([FromBody] GuiaRemision documento)
34 | {
35 | var response = new DocumentoResponse();
36 | try
37 | {
38 | var notaCredito = _documentoXml.Generar(documento);
39 | response.TramaXmlSinFirma = await _serializador.GenerarXml(notaCredito);
40 | response.Exito = true;
41 | }
42 | catch (Exception ex)
43 | {
44 | response.MensajeError = ex.Message;
45 | response.Pila = ex.StackTrace;
46 | response.Exito = false;
47 | }
48 |
49 | return Ok(response);
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarComunicacionBajaController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | public class GenerarComunicacionBajaController : ApiController
14 | {
15 | private readonly IDocumentoXml _documentoXml;
16 | private readonly ISerializador _serializador;
17 |
18 | ///
19 | public GenerarComunicacionBajaController(ISerializador serializador)
20 | {
21 | _serializador = serializador;
22 | _documentoXml = new ComunicacionBajaXml();
23 | }
24 |
25 | ///
26 | /// Genera la Comunicacion de Baja.
27 | ///
28 | [HttpPost]
29 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
30 | [SwaggerResponse(400, "Bad Request", typeof(string))]
31 | [SwaggerResponse(209, "Conflicts", typeof(string))]
32 | public async Task Post([FromBody]ComunicacionBaja baja)
33 | {
34 | var response = new DocumentoResponse();
35 |
36 | try
37 | {
38 | var voidedDocument = _documentoXml.Generar(baja);
39 | response.TramaXmlSinFirma = await _serializador.GenerarXml(voidedDocument);
40 | response.Exito = true;
41 | }
42 | catch (Exception ex)
43 | {
44 | response.MensajeError = ex.Message;
45 | response.Pila = ex.StackTrace;
46 | response.Exito = false;
47 | }
48 |
49 | return Ok(response);
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/configuration.svcinfo:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/billConsultService.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/Reference.svcmap:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 | true
6 | true
7 |
8 | false
9 | false
10 | false
11 |
12 |
13 | true
14 | Auto
15 | true
16 | true
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarNotaDebitoController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | public class GenerarNotaDebitoController : ApiController
14 | {
15 | private readonly IDocumentoXml _documentoXml;
16 | private readonly ISerializador _serializador;
17 |
18 | ///
19 | public GenerarNotaDebitoController(ISerializador serializador)
20 | {
21 | _serializador = serializador;
22 | _documentoXml = new NotaDebitoXml();
23 | }
24 |
25 | ///
26 | /// Genera el XML para la Nota de Debito
27 | ///
28 | [HttpPost]
29 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
30 | [SwaggerResponse(400, "Bad Request", typeof(string))]
31 | [SwaggerResponse(209, "Conflicts", typeof(string))]
32 | public async Task Post([FromBody] DocumentoElectronico documento)
33 | {
34 | var response = new DocumentoResponse();
35 | try
36 | {
37 | var notaDebito = _documentoXml.Generar(documento);
38 | response.TramaXmlSinFirma = await _serializador.GenerarXml(notaDebito);
39 | var serieCorrelativo = documento.IdDocumento.Split('-');
40 | response.ValoresParaQr =
41 | $"{documento.Emisor.NroDocumento}|{documento.TipoDocumento}|{serieCorrelativo[0]}|{serieCorrelativo[1]}|{documento.TotalIgv:N2}|{documento.TotalVenta:N2}|{Convert.ToDateTime(documento.FechaEmision):yyyy-MM-dd}|{documento.Receptor.TipoDocumento}|{documento.Receptor.NroDocumento}|";
42 | response.Exito = true;
43 | }
44 | catch (Exception ex)
45 | {
46 | response.MensajeError = ex.Message;
47 | response.Pila = ex.StackTrace;
48 | response.Exito = false;
49 | }
50 |
51 | return Ok(response);
52 | }
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarNotaCreditoController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | public class GenerarNotaCreditoController : ApiController
14 | {
15 | private readonly IDocumentoXml _documentoXml;
16 | private readonly ISerializador _serializador;
17 |
18 | ///
19 | public GenerarNotaCreditoController(ISerializador serializador)
20 | {
21 | _serializador = serializador;
22 | _documentoXml = new NotaCreditoXml();
23 | }
24 |
25 | ///
26 | /// Genera el XML para la Nota de Credito
27 | ///
28 | [HttpPost]
29 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
30 | [SwaggerResponse(400, "Bad Request", typeof(string))]
31 | [SwaggerResponse(209, "Conflicts", typeof(string))]
32 | public async Task Post([FromBody] DocumentoElectronico documento)
33 | {
34 | var response = new DocumentoResponse();
35 | try
36 | {
37 | var notaCredito = _documentoXml.Generar(documento);
38 | response.TramaXmlSinFirma = await _serializador.GenerarXml(notaCredito);
39 | var serieCorrelativo = documento.IdDocumento.Split('-');
40 | response.ValoresParaQr =
41 | $"{documento.Emisor.NroDocumento}|{documento.TipoDocumento}|{serieCorrelativo[0]}|{serieCorrelativo[1]}|{documento.TotalIgv:N2}|{documento.TotalVenta:N2}|{Convert.ToDateTime(documento.FechaEmision):yyyy-MM-dd}|{documento.Receptor.TipoDocumento}|{documento.Receptor.NroDocumento}|";
42 | response.Exito = true;
43 | }
44 | catch (Exception ex)
45 | {
46 | response.MensajeError = ex.Message;
47 | response.Pila = ex.StackTrace;
48 | response.Exito = false;
49 | }
50 |
51 | return Ok(response);
52 | }
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/ConsultasSunat/Reference.svcmap:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 | true
6 | true
7 |
8 | false
9 | false
10 | false
11 |
12 |
13 |
14 |
15 | true
16 | Auto
17 | true
18 | true
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/ConsultarTicketController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Web.Http;
4 | using OpenInvoicePeru.Comun.Dto.Intercambio;
5 | using OpenInvoicePeru.Firmado;
6 | using OpenInvoicePeru.Servicio;
7 | using Swashbuckle.Swagger.Annotations;
8 |
9 | namespace OpenInvoicePeru.WebApi.Controllers
10 | {
11 | ///
12 | public class ConsultarTicketController : ApiController
13 | {
14 | private readonly IServicioSunatDocumentos _servicioSunatDocumentos;
15 | private readonly ISerializador _serializador;
16 |
17 | ///
18 | public ConsultarTicketController(IServicioSunatDocumentos servicioSunatDocumentos, ISerializador serializador)
19 | {
20 | _servicioSunatDocumentos = servicioSunatDocumentos;
21 | _serializador = serializador;
22 | }
23 |
24 | ///
25 | /// Consulta el Ticket existen en SUNAT (Solo Produccion)
26 | ///
27 | [HttpPost]
28 | [SwaggerResponse(200, "OK", typeof(EnviarDocumentoResponse))]
29 | [SwaggerResponse(400, "Bad Request", typeof(string))]
30 | [SwaggerResponse(209, "Conflicts", typeof(string))]
31 | public async Task Post([FromBody] ConsultaTicketRequest request)
32 | {
33 | var response = new EnviarDocumentoResponse();
34 |
35 | try
36 | {
37 | _servicioSunatDocumentos.Inicializar(new ParametrosConexion
38 | {
39 | Ruc = request.Ruc,
40 | UserName = request.UsuarioSol,
41 | Password = request.ClaveSol,
42 | EndPointUrl = request.EndPointUrl
43 | });
44 |
45 | var resultado = _servicioSunatDocumentos.ConsultarTicket(request.NroTicket);
46 |
47 | if (!resultado.Exito)
48 | {
49 | response.Exito = false;
50 | response.MensajeError = resultado.MensajeError;
51 | }
52 | else
53 | response = await _serializador.GenerarDocumentoRespuesta(resultado.ConstanciaDeRecepcion);
54 | }
55 | catch (Exception ex)
56 | {
57 | response.MensajeError = ex.Source == "DotNetZip" ? "El Ticket no existe" : ex.Message;
58 | response.Pila = ex.StackTrace;
59 | response.Exito = false;
60 | }
61 |
62 | return Ok(response);
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/EnviarDocumentoController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Firmado;
3 | using OpenInvoicePeru.Servicio;
4 | using System.Threading.Tasks;
5 | using System.Web.Http;
6 | using Swashbuckle.Swagger.Annotations;
7 |
8 | namespace OpenInvoicePeru.WebApi.Controllers
9 | {
10 | ///
11 | public class EnviarDocumentoController : ApiController
12 | {
13 | private readonly ISerializador _serializador;
14 | private readonly IServicioSunatDocumentos _servicioSunatDocumentos;
15 |
16 | ///
17 | public EnviarDocumentoController(ISerializador serializador, IServicioSunatDocumentos servicioSunatDocumentos)
18 | {
19 | _serializador = serializador;
20 | _servicioSunatDocumentos = servicioSunatDocumentos;
21 | }
22 |
23 | ///
24 | /// Envia el Documento a SUNAT/OSE
25 | ///
26 | [HttpPost]
27 | [SwaggerResponse(200, "OK", typeof(EnviarDocumentoResponse))]
28 | [SwaggerResponse(400, "Bad Request", typeof(string))]
29 | [SwaggerResponse(209, "Conflicts", typeof(string))]
30 | public async Task Post([FromBody]EnviarDocumentoRequest request)
31 | {
32 | var response = new EnviarDocumentoResponse();
33 | var nombreArchivo = $"{request.Ruc}-{request.TipoDocumento}-{request.IdDocumento}";
34 | var tramaZip = await _serializador.GenerarZip(request.TramaXmlFirmado, nombreArchivo);
35 |
36 | _servicioSunatDocumentos.Inicializar(new ParametrosConexion
37 | {
38 | Ruc = request.Ruc,
39 | UserName = request.UsuarioSol,
40 | Password = request.ClaveSol,
41 | EndPointUrl = request.EndPointUrl
42 | });
43 |
44 | var resultado = _servicioSunatDocumentos.EnviarDocumento(new DocumentoSunat
45 | {
46 | TramaXml = tramaZip,
47 | NombreArchivo = $"{nombreArchivo}.zip"
48 | });
49 |
50 | if (!resultado.Exito)
51 | {
52 | response.Exito = false;
53 | response.MensajeError = resultado.MensajeError;
54 | }
55 | else
56 | {
57 | response = await _serializador.GenerarDocumentoRespuesta(resultado.ConstanciaDeRecepcion);
58 | // Quitamos la R y la extensión devueltas por el Servicio.
59 | response.NombreArchivo = nombreArchivo;
60 |
61 |
62 | }
63 |
64 | return response;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun/Constantes/EspacioNombres.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable InconsistentNaming
2 |
3 | namespace OpenInvoicePeru.Comun.Constantes
4 | {
5 | public static class EspacioNombres
6 | {
7 | public const string xmlnsInvoice = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2";
8 | public const string xmlnsCreditNote = "urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2";
9 | public const string xmlnsDebitNote = "urn:oasis:names:specification:ubl:schema:xsd:DebitNote-2";
10 | public const string xmlnsVoidedDocuments = "urn:sunat:names:specification:ubl:peru:schema:xsd:VoidedDocuments-1";
11 | public const string xmlnsSummaryDocuments = "urn:sunat:names:specification:ubl:peru:schema:xsd:SummaryDocuments-1";
12 | public const string xmlnsRetention = "urn:sunat:names:specification:ubl:peru:schema:xsd:Retention-1";
13 | public const string xmlnsPerception = "urn:sunat:names:specification:ubl:peru:schema:xsd:Perception-1";
14 | public const string xmlnsDespatchAdvice = "urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2";
15 | public const string sac = "urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1";
16 | public const string cac = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2";
17 | public const string cbc = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2";
18 | public const string udt = "urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2";
19 | public const string ccts = "urn:un:unece:uncefact:documentation:2";
20 | public const string ext = "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2";
21 | public const string qdt = "urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2";
22 | public const string ds = "http://www.w3.org/2000/09/xmldsig#";
23 | public const string xsi = "http://www.w3.org/2001/XMLSchema-instance";
24 | public const string ar = "urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2";
25 | public const string wssecurity =
26 | "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
27 |
28 | public const string nodoId = "/ar:ApplicationResponse/cbc:ID";
29 | public const string nodoResponseDate = "/ar:ApplicationResponse/cbc:ResponseDate";
30 | public const string nodoResponseTime = "ar:ApplicationResponse/cbc:ResponseTime";
31 | public const string nodoResponseCode =
32 | "/ar:ApplicationResponse/cac:DocumentResponse/cac:Response/cbc:ResponseCode";
33 | public const string nodoDescription =
34 | "/ar:ApplicationResponse/cac:DocumentResponse/cac:Response/cbc:Description";
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarFacturaController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | public class GenerarFacturaController : ApiController
14 | {
15 | private readonly IDocumentoXml _documentoXml;
16 | private readonly ISerializador _serializador;
17 |
18 | ///
19 | public GenerarFacturaController(ISerializador serializador)
20 | {
21 | _serializador = serializador;
22 | _documentoXml = new FacturaXml();
23 | //_documentoXml = _documentoXml = UnityConfig.Container
24 | // .Resolve(GetType().Name);
25 | }
26 |
27 | ///
28 | /// Generar el XML para una Factura o una Boleta.
29 | ///
30 | [HttpPost]
31 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
32 | [SwaggerResponse(400, "Bad Request", typeof(string))]
33 | [SwaggerResponse(209, "Conflicts", typeof(string))]
34 | public async Task Post([FromBody] DocumentoElectronico documento)
35 | {
36 | var response = new DocumentoResponse();
37 | try
38 | {
39 | var invoice = _documentoXml.Generar(documento);
40 | response.TramaXmlSinFirma = await _serializador.GenerarXml(invoice);
41 | var serieCorrelativo = documento.IdDocumento.Split('-');
42 | response.ValoresParaQr =
43 | $"{documento.Emisor.NroDocumento}|{documento.TipoDocumento}|{serieCorrelativo[0]}|{serieCorrelativo[1]}|{documento.TotalIgv:N2}|{documento.TotalVenta:N2}|{Convert.ToDateTime(documento.FechaEmision):yyyy-MM-dd}|{documento.Receptor.TipoDocumento}|{documento.Receptor.NroDocumento}|";
44 |
45 | //await Task.Factory.StartNew(async () =>
46 | //{
47 | // await _telegramService.EnviarMensaje($"{documento.Emisor.NombreLegal} => para {documento.Receptor.NombreLegal} | {documento.IdDocumento} con un Total de {documento.TotalVenta:N2}");
48 | //});
49 |
50 | response.Exito = true;
51 | }
52 | catch (Exception ex)
53 | {
54 | response.MensajeError = ex.Message;
55 | response.Pila = ex.StackTrace;
56 | response.Exito = false;
57 | }
58 |
59 | return Ok(response);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/ConsultarConstanciaController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Web.Http;
4 | using OpenInvoicePeru.Comun.Dto.Intercambio;
5 | using OpenInvoicePeru.Firmado;
6 | using OpenInvoicePeru.Servicio;
7 | using Swashbuckle.Swagger.Annotations;
8 |
9 | namespace OpenInvoicePeru.WebApi.Controllers
10 | {
11 | ///
12 | public class ConsultarConstanciaController : ApiController
13 | {
14 | private readonly IServicioSunatConsultas _servicioSunatConsultas;
15 | private readonly ISerializador _serializador;
16 |
17 | ///
18 | public ConsultarConstanciaController(IServicioSunatConsultas servicioSunatConsultas, ISerializador serializador)
19 | {
20 | _servicioSunatConsultas = servicioSunatConsultas;
21 | _serializador = serializador;
22 | }
23 |
24 | ///
25 | /// Consulta el CDR existente en SUNAT (solo Produccion)
26 | ///
27 | [HttpPost]
28 | [SwaggerResponse(200, "OK", typeof(EnviarDocumentoResponse))]
29 | [SwaggerResponse(400, "Bad Request", typeof(string))]
30 | [SwaggerResponse(209, "Conflicts", typeof(string))]
31 | public async Task Post([FromBody] ConsultaConstanciaRequest request)
32 | {
33 | var response = new EnviarDocumentoResponse();
34 |
35 | try
36 | {
37 | _servicioSunatConsultas.Inicializar(new ParametrosConexion
38 | {
39 | Ruc = request.Ruc,
40 | UserName = request.UsuarioSol,
41 | Password = request.ClaveSol,
42 | EndPointUrl = request.EndPointUrl
43 | });
44 |
45 | var resultado = _servicioSunatConsultas.ConsultarConstanciaDeRecepcion(new DatosDocumento
46 | {
47 | RucEmisor = request.Ruc,
48 | TipoComprobante = request.TipoDocumento,
49 | Serie = request.Serie,
50 | Numero = request.Numero
51 | });
52 |
53 | if (!resultado.Exito)
54 | {
55 | response.Exito = false;
56 | response.MensajeRespuesta = resultado.MensajeError;
57 | }
58 | else
59 | response = await _serializador.GenerarDocumentoRespuesta(resultado.ConstanciaDeRecepcion);
60 | }
61 | catch (Exception ex)
62 | {
63 | response.MensajeError = ex.Message;
64 | response.Pila = ex.StackTrace;
65 | response.Exito = false;
66 | }
67 |
68 | return Ok(response);
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun.Dto/Modelos/GuiaRemision.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | using OpenInvoicePeru.Comun.Dto.Contratos;
4 | using System.Collections.Generic;
5 |
6 | namespace OpenInvoicePeru.Comun.Dto.Modelos
7 | {
8 | public class GuiaRemision : IDocumentoElectronico
9 | {
10 | [JsonProperty(Required = Required.Always)]
11 | public string IdDocumento { get; set; }
12 |
13 | [JsonProperty(Required = Required.Always)]
14 | public string FechaEmision { get; set; }
15 |
16 | [JsonProperty(Required = Required.Always)]
17 | public string TipoDocumento { get; set; }
18 |
19 | [JsonProperty(Required = Required.AllowNull)]
20 | public string Glosa { get; set; }
21 |
22 | [JsonProperty(Required = Required.Always)]
23 | public Contribuyente Remitente { get; set; }
24 |
25 | [JsonProperty(Required = Required.Always)]
26 | public Contribuyente Destinatario { get; set; }
27 |
28 | [JsonProperty(Required = Required.Always)]
29 | public Contribuyente Tercero { get; set; }
30 |
31 | [JsonProperty(Required = Required.AllowNull)]
32 | public DocumentoRelacionado DocumentoRelacionado { get; set; }
33 |
34 | [JsonProperty(Required = Required.AllowNull)]
35 | public DocumentoRelacionado GuiaBaja { get; set; }
36 |
37 | [JsonProperty(Required = Required.Always)]
38 | public string CodigoMotivoTraslado { get; set; }
39 |
40 | [JsonProperty(Required = Required.Always)]
41 | public string DescripcionMotivo { get; set; }
42 |
43 | [JsonProperty(Required = Required.Always)]
44 | public bool Transbordo { get; set; }
45 |
46 | [JsonProperty(Required = Required.Always)]
47 | public decimal PesoBrutoTotal { get; set; }
48 |
49 | public int NroPallets { get; set; }
50 |
51 | [JsonProperty(Required = Required.Always)]
52 | public string ModalidadTraslado { get; set; }
53 |
54 | [JsonProperty(Required = Required.Always)]
55 | public string FechaInicioTraslado { get; set; }
56 |
57 | public string RucTransportista { get; set; }
58 |
59 | public string RazonSocialTransportista { get; set; }
60 |
61 | public string NroPlacaVehiculo { get; set; }
62 |
63 | public string NroDocumentoConductor { get; set; }
64 |
65 | [JsonProperty(Required = Required.Always)]
66 | public Direccion DireccionPartida { get; set; }
67 |
68 | [JsonProperty(Required = Required.Always)]
69 | public Direccion DireccionLlegada { get; set; }
70 |
71 | public string NumeroContenedor { get; set; }
72 |
73 | public string CodigoPuerto { get; set; }
74 |
75 | [JsonProperty(Required = Required.Always)]
76 | public List BienesATransportar { get; set; }
77 |
78 | public string ShipmentId { get; set; }
79 | }
80 | }
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun/OpenInvoicePeru.Comun.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C6D3447F-6AED-4DA5-B28C-7C0356F2F4A8}
8 | Library
9 | Properties
10 | OpenInvoicePeru.Comun
11 | OpenInvoicePeru.Comun
12 | v4.7.1
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
60 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/billService1.wsdl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/billService.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/configuration.svcinfo:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/EnviarResumenController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Web.Http;
4 | using OpenInvoicePeru.Comun.Dto.Intercambio;
5 | using OpenInvoicePeru.Firmado;
6 | using OpenInvoicePeru.Servicio;
7 | using Swashbuckle.Swagger.Annotations;
8 |
9 | namespace OpenInvoicePeru.WebApi.Controllers
10 | {
11 | ///
12 | public class EnviarResumenController : ApiController
13 | {
14 | private readonly ISerializador _serializador;
15 | private readonly IServicioSunatDocumentos _servicioSunatDocumentos;
16 |
17 | ///
18 | public EnviarResumenController(ISerializador serializador, IServicioSunatDocumentos servicioSunatDocumentos)
19 | {
20 | _serializador = serializador;
21 | _servicioSunatDocumentos = servicioSunatDocumentos;
22 | }
23 |
24 | ///
25 | /// Envia el Resumen Diario/Comunicacion de Baja a SUNAT
26 | ///
27 | [HttpPost]
28 | [SwaggerResponse(200, "OK", typeof(EnviarResumenResponse))]
29 | [SwaggerResponse(400, "Bad Request", typeof(string))]
30 | [SwaggerResponse(209, "Conflicts", typeof(string))]
31 | public async Task Post([FromBody]EnviarDocumentoRequest request)
32 | {
33 | var response = new EnviarResumenResponse();
34 | var nombreArchivo = $"{request.Ruc}-{request.IdDocumento}";
35 |
36 | try
37 | {
38 | var tramaZip = await _serializador.GenerarZip(request.TramaXmlFirmado, nombreArchivo);
39 |
40 | _servicioSunatDocumentos.Inicializar(new ParametrosConexion
41 | {
42 | Ruc = request.Ruc,
43 | UserName = request.UsuarioSol,
44 | Password = request.ClaveSol,
45 | EndPointUrl = request.EndPointUrl
46 | });
47 |
48 | var resultado = _servicioSunatDocumentos.EnviarResumen(new DocumentoSunat
49 | {
50 | NombreArchivo = $"{nombreArchivo}.zip",
51 | TramaXml = tramaZip
52 | });
53 |
54 | if (resultado.Exito)
55 | {
56 | response.NroTicket = resultado.NumeroTicket;
57 | response.Exito = true;
58 | response.NombreArchivo = nombreArchivo;
59 | }
60 | else
61 | {
62 | response.MensajeError = resultado.MensajeError;
63 | response.Exito = false;
64 | }
65 | }
66 | catch (Exception ex)
67 | {
68 | response.MensajeError = ex.Message;
69 | response.Pila = ex.StackTrace;
70 | response.Exito = false;
71 | }
72 |
73 | return Ok(response);
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Comun/Constantes/ValoresUbl.cs:
--------------------------------------------------------------------------------
1 | namespace OpenInvoicePeru.Comun.Constantes
2 | {
3 | public static class ValoresUbl
4 | {
5 | public const string TipoOperacionSchemeName = "Tipo de Operacion";
6 | public const string SchemeAgencyName = "PE:SUNAT";
7 | public const string SchemeAgencyNameInei = "PE:INEI";
8 | public const string InvoiceTypeCodeName = "Tipo de Documento";
9 | public const string DocumentCurrencyCode = "ISO 4217 Alpha";
10 | public const string CurrencyListName = "Currency";
11 | public const string CurrencyAgencyName = "United Nations Economic Commission for Europe";
12 | public const string CompanySchemeName = "Documento de Identidad";
13 | public const string TaxCategorySchemeId = "UN/ECE 5350";
14 | public const string TaxCategorySchemeName = "Codigo de tributos";
15 | public const string QuantityCodeListId = "UN/ECE rec 20";
16 | public const string PriceTypeCodeListName = "Tipo de Precio";
17 | public const string TaxExemptionListName = "Afectacion del IGV";
18 | public const string TaxSchemeId = "UN/ECE 5153";
19 | public const string TaxSchemeName = "Tax Scheme Identifier";
20 | public const string PaymentMeansSchemeName = "Codigo de detraccion";
21 | public const string DiscrepancyDebitResponseCodeListName = "Tipo de nota de debito";
22 | public const string DiscrepancyResponseCodeListName = "Tipo de nota de credito";
23 | public const string AdditionalDocumentsSchemeName = "Documentos Relacionados";
24 | public const string UnspscListId = "UNSPSC";
25 | public const string UnspscListAgencyName = "GS1 US";
26 | public const string UnspscListName = "Item Classification";
27 | public const string InvoiceTypeCodeSchemeUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo01";
28 | public const string TaxSchemeSchemeUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo05";
29 | public const string CompanySchemeUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06";
30 | public const string TaxExemptionUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo07";
31 | public const string DiscrepancyResponseCodeListUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo09";
32 | public const string DiscrepancyDebitResponseCodeListUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo10";
33 | public const string AdditionalDocumentsSchemeUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo12";
34 | public const string PriceTypeCodeUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo16";
35 | public const string TipoOperacionSchemeUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo51";
36 | public const string AdditionalPropertyListUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo55";
37 | public const string AllowanceChargeReasonCodeListUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo53";
38 | public const string PaymentMeansSchemeUri = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo54";
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | # OpenInvoicePeru v3.0 #
3 | Esta es una versión gratuita de OpenInvoicePeru construido con C#, haciendo sencilla la Facturación Electrónica de SUNAT, este proyecto está orientado al desarrollador.
4 | Permite la generacion de XML, empaquetado, envío y recepción de documentos electrónicos a través de una API REST.
5 |
6 | [](https://frameworkperu.visualstudio.com/OpenInvoicePeruUBL21/_build/latest?definitionId=6)
7 | Si encuentra algún bug por favor reportarlo a la zona de [Issues](https://github.com/erickorlando/openinvoiceperu/issues).
8 |
9 | Para consultar las novedades y cambios del proyecto revise el [Control de Cambios](CHANGELOG.md)
10 |
11 | # Características #
12 | - Generación de XML los siguientes documentos electrónicos:
13 | - Facturas (UBL 2.1)
14 | - Boletas (UBL 2.1)
15 | - Notas de Crédito (UBL 2.1)
16 | - Notas de Débito (UBL 2.1)
17 | - Resumen Diario de Boletas
18 | - Comunicaciones de Baja
19 | - Retenciones
20 | - Percepciones
21 | - Guías de Remisión (UBL 2.1)
22 |
23 | - Firmado del XML con un certificado digital elegido por el usuario.
24 | - Envío al servicio Web de SUNAT de los documentos electrónicos generados (Beta y Producción).
25 | - Envío de Resumen Diario y Comunicación de Baja.
26 | - Desempaquetado y Lectura del contenido del CDR de SUNAT.
27 | - Consulta de Tickets de los Resúmenes y Bajas.
28 | - API REST bajo ASP.NET Web API 2.
29 |
30 | ### Cliente API REST de Ejemplo ###
31 | - Ejemplos en C# para el consumo de la API REST con PostSharp.
32 |
33 | ## Consideraciones ##
34 | - El proyecto se ha desarrollado con VS2019, usando como base el .NET Framework 4.7.1.
35 | - Se recomienda usar encarecidamente VS2019 o superior, la edición [Community Edition](https://www.visualstudio.com/downloads/download-visual-studio-vs), es gratis y mucho mejor que sus predecesores.
36 | Puede usar la versión Professional o Enterprise si lo desea.
37 |
38 | - Para poder ejecutar correctamente el proyecto **debe iniciar Visual Studio como Administrador** y tener instalado IIS 10.0 o posterior.
39 |
40 | ## Descargo de Responsabilidad ##
41 |
42 | Este software se entrega como tal y es libre de modificarlo a su gusto, copiarlo en su totalidad
43 | o de manera parcial, un agradecimiento público no cuesta nada.
44 |
45 | Así mismo no hay garantía expresa de este producto, cualquier inconveniente que se presente con SUNAT
46 | es enteramente responsabilidad del usuario al usar este Software.
47 |
48 | Si tiene errores con SUNAT fíjese en el código devuelto:
49 |
50 | - Del 0100 al 1999 Excepciones (Usuarios mal escritos, RUCs no validos, etc.).
51 | - Del 2000 al 3999 Errores que generan rechazo (Se envia pero rebota).
52 | - Del 4000 en adelante Observaciones (Correcciones menores).
53 |
54 | Si tiene mas dudas con SUNAT comuníquese con ellos al [+51 1 3150730](tel:+5113150730).
55 |
56 | ## Asesoría y Soporte ##
57 |
58 | Este proyecto no cuenta con soporte, por ello el código es libre para su revisión, reproducción total o parcial sin pago de regalías ni tampoco derecho a reclamos hacia el creador.
59 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Firmado/OpenInvoicePeru.Firmado.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1CFD1D28-D342-413D-A6E1-7616CB9708E2}
8 | Library
9 | Properties
10 | OpenInvoicePeru.Firmado
11 | OpenInvoicePeru.Firmado
12 | v4.7.1
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | TRACE;DEBUG
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | {54eb4da6-9a5b-4faf-9699-a5876fabd6c5}
51 | OpenInvoicePeru.Comun.Dto
52 |
53 |
54 | {c6d3447f-6aed-4da5-b28c-7c0356f2f4a8}
55 | OpenInvoicePeru.Comun
56 |
57 |
58 |
59 |
66 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service References/Documentos/billService.wsdl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/OpenInvoicePeru/OpenInvoicePeru.WebApi/Controllers/GenerarResumenDiarioController.cs:
--------------------------------------------------------------------------------
1 | using OpenInvoicePeru.Comun.Dto.Intercambio;
2 | using OpenInvoicePeru.Comun.Dto.Modelos;
3 | using OpenInvoicePeru.Firmado;
4 | using OpenInvoicePeru.Xml;
5 | using Swashbuckle.Swagger.Annotations;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Web.Http;
9 |
10 | namespace OpenInvoicePeru.WebApi.Controllers
11 | {
12 | ///
13 | [RoutePrefix("api/GenerarResumenDiario")]
14 | public class GenerarResumenDiarioController : ApiController
15 | {
16 | private IDocumentoXml _documentoXml;
17 | private readonly ISerializador _serializador;
18 |
19 | ///
20 | public GenerarResumenDiarioController(ISerializador serializador)
21 | {
22 | _serializador = serializador;
23 | _documentoXml = new ResumenDiarioNuevoXml();
24 | }
25 |
26 |
27 | ///
28 | /// Genera el XML para el Resumen Diario CustomizationID 1.0
29 | ///
30 | [Route("v1")]
31 | [HttpPost]
32 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
33 | [SwaggerResponse(400, "Bad Request", typeof(string))]
34 | [SwaggerResponse(209, "Conflicts", typeof(string))]
35 | public async Task Post([FromBody] ResumenDiario resumen)
36 | {
37 | var response = new DocumentoResponse();
38 | try
39 | {
40 | var summary = _documentoXml.Generar(resumen);
41 | response.TramaXmlSinFirma = await _serializador.GenerarXml(summary);
42 | response.Exito = true;
43 | }
44 | catch (Exception ex)
45 | {
46 | response.Exito = false;
47 | response.MensajeError = ex.Message;
48 | response.Pila = ex.StackTrace;
49 | }
50 |
51 | return Ok(response);
52 | }
53 |
54 | ///
55 | /// Genera el XML para el Resumen Diario CustomizationID 1.1
56 | ///
57 | [Route("v2")]
58 | [HttpPost]
59 | [SwaggerResponse(200, "OK", typeof(DocumentoResponse))]
60 | [SwaggerResponse(400, "Bad Request", typeof(string))]
61 | [SwaggerResponse(209, "Conflicts", typeof(string))]
62 | public async Task ResumenNuevo([FromBody] ResumenDiarioNuevo resumen)
63 | {
64 | var response = new DocumentoResponse();
65 | try
66 | {
67 | // Solucion temporal --> Issue #58
68 | _documentoXml = new ResumenDiarioNuevoXml();
69 | var summary = _documentoXml.Generar(resumen);
70 | response.TramaXmlSinFirma = await _serializador.GenerarXml(summary);
71 | response.Exito = true;
72 | }
73 | catch (Exception ex)
74 | {
75 | response.Exito = false;
76 | response.MensajeError = ex.Message;
77 | response.Pila = ex.StackTrace;
78 | }
79 |
80 | return Ok(response);
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------