Counterpart in SII Issued Invoices Using WCF

1

In version 07, the PersonaFisicaJuridicaType class does not have a member that is called NIF as it says the documentation of the AEAT. Therefore to define the NIF use IDOtroType. But there is no way. He answers me with the error 1104 Incorrect field value ID

PersonaFisicaJuridicaType LaContra = new PersonaFisicaJuridicaType() ;
LaContra.NombreRazon = NombreRazon ;
//-------------------------------
 IDOtroType ElOtro = new IDOtroType();
 ElOtro.CodigoPaisSpecified = true;
 ElOtro.CodigoPais = CountryType2.ES;
 ElOtro.IDType = PersonaFisicaJuridicaIDTypeType.Item02;
 ElOtro.ID = "23740800Q" ;
        //---------------------------
 LaContra.Item = ElOtro;
 LaFraExpedida.Contraparte = LaContra;
    
asked by M.Genol 15.06.2017 в 08:09
source

2 answers

1

The user pburgov explained it to you for Java, since I do not know what language you are doing, I explain to you how I did it in C #.

As long as the counterpart or issuer can be non-Spanish, the identifier is stored inside Item.

Item stores an object, which can be either a string or an IDOtro object.

If the counterpart is Spanish, and therefore has a nif, it would be as simple as:

PersonaFisicaJuridicaType LaContra = new PersonaFisicaJuridicaType() ;
LaContra.NombreRazon = NombreRazon ;
LaContra.Item = "23740800Q";
LaFraExpedida.Contraparte = LaContra;

On the other hand, if the counterpart is not Spanish, you must fill in the object IDOtro as you did.

PersonaFisicaJuridicaType LaContra = new PersonaFisicaJuridicaType() ;
LaContra.NombreRazon = NombreRazon ;
//-------------------------------
IDOtroType ElOtro = new IDOtroType();
ElOtro.CodigoPaisSpecified = true;
ElOtro.CodigoPais = CountryType2.ES;
ElOtro.IDType = PersonaFisicaJuridicaIDTypeType.Item02;
ElOtro.ID = "23740800Q" ;
//---------------------------
LaContra.Item = ElOtro;
LaFraExpedida.Contraparte = LaContra;

The error is probably due to the fact that you filled IDOtro (that is, a foreign identifier) but you defined it as CodigoPais a España.

    
answered by 22.06.2017 в 08:32
0

Good morning, it does have the NIF field, at least it appears to me in the implementation I'm doing in java. This is the java class as extracted from the SuministroFactEmitidas.wsdl file by the wsdl2java tool

public class PersonaFisicaJuridicaType {

@XmlElement(name = "NombreRazon", required = true)
protected String nombreRazon;
@XmlElement(name = "NIFRepresentante")
protected String nifRepresentante;
@XmlElement(name = "NIF")
protected String nif;
@XmlElement(name = "IDOtro")
protected IDOtroType idOtro;
//.........

/**
 * Obtiene el valor de la propiedad nif.
 * 
 * @return
 *     possible object is
 *     {@link String }
 *     
 */
public String getNIF() {
    return nif;
}

/**
 * Define el valor de la propiedad nif.
 * 
 * @param value
 *     allowed object is
 *     {@link String }
 *     
 */
public void setNIF(String value) {
    this.nif = value;
}
//Resto del código de la clase
}

And so I use it in the code that manages the shipment to the AEAT

private List<LRfacturasEmitidasType> getFacturas() {
    //Instanciamos un array para el detalle de las facturas
    List<LRfacturasEmitidasType> facturasEmitidasList = new ArrayList<>();
    for (Factura selectedData : selectedDataList) {
        /*
           Contraparte (PersonaFisicaJuridicaType) 
         */
        PersonaFisicaJuridicaType contraparte = new PersonaFisicaJuridicaType();
        contraparte.setNIF(selectedData.getContraparteNIF());
        contraparte.setNombreRazon(selectedData.getContraparteNombreRazon());
        if (!selectedData.getContraparteCountry().equalsIgnoreCase("ES")) {
            IDOtroType otroType = new IDOtroType();
            otroType.setCodigoPais(CountryType2.valueOf(selectedData.getContraparteCountry()));
            otroType.setIDType(selectedData.getIdType());
            otroType.setID(selectedData.getContraparteNIF());
            contraparte.setIDOtro(otroType);
            contraparte.setNIF(null);
        }
//.....
}
    
answered by 22.06.2017 в 08:07