br_nfe 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +0 -1
  4. data/Gemfile.lock +1 -1
  5. data/README.markdown +264 -106
  6. data/lib/br_nfe/{helper → association}/have_address.rb +1 -1
  7. data/lib/br_nfe/{helper → association}/have_condicao_pagamento.rb +1 -1
  8. data/lib/br_nfe/association/have_destinatario.rb +22 -0
  9. data/lib/br_nfe/association/have_emitente.rb +24 -0
  10. data/lib/br_nfe/base.rb +37 -27
  11. data/lib/br_nfe/condicao_pagamento.rb +2 -0
  12. data/lib/br_nfe/constants.rb +33 -0
  13. data/lib/br_nfe/endereco.rb +10 -0
  14. data/lib/br_nfe/helper/string_methods.rb +4 -0
  15. data/lib/br_nfe/{emitente.rb → person.rb} +11 -7
  16. data/lib/br_nfe/product/base.rb +82 -0
  17. data/lib/br_nfe/product/consulta_status_servico.rb +35 -0
  18. data/lib/br_nfe/product/emitente.rb +8 -0
  19. data/lib/br_nfe/product/gateway/base.rb +62 -0
  20. data/lib/br_nfe/product/gateway/web_service_svrs.rb +39 -0
  21. data/lib/br_nfe/product/value_nf.rb +9 -0
  22. data/lib/br_nfe/product/xml/soap_env.xml.slim +8 -0
  23. data/lib/br_nfe/product/xml/v3_10/XSD/consReciNFe_v3.10.xsd +9 -0
  24. data/lib/br_nfe/product/xml/v3_10/XSD/consSitNFe_v3.10.xsd +9 -0
  25. data/lib/br_nfe/product/xml/v3_10/XSD/consStatServ_v3.10.xsd +9 -0
  26. data/lib/br_nfe/product/xml/v3_10/XSD/enviNFe_v3.10.xsd +9 -0
  27. data/lib/br_nfe/product/xml/v3_10/XSD/inutNFe_v3.10.xsd +9 -0
  28. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteConsSitNFe_v3.10.xsd +502 -0
  29. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteConsStatServ_v3.10.xsd +98 -0
  30. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteInutNFe_v3.10.xsd +193 -0
  31. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteNFe_v3.10.xsd +6060 -0
  32. data/lib/br_nfe/product/xml/v3_10/XSD/nfe_v3.10.xsd +9 -0
  33. data/lib/br_nfe/product/xml/v3_10/XSD/procInutNFe_v3.10.xsd +9 -0
  34. data/lib/br_nfe/product/xml/v3_10/XSD/procNFe_v3.10.xsd +9 -0
  35. data/lib/br_nfe/product/xml/v3_10/XSD/retConsReciNFe_v3.10.xsd +9 -0
  36. data/lib/br_nfe/product/xml/v3_10/XSD/retConsSitNFe_v3.10.xsd +9 -0
  37. data/lib/br_nfe/product/xml/v3_10/XSD/retConsStatServ_v3.10.xsd +9 -0
  38. data/lib/br_nfe/product/xml/v3_10/XSD/retEnviNFe_v3.10.xsd +9 -0
  39. data/lib/br_nfe/product/xml/v3_10/XSD/retInutNFe_v3.10.xsd +9 -0
  40. data/lib/br_nfe/product/xml/v3_10/XSD/tiposBasico_v3.10.xsd +571 -0
  41. data/lib/br_nfe/product/xml/v3_10/XSD/xmldsig-core-schema_v1.01.xsd +98 -0
  42. data/lib/br_nfe/product/xml/v3_10/consulta_status_servico.xml.slim +4 -0
  43. data/lib/br_nfe/service/association/have_intermediario.rb +26 -0
  44. data/lib/br_nfe/service/association/have_rps.rb +36 -0
  45. data/lib/br_nfe/service/base.rb +24 -20
  46. data/lib/br_nfe/service/betha/v1/cancela_nfse.rb +43 -0
  47. data/lib/br_nfe/service/betha/v1/consulta_lote_rps.rb +20 -6
  48. data/lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb +17 -6
  49. data/lib/br_nfe/service/betha/v1/consulta_nfse.rb +16 -5
  50. data/lib/br_nfe/service/betha/v1/consulta_situacao_lote_rps.rb +15 -6
  51. data/lib/br_nfe/service/betha/v1/gateway.rb +4 -0
  52. data/lib/br_nfe/service/betha/v1/recepcao_lote_rps.rb +13 -5
  53. data/lib/br_nfe/service/betha/v1/xml/_tc_identificacao_prestador.xml.slim +3 -0
  54. data/lib/br_nfe/service/betha/v1/xml/_tc_pedido_cancelamento.xml.slim +4 -0
  55. data/lib/br_nfe/service/concerns/rules/cancelamento_nfs.rb +8 -0
  56. data/lib/br_nfe/service/concerns/rules/consulta_nfs_por_rps.rb +1 -1
  57. data/lib/br_nfe/service/concerns/rules/consulta_nfse.rb +5 -2
  58. data/lib/br_nfe/service/concerns/values_ts/service_v1.rb +319 -0
  59. data/lib/br_nfe/service/destinatario.rb +7 -0
  60. data/lib/br_nfe/service/emitente.rb +8 -0
  61. data/lib/br_nfe/service/intermediario.rb +1 -12
  62. data/lib/br_nfe/service/item.rb +7 -7
  63. data/lib/br_nfe/service/response/build/base.rb +166 -0
  64. data/lib/br_nfe/service/response/build/cancelamento.rb +62 -0
  65. data/lib/br_nfe/service/response/build/consulta_lote_rps.rb +25 -0
  66. data/lib/br_nfe/service/response/build/consulta_nfs_por_rps.rb +25 -0
  67. data/lib/br_nfe/service/response/build/consulta_nfse.rb +24 -0
  68. data/lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb +56 -0
  69. data/lib/br_nfe/service/response/build/invoice_build.rb +359 -0
  70. data/lib/br_nfe/service/response/build/recepcao_lote_rps.rb +69 -0
  71. data/lib/br_nfe/service/response/cancelamento.rb +22 -0
  72. data/lib/br_nfe/service/response/consulta_lote_rps.rb +18 -0
  73. data/lib/br_nfe/service/response/consulta_nfs_por_rps.rb +10 -0
  74. data/lib/br_nfe/service/response/consulta_nfse.rb +10 -0
  75. data/lib/br_nfe/service/response/consulta_situacao_lote_rps.rb +74 -0
  76. data/lib/br_nfe/service/response/default.rb +93 -0
  77. data/lib/br_nfe/{response/service → service/response}/nota_fiscal.rb +19 -12
  78. data/lib/br_nfe/service/response/paths/v1/tc_nfse.rb +275 -0
  79. data/lib/br_nfe/service/response/recepcao_lote_rps.rb +35 -0
  80. data/lib/br_nfe/service/rps.rb +30 -27
  81. data/lib/br_nfe/service/sc/florianopolis/xml/_service_item.xml.slim +4 -4
  82. data/lib/br_nfe/service/sc/florianopolis/xml/inf_requisicao.xml.slim +4 -4
  83. data/lib/br_nfe/service/simpliss/v1/cancela_nfse.rb +16 -6
  84. data/lib/br_nfe/service/simpliss/v1/consulta_lote_rps.rb +20 -12
  85. data/lib/br_nfe/service/simpliss/v1/consulta_nfs_por_rps.rb +21 -6
  86. data/lib/br_nfe/service/simpliss/v1/consulta_nfse.rb +20 -6
  87. data/lib/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps.rb +17 -6
  88. data/lib/br_nfe/service/simpliss/v1/recepcao_lote_rps.rb +16 -4
  89. data/lib/br_nfe/service/simpliss/v1/xml/_tc_item_servico.xml.slim +2 -2
  90. data/lib/br_nfe/service/thema/v1/cancela_nfse.rb +21 -19
  91. data/lib/br_nfe/service/thema/v1/consulta_lote_rps.rb +21 -19
  92. data/lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb +25 -18
  93. data/lib/br_nfe/service/thema/v1/consulta_nfse.rb +20 -20
  94. data/lib/br_nfe/service/thema/v1/consulta_situacao_lote_rps.rb +14 -20
  95. data/lib/br_nfe/service/thema/v1/recepcao_lote_rps.rb +11 -16
  96. data/lib/br_nfe/service/thema/v1/recepcao_lote_rps_limitado.rb +8 -6
  97. data/lib/br_nfe/service/xml/v1/_tc_identificacao_nfse.xml.slim +1 -1
  98. data/lib/br_nfe/service/xml/v1/_tc_pedido_cancelamento.xml.slim +1 -1
  99. data/lib/br_nfe/service/xml/v1/_tc_valores.xml.slim +11 -11
  100. data/lib/br_nfe/version.rb +1 -1
  101. data/lib/br_nfe.rb +62 -62
  102. data/test/br_nfe/association/have_address_test.rb +64 -0
  103. data/test/br_nfe/association/have_condicao_pagamento_test.rb +75 -0
  104. data/test/br_nfe/association/have_destinatario_test.rb +76 -0
  105. data/test/br_nfe/association/have_emitente_test.rb +80 -0
  106. data/test/br_nfe/base_test.rb +96 -61
  107. data/test/br_nfe/endereco_test.rb +21 -0
  108. data/test/br_nfe/person_test.rb +55 -0
  109. data/test/br_nfe/product/base_test.rb +150 -0
  110. data/test/br_nfe/product/consulta_status_servico_test.rb +59 -0
  111. data/test/br_nfe/product/emitente_test.rb +29 -0
  112. data/test/br_nfe/product/gateway/base_test.rb +16 -0
  113. data/test/br_nfe/product/gateway/web_service_svrs_test.rb +36 -0
  114. data/test/br_nfe/service/association/have_intermediario_test.rb +80 -0
  115. data/test/br_nfe/service/association/have_rps_test.rb +62 -0
  116. data/test/br_nfe/service/base_test.rb +42 -42
  117. data/test/br_nfe/service/betha/v1/cancela_nfse_test.rb +90 -0
  118. data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +105 -5
  119. data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +103 -5
  120. data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +114 -5
  121. data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +118 -5
  122. data/test/br_nfe/service/betha/v1/gateway_test.rb +1 -1
  123. data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +51 -5
  124. data/test/br_nfe/service/concerns/rules/cancelamento_nfs_test.rb +2 -2
  125. data/test/br_nfe/service/concerns/rules/consulta_nfs_por_rps_test.rb +2 -7
  126. data/test/br_nfe/service/concerns/rules/consulta_nfse_test.rb +24 -3
  127. data/test/br_nfe/service/concerns/rules/recepcao_lote_rps_test.rb +1 -1
  128. data/test/br_nfe/{helper → service/concerns}/values_ts/service_v1_test.rb +2 -2
  129. data/test/br_nfe/{destinatario_test.rb → service/destinatario_test.rb} +3 -4
  130. data/test/br_nfe/service/emitente_test.rb +29 -0
  131. data/test/br_nfe/service/item_test.rb +14 -14
  132. data/test/br_nfe/service/response/build/base_test.rb +80 -0
  133. data/test/br_nfe/{response/service → service/response}/default_test.rb +1 -82
  134. data/test/br_nfe/service/response/nota_fiscal_test.rb +59 -0
  135. data/test/br_nfe/{response/service → service/response}/paths/v1/tc_nfse_test.rb +10 -10
  136. data/test/br_nfe/service/rps_test.rb +107 -138
  137. data/test/br_nfe/service/sc/florianopolis/emission_rps_test.rb +9 -9
  138. data/test/br_nfe/service/simpliss/v1/base_test.rb +1 -1
  139. data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +7 -10
  140. data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +11 -18
  141. data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +11 -18
  142. data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +11 -18
  143. data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +7 -11
  144. data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +3 -9
  145. data/test/br_nfe/service/thema/v1/base_test.rb +1 -1
  146. data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +7 -14
  147. data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +6 -17
  148. data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +6 -13
  149. data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +11 -18
  150. data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +7 -11
  151. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +1 -5
  152. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +3 -9
  153. data/test/factories/base.rb +0 -1
  154. data/test/factories/{emitente.rb → person.rb} +1 -1
  155. data/test/factories/product/base.rb +12 -0
  156. data/test/factories/product/consulta_status_servico.rb +12 -0
  157. data/test/factories/product/emitente.rb +15 -0
  158. data/test/factories/product/gateway/base.rb +5 -0
  159. data/test/factories/product/gateway/web_service_svrs.rb +5 -0
  160. data/test/factories/service/betha/v1/{cancelamento_nfs.rb → cancela_nfse.rb} +2 -1
  161. data/test/factories/service/betha/v1/consulta_lote_rps.rb +1 -1
  162. data/test/factories/service/betha/v1/consulta_nfs_por_rps.rb +1 -1
  163. data/test/factories/service/betha/v1/consulta_nfse.rb +1 -1
  164. data/test/factories/service/betha/v1/consulta_situacao_lote_rps.rb +1 -1
  165. data/test/factories/{destinatario.rb → service/destinatario.rb} +1 -1
  166. data/test/factories/service/emitente.rb +15 -0
  167. data/test/factories/service/item.rb +4 -4
  168. data/test/factories/service/response/build_response.rb +5 -0
  169. data/test/factories/service/response/default.rb +6 -0
  170. data/test/factories/{response/service → service/response}/nota_fiscal.rb +8 -8
  171. data/test/factories/service/rps.rb +11 -11
  172. data/test/factories/service/sc/florianopolis/base.rb +1 -1
  173. data/test/factories/service/sc/florianopolis/cancellation.rb +1 -1
  174. data/test/factories/service/sc/florianopolis/emission_rps.rb +1 -1
  175. data/test/factories/service/simpliss/v1/base.rb +1 -1
  176. data/test/factories/service/simpliss/v1/cancela_nfse.rb +1 -1
  177. data/test/factories/service/simpliss/v1/consulta_lote_rps.rb +1 -1
  178. data/test/factories/service/simpliss/v1/consulta_nfs_por_rps.rb +1 -1
  179. data/test/factories/service/simpliss/v1/consulta_nfse.rb +1 -1
  180. data/test/factories/service/simpliss/v1/consulta_situacao_lote_rps.rb +1 -1
  181. data/test/factories/service/simpliss/v1/recepcao_lote_rps.rb +1 -1
  182. data/test/factories/service/thema/v1/base.rb +1 -1
  183. data/test/factories/service/thema/v1/cancela_nfse.rb +1 -1
  184. data/test/factories/service/thema/v1/consulta_lote_rps.rb +1 -1
  185. data/test/factories/service/thema/v1/consulta_nfs_por_rps.rb +1 -1
  186. data/test/factories/service/thema/v1/consulta_nfse.rb +1 -1
  187. data/test/factories/service/thema/v1/consulta_situacao_lote_rps.rb +1 -1
  188. data/test/factories/service/thema/v1/recepcao_lote_rps.rb +1 -1
  189. data/test/fixtures/service/response/betha/v1/cancela_nfse/fault.xml +17 -0
  190. data/test/fixtures/service/response/betha/v1/cancela_nfse/success.xml +48 -0
  191. data/test/fixtures/service/response/betha/v1/consulta_lote_rps/fault.xml +18 -0
  192. data/test/fixtures/service/response/betha/v1/consulta_lote_rps/success.xml +108 -0
  193. data/test/fixtures/service/response/betha/v1/consulta_nfse/fault.xml +18 -0
  194. data/test/fixtures/service/response/betha/v1/consulta_nfse/nfs_empty.xml +12 -0
  195. data/test/fixtures/service/response/betha/v1/consulta_nfse/success.xml +115 -0
  196. data/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/fault.xml +18 -0
  197. data/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/success.xml +103 -0
  198. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/error.xml +13 -0
  199. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/fault.xml +17 -0
  200. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/success.xml +13 -0
  201. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed.xml +13 -0
  202. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed_by_code_error.xml +17 -0
  203. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived.xml +13 -0
  204. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived_by_code_error.xml +17 -0
  205. data/test/fixtures/service/response/betha/v1/recepcao_lote_rps/error.xml +17 -0
  206. data/test/fixtures/service/response/betha/v1/recepcao_lote_rps/success.xml +14 -0
  207. metadata +160 -94
  208. data/lib/br_nfe/destinatario.rb +0 -26
  209. data/lib/br_nfe/helper/have_destinatario.rb +0 -18
  210. data/lib/br_nfe/helper/have_emitente.rb +0 -20
  211. data/lib/br_nfe/helper/have_intermediario.rb +0 -24
  212. data/lib/br_nfe/helper/have_rps.rb +0 -34
  213. data/lib/br_nfe/helper/values_ts/service_v1.rb +0 -317
  214. data/lib/br_nfe/response/service/build_response.rb +0 -463
  215. data/lib/br_nfe/response/service/default.rb +0 -185
  216. data/lib/br_nfe/response/service/paths/base.rb +0 -127
  217. data/lib/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta.rb +0 -22
  218. data/lib/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta.rb +0 -25
  219. data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta.rb +0 -25
  220. data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta.rb +0 -25
  221. data/lib/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta.rb +0 -31
  222. data/lib/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta.rb +0 -36
  223. data/lib/br_nfe/response/service/paths/v1/tc_nfse.rb +0 -271
  224. data/lib/br_nfe/service/betha/v1/cancelamento_nfs.rb +0 -36
  225. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta.rb +0 -23
  226. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta.rb +0 -21
  227. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -21
  228. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_cancelar_nfse_resposta.rb +0 -22
  229. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_lote_rps_resposta.rb +0 -25
  230. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_resposta.rb +0 -25
  231. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -25
  232. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_situacao_lote_rps_resposta.rb +0 -31
  233. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_enviar_lote_rps_resposta.rb +0 -36
  234. data/lib/br_nfe/service/thema/v1/response_paths/servico_cancelar_nfse_resposta.rb +0 -17
  235. data/lib/br_nfe/service/thema/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -19
  236. data/test/br_nfe/emitente_test.rb +0 -46
  237. data/test/br_nfe/helper/have_address_test.rb +0 -62
  238. data/test/br_nfe/helper/have_condicao_pagamento_test.rb +0 -71
  239. data/test/br_nfe/helper/have_destinatario_test.rb +0 -64
  240. data/test/br_nfe/helper/have_emitente_test.rb +0 -63
  241. data/test/br_nfe/helper/have_intermediario_test.rb +0 -77
  242. data/test/br_nfe/helper/have_rps_test.rb +0 -59
  243. data/test/br_nfe/response/service/build_response_test.rb +0 -205
  244. data/test/br_nfe/response/service/nota_fiscal_test.rb +0 -41
  245. data/test/br_nfe/response/service/paths/base_test.rb +0 -196
  246. data/test/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta_test.rb +0 -25
  247. data/test/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta_test.rb +0 -30
  248. data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta_test.rb +0 -30
  249. data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta_test.rb +0 -30
  250. data/test/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta_test.rb +0 -30
  251. data/test/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta_test.rb +0 -34
  252. data/test/br_nfe/service/betha/v1/cancelamento_nfs_test.rb +0 -54
  253. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta_test.rb +0 -16
  254. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta_test.rb +0 -16
  255. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta_test.rb +0 -16
  256. data/test/factories/response/service/build_response.rb +0 -5
  257. data/test/factories/response/service/default.rb +0 -10
