class SunatInvoice::CreditNote

Attributes

description[RW]
ref_document_number[RW]
ref_document_type[RW]
response_code[RW]

Public Instance Methods

xml() click to toggle source
# File lib/sunat_invoice/credit_note.rb, line 22
def xml
  build = build_xml do |xml|
    build_document_data(xml)
    build_discrepancy_response(xml)
    build_billing_reference(xml)
    build_common_content(xml)
  end
  @signature.sign(build.to_xml)
end

Private Instance Methods

build_billing_reference(xml) click to toggle source
# File lib/sunat_invoice/credit_note.rb, line 50
def build_billing_reference(xml)
  xml['cac'].BillingReference do
    xml['cac'].InvoiceDocumentReference do
      xml['cbc'].ID ref_document_number
      xml['cbc'].DocumentTypeCode ref_document_type
    end
  end
end
build_discrepancy_response(xml) click to toggle source
# File lib/sunat_invoice/credit_note.rb, line 42
def build_discrepancy_response(xml)
  xml['cac'].DiscrepancyResponse do
    xml['cbc'].ReferenceID ref_document_number
    xml['cbc'].ResponseCode response_code # CATALOG_09
    xml['cbc'].Description description
  end
end
namespaces() click to toggle source
# File lib/sunat_invoice/credit_note.rb, line 38
def namespaces
  CREDIT_NOTE_NAMESPACES.merge(TRADE_NAMESPACES)
end
root_name() click to toggle source
# File lib/sunat_invoice/credit_note.rb, line 34
def root_name
  'CreditNote'
end