139 lines
5.2 KiB
Go
139 lines
5.2 KiB
Go
package verifactu
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"fmt"
|
|
)
|
|
|
|
type AltaRequest struct {
|
|
Cabecera Cabecera `xml:"sum:RegFactuSistemaFacturacion>sum:Cabecera"`
|
|
RegistroAlta RegistroAlta `xml:"sum:RegFactuSistemaFacturacion>sum:RegistroFactura>sum1:RegistroAlta"`
|
|
}
|
|
|
|
type Cabecera struct {
|
|
ObligadoEmision ObligadoEmision `xml:"sum1:ObligadoEmision"`
|
|
}
|
|
|
|
type ObligadoEmision struct {
|
|
NombreRazon string `xml:"sum1:NombreRazon"`
|
|
NIF string `xml:"sum1:NIF"`
|
|
}
|
|
|
|
type RegistroAlta struct {
|
|
IDVersion string `xml:"sum1:IDVersion"`
|
|
IDFactura IDFactura `xml:"sum1:IDFactura"`
|
|
NombreRazonEmisor string `xml:"sum1:NombreRazonEmisor"`
|
|
TipoFactura string `xml:"sum1:TipoFactura"`
|
|
DescripcionOperacion string `xml:"sum1:DescripcionOperacion"`
|
|
Destinatarios *Destinatarios `xml:"sum1:Desglose>sum1:DetalleDesglose"`
|
|
Desglose Desglose `xml:"sum1:Desglose"`
|
|
CuotaTotal string `xml:"sum1:CuotaTotal"`
|
|
ImporteTotal string `xml:"sum1:ImporteTotal"`
|
|
Encadenamiento Encadenamiento `xml:"sum1:Encadenamiento"`
|
|
SistemaInformatico SistemaInformatico `xml:"sum1:SistemaInformatico"`
|
|
FechaHoraHusoGenRegistro string `xml:"sum1:FechaHoraHusoGenRegistro"`
|
|
TipoHuella string `xml:"sum1:TipoHuella"`
|
|
Huella string `xml:"sum1:Huella"`
|
|
}
|
|
|
|
type IDFactura struct {
|
|
IDEmisorFactura string `xml:"sum1:IDEmisorFactura"`
|
|
NumSerieFactura string `xml:"sum1:NumSerieFactura"`
|
|
FechaExpedicionFactura string `xml:"sum1:FechaExpedicionFactura"`
|
|
}
|
|
|
|
type Destinatarios struct {
|
|
IDDestinatario []IDDestinatario `xml:"sum1:IDDestinatario"`
|
|
}
|
|
|
|
type IDDestinatario struct {
|
|
NombreRazon string `xml:"sum1:NombreRazon"`
|
|
NIF string `xml:"sum1:NIF"`
|
|
}
|
|
|
|
type Desglose struct {
|
|
DetalleDesglose []DetalleDesglose `xml:"sum1:DetalleDesglose"`
|
|
}
|
|
|
|
type DetalleDesglose struct {
|
|
ClaveRegimen string `xml:"sum1:ClaveRegimen"`
|
|
CalificacionOperacion string `xml:"sum1:CalificacionOperacion"`
|
|
TipoImpositivo string `xml:"sum1:TipoImpositivo"`
|
|
BaseImponibleOimporteNoSujeto string `xml:"sum1:BaseImponibleOimporteNoSujeto"`
|
|
CuotaRepercutida string `xml:"sum1:CuotaRepercutida"`
|
|
}
|
|
|
|
type Encadenamiento struct {
|
|
PrimerRegistro string `xml:"sum1:PrimerRegistro,omitempty"`
|
|
RegistroAnterior *RegistroAnterior `xml:"sum1:RegistroAnterior,omitempty"`
|
|
}
|
|
|
|
type RegistroAnterior struct {
|
|
IDEmisorFactura string `xml:"sum1:IDEmisorFactura"`
|
|
NumSerieFactura string `xml:"sum1:NumSerieFactura"`
|
|
FechaExpedicionFactura string `xml:"sum1:FechaExpedicionFactura"`
|
|
Huella string `xml:"sum1:Huella"`
|
|
}
|
|
|
|
type SistemaInformatico struct {
|
|
NombreRazon string `xml:"sum1:NombreRazon"`
|
|
NIF string `xml:"sum1:NIF"`
|
|
NombreSistemaInformatico string `xml:"sum1:NombreSistemaInformatico"`
|
|
IdSistemaInformatico string `xml:"sum1:IdSistemaInformatico"`
|
|
Version string `xml:"sum1:Version"`
|
|
NumeroInstalacion string `xml:"sum1:NumeroInstalacion"`
|
|
TipoUsoPosibleSoloVerifactu string `xml:"sum1:TipoUsoPosibleSoloVerifactu"`
|
|
TipoUsoPosibleMultiOT string `xml:"sum1:TipoUsoPosibleMultiOT"`
|
|
IndicadorMultiplesOT string `xml:"sum1:IndicadorMultiplesOT"`
|
|
}
|
|
|
|
type AnulacionRequest struct {
|
|
Cabecera Cabecera `xml:"sum:RegFactuSistemaFacturacion>sum:Cabecera"`
|
|
RegistroAnulacion RegistroAnulacion `xml:"sum:RegFactuSistemaFacturacion>sum:RegistroFactura>sum1:RegistroAnulacion"`
|
|
}
|
|
|
|
type RegistroAnulacion struct {
|
|
IDVersion string `xml:"sum1:IDVersion"`
|
|
IDFacturaAnulada IDFacturaAnulada `xml:"sum1:IDFacturaAnulada"`
|
|
Encadenamiento Encadenamiento `xml:"sum1:Encadenamiento"`
|
|
SistemaInformatico SistemaInformatico `xml:"sum1:SistemaInformatico"`
|
|
FechaHoraHusoGenRegistro string `xml:"sum1:FechaHoraHusoGenRegistro"`
|
|
TipoHuella string `xml:"sum1:TipoHuella"`
|
|
Huella string `xml:"sum1:Huella"`
|
|
}
|
|
|
|
type IDFacturaAnulada struct {
|
|
IDEmisorFacturaAnulada string `xml:"sum1:IDEmisorFacturaAnulada"`
|
|
NumSerieFacturaAnulada string `xml:"sum1:NumSerieFacturaAnulada"`
|
|
FechaExpedicionFacturaAnulada string `xml:"sum1:FechaExpedicionFacturaAnulada"`
|
|
}
|
|
|
|
type Response struct {
|
|
XMLName xml.Name `xml:"Envelope"`
|
|
Body ResponseBody
|
|
}
|
|
|
|
type ResponseBody struct {
|
|
XMLName xml.Name `xml:"Body"`
|
|
Fault *Fault `xml:"Fault,omitempty"`
|
|
RegistroRespuesta *RegistroRespuesta `xml:"RegistroRespuesta,omitempty"`
|
|
}
|
|
|
|
type Fault struct {
|
|
FaultCode string `xml:"faultcode"`
|
|
FaultString string `xml:"faultstring"`
|
|
}
|
|
|
|
type RegistroRespuesta struct {
|
|
CSV string `xml:"CSV"`
|
|
Estado string `xml:"Estado"`
|
|
}
|
|
|
|
func BuildAltaRequest(emisorNombre string, data interface{}) (*AltaRequest, error) {
|
|
return nil, fmt.Errorf("not implemented")
|
|
}
|
|
|
|
func BuildAnulacionRequest(emisorNombre string, data interface{}) (*AnulacionRequest, error) {
|
|
return nil, fmt.Errorf("not implemented")
|
|
}
|