@@ -0,0 +1,93 @@
1
+ module BrNfe
2
+ module Service
3
+ module Response
4
+ class Default < BrNfe::ActiveModelBase
5
+
6
+ # Array contendo as mensagens de erros
7
+ # No array pode conter Hash (com :codigo, :mensagem e :correcao)
8
+ # mas também pode conter mensagens de texto puro
9
+ #
10
+ # <b>Tipo de retorno: </b> _Array_
11
+ #
12
+ attr_accessor :error_messages
13
+
14
+ # Array contendo as notas fiscais encontradas no xml de retorno.
15
+ # Utillizado em algumas requisições onde pode ser que retorne algum XML de NFe
16
+ # É um Array contendo objetos da classe BrNfe::Service::Response::NotaFiscal
17
+ #
18
+ # <b>Tipo de retorno: </b> _Array_
19
+ #
20
+ attr_accessor :notas_fiscais
21
+
22
+ # XML original da resposta
23
+ # Contém todo o XML Envelope da resposta SOAP
24
+ #
25
+ # <b>Tipo de retorno: </b> _String_ XML
26
+ #
27
+ attr_accessor :original_xml
28
+
29
+ # Status possíveis
30
+ # [:success, :falied, :soap_error, :http_error, :unknown_error]
31
+ #
32
+ # <b>Tipo de retorno: </b> _Hash_
33
+ #
34
+ attr_accessor :status
35
+
36
+
37
+ def initialize(attributes = {})
38
+ self.notas_fiscais = [] # Para poder utilizar o <<
39
+ self.error_messages = [] # Para poder utilizar o <<
40
+ super
41
+ end
42
+
43
+ def notas_fiscais
44
+ @notas_fiscais = [@notas_fiscais].flatten # Para retornar sempre um vetor
45
+ end
46
+
47
+ def error_messages
48
+ @error_messages = [@error_messages].flatten
49
+ end
50
+
51
+ # Método para saber se a conexão com a prefeitura foi mal-sucedida.
52
+ # Caso ocorra algum erro na requisição irá retornar true.
53
+ #
54
+ # <b>Tipo de retorno: </b> _Boolean_
55
+ #
56
+ def unsuccessful_request?
57
+ status.in?([:soap_error, :http_error, :unknown_error])
58
+ end
59
+
60
+ # Método para saber se a conexão com a prefeitura foi bem-sucedida.
61
+ # Caso a requisição ocorra certo e não apresente nenhuma exception
62
+ # irá retornar true.
63
+ #
64
+ # <b>Tipo de retorno: </b> _Boolean_
65
+ #
66
+ def successful_request?
67
+ !unsuccessful_request?
68
+ end
69
+
70
+ def success?
71
+ status == :success
72
+ end
73
+
74
+ def status
75
+ @status ||= get_status
76
+ end
77
+
78
+ def get_status
79
+ error_messages.blank? ? :success : :falied
80
+ end
81
+
82
+ # Retorna um array apenas com os códigos das mensagens de erro.
83
+ # Sempre retornar o código no formato de String.
84
+ #
85
+ # <b>Tipo de retorno: </b> _Array_
86
+ #
87
+ def message_codes
88
+ @message_codes ||= error_messages.select{|msg| msg.is_a?(Hash)}.map{|msg| msg[:code].try(:to_s) }
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -1,11 +1,11 @@
1
1
  module BrNfe
