Method: Facturama::Samples::SampleApiMulti#sample_cfdis
- Defined in:
- lib/samples/sample_api_multi.rb
#sample_cfdis(facturama) ⇒ Object
EJEMPLO DEL SERVICIO DE CFDI
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/samples/sample_api_multi.rb', line 149 def sample_cfdis( facturama ) puts "===== Ejemplo de CFDI - Inicio =====" # Creacion del cfdi en su forma general (sin items / productos) asociados cfdi = sample_cfdis_create(facturama) cfdi_uuid = cfdi['Complement']['TaxStamp']['Uuid'] puts "Se creó exitosamente el cfdi con el folio fiscal: " + cfdi_uuid # Descarga de los arvhivos PDF y XML del cfdi recien creado file_path = "factura" + cfdi_uuid facturama.cfdis.save_pdf( file_path + ".pdf", cfdi['Id']) facturama.cfdis.save_xml( file_path + ".xml", cfdi['Id']) # Envio del cfdi por correo if facturama.cfdis.send_by_mail(cfdi['Id'], "[email protected]", "Factura del servicio" ) puts "Se envió por correo exitosamente el cfdi con el folio fiscal: " + cfdi_uuid end # Se elmina el cfdi recien creado facturama.cfdis.remove(cfdi['Id']) puts "Se elminó exitosamente el cfdi con el folio fiscal: " + cfdi_uuid # Consulta de cfdi por palabra clave o Rfc lst_by_rfc = facturama.cfdis.list_by_rfc("ESO1202108R2") lst_by_keyword = facturama.cfdis.list_by_keyword("Software") puts "Se obtiene la lista de facturas por RFC: #{lst_by_rfc.length}" puts "Se obtiene la lista de facturas por KEYWORD: #{lst_by_keyword.length}" puts "===== Ejemplo de CFDI - Fin =====" end |