adilsoncarvalho / barateza-nfcrawler

Crawler to get data from the NF-e and NFC-e
2 stars 1 forks source link

Split attribute onto a codigo/descricao pair #19

Open adilsoncarvalho opened 8 years ago

adilsoncarvalho commented 8 years ago

Create both a CodigoDescricaoItem and a CodigoDescricaoLoader that will read a single string and break it into a code and a description.

How they are

"destinatario": {  
  "consumidor_final": "1 - Consumidor final",
  "cpf": "022.366.409-00",
  "destino_operacao": "1 - Operação Interna",
  "presenca_comprador": "1 - Operação presencial"
},

How they must be

"destinatario": {  
  "consumidor_final": {
    "codigo": "1",
    "descricao": "Consumidor final"
  },
  "cpf": "022.366.409-00",
  "destino_operacao": {
    "codigo": "1",
    "descricao": "Operação Interna"
  },
  "presenca_comprador": {
    "codigo": "1",
    "descricao": "Operação presencial"
  }
},

How to find them on the code

# TODO break into codigo/descricao

Postponed on PR #5