2
- module Response
3
- module Service
2
+ module Service
3
+ module Response
4
4
  class NotaFiscal < BrNfe::ActiveModelBase
5
- include BrNfe::Helper::HaveIntermediario
6
- include BrNfe::Helper::HaveDestinatario
7
- include BrNfe::Helper::HaveEmitente
8
- include BrNfe::Helper::HaveCondicaoPagamento
5
+ include BrNfe::Association::HaveDestinatario
6
+ include BrNfe::Association::HaveEmitente
7
+ include BrNfe::Association::HaveCondicaoPagamento
8
+ include BrNfe::Service::Association::HaveIntermediario
9
9
 
10
10
  attr_accessor :numero_nf
11
11
  attr_accessor :codigo_verificacao
@@ -38,18 +38,18 @@ module BrNfe
38
38
  attr_accessor :codigo_municipio
39
39
 
40
40
  #Valores dos serviços
41
- attr_accessor :total_services
42
- attr_accessor :deductions
41
+ attr_accessor :valor_total_servicos
42
+ attr_accessor :deducoes
43
43
  attr_accessor :valor_pis
44
44
  attr_accessor :valor_cofins
45
45
  attr_accessor :valor_inss
46
46
  attr_accessor :valor_ir
47
47
  attr_accessor :valor_csll
