Class: VerifactuRails::RegistroAnulacion
- Inherits:
-
Object
- Object
- VerifactuRails::RegistroAnulacion
- Defined in:
- lib/verifactu_rails/registro.rb
Overview
Registro de facturación de ANULACIÓN.
Constant Summary collapse
- RECHAZOS_PREVIOS =
A diferencia del alta, aquí RechazoPrevio NO admite "X": ese valor existe para subsanar altas que no constan en la AEAT, y una anulación de algo que no consta se expresa con SinRegistroPrevio.
%w[N S].freeze
Instance Attribute Summary collapse
-
#fecha_expedicion ⇒ Object
readonly
Returns the value of attribute fecha_expedicion.
-
#fecha_hora_gen ⇒ Object
readonly
Returns the value of attribute fecha_hora_gen.
-
#id_emisor ⇒ Object
readonly
Returns the value of attribute id_emisor.
-
#num_serie ⇒ Object
readonly
Returns the value of attribute num_serie.
-
#rechazo_previo ⇒ Object
readonly
Returns the value of attribute rechazo_previo.
-
#sin_registro_previo ⇒ Object
readonly
Returns the value of attribute sin_registro_previo.
-
#sistema_informatico ⇒ Object
readonly
Returns the value of attribute sistema_informatico.
Instance Method Summary collapse
- #construir(xml, anterior:) ⇒ Object
-
#huella(anterior:) ⇒ Object
Una anulación nunca puede iniciar la cadena, así que
anteriores obligatorio. -
#initialize(id_emisor:, num_serie:, fecha_expedicion:, sistema_informatico:, fecha_hora_gen:, sin_registro_previo: nil, rechazo_previo: nil) ⇒ RegistroAnulacion
constructor
A new instance of RegistroAnulacion.
Constructor Details
#initialize(id_emisor:, num_serie:, fecha_expedicion:, sistema_informatico:, fecha_hora_gen:, sin_registro_previo: nil, rechazo_previo: nil) ⇒ RegistroAnulacion
Returns a new instance of RegistroAnulacion.
782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'lib/verifactu_rails/registro.rb', line 782 def initialize(id_emisor:, num_serie:, fecha_expedicion:, sistema_informatico:, fecha_hora_gen:, sin_registro_previo: nil, rechazo_previo: nil) @id_emisor = Formato.nif(id_emisor, 'IDEmisorFacturaAnulada') @num_serie = Formato.num_serie(num_serie, 'NumSerieFacturaAnulada') @fecha_expedicion = Formato.fecha(fecha_expedicion) @sistema_informatico = Formato.objeto(sistema_informatico, 'sistema_informatico', SistemaInformatico) @fecha_hora_gen = Formato.marca_temporal(fecha_hora_gen) @sin_registro_previo = Formato.si_no(sin_registro_previo, 'SinRegistroPrevio') @rechazo_previo = rechazo_previo && Formato.enumerado(rechazo_previo, 'RechazoPrevio', RECHAZOS_PREVIOS) end |
Instance Attribute Details
#fecha_expedicion ⇒ Object (readonly)
Returns the value of attribute fecha_expedicion.
775 776 777 |
# File 'lib/verifactu_rails/registro.rb', line 775 def fecha_expedicion @fecha_expedicion end |
#fecha_hora_gen ⇒ Object (readonly)
Returns the value of attribute fecha_hora_gen.
775 776 777 |
# File 'lib/verifactu_rails/registro.rb', line 775 def fecha_hora_gen @fecha_hora_gen end |
#id_emisor ⇒ Object (readonly)
Returns the value of attribute id_emisor.
775 776 777 |
# File 'lib/verifactu_rails/registro.rb', line 775 def id_emisor @id_emisor end |
#num_serie ⇒ Object (readonly)
Returns the value of attribute num_serie.
775 776 777 |
# File 'lib/verifactu_rails/registro.rb', line 775 def num_serie @num_serie end |
#rechazo_previo ⇒ Object (readonly)
Returns the value of attribute rechazo_previo.
775 776 777 |
# File 'lib/verifactu_rails/registro.rb', line 775 def rechazo_previo @rechazo_previo end |
#sin_registro_previo ⇒ Object (readonly)
Returns the value of attribute sin_registro_previo.
775 776 777 |
# File 'lib/verifactu_rails/registro.rb', line 775 def sin_registro_previo @sin_registro_previo end |
#sistema_informatico ⇒ Object (readonly)
Returns the value of attribute sistema_informatico.
775 776 777 |
# File 'lib/verifactu_rails/registro.rb', line 775 def sistema_informatico @sistema_informatico end |
Instance Method Details
#construir(xml, anterior:) ⇒ Object
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 |
# File 'lib/verifactu_rails/registro.rb', line 807 def construir(xml, anterior:) propia = huella(anterior: anterior) xml['sum1'].RegistroAnulacion do xml['sum1'].IDVersion IDVERSION xml['sum1'].IDFactura do xml['sum1'].IDEmisorFacturaAnulada id_emisor xml['sum1'].NumSerieFacturaAnulada num_serie xml['sum1'].FechaExpedicionFacturaAnulada fecha_expedicion end xml['sum1'].SinRegistroPrevio sin_registro_previo if sin_registro_previo xml['sum1'].RechazoPrevio rechazo_previo if rechazo_previo xml['sum1'].Encadenamiento do xml['sum1'].RegistroAnterior do anterior.a_pares.each { |campo, valor| xml['sum1'].send(campo, valor) } end end xml['sum1'].SistemaInformatico do sistema_informatico.a_pares.each { |campo, valor| xml['sum1'].send(campo, valor) } end xml['sum1'].FechaHoraHusoGenRegistro fecha_hora_gen xml['sum1'].TipoHuella TIPO_HUELLA xml['sum1'].Huella propia end end |
#huella(anterior:) ⇒ Object
Una anulación nunca puede iniciar la cadena, así que anterior es
obligatorio. Huella.anulacion ya lo exige; lo repetimos aquí para fallar
antes de construir nada.
799 800 801 802 803 804 805 |
# File 'lib/verifactu_rails/registro.rb', line 799 def huella(anterior:) Huella.anulacion( id_emisor: id_emisor, num_serie: num_serie, fecha_expedicion: fecha_expedicion, fecha_hora_gen: fecha_hora_gen, huella_anterior: anterior&.huella ) end |