Class: Ticketbai::Operations::IssuanceUnsigned
- Inherits:
-
Object
- Object
- Ticketbai::Operations::IssuanceUnsigned
- Defined in:
- lib/ticketbai/operations/issuance_unsigned.rb
Overview
In this operation, the document is not signed and it is not encoded in Base64 when making the request to the API as issuance and annulment operations, instead it is directly appended to the tag FacturaEmitida of the api payload document.
Constant Summary collapse
- OPERATION_NAME =
:issuance_unsigned
Instance Attribute Summary collapse
-
#invoice_amount ⇒ Object
readonly
Factura > TipoDesglose.
-
#invoice_date ⇒ Object
readonly
Factura > CabeceraFactura.
-
#invoice_description ⇒ Object
readonly
Factura > DatosFactura.
-
#invoice_number ⇒ Object
readonly
Factura > CabeceraFactura.
-
#invoice_serial ⇒ Object
readonly
Factura > CabeceraFactura.
-
#invoice_time ⇒ Object
readonly
Factura > CabeceraFactura.
-
#invoice_total ⇒ Object
readonly
Factura > DatosFactura.
-
#invoice_vat ⇒ Object
readonly
Factura > TipoDesglose.
-
#invoice_vat_key ⇒ Object
readonly
Factura > DatosFactura.
-
#invoice_vat_total ⇒ Object
readonly
Factura > TipoDesglose.
-
#receiver_name ⇒ Object
readonly
Sujetos > Destinatario.
-
#receiver_nif ⇒ Object
readonly
Sujetos > Destinatario.
Instance Method Summary collapse
- #build_document ⇒ Object
- #create ⇒ Object
-
#initialize(**args) ⇒ IssuanceUnsigned
constructor
A new instance of IssuanceUnsigned.
Constructor Details
#initialize(**args) ⇒ IssuanceUnsigned
Returns a new instance of IssuanceUnsigned.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 33 def initialize(**args) @receiver_nif = args[:receiver_nif].strip @receiver_name = args[:receiver_name] @receiver_country = args[:receiver_country]&.upcase || 'ES' @receiver_in_eu = args[:receiver_in_eu] @invoice_serial = args[:invoice_serial] @invoice_number = args[:invoice_number] @invoice_date = args[:invoice_date] @simplified_invoice = args[:simplified_invoice] @invoice_description = args[:invoice_description] @invoice_total = args[:invoice_total] @invoice_vat_key = args[:invoice_vat_key] @invoice_amount = args[:invoice_amount] @invoice_vat = args[:invoice_vat] @invoice_vat_total = args[:invoice_vat_total] end |
Instance Attribute Details
#invoice_amount ⇒ Object (readonly)
Factura > TipoDesglose
13 14 15 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 13 def invoice_amount @invoice_amount end |
#invoice_date ⇒ Object (readonly)
Factura > CabeceraFactura
9 10 11 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 9 def invoice_date @invoice_date end |
#invoice_description ⇒ Object (readonly)
Factura > DatosFactura
11 12 13 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 11 def invoice_description @invoice_description end |
#invoice_number ⇒ Object (readonly)
Factura > CabeceraFactura
9 10 11 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 9 def invoice_number @invoice_number end |
#invoice_serial ⇒ Object (readonly)
Factura > CabeceraFactura
9 10 11 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 9 def invoice_serial @invoice_serial end |
#invoice_time ⇒ Object (readonly)
Factura > CabeceraFactura
9 10 11 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 9 def invoice_time @invoice_time end |
#invoice_total ⇒ Object (readonly)
Factura > DatosFactura
11 12 13 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 11 def invoice_total @invoice_total end |
#invoice_vat ⇒ Object (readonly)
Factura > TipoDesglose
13 14 15 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 13 def invoice_vat @invoice_vat end |
#invoice_vat_key ⇒ Object (readonly)
Factura > DatosFactura
11 12 13 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 11 def invoice_vat_key @invoice_vat_key end |
#invoice_vat_total ⇒ Object (readonly)
Factura > TipoDesglose
13 14 15 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 13 def invoice_vat_total @invoice_vat_total end |
#receiver_name ⇒ Object (readonly)
Sujetos > Destinatario
7 8 9 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 7 def receiver_name @receiver_name end |
#receiver_nif ⇒ Object (readonly)
Sujetos > Destinatario
7 8 9 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 7 def receiver_nif @receiver_nif end |
Instance Method Details
#build_document ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 54 def build_document if @receiver_nif && @receiver_name @receiver = Ticketbai::Nodes::Receiver.new(receiver_country: @receiver_country, receiver_nif: @receiver_nif, receiver_name: @receiver_name) end @invoice_header = Ticketbai::Nodes::InvoiceHeader.new( invoice_serial: @invoice_serial, invoice_number: @invoice_number, invoice_date: @invoice_date, invoice_time: @invoice_time, simplified_invoice: @simplified_invoice ) @invoice_data = Ticketbai::Nodes::InvoiceData.new( invoice_description: @invoice_description, invoice_total: @invoice_total, invoice_vat_key: @invoice_vat_key ) @breakdown_type = Ticketbai::Nodes::BreakdownType.new( receiver_country: @receiver_country, invoice_amount: @invoice_amount, invoice_vat: @invoice_vat, invoice_vat_total: @invoice_vat_total, receiver_in_eu: @receiver_in_eu, simplified_invoice: @simplified_invoice ) Ticketbai::Documents::IssuanceUnsigned.new( receiver: @receiver, invoice_header: @invoice_header, invoice_data: @invoice_data, breakdown_type: @breakdown_type ).create end |
#create ⇒ Object
50 51 52 |
# File 'lib/ticketbai/operations/issuance_unsigned.rb', line 50 def create build_document end |