48
- attr_accessor :iss_retained
48
+ attr_accessor :iss_retido
49
49
  attr_accessor :outras_retencoes
50
50
  attr_accessor :total_iss
51
- attr_accessor :base_calculation
52
- attr_accessor :iss_tax_rate
51
+ attr_accessor :base_calculo
52
+ attr_accessor :iss_aliquota
53
53
  attr_accessor :valor_liquido # v2
54
54
  attr_accessor :desconto_condicionado # v2
55
55
  attr_accessor :desconto_incondicionado # v2
@@ -85,7 +85,14 @@ module BrNfe
85
85
  attr_accessor :codigo_obra
86
86
  attr_accessor :codigo_art
87
87
 
88
-
88
+ private
89
+
90
+ def emitente_class
91
+ BrNfe.emitente_service_class
92
+ end
93
+ def destinatario_class
94
+ BrNfe.destinatario_service_class
95
+ end
89
96
  end
90
97
  end
91
98
  end
@@ -0,0 +1,275 @@
1
+ module BrNfe
2
+ module Service
3
+ module Response
4
+ module Paths
5
+ module V1
6
+ module TcNfse
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ def response_default_path_to_nf
11
+ [:nfse, :inf_nfse]
12
+ end
13
+
14
+ def response_invoice_numero_nf_path
15
+ response_default_path_to_nf + [:numero]
16
+ end
17
+
18
+ def response_invoice_codigo_verificacao_path
19
+ response_default_path_to_nf + [:codigo_verificacao]
20
+ end
21
+
22
+ def response_invoice_data_emissao_path
23
+ response_default_path_to_nf + [:data_emissao]
24
+ end
25
+
26
+ def response_invoice_rps_numero_path
27
+ response_default_path_to_nf + [:identificacao_rps, :numero]
28
+ end
29
+
30
+ def response_invoice_rps_serie_path
31
+ response_default_path_to_nf + [:identificacao_rps, :serie]
32
+ end
33
+
34
+ def response_invoice_rps_tipo_path
35
+ response_default_path_to_nf + [:identificacao_rps, :tipo]
36
+ end
37
+
38
+ def response_invoice_data_emissao_rps_path
39
+ response_default_path_to_nf + [:data_emissao_rps]
40
+ end
41
+
42
+ def response_invoice_natureza_operacao_path
43
+ response_default_path_to_nf + [:natureza_operacao]
44
+ end
45
+
46
+ def response_invoice_regime_especial_tributacao_path
47
+ response_default_path_to_nf + [:regime_especial_tributacao]
48
+ end
49
+
50
+ def response_invoice_optante_simples_nacional_path
51
+ response_default_path_to_nf + [:optante_simples_nacional]
52
+ end
53
+
54
+ def response_invoice_incentivador_cultural_path
55
+ response_default_path_to_nf + [:incentivador_cultural]
56
+ end
57
+
58
+ def response_invoice_competencia_path
59
+ response_default_path_to_nf + [:competencia]
60
+ end
61
+
62
+ def response_invoice_outras_informacoes_path
63
+ response_default_path_to_nf + [:outras_informacoes]
64
+ end
65
+
66
+ def response_invoice_item_lista_servico_path
67
+ response_default_path_to_nf + [:servico, :item_lista_servico]
68
+ end
69
+
70
+ def response_invoice_cnae_code_path
71
+ response_default_path_to_nf + [:servico, :codigo_cnae]
72
+ end
73
+
74
+ def response_invoice_description_path
75
+ response_default_path_to_nf + [:servico, :discriminacao]
76
+ end
77
+
78
+ def response_invoice_codigo_municipio_path
79
+ response_default_path_to_nf + [:servico, :codigo_municipio]
80
+ end
81
+
82
+ def response_invoice_valor_total_servicos_path
83
+ response_default_path_to_nf + [:servico, :valores, :valor_servicos]
84
+ end
85
+
86
+ def response_invoice_deducoes_path
87
+ response_default_path_to_nf + [:servico, :valores, :valor_deducoes]
88
+ end
89
+
90
+ def response_invoice_valor_pis_path
91
+ response_default_path_to_nf + [:servico, :valores, :valor_pis]
92
+ end
93
+
94
+ def response_invoice_valor_cofins_path
95
+ response_default_path_to_nf + [:servico, :valores, :valor_cofins]
96
+ end
97
+
98
+ def response_invoice_valor_inss_path
99
+ response_default_path_to_nf + [:servico, :valores, :valor_inss]
100
+ end
101
+
102
+ def response_invoice_valor_ir_path
103
+ response_default_path_to_nf + [:servico, :valores, :valor_ir]
104
+ end
105
+
106
+ def response_invoice_valor_csll_path
107
+ response_default_path_to_nf + [:servico, :valores, :valor_csll]
108
+ end
109
+
110
+ def response_invoice_iss_retido_path
111
+ response_default_path_to_nf + [:servico, :valores, :iss_retido]
112
+ end
113
+
114
+ def response_invoice_outras_retencoes_path
115
+ response_default_path_to_nf + [:servico, :valores, :outras_retencoes]
116
+ end
117
+
118
+ def response_invoice_total_iss_path
119
+ response_default_path_to_nf + [:servico, :valores, :valor_iss]
120
+ end
121
+
122
+ def response_invoice_base_calculo_path
123
+ response_default_path_to_nf + [:servico, :valores, :base_calculo]
124
+ end
125
+
126
+ def response_invoice_iss_aliquota_path
127
+ response_default_path_to_nf + [:servico, :valores, :aliquota]
128
+ end
129
+
130
+ def response_invoice_valor_liquido_path
131
+ response_default_path_to_nf + [:servico, :valores, :valor_liquido_nfse]
132
+ end
133
+
134
+ def response_invoice_desconto_condicionado_path
135
+ response_default_path_to_nf + [:servico, :valores, :desconto_condicionado]
136
+ end
137
+
138
+ def response_invoice_desconto_incondicionado_path
139
+ response_default_path_to_nf + [:servico, :valores, :desconto_incondicionado]
140
+ end
141
+
142
+ def response_invoice_orgao_gerador_municipio_path
143
+ response_default_path_to_nf + [:orgao_gerador, :codigo_municipio]
144
+ end
145
+
146
+ def response_invoice_orgao_gerador_uf_path
147
+ response_default_path_to_nf + [:orgao_gerador, :uf]
148
+ end
149
+
150
+ def response_invoice_codigo_obra_path
151
+ response_default_path_to_nf + [:construcao_civil, :codigo_obra]
152
+ end
153
+
154
+ def response_invoice_codigo_art_path
155
+ response_default_path_to_nf + [:construcao_civil, :art]
156
+ end
157
+
158
+ def response_invoice_cancelamento_codigo_path
159
+ [:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :codigo_cancelamento]
160
+ end
161
+ def response_invoice_cancelamento_numero_nf_path
162
+ [:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :numero]
163
+ end
164
+ def response_invoice_cancelamento_cnpj_path
165
+ [:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :cnpj]
166
+ end
167
+ def response_invoice_cancelamento_inscricao_municipal_path
168
+ [:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :inscricao_municipal]
169
+ end
170
+ def response_invoice_cancelamento_municipio_path
171
+ [:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :codigo_municipio]
172
+ end
173
+ def response_invoice_cancelamento_data_hora_path
174
+ [:nfse_cancelamento, :confirmacao, :data_hora_cancelamento]
175
+ end
176
+ def response_invoice_nfe_substituidora_path
177
+ [:nfse_substituicao, :substituicao_nfse, :nfse_substituidora]
178
+ end
179
+
180
+ ############################## PATH PARA EMITENTE ##########################################
181
+ def response_invoice_emitente_path
182
+ response_default_path_to_nf+[:prestador_servico]
183
+ end
184
+ def response_invoice_emitente_cnpj_path
185
+ response_invoice_emitente_path + [:identificacao_prestador, :cnpj]
186
+ end
187
+ def response_invoice_emitente_inscricao_municipal_path
188
+ response_invoice_emitente_path + [:identificacao_prestador, :inscricao_municipal]
189
+ end
190
+ def response_invoice_emitente_razao_social_path
191
+ response_invoice_emitente_path + [:razao_social]
192
+ end
193
+ def response_invoice_emitente_nome_fantasia_path
194
+ response_invoice_emitente_path + [:nome_fantasia]
195
+ end
196
+ def response_invoice_emitente_telefone_path
197
+ response_invoice_emitente_path + [:contato, :telefone]
198
+ end
199
+ def response_invoice_emitente_email_path
200
+ response_invoice_emitente_path + [:contato, :email]
201
+ end
202
+ def response_invoice_emitente_endereco_logradouro_path
203
+ response_invoice_emitente_path + [:endereco, :endereco]
204
+ end
205
+ def response_invoice_emitente_endereco_numero_path
206
+ response_invoice_emitente_path + [:endereco, :numero]
207
+ end
208
+ def response_invoice_emitente_endereco_complemento_path
209
+ response_invoice_emitente_path + [:endereco, :complemento]
210
+ end
211
+ def response_invoice_emitente_endereco_bairro_path
212
+ response_invoice_emitente_path + [:endereco, :bairro]
213
+ end
214
+ def response_invoice_emitente_endereco_codigo_municipio_path
215
+ response_invoice_emitente_path + [:endereco, :codigo_municipio]
216
+ end
217
+ def response_invoice_emitente_endereco_uf_path
218
+ response_invoice_emitente_path + [:endereco, :uf]
219
+ end
220
+ def response_invoice_emitente_endereco_cep_path
221
+ response_invoice_emitente_path + [:endereco, :cep]
222
+ end
223
+ ############################## PATH PARA DESTINATÁRIO ##########################################
224
+ def response_invoice_destinatario_cpf_path
225
+ response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :cpf_cnpj, :cpf]
226
+ end
227
+ def response_invoice_destinatario_cnpj_path
228
+ response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :cpf_cnpj, :cnpj]
229
+ end
230
+ def response_invoice_destinatario_inscricao_municipal_path
231
+ response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :inscricao_municipal]
232
+ end
233
+ def response_invoice_destinatario_inscricao_estadual_path
234
+ response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :inscricao_estadual]
235
+ end
236
+ def response_invoice_destinatario_inscricao_suframa_path
237
+ response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :inscricao_suframa]
238
+ end
239
+ def response_invoice_destinatario_razao_social_path
240
+ response_default_path_to_nf+[:tomador_servico, :razao_social]
241
+ end
242
+ def response_invoice_destinatario_telefone_path
243
+ response_default_path_to_nf+[:tomador_servico, :contato, :telefone]
244
+ end
245
+ def response_invoice_destinatario_email_path
246
+ response_default_path_to_nf+[:tomador_servico, :contato, :email]
247
+ end
248
+ def response_invoice_destinatario_endereco_logradouro_path
249
+ response_default_path_to_nf+[:tomador_servico, :endereco, :endereco]
250
+ end
251
+ def response_invoice_destinatario_endereco_numero_path
252
+ response_default_path_to_nf+[:tomador_servico, :endereco, :numero]
253
+ end
254
+ def response_invoice_destinatario_endereco_complemento_path
255
+ response_default_path_to_nf+[:tomador_servico, :endereco, :complemento]
256
+ end
257
+ def response_invoice_destinatario_endereco_bairro_path
258
+ response_default_path_to_nf+[:tomador_servico, :endereco, :bairro]
259
+ end
260
+ def response_invoice_destinatario_endereco_codigo_municipio_path
261
+ response_default_path_to_nf+[:tomador_servico, :endereco, :codigo_municipio]
262
+ end
263
+ def response_invoice_destinatario_endereco_uf_path
264
+ response_default_path_to_nf+[:tomador_servico, :endereco, :uf]
265
+ end
266
+ def response_invoice_destinatario_endereco_cep_path
267
+ response_default_path_to_nf+[:tomador_servico, :endereco, :cep]
268
+ end
269
+ end
270
+ end
271
+ end
272
+ end
273
+ end
274
+ end
275
+ end
@@ -0,0 +1,35 @@
1
+ module BrNfe
2
+ module Service
3
+ module Response
4
+ class RecepcaoLoteRps < Default
5
+ # Número do protocolo de recebimento do XML
6
+ # Setado normalmente quando é enviado um lote RPS
7
+ # para processamento.
8
+ # O valor desse atributo é utilizado para posteriormente
9
+ # fazer a consulta para saber se o RPS já foi processado
10
+ #
11
+ # <b>Tipo de retorno: </b> _Integer_ ou _String_
12
+ #
13
+ attr_accessor :protocolo
14
+
15
+ # Data/Data hora do recebimento do XML pelo orgão emissor
16
+ # Nesse atrubuto pe setado a data/hora na qual o orgão emissor
17
+ # recebeu o XML que foi enviado.
18
+ # também é nesse atributo que é setado a data/hora do processamento
19
+ # da NF-e (nos casos de consulta)
20
+ #
21
+ # <b>Tipo de retorno: </b> _DateTime_
22
+ #
23
+ attr_accessor :data_recebimento
24
+
25
+ # Número do lote RPS
26
+ # Nesse atributo é setado o número do lote RPS
27
+ # quando o mesmo for retornado na resposta
28
+ #
29
+ # <b>Tipo de retorno: </b> _Integer_
30
+ #
31
+ attr_accessor :numero_lote
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,9 +1,9 @@
1
1
  module BrNfe
