class SunatInvoice::Provider
Attributes
cert_file[RW]
certificate file path
pk_file[RW]
public key file path
signature_id[RW]
signature identification
signature_location_id[RW]
Id for signature element in xml document
Public Instance Methods
info(xml, with_address = true)
click to toggle source
# File lib/sunat_invoice/provider.rb, line 22 def info(xml, with_address = true) xml['cac'].AccountingSupplierParty do xml['cbc'].CustomerAssignedAccountID ruc xml['cbc'].AdditionalAccountID document_type build_party_xml(xml, with_address) end end
Private Instance Methods
address(xml)
click to toggle source
# File lib/sunat_invoice/provider.rb, line 40 def address(xml) xml['cbc'].ID @ubigeo xml['cbc'].StreetName @street xml['cbc'].CitySubdivisionName @zone xml['cbc'].CityName @province xml['cbc'].CountrySubentity @department xml['cbc'].District @district build_country(xml) end
build_country(xml)
click to toggle source
# File lib/sunat_invoice/provider.rb, line 50 def build_country(xml) xml['cac'].Country do xml['cbc'].IdentificationCode country_code end end
build_name(xml)
click to toggle source
# File lib/sunat_invoice/provider.rb, line 56 def build_name(xml) xml['cac'].PartyName do xml['cbc'].Name commercial_name end end
build_party_xml(xml, with_address)
click to toggle source
# File lib/sunat_invoice/provider.rb, line 32 def build_party_xml(xml, with_address) xml['cac'].Party do build_name(xml) if commercial_name xml['cac'].PostalAddress { address(xml) } if with_address build_registration_name(xml) end end
build_registration_name(xml)
click to toggle source
# File lib/sunat_invoice/provider.rb, line 62 def build_registration_name(xml) xml['cac'].PartyLegalEntity do xml['cbc'].RegistrationName name end end