ipiranga-inovai-project-lib 0.9__py3-none-any.whl → 1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. inovai/models/Endereco.py +101 -0
  2. inovai/models/NFe.py +474 -0
  3. inovai/models/NFeBoleto.py +218 -0
  4. inovai/models/NFeCartao.py +62 -0
  5. inovai/models/NFeDetalhePagamento.py +67 -0
  6. inovai/models/NFeDocImportacao.py +117 -0
  7. inovai/models/NFeDocImportacaoAdicao.py +66 -0
  8. inovai/models/NFeDocRef.py +82 -0
  9. inovai/models/NFeDuplicata.py +58 -0
  10. inovai/models/NFeEnvioXML.py +66 -0
  11. inovai/models/NFeEnvolvido.py +108 -0
  12. inovai/models/NFeExportacao.py +58 -0
  13. inovai/models/NFeFatura.py +62 -0
  14. inovai/models/NFeImposto.py +232 -0
  15. inovai/models/NFeImpostoRetido.py +114 -0
  16. inovai/models/NFeIntermediadorTransacao.py +54 -0
  17. inovai/models/NFeItem.py +252 -0
  18. inovai/models/NFeItemDadosCombustivel.py +79 -0
  19. inovai/models/NFeItemExportacao.py +94 -0
  20. inovai/models/NFeItemOrigemCombustivel.py +57 -0
  21. inovai/models/NFeObservacao.py +58 -0
  22. inovai/models/NFeObservacaoItem.py +58 -0
  23. inovai/models/NFeOrigem.py +58 -0
  24. inovai/models/NFePagamento.py +55 -0
  25. inovai/models/NFeProcReferenciado.py +58 -0
  26. inovai/models/NFeTransporte.py +78 -0
  27. inovai/models/NFeVeiculo.py +62 -0
  28. inovai/models/NFeVolume.py +74 -0
  29. inovai/models/__init__.py +0 -0
  30. {ipiranga_inovai_project_lib-0.9.dist-info → ipiranga_inovai_project_lib-1.0.dist-info}/METADATA +1 -1
  31. ipiranga_inovai_project_lib-1.0.dist-info/RECORD +37 -0
  32. ipiranga_inovai_project_lib-0.9.dist-info/RECORD +0 -8
  33. {ipiranga_inovai_project_lib-0.9.dist-info → ipiranga_inovai_project_lib-1.0.dist-info}/LICENSE +0 -0
  34. {ipiranga_inovai_project_lib-0.9.dist-info → ipiranga_inovai_project_lib-1.0.dist-info}/WHEEL +0 -0
  35. {ipiranga_inovai_project_lib-0.9.dist-info → ipiranga_inovai_project_lib-1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,252 @@
1
+ from domain.models.NFeDocImportacao import NFeDocImportacao
2
+ from domain.models.NFeImposto import NFeImposto
3
+ from domain.models.NFeItemDadosCombustivel import NFeItemDadosCombustivel
4
+ from domain.models.NFeItemExportacao import NFeItemExportacao
5
+ from domain.models.NFeObservacaoItem import NFeObservacaoItem
6
+ import xml.etree.ElementTree as ET
7
+
8
+ class NFeItem:
9
+ DIs: [NFeDocImportacao]
10
+ cBarra: str
11
+ cBarraTrib: str
12
+ cEAN: str
13
+ cEANTrib: str
14
+ cest: str
15
+ cfop: str
16
+ codBeneficioFiscal: str
17
+ codConta: str
18
+ codFisJuridicaRef: str
19
+ codigoServLei116: str
20
+ dadosCombustivel: NFeItemDadosCombustivel
21
+ dadosExportacao: [NFeItemExportacao]
22
+ dadosObservacaoItem: [NFeObservacaoItem]
23
+ exTIPI: str
24
+ impostos: [NFeImposto]
25
+ impostosDevolvidos: [NFeImposto]
26
+ indFisJuridicaRef: int
27
+ indProduto: str
28
+ indTipoReferencia: str
29
+ item: int
30
+ nbm: str
31
+ ncm: str
32
+ numItemRef: int
33
+ numeroFCI: str
34
+ nve: str
35
+ pedidoExternoItem: int
36
+ pedidoExternoNumero: str
37
+ percentualDevolvido: float
38
+ produtoCodigo: str
39
+ produtoInfo: str
40
+ produtoNome: str
41
+ qtdDevolucaoRef: float
42
+ quantidade: float
43
+ quantidadeTrib: float
44
+ unidadeMedida: str
45
+ unidadeMedidaTrib: str
46
+ valorDesconto: float
47
+ valorDespAduaneira: float
48
+ valorFrete: float
49
+ valorIOF: float
50
+ valorOutros: float
51
+ valorSeguro: float
52
+ valorTotal: float
53
+ valorTotalTrib: float
54
+ valorUnitario: float
55
+ valorUnitarioTrib: float
56
+
57
+ def __init__(self, **json):
58
+ if json:
59
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
60
+ # str, float, bool, int
61
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
62
+
63
+ if key in json:
64
+ if isinstance(typeProp, list):
65
+ cls = globals()[class_name]
66
+ items = []
67
+ for item_data in json[key]:
68
+ item = cls(**item_data)
69
+ items.append(item)
70
+ setattr(self, key, items)
71
+ elif class_name not in ('str', 'int', 'float', 'bool'):
72
+ cls = globals()[class_name]
73
+ instance = cls(**json[key])
74
+ setattr(self, key, instance)
75
+ else:
76
+ setattr(self, key, str(json[key]))
77
+ else:
78
+ if isinstance(typeProp, list):
79
+ # cls = globals()[class_name]
80
+ items = []
81
+ setattr(self, key, items)
82
+ elif class_name not in ('str', 'int', 'float', 'bool'):
83
+ cls = globals()[class_name]
84
+ instance = cls()
85
+ setattr(self, key, instance)
86
+ else:
87
+ setattr(self, key, '')
88
+ else:
89
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
90
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
91
+ if isinstance(typeProp, list):
92
+ # cls = globals()[class_name]
93
+ items = []
94
+ setattr(self, key, items)
95
+ elif class_name not in ('str', 'int', 'float', 'bool'):
96
+ cls = globals()[class_name]
97
+ instance = cls()
98
+ setattr(self, key, instance)
99
+ else:
100
+ setattr(self, key, '')
101
+
102
+ def get_DIs(self):
103
+ return self.DIs
104
+
105
+ def get_cBarra(self):
106
+ return self.cBarra
107
+
108
+ def get_cBarraTrib(self):
109
+ return self.cBarraTrib
110
+
111
+ def get_cEAN(self):
112
+ return self.cEAN
113
+
114
+ def get_cEANTrib(self):
115
+ return self.cEANTrib
116
+
117
+ def get_cest(self):
118
+ return self.cest
119
+
120
+ def get_cfop(self):
121
+ return self.cfop
122
+
123
+ def get_codBeneficioFiscal(self):
124
+ return self.codBeneficioFiscal
125
+
126
+ def get_codConta(self):
127
+ return self.codConta
128
+
129
+ def get_codFisJuridicaRef(self):
130
+ return self.codFisJuridicaRef
131
+
132
+ def get_codigoServLei116(self):
133
+ return self.codigoServLei116
134
+
135
+ def get_dadosCombustivel(self):
136
+ return self.dadosCombustivel
137
+
138
+ def get_dadosExportacao(self):
139
+ return self.dadosExportacao
140
+
141
+ def get_dadosObservacaoItem(self):
142
+ return self.dadosObservacaoItem
143
+
144
+ def get_exTIPI(self):
145
+ return self.exTIPI
146
+
147
+ def get_impostos(self):
148
+ return self.impostos
149
+
150
+ def get_impostosDevolvidos(self):
151
+ return self.impostosDevolvidos
152
+
153
+ def get_indFisJuridicaRef(self):
154
+ return self.indFisJuridicaRef
155
+
156
+ def get_indProduto(self):
157
+ return self.indProduto
158
+
159
+ def get_indTipoReferencia(self):
160
+ return self.indTipoReferencia
161
+
162
+ def get_item(self):
163
+ return self.item
164
+
165
+ def get_nbm(self):
166
+ return self.nbm
167
+
168
+ def get_ncm(self):
169
+ return self.ncm
170
+
171
+ def get_numItemRef(self):
172
+ return self.numItemRef
173
+
174
+ def get_numeroFCI(self):
175
+ return self.numeroFCI
176
+
177
+ def get_nve(self):
178
+ return self.nve
179
+
180
+ def get_pedidoExternoItem(self):
181
+ return self.pedidoExternoItem
182
+
183
+ def get_pedidoExternoNumero(self):
184
+ return self.pedidoExternoNumero
185
+
186
+ def get_percentualDevolvido(self):
187
+ return self.percentualDevolvido
188
+
189
+ def get_produtoCodigo(self):
190
+ return self.produtoCodigo
191
+
192
+ def get_produtoInfo(self):
193
+ return self.produtoInfo
194
+
195
+ def get_produtoNome(self):
196
+ return self.produtoNome
197
+
198
+ def get_qtdDevolucaoRef(self):
199
+ return self.qtdDevolucaoRef
200
+
201
+ def get_quantidade(self):
202
+ return self.quantidade
203
+
204
+ def get_quantidadeTrib(self):
205
+ return self.quantidadeTrib
206
+
207
+ def get_unidadeMedida(self):
208
+ return self.unidadeMedida
209
+
210
+ def get_unidadeMedidaTrib(self):
211
+ return self.unidadeMedidaTrib
212
+
213
+ def get_valorDesconto(self):
214
+ return self.valorDesconto
215
+
216
+ def get_valorDespAduaneira(self):
217
+ return self.valorDespAduaneira
218
+
219
+ def get_valorFrete(self):
220
+ return self.valorFrete
221
+
222
+ def get_valorIOF(self):
223
+ return self.valorIOF
224
+
225
+ def get_valorOutros(self):
226
+ return self.valorOutros
227
+
228
+ def get_valorSeguro(self):
229
+ return self.valorSeguro
230
+
231
+ def get_valorTotal(self):
232
+ return self.valorTotal
233
+
234
+ def get_valorTotalTrib(self):
235
+ return self.valorTotalTrib
236
+
237
+ def get_valorUnitario(self):
238
+ return self.valorUnitario
239
+
240
+ def get_valorUnitarioTrib(self):
241
+ return self.valorUnitarioTrib
242
+
243
+ def to_xml(self, template):
244
+ element = ET.Element(template.get('root', 'DET_NITEM'))
245
+
246
+ for attr, tag in template.get('fields', {}).items():
247
+ value = getattr(self, attr, None)
248
+ if value is not None:
249
+ child = ET.SubElement(element, tag)
250
+ child.text = str(value)
251
+
252
+ return element
@@ -0,0 +1,79 @@
1
+ from domain.models.NFeItemOrigemCombustivel import NFeItemOrigemCombustivel
2
+ class NFeItemDadosCombustivel:
3
+ cProdANP: str
4
+ codif: str
5
+ descANP: str
6
+ origemCombustivel: [NFeItemOrigemCombustivel]
7
+ percentualBioDiesel: float
8
+ percentualGLP: float
9
+ qtdAmbiente: float
10
+ ufConsumo: str
11
+
12
+ def __init__(self, **json):
13
+ if json:
14
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
15
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
16
+
17
+ if key in json:
18
+ if isinstance(typeProp, list):
19
+ cls = globals()[class_name]
20
+ items = []
21
+ initial_value = json[key]
22
+ if isinstance(initial_value, dict):
23
+ initial_value = [initial_value]
24
+ for item_data in initial_value:
25
+ item = cls(**item_data)
26
+ items.append(item)
27
+ setattr(self, key, items)
28
+ elif class_name not in ('str', 'int', 'float', 'bool'):
29
+ cls = globals()[class_name]
30
+ instance = cls(**json[key])
31
+ setattr(self, key, instance)
32
+ else:
33
+ setattr(self, key, str(json[key]))
34
+ else:
35
+ if isinstance(typeProp, list):
36
+ items = []
37
+ setattr(self, key, items)
38
+ elif class_name not in ('str', 'int', 'float', 'bool'):
39
+ cls = globals()[class_name]
40
+ instance = cls()
41
+ setattr(self, key, instance)
42
+ else:
43
+ setattr(self, key, '')
44
+ else:
45
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
46
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
47
+ if isinstance(typeProp, list):
48
+ items = []
49
+ setattr(self, key, items)
50
+ elif class_name not in ('str', 'int', 'float', 'bool'):
51
+ cls = globals()[class_name]
52
+ instance = cls()
53
+ setattr(self, key, instance)
54
+ else:
55
+ setattr(self, key, '')
56
+
57
+ def get_cProdANP(self):
58
+ return self.cProdANP
59
+
60
+ def get_codif(self):
61
+ return self.codif
62
+
63
+ def get_descANP(self):
64
+ return self.descANP
65
+
66
+ def get_origemCombustivel(self):
67
+ return self.origemCombustivel
68
+
69
+ def get_percentualBioDiesel(self):
70
+ return self.percentualBioDiesel
71
+
72
+ def get_percentualGLP(self):
73
+ return self.percentualGLP
74
+
75
+ def get_qtdAmbiente(self):
76
+ return self.qtdAmbiente
77
+
78
+ def get_ufConsumo(self):
79
+ return self.ufConsumo
@@ -0,0 +1,94 @@
1
+ class NFeItemExportacao:
2
+ codTipoConhecimentoTransp: str
3
+ dataAverbacao: str
4
+ dataDespacho: str
5
+ dataEmbarque: str
6
+ dataEmissaoNf: str
7
+ dataRegistro: str
8
+ expIndChave: str
9
+ expIndNumReg: str
10
+ expIndQtdEfet: float
11
+ numeroDeclaracao: str
12
+ numeroDrawback: str
13
+ numeroRegistro: str
14
+
15
+ def __init__(self, **json):
16
+ if json:
17
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
18
+ # str, float, bool, int
19
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
20
+
21
+ if key in json:
22
+ if isinstance(typeProp, list):
23
+ cls = globals()[class_name]
24
+ items = []
25
+ for item_data in json[key]:
26
+ item = cls(**item_data)
27
+ items.append(item)
28
+ setattr(self, key, items)
29
+ elif class_name not in ('str', 'int', 'float', 'bool'):
30
+ cls = globals()[class_name]
31
+ instance = cls(**json[key])
32
+ setattr(self, key, instance)
33
+ else:
34
+ setattr(self, key, str(json[key]))
35
+ else:
36
+ if isinstance(typeProp, list):
37
+ # cls = globals()[class_name]
38
+ items = []
39
+ setattr(self, key, items)
40
+ elif class_name not in ('str', 'int', 'float', 'bool'):
41
+ cls = globals()[class_name]
42
+ instance = cls()
43
+ setattr(self, key, instance)
44
+ else:
45
+ setattr(self, key, '')
46
+ else:
47
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
48
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
49
+ if isinstance(typeProp, list):
50
+ # cls = globals()[class_name]
51
+ items = []
52
+ setattr(self, key, items)
53
+ elif class_name not in ('str', 'int', 'float', 'bool'):
54
+ cls = globals()[class_name]
55
+ instance = cls()
56
+ setattr(self, key, instance)
57
+ else:
58
+ setattr(self, key, '')
59
+
60
+ def get_codTipoConhecimentoTransp(self):
61
+ return self.codTipoConhecimentoTransp
62
+
63
+ def get_dataAverbacao(self):
64
+ return self.dataAverbacao
65
+
66
+ def get_dataDespacho(self):
67
+ return self.dataDespacho
68
+
69
+ def get_dataEmbarque(self):
70
+ return self.dataEmbarque
71
+
72
+ def get_dataEmissaoNf(self):
73
+ return self.dataEmissaoNf
74
+
75
+ def get_dataRegistro(self):
76
+ return self.dataRegistro
77
+
78
+ def get_expIndChave(self):
79
+ return self.expIndChave
80
+
81
+ def get_expIndNumReg(self):
82
+ return self.expIndNumReg
83
+
84
+ def get_expIndQtdEfet(self):
85
+ return self.expIndQtdEfet
86
+
87
+ def get_numeroDeclaracao(self):
88
+ return self.numeroDeclaracao
89
+
90
+ def get_numeroDrawback(self):
91
+ return self.numeroDrawback
92
+
93
+ def get_numeroRegistro(self):
94
+ return self.numeroRegistro
@@ -0,0 +1,57 @@
1
+ class NFeItemOrigemCombustivel:
2
+ indicadorImportacaoComb: str
3
+ percentualOriginarioComb: str
4
+ ufOrigemComb: str
5
+
6
+ def __init__(self, **json):
7
+ if json:
8
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
9
+ # str, float, bool, int
10
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
11
+
12
+ if key in json:
13
+ if isinstance(typeProp, list):
14
+ cls = globals()[class_name]
15
+ items = []
16
+ for item_data in json[key]:
17
+ item = cls(**item_data)
18
+ items.append(item)
19
+ setattr(self, key, items)
20
+ elif class_name not in ('str', 'int', 'float', 'bool'):
21
+ cls = globals()[class_name]
22
+ instance = cls(**json[key])
23
+ setattr(self, key, instance)
24
+ else:
25
+ setattr(self, key, str(json[key]))
26
+ else:
27
+ if isinstance(typeProp, list):
28
+ # cls = globals()[class_name]
29
+ items = []
30
+ setattr(self, key, items)
31
+ elif class_name not in ('str', 'int', 'float', 'bool'):
32
+ cls = globals()[class_name]
33
+ instance = cls()
34
+ setattr(self, key, instance)
35
+ else:
36
+ setattr(self, key, '')
37
+ else:
38
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
39
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
40
+ if isinstance(typeProp, list):
41
+ # cls = globals()[class_name]
42
+ items = []
43
+ setattr(self, key, items)
44
+ elif class_name not in ('str', 'int', 'float', 'bool'):
45
+ cls = globals()[class_name]
46
+ instance = cls()
47
+ setattr(self, key, instance)
48
+ else:
49
+ setattr(self, key, '')
50
+ def get_indicadorImportacaoComb(self):
51
+ return self.indicadorImportacaoComb
52
+
53
+ def get_percentualOriginarioComb(self):
54
+ return self.percentualOriginarioComb
55
+
56
+ def get_ufOrigemComb(self):
57
+ return self.ufOrigemComb
@@ -0,0 +1,58 @@
1
+ class NFeObservacao:
2
+ campo: str
3
+ tipo: str
4
+ valor: str
5
+
6
+ def __init__(self, **json):
7
+ if json:
8
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
9
+ # str, float, bool, int
10
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
11
+
12
+ if key in json:
13
+ if isinstance(typeProp, list):
14
+ cls = globals()[class_name]
15
+ items = []
16
+ for item_data in json[key]:
17
+ item = cls(**item_data)
18
+ items.append(item)
19
+ setattr(self, key, items)
20
+ elif class_name not in ('str', 'int', 'float', 'bool'):
21
+ cls = globals()[class_name]
22
+ instance = cls(**json[key])
23
+ setattr(self, key, instance)
24
+ else:
25
+ setattr(self, key, str(json[key]))
26
+ else:
27
+ if isinstance(typeProp, list):
28
+ # cls = globals()[class_name]
29
+ items = []
30
+ setattr(self, key, items)
31
+ elif class_name not in ('str', 'int', 'float', 'bool'):
32
+ cls = globals()[class_name]
33
+ instance = cls()
34
+ setattr(self, key, instance)
35
+ else:
36
+ setattr(self, key, '')
37
+ else:
38
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
39
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
40
+ if isinstance(typeProp, list):
41
+ # cls = globals()[class_name]
42
+ items = []
43
+ setattr(self, key, items)
44
+ elif class_name not in ('str', 'int', 'float', 'bool'):
45
+ cls = globals()[class_name]
46
+ instance = cls()
47
+ setattr(self, key, instance)
48
+ else:
49
+ setattr(self, key, '')
50
+
51
+ def get_campo(self):
52
+ return self.campo
53
+
54
+ def get_tipo(self):
55
+ return self.tipo
56
+
57
+ def get_valor(self):
58
+ return self.valor
@@ -0,0 +1,58 @@
1
+ class NFeObservacaoItem:
2
+ campo: str
3
+ tipo: str
4
+ valor: str
5
+
6
+ def __init__(self, **json):
7
+ if json:
8
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
9
+ # str, float, bool, int
10
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
11
+
12
+ if key in json:
13
+ if isinstance(typeProp, list):
14
+ cls = globals()[class_name]
15
+ items = []
16
+ for item_data in json[key]:
17
+ item = cls(**item_data)
18
+ items.append(item)
19
+ setattr(self, key, items)
20
+ elif class_name not in ('str', 'int', 'float', 'bool'):
21
+ cls = globals()[class_name]
22
+ instance = cls(**json[key])
23
+ setattr(self, key, instance)
24
+ else:
25
+ setattr(self, key, str(json[key]))
26
+ else:
27
+ if isinstance(typeProp, list):
28
+ # cls = globals()[class_name]
29
+ items = []
30
+ setattr(self, key, items)
31
+ elif class_name not in ('str', 'int', 'float', 'bool'):
32
+ cls = globals()[class_name]
33
+ instance = cls()
34
+ setattr(self, key, instance)
35
+ else:
36
+ setattr(self, key, '')
37
+ else:
38
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
39
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
40
+ if isinstance(typeProp, list):
41
+ # cls = globals()[class_name]
42
+ items = []
43
+ setattr(self, key, items)
44
+ elif class_name not in ('str', 'int', 'float', 'bool'):
45
+ cls = globals()[class_name]
46
+ instance = cls()
47
+ setattr(self, key, instance)
48
+ else:
49
+ setattr(self, key, '')
50
+
51
+ def get_campo(self):
52
+ return self.campo
53
+
54
+ def get_tipo(self):
55
+ return self.tipo
56
+
57
+ def get_valor(self):
58
+ return self.valor
@@ -0,0 +1,58 @@
1
+ class NFeOrigem:
2
+ moeda: str
3
+ pais: str
4
+ vlrMercMoeda: float
5
+
6
+ def __init__(self, **json):
7
+ if json:
8
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
9
+ # str, float, bool, int
10
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
11
+
12
+ if key in json:
13
+ if isinstance(typeProp, list):
14
+ cls = globals()[class_name]
15
+ items = []
16
+ for item_data in json[key]:
17
+ item = cls(**item_data)
18
+ items.append(item)
19
+ setattr(self, key, items)
20
+ elif class_name not in ('str', 'int', 'float', 'bool'):
21
+ cls = globals()[class_name]
22
+ instance = cls(**json[key])
23
+ setattr(self, key, instance)
24
+ else:
25
+ setattr(self, key, str(json[key]))
26
+ else:
27
+ if isinstance(typeProp, list):
28
+ # cls = globals()[class_name]
29
+ items = []
30
+ setattr(self, key, items)
31
+ elif class_name not in ('str', 'int', 'float', 'bool'):
32
+ cls = globals()[class_name]
33
+ instance = cls()
34
+ setattr(self, key, instance)
35
+ else:
36
+ setattr(self, key, '')
37
+ else:
38
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
39
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
40
+ if isinstance(typeProp, list):
41
+ # cls = globals()[class_name]
42
+ items = []
43
+ setattr(self, key, items)
44
+ elif class_name not in ('str', 'int', 'float', 'bool'):
45
+ cls = globals()[class_name]
46
+ instance = cls()
47
+ setattr(self, key, instance)
48
+ else:
49
+ setattr(self, key, '')
50
+
51
+ def get_moeda(self):
52
+ return self.moeda
53
+
54
+ def get_pais(self):
55
+ return self.pais
56
+
57
+ def get_vlrMercMoeda(self):
58
+ return self.vlrMercMoeda
@@ -0,0 +1,55 @@
1
+ from domain.models.NFeDetalhePagamento import NFeDetalhePagamento
2
+ class NFePagamento:
3
+ detalhesPagamento: [NFeDetalhePagamento]
4
+ valorTroco: float
5
+
6
+ def __init__(self, **json):
7
+ if json:
8
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
9
+ # str, float, bool, int
10
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
11
+
12
+ if key in json:
13
+ if isinstance(typeProp, list):
14
+ cls = globals()[class_name]
15
+ items = []
16
+ for item_data in json[key]:
17
+ item = cls(**item_data)
18
+ items.append(item)
19
+ setattr(self, key, items)
20
+ elif class_name not in ('str', 'int', 'float', 'bool'):
21
+ cls = globals()[class_name]
22
+ instance = cls(**json[key])
23
+ setattr(self, key, instance)
24
+ else:
25
+ setattr(self, key, str(json[key]))
26
+ else:
27
+ if isinstance(typeProp, list):
28
+ # cls = globals()[class_name]
29
+ items = []
30
+ setattr(self, key, items)
31
+ elif class_name not in ('str', 'int', 'float', 'bool'):
32
+ cls = globals()[class_name]
33
+ instance = cls()
34
+ setattr(self, key, instance)
35
+ else:
36
+ setattr(self, key, '')
37
+ else:
38
+ for key, typeProp in self.__class__.__dict__['__annotations__'].items():
39
+ class_name = str(typeProp).split("'")[1].split(".")[-1]
40
+ if isinstance(typeProp, list):
41
+ # cls = globals()[class_name]
42
+ items = []
43
+ setattr(self, key, items)
44
+ elif class_name not in ('str', 'int', 'float', 'bool'):
45
+ cls = globals()[class_name]
46
+ instance = cls()
47
+ setattr(self, key, instance)
48
+ else:
49
+ setattr(self, key, '')
50
+
51
+ def get_detalhesPagamento(self):
52
+ return self.detalhesPagamento
53
+
54
+ def get_valorTroco(self):
55
+ return self.valorTroco