2
2
  module Service
3
3
  class Rps < BrNfe::ActiveModelBase
4
- include BrNfe::Helper::HaveDestinatario
5
- include BrNfe::Helper::HaveIntermediario
6
- include BrNfe::Helper::HaveCondicaoPagamento
4
+ include BrNfe::Association::HaveDestinatario
5
+ include BrNfe::Service::Association::HaveIntermediario
6
+ include BrNfe::Association::HaveCondicaoPagamento
7
7
 
8
8
  # Método utilizado para saberse o modelo deve validar
9
9
  # as informações obrigatórias do RPS.
@@ -19,14 +19,14 @@ module BrNfe
19
19
  validates :numero, :serie, :tipo, presence: true, if: :validate_rps?
20
20
 
21
21
  with_options if: :validar_recepcao_rps do |record|
22
- record.validates :data_emissao, :item_lista_servico, :description, :codigo_municipio, :base_calculation, presence: true
23
- record.validates :total_iss, :iss_tax_rate, presence: true, unless: :iss_retained?
22
+ record.validates :data_emissao, :item_lista_servico, :description, :codigo_municipio, :base_calculo, presence: true
23
+ record.validates :total_iss, :iss_aliquota, presence: true, unless: :iss_retido?
24
24
  record.validates :municipio_incidencia, presence: true, if: :municipio_incidencia_obrigatorio?
