Class: Ticketbai::Operations::Annulment

Inherits:
Ticketbai::Operation show all
Defined in:
lib/ticketbai/operations/annulment.rb

Constant Summary collapse

OPERATION_NAME =
:annulment
ATTRIBUTES =
%i[issuing_company_nif issuing_company_name invoice_serial invoice_number invoice_date].freeze

Instance Attribute Summary

Attributes inherited from Ticketbai::Operation

#company_cert

Instance Method Summary collapse

Methods inherited from Ticketbai::Operation

#create

Constructor Details

#initialize(**args) ⇒ Annulment

Returns a new instance of Annulment.

Parameters:

  • issuing_company_nif (String)

    NIF of the taxpayer’s company

  • issuing_company_name (String)

    Name of the taxpayer’s company

  • invoice_serial (String)

    Invoice’s serial number

  • invoice_number (String)

    Invoice’s number

  • invoice_date (String)

    Invoices emission date (Format: d-m-Y)

  • company_cert (String)

    The name of the certificate to be used for issuance



18
19
20
# File 'lib/ticketbai/operations/annulment.rb', line 18

def initialize(**args)
  super(args)
end

Instance Method Details

#build_documentObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ticketbai/operations/annulment.rb', line 22

def build_document
  @issuer = Ticketbai::Nodes::Issuer.new(issuing_company_nif: @issuing_company_nif, issuing_company_name: @issuing_company_name)

  @invoice_header = Ticketbai::Nodes::InvoiceHeader.new(
    invoice_serial: @invoice_serial,
    invoice_number: @invoice_number,
    invoice_date: @invoice_date
  )

  @software = Ticketbai::Nodes::Software.new

  Ticketbai::Documents::Annulment.new(
    issuer: @issuer,
    invoice_header: @invoice_header,
    software: @software
  ).create
end