25
25
 
26
- record.validates :total_services, :base_calculation, numericality: {greater_than: 0}
26
+ record.validates :valor_total_servicos, :base_calculo, numericality: {greater_than: 0}
27
27
 
28
- record.validates :deductions, :valor_pis, :valor_cofins, :valor_inss, :valor_ir,
29
- :valor_csll, :outras_retencoes, :total_iss, :iss_tax_rate, :base_calculation,
28
+ record.validates :deducoes, :valor_pis, :valor_cofins, :valor_inss, :valor_ir,
29
+ :valor_csll, :outras_retencoes, :total_iss, :iss_aliquota, :base_calculo,
30
30
  :desconto_incondicionado, :desconto_condicionado, numericality: true, allow_blank: true
31
31
 
32
32
  record.validate :validar_intermediario
@@ -60,7 +60,7 @@ module BrNfe
60
60
  # Valor da base de cálculo da substituição tributária
61
61
  #
62
62
  # <b>Tipo: </b> _Float_
63
- attr_accessor :total_base_calculation_st
63
+ attr_accessor :total_base_calculo_st
64
64
 
65
65
  # Valor total do ISS de substituição tributária
66
66
  #
@@ -90,9 +90,9 @@ module BrNfe
90
90
  # do valor de todos os itens
91
91
  #
92
92
  # <b>Tipo: </b> _Float_
93
- attr_accessor :total_services
94
- def total_services
95
- @total_services || items.map(&:total_value).map(&:to_f).sum.round(2)
93
+ attr_accessor :valor_total_servicos
94
+ def valor_total_servicos
95
+ @valor_total_servicos || items.map(&:valor_total).map(&:to_f).sum.round(2)
96
96
  end
97
97
 
98
98
  # Valor da base de cálculo
@@ -100,28 +100,28 @@ module BrNfe
100
100
  # o valor das deduções
101
101
  #
102
102
  # <b>Tipo: </b> _Float_
103
- attr_accessor :base_calculation
104
- def base_calculation
105
- @base_calculation || (total_services.to_f - deductions.to_f).round(2)
103
+ attr_accessor :base_calculo
104
+ def base_calculo
105
+ @base_calculo || (valor_total_servicos.to_f - deducoes.to_f).round(2)
106
106
  end
107
107
 
108
108
  # Valor das deduções de impostos
109
109
  #
110
110
  # <b>Tipo: </b> _Float_
111
- attr_accessor :deductions
111
+ attr_accessor :deducoes
112
112
 
113
113
  # Iss retido?
114
114
  # Identifica se o ISS foi retido
115
115
  #
116
116
  # <b>Tipo: </b> _Integer_
117
- attr_accessor :iss_retained
117
+ attr_accessor :iss_retido
118
118
 
119
119
  # Valor do Iss retido
120
120
  # Total de iss retido da nota
121
121
  #
122
122
  # <b>Tipo: </b> _float_
123
123
  #
124
- attr_accessor :total_iss_retained
124
+ attr_accessor :total_iss_retido
125
125
 
126
126
  # Valor total do ISS (R$)
127
127
  # Valor utilizado para identificar o valor total do ISS
@@ -139,9 +139,9 @@ module BrNfe
139
139
  # 3.5% = 3.5
140
140
  #
141
141
  # <b>Tipo: </b> _Float_
142
- attr_accessor :iss_tax_rate
143
- def iss_tax_rate
144
- @iss_tax_rate || items.first.try(:iss_tax_rate)
142
+ attr_accessor :iss_aliquota
143
+ def iss_aliquota
144
+ @iss_aliquota || items.first.try(:iss_aliquota)
145
145
  end
146
146
 
147
147
  # Valor líquido da NF (R$)
@@ -149,12 +149,12 @@ module BrNfe
149
149
  #
150
150
  # <b>Tipo: </b> _Float_
151
151
  #
152
- attr_accessor :net_value
153
- def net_value
154
- @net_value ||= total_services.to_f - (
152
+ attr_accessor :valor_liquido
153
+ def valor_liquido
154
+ @valor_liquido ||= valor_total_servicos.to_f - (
155
155
  valor_pis.to_f + valor_cofins.to_f + valor_inss.to_f +
156
156
  valor_ir.to_f + valor_csll.to_f + outras_retencoes.to_f +
157
- total_iss_retained.to_f + desconto_incondicionado.to_f + desconto_condicionado.to_f
157
+ total_iss_retido.to_f + desconto_incondicionado.to_f + desconto_condicionado.to_f
158
158
  )
159
159
  end
160
160
 
@@ -203,8 +203,8 @@ module BrNfe
203
203
  numero_substituicao.present? && serie_substituicao.present? && tipo_substituicao.present?
204
204
  end
205
205
 
206
- def iss_retained?
207
- BrNfe.true_values.include?(iss_retained)
206
+ def iss_retido?
207
+ BrNfe.true_values.include?(iss_retido)
208
208
  end
209
209
 
210
210
  def competencia
@@ -235,6 +235,9 @@ module BrNfe
235
235
  def municipio_incidencia_obrigatorio?
236
236
  "#{exigibilidade_iss}".in?(['1','01','6','06','7','07'])
237
237
  end
238
+ def destinatario_class
239
+ BrNfe.destinatario_service_class
240
+ end
238
241
  end
239
242
  end
240
243
  end
@@ -3,7 +3,7 @@ ItemServico
3
3
  CodigoAtividade = BrNfe::Helper.only_number(item.cnae_code).max_size(8)
4
4
  DescricaoServico = "#{item.description}".max_size(1000)
5
5
  CST = BrNfe::Helper.only_number(item.cst).max_size(2)
6
- Aliquota = value_monetary(item.iss_tax_rate, 4)
7
- ValorUnitario = value_monetary(item.unit_value, 2)
8
- Quantidade = item.quantity.to_i
9
- ValorTotal = value_monetary(item.total_value, 2)
6
+ Aliquota = value_monetary(item.iss_aliquota, 4)
7
+ ValorUnitario = value_monetary(item.valor_unitario, 2)
8
+ Quantidade = item.quantidade.to_i
9
+ ValorTotal = value_monetary(item.valor_total, 2)
@@ -14,16 +14,16 @@
14
14
  - rps.items.each do |item|
15
15
  = render_xml '_service_item', item: item, dir_path: "#{BrNfe.root}/lib/br_nfe/service/sc/florianopolis/xml"
16
16
 
17
- BaseCalculo = value_monetary(rps.base_calculation, 2)
17
+ BaseCalculo = value_monetary(rps.base_calculo, 2)
18
18
  ValorISSQN = value_monetary(rps.total_iss, 2)
19
19
 
20
- - if rps.total_base_calculation_st.present?
21
- BaseCalculoSubstituicao = value_monetary(rps.total_base_calculation_st, 2)
20
+ - if rps.total_base_calculo_st.present?
21
+ BaseCalculoSubstituicao = value_monetary(rps.total_base_calculo_st, 2)
22
22
 
23
23
  - if rps.total_issqn_st.present?
24
24
  ValorISSQNSubstituicao = value_monetary(rps.total_issqn_st, 2)
25
25
 
26
- ValorTotalServicos = value_monetary(rps.total_services, 2)
26
+ ValorTotalServicos = value_monetary(rps.valor_total_servicos, 2)
27
27
 
28
28
  - if rps.description.present?
29
29
  DadosAdicionais = "#{rps.description}".max_size(1000)
@@ -4,8 +4,7 @@ module BrNfe
4
4
  module V1
5
5
  class CancelaNfse < BrNfe::Service::Simpliss::V1::Base
6
6
  include BrNfe::Service::Concerns::Rules::CancelamentoNfs
7
- include BrNfe::Service::Simpliss::V1::ResponsePaths::ServicoCancelarNfseResposta
8
-
7
+
9
8
  def method_wsdl
10
9
  :cancelar_nfse
11
10
  end
@@ -14,15 +13,26 @@ module BrNfe
14
13
  render_xml 'servico_cancelar_nfse_envio'
15
14
  end
16
15
 
17
- def response_root_path
18
- [:cancelar_nfse_response]
19
- end
20
-
21
16
  # Tag root da requisição
22
17
  #
23
18
  def soap_body_root_tag
24
19
  'CancelarNfse'
25
20
  end
21
+
22
+ private
23
+
24
+ def set_response
25
+ @response = BrNfe::Service::Response::Build::Cancelamento.new(
26
+ savon_response: @original_response, # Rsposta da requisição SOAP
27
+ keys_root_path: [:cancelar_nfse_response], # Caminho inicial da resposta / Chave pai principal
28
+ body_xml_path: nil,
29
+ xml_encode: response_encoding, # Codificação do xml de resposta
30
+ codigo_cancelamento_path: [:cancelar_nfse_result, :cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :codigo_cancelamento],
31
+ data_hora_cancelamento_path: [:cancelar_nfse_result, :cancelamento, :confirmacao, :data_hora_cancelamento],
32
+ numero_nfs_path: [:cancelar_nfse_result, :cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :numero],
33
+ message_errors_path: [:cancelar_nfse_result, :lista_mensagem_retorno, :mensagem_retorno]
34
+ ).response
35
+ end
26
36
  end
27
37
  end
28
38
  end