br_nfe 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (495) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +12 -2
  5. data/README.markdown +3 -1
  6. data/Rakefile +20 -1
  7. data/lib/br_nfe/active_model/associations.rb +11 -0
  8. data/lib/br_nfe/active_model/has_many.rb +65 -0
  9. data/lib/br_nfe/active_model/has_one.rb +57 -0
  10. data/lib/br_nfe/active_model_base.rb +38 -1
  11. data/lib/br_nfe/base.rb +9 -0
  12. data/lib/br_nfe/calculos/fatores_de_multiplicacao.rb +67 -0
  13. data/lib/br_nfe/calculos/modulo11.rb +54 -0
  14. data/lib/br_nfe/calculos/modulo11_fator_de2a9.rb +83 -0
  15. data/lib/br_nfe/calculos/modulo11_fator_de2a9_resto_zero.rb +29 -0
  16. data/lib/br_nfe/constants.rb +46 -1
  17. data/lib/br_nfe/endereco.rb +6 -2
  18. data/lib/br_nfe/helper/cpf_cnpj.rb +8 -1
  19. data/lib/br_nfe/person.rb +32 -3
  20. data/lib/br_nfe/product/destinatario.rb +45 -0
  21. data/lib/br_nfe/product/emitente.rb +14 -1
  22. data/lib/br_nfe/product/evento/base.rb +146 -0
  23. data/lib/br_nfe/product/evento/cancelamento.rb +46 -0
  24. data/lib/br_nfe/product/gateway/base.rb +16 -43
  25. data/lib/br_nfe/product/gateway/web_service_am.rb +140 -0
  26. data/lib/br_nfe/product/gateway/web_service_ba.rb +140 -0
  27. data/lib/br_nfe/product/gateway/web_service_ce.rb +162 -0
  28. data/lib/br_nfe/product/gateway/web_service_go.rb +140 -0
  29. data/lib/br_nfe/product/gateway/web_service_mg.rb +140 -0
  30. data/lib/br_nfe/product/gateway/web_service_ms.rb +140 -0
  31. data/lib/br_nfe/product/gateway/web_service_mt.rb +140 -0
  32. data/lib/br_nfe/product/gateway/web_service_pe.rb +140 -0
  33. data/lib/br_nfe/product/gateway/web_service_pr.rb +140 -0
  34. data/lib/br_nfe/product/gateway/web_service_rs.rb +140 -0
  35. data/lib/br_nfe/product/gateway/web_service_sp.rb +140 -0
  36. data/lib/br_nfe/product/gateway/web_service_svan.rb +162 -0
  37. data/lib/br_nfe/product/gateway/web_service_svc_an.rb +131 -0
  38. data/lib/br_nfe/product/gateway/web_service_svc_rs.rb +20 -0
  39. data/lib/br_nfe/product/gateway/web_service_svrs.rb +111 -10
  40. data/lib/br_nfe/product/nf_xml_value.rb +278 -0
  41. data/lib/br_nfe/product/nfe/adicao_importacao.rb +76 -0
  42. data/lib/br_nfe/product/nfe/cobranca/duplicata.rb +44 -0
  43. data/lib/br_nfe/product/nfe/cobranca/fatura.rb +64 -0
  44. data/lib/br_nfe/product/nfe/cobranca/pagamento.rb +99 -0
  45. data/lib/br_nfe/product/nfe/declaracao_importacao.rb +221 -0
  46. data/lib/br_nfe/product/nfe/detalhe_exportacao.rb +89 -0
  47. data/lib/br_nfe/product/nfe/item.rb +678 -0
  48. data/lib/br_nfe/product/nfe/item_tax/cofins.rb +138 -0
  49. data/lib/br_nfe/product/nfe/item_tax/cofins_st.rb +68 -0
  50. data/lib/br_nfe/product/nfe/item_tax/icms.rb +593 -0
  51. data/lib/br_nfe/product/nfe/item_tax/icms_uf_destino.rb +169 -0
  52. data/lib/br_nfe/product/nfe/item_tax/importacao.rb +62 -0
  53. data/lib/br_nfe/product/nfe/item_tax/ipi.rb +179 -0
  54. data/lib/br_nfe/product/nfe/item_tax/issqn.rb +256 -0
  55. data/lib/br_nfe/product/nfe/item_tax/pis.rb +138 -0
  56. data/lib/br_nfe/product/nfe/item_tax/pis_st.rb +68 -0
  57. data/lib/br_nfe/product/nfe/processo_referencia.rb +48 -0
  58. data/lib/br_nfe/product/nfe/transporte/base.rb +264 -0
  59. data/lib/br_nfe/product/nfe/transporte/transportador.rb +15 -0
  60. data/lib/br_nfe/product/nfe/transporte/veiculo.rb +53 -0
  61. data/lib/br_nfe/product/nfe/transporte/volume.rb +89 -0
  62. data/lib/br_nfe/product/nota_fiscal.rb +1173 -0
  63. data/lib/br_nfe/product/operation/base.rb +255 -0
  64. data/lib/br_nfe/product/operation/nfe_autorizacao.rb +118 -0
  65. data/lib/br_nfe/product/operation/nfe_consulta_protocolo.rb +61 -0
  66. data/lib/br_nfe/product/operation/nfe_download_nf.rb +86 -0
  67. data/lib/br_nfe/product/operation/nfe_inutilizacao.rb +168 -0
  68. data/lib/br_nfe/product/operation/nfe_recepcao_evento.rb +70 -0
  69. data/lib/br_nfe/product/operation/nfe_ret_autorizacao.rb +63 -0
  70. data/lib/br_nfe/product/operation/nfe_status_servico.rb +46 -0
  71. data/lib/br_nfe/product/response/base.rb +97 -0
  72. data/lib/br_nfe/product/response/build/base.rb +287 -0
  73. data/lib/br_nfe/product/response/build/nfe_autorizacao.rb +102 -0
  74. data/lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb +133 -0
  75. data/lib/br_nfe/product/response/build/nfe_inutilizacao.rb +53 -0
  76. data/lib/br_nfe/product/response/build/nfe_ret_autorizacao.rb +65 -0
  77. data/lib/br_nfe/product/response/build/nfe_status_servico.rb +43 -0
  78. data/lib/br_nfe/product/response/event.rb +89 -0
  79. data/lib/br_nfe/product/response/nfe_autorizacao.rb +12 -0
  80. data/lib/br_nfe/product/response/nfe_consulta_protocolo.rb +13 -0
  81. data/lib/br_nfe/product/response/nfe_inutilizacao.rb +89 -0
  82. data/lib/br_nfe/product/response/nfe_ret_autorizacao.rb +9 -0
  83. data/lib/br_nfe/product/response/nfe_status_servico.rb +31 -0
  84. data/lib/br_nfe/product/xml/_signed_info_sh1.xml.slim +9 -0
  85. data/lib/br_nfe/product/xml/_tc_cpf_cnpj.xml.slim +7 -0
  86. data/lib/br_nfe/product/xml/signature_sh1.xml.slim +12 -0
  87. data/lib/br_nfe/product/xml/v1_00/evento/infEventoCancelamento.xml.slim +19 -0
  88. data/lib/br_nfe/product/xml/v1_00/root/NfeDownloadNf.xml.slim +5 -0
  89. data/lib/br_nfe/product/xml/v1_00/root/NfeRecepcaoEvento.xml.slim +7 -0
  90. data/lib/br_nfe/product/xml/v2_00/_tc_endereco.xml.slim +19 -0
  91. data/lib/br_nfe/product/xml/v2_00/_tc_infNFe.xml.slim +39 -0
  92. data/lib/br_nfe/product/xml/v2_00/infInut.xml.slim +12 -0
  93. data/lib/br_nfe/product/xml/v2_00/infNFe/NFe.xml.slim +4 -0
  94. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_cobr.xml.slim +19 -0
  95. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_dest.xml.slim +14 -0
  96. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_det.xml.slim +7 -0
  97. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_emit.xml.slim +19 -0
  98. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_entrega.xml.slim +11 -0
  99. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_exporta.xml.slim +2 -0
  100. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_ide.xml.slim +24 -0
  101. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_infAdic.xml.slim +13 -0
  102. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_retirada.xml.slim +11 -0
  103. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_total.xml.slim +50 -0
  104. data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_transp.xml.slim +35 -0
  105. data/lib/br_nfe/product/xml/v2_00/infNFe/det/_tc_imposto.xml.slim +31 -0
  106. data/lib/br_nfe/product/xml/v2_00/infNFe/det/_tc_prod.xml.slim +37 -0
  107. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS00.xml.slim +6 -0
  108. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS10.xml.slim +16 -0
  109. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS101.xml.slim +4 -0
  110. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS102.xml.slim +3 -0
  111. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS20.xml.slim +6 -0
  112. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS201.xml.slim +15 -0
  113. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS202.xml.slim +14 -0
  114. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS30.xml.slim +12 -0
  115. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS40.xml.slim +7 -0
  116. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS500.xml.slim +6 -0
  117. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS51.xml.slim +13 -0
  118. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS60.xml.slim +5 -0
  119. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS70.xml.slim +18 -0
  120. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS90.xml.slim +21 -0
  121. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS900.xml.slim +25 -0
  122. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_COFINS.xml.slim +26 -0
  123. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_COFINS_ST.xml.slim +7 -0
  124. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_ICMS.xml.slim +45 -0
  125. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_II.xml.slim +4 -0
  126. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_IPI.xml.slim +30 -0
  127. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_PIS.xml.slim +26 -0
  128. data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_PIS_ST.xml.slim +7 -0
  129. data/lib/br_nfe/product/xml/v2_00/infNFe/det/prod/_tc_di.xml.slim +13 -0
  130. data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_retTransp.xml.slim +6 -0
  131. data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_transporta.xml.slim +17 -0
  132. data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_vol.xml.slim +15 -0
  133. data/lib/br_nfe/product/xml/v2_00/infNFe.xml.slim +3 -0
  134. data/lib/br_nfe/product/xml/v2_00/root/NfeAutorizacao.xml.slim +5 -0
  135. data/lib/br_nfe/product/xml/v2_00/root/NfeInutilizacao.xml.slim +4 -0
  136. data/lib/br_nfe/product/xml/v2_00/root/NfeRetAutorizacao.xml.slim +3 -0
  137. data/lib/br_nfe/product/xml/v2_00/root/NfeStatusServico.xml.slim +4 -0
  138. data/lib/br_nfe/product/xml/v2_01/root/NfeConsultaProtocolo.xml.slim +4 -0
  139. data/lib/br_nfe/product/xml/v3_10/_tc_infNFe.xml.slim +44 -0
  140. data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_dest.xml.slim +25 -0
  141. data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_det.xml.slim +14 -0
  142. data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_exporta.xml.slim +4 -0
  143. data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_ide.xml.slim +26 -0
  144. data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_pag.xml.slim +7 -0
  145. data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_total.xml.slim +78 -0
  146. data/lib/br_nfe/product/xml/v3_10/infNFe/det/_tc_imposto.xml.slim +37 -0
  147. data/lib/br_nfe/product/xml/v3_10/infNFe/det/_tc_prod.xml.slim +48 -0
  148. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS20.xml.slim +12 -0
  149. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS30.xml.slim +17 -0
  150. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS40.xml.slim +7 -0
  151. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS51.xml.slim +19 -0
  152. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS70.xml.slim +23 -0
  153. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS90.xml.slim +26 -0
  154. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/_tc_ICMSUFDest.xml.slim +8 -0
  155. data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/_tc_ISSQN.xml.slim +35 -0
  156. data/lib/br_nfe/product/xml/v3_10/infNFe/det/prod/_tc_det_export.xml.slim +8 -0
  157. data/lib/br_nfe/product/xml/v3_10/infNFe/det/prod/_tc_di.xml.slim +28 -0
  158. data/lib/br_nfe/product/xml/v3_10/root/NfeAutorizacao.xml.slim +6 -0
  159. data/lib/br_nfe/service/base.rb +1 -105
  160. data/lib/br_nfe/service/betha/v1/cancela_nfse.rb +1 -1
  161. data/lib/br_nfe/service/response/default.rb +1 -1
  162. data/lib/br_nfe/service/simpliss/v1/base.rb +2 -0
  163. data/lib/br_nfe/version.rb +2 -2
  164. data/lib/br_nfe.rb +180 -22
  165. data/lib/config/locales/br_nfe/en/product/nfe/cobranca/fatura.yml +6 -0
  166. data/lib/config/locales/br_nfe/en/product/nfe/declaracao_importacao.yml +10 -0
  167. data/lib/config/locales/br_nfe/en/product/nfe/item.yml +20 -0
  168. data/lib/config/locales/br_nfe/en/product/nfe/item_tax/icms_uf_destino.yml +8 -0
  169. data/lib/config/locales/br_nfe/en/product/nfe/transporte/base.yml +9 -0
  170. data/lib/config/locales/br_nfe/en/product/nota_fiscal.yml +21 -0
  171. data/lib/config/locales/br_nfe/en/product/operation/nfe_autorizacao.yml +10 -0
  172. data/lib/config/locales/br_nfe/en/product/operation/nfe_recepcao_evento.yml +6 -0
  173. data/lib/config/locales/br_nfe/pt-BR/product/nfe/cobranca/fatura.yml +6 -0
  174. data/lib/config/locales/br_nfe/pt-BR/product/nfe/declaracao_importacao.yml +10 -0
  175. data/lib/config/locales/br_nfe/pt-BR/product/nfe/item.yml +20 -0
  176. data/lib/config/locales/br_nfe/pt-BR/product/nfe/item_tax/icms_uf_destino.yml +8 -0
  177. data/lib/config/locales/br_nfe/pt-BR/product/nfe/transporte/base.yml +9 -0
  178. data/lib/config/locales/br_nfe/pt-BR/product/nota_fiscal.yml +21 -0
  179. data/lib/config/locales/br_nfe/pt-BR/product/operation/nfe_autorizacao.yml +10 -0
  180. data/lib/config/locales/br_nfe/pt-BR/product/operation/nfe_recepcao_evento.yml +6 -0
  181. data/test/br_nfe/association/have_destinatario_test.rb +8 -8
  182. data/test/br_nfe/association/have_emitente_test.rb +6 -6
  183. data/test/br_nfe/base_test.rb +15 -4
  184. data/test/br_nfe/endereco_test.rb +15 -0
  185. data/test/br_nfe/person_test.rb +55 -6
  186. data/test/br_nfe/product/destinatario_test.rb +26 -0
  187. data/test/br_nfe/product/emitente_test.rb +1 -2
  188. data/test/br_nfe/product/evento/base_test.rb +58 -0
  189. data/test/br_nfe/product/evento/cancelamento_test.rb +32 -0
  190. data/test/br_nfe/product/gateway/web_service_am_test.rb +242 -0
  191. data/test/br_nfe/product/gateway/web_service_ba_test.rb +242 -0
  192. data/test/br_nfe/product/gateway/web_service_ce_test.rb +242 -0
  193. data/test/br_nfe/product/gateway/web_service_go_test.rb +242 -0
  194. data/test/br_nfe/product/gateway/web_service_mg_test.rb +242 -0
  195. data/test/br_nfe/product/gateway/web_service_ms_test.rb +242 -0
  196. data/test/br_nfe/product/gateway/web_service_mt_test.rb +408 -0
  197. data/test/br_nfe/product/gateway/web_service_pe_test.rb +408 -0
  198. data/test/br_nfe/product/gateway/web_service_pr_test.rb +408 -0
  199. data/test/br_nfe/product/gateway/web_service_rs_test.rb +407 -0
  200. data/test/br_nfe/product/gateway/web_service_sp_test.rb +408 -0
  201. data/test/br_nfe/product/gateway/web_service_svan_test.rb +242 -0
  202. data/test/br_nfe/product/gateway/web_service_svc_an_test.rb +185 -0
  203. data/test/br_nfe/product/gateway/web_service_svc_rs_test.rb +185 -0
  204. data/test/br_nfe/product/gateway/web_service_svrs_test.rb +208 -2
  205. data/test/br_nfe/product/nfe/adicao_importacao_test.rb +19 -0
  206. data/test/br_nfe/product/nfe/cobranca/duplicata_test.rb +19 -0
  207. data/test/br_nfe/product/nfe/cobranca/fatura_test.rb +32 -0
  208. data/test/br_nfe/product/nfe/cobranca/pagamento_test.rb +105 -0
  209. data/test/br_nfe/product/nfe/declaracao_importacao_test.rb +116 -0
  210. data/test/br_nfe/product/nfe/detalhe_exportacao_test.rb +97 -0
  211. data/test/br_nfe/product/nfe/item_tax/cofins_st_test.rb +22 -0
  212. data/test/br_nfe/product/nfe/item_tax/cofins_test.rb +113 -0
  213. data/test/br_nfe/product/nfe/item_tax/icms_test.rb +1011 -0
  214. data/test/br_nfe/product/nfe/item_tax/icms_uf_destino_test.rb +99 -0
  215. data/test/br_nfe/product/nfe/item_tax/importacao_test.rb +23 -0
  216. data/test/br_nfe/product/nfe/item_tax/ipi_test.rb +160 -0
  217. data/test/br_nfe/product/nfe/item_tax/issqn_test.rb +84 -0
  218. data/test/br_nfe/product/nfe/item_tax/pis_st_test.rb +22 -0
  219. data/test/br_nfe/product/nfe/item_tax/pis_test.rb +113 -0
  220. data/test/br_nfe/product/nfe/item_test.rb +381 -0
  221. data/test/br_nfe/product/nfe/processo_referencia_test.rb +30 -0
  222. data/test/br_nfe/product/nfe/transporte/base_test.rb +182 -0
  223. data/test/br_nfe/product/nfe/transporte/transportador_test.rb +13 -0
  224. data/test/br_nfe/product/nfe/transporte/veiculo_test.rb +13 -0
  225. data/test/br_nfe/product/nfe/transporte/volume_test.rb +42 -0
  226. data/test/br_nfe/product/nota_fiscal_test.rb +662 -0
  227. data/test/br_nfe/product/operation/base_test.rb +538 -0
  228. data/test/br_nfe/product/operation/nfe_autorizacao_test.rb +378 -0
  229. data/test/br_nfe/product/operation/nfe_consulta_protocolo_test.rb +349 -0
  230. data/test/br_nfe/product/operation/nfe_download_nf_test.rb +93 -0
  231. data/test/br_nfe/product/operation/nfe_inutilizacao_test.rb +210 -0
  232. data/test/br_nfe/product/operation/nfe_recepcao_evento_test.rb +84 -0
  233. data/test/br_nfe/product/operation/nfe_ret_autorizacao_test.rb +309 -0
  234. data/test/br_nfe/product/operation/nfe_status_servico_test.rb +122 -0
  235. data/test/br_nfe/product/response/base_test.rb +75 -0
  236. data/test/br_nfe/product/response/build/base_test.rb +34 -0
  237. data/test/br_nfe/product/response/nfe_ret_autorizacao_test.rb +14 -0
  238. data/test/br_nfe/service/association/have_intermediario_test.rb +10 -10
  239. data/test/br_nfe/service/base_test.rb +9 -206
  240. data/test/br_nfe/service/betha/v1/cancela_nfse_test.rb +8 -6
  241. data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +6 -3
  242. data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +6 -3
  243. data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +7 -4
  244. data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +12 -9
  245. data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +6 -3
  246. data/test/br_nfe/service/rps_test.rb +2 -2
  247. data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +6 -3
  248. data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +7 -4
  249. data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +7 -4
  250. data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +8 -5
  251. data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +9 -6
  252. data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +6 -3
  253. data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +6 -3
  254. data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +6 -3
  255. data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +6 -3
  256. data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +8 -5
  257. data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +9 -6
  258. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +6 -3
  259. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +6 -3
  260. data/test/factories/person.rb +1 -1
  261. data/test/factories/product/destinatario.rb +11 -0
  262. data/test/factories/product/emitente.rb +1 -1
  263. data/test/factories/product/evento/base.rb +9 -0
  264. data/test/factories/product/evento/cancelamento.rb +10 -0
  265. data/test/factories/product/gateway/web_service_am.rb +5 -0
  266. data/test/factories/product/gateway/web_service_ba.rb +5 -0
  267. data/test/factories/product/nfe/adicao_importacao.rb +7 -0
  268. data/test/factories/product/nfe/cobranca/duplicata.rb +7 -0
  269. data/test/factories/product/nfe/cobranca/fatura.rb +8 -0
  270. data/test/factories/product/nfe/cobranca/pagamento.rb +9 -0
  271. data/test/factories/product/nfe/declaracao_importacao.rb +10 -0
  272. data/test/factories/product/nfe/detalhe_exportacao.rb +5 -0
  273. data/test/factories/product/nfe/item.rb +24 -0
  274. data/test/factories/product/nfe/item_tax/cofins.rb +5 -0
  275. data/test/factories/product/nfe/item_tax/cofins_st.rb +5 -0
  276. data/test/factories/product/nfe/item_tax/icms.rb +9 -0
  277. data/test/factories/product/nfe/item_tax/icms_uf_destino.rb +11 -0
  278. data/test/factories/product/nfe/item_tax/importacao.rb +8 -0
  279. data/test/factories/product/nfe/item_tax/ipi.rb +6 -0
  280. data/test/factories/product/nfe/item_tax/issqn.rb +9 -0
  281. data/test/factories/product/nfe/item_tax/pis.rb +5 -0
  282. data/test/factories/product/nfe/item_tax/pis_st.rb +5 -0
  283. data/test/factories/product/nfe/processo_referencia.rb +6 -0
  284. data/test/factories/product/nfe/transporte/base.rb +5 -0
  285. data/test/factories/product/nfe/transporte/transportador.rb +7 -0
  286. data/test/factories/product/nfe/transporte/veiculo.rb +7 -0
  287. data/test/factories/product/nfe/transporte/volume.rb +5 -0
  288. data/test/factories/product/nota_fiscal.rb +22 -0
  289. data/test/factories/product/{base.rb → operation/base.rb} +1 -1
  290. data/test/factories/product/operation/nfe_autorizacao.rb +590 -0
  291. data/test/factories/product/operation/nfe_consulta_protocolo.rb +13 -0
  292. data/test/factories/product/operation/nfe_download_nf.rb +15 -0
  293. data/test/factories/product/operation/nfe_inutilizacao.rb +19 -0
  294. data/test/factories/product/operation/nfe_recepcao_evento.rb +14 -0
  295. data/test/factories/product/operation/nfe_ret_autorizacao.rb +13 -0
  296. data/test/factories/product/{consulta_status_servico.rb → operation/nfe_status_servico.rb} +1 -1
  297. data/test/factories/product/response/base.rb +12 -0
  298. data/test/factories/product/response/build/base.rb +6 -0
  299. data/test/factories/product/response/nfe_ret_autorizacao.rb +13 -0
  300. data/test/factories/service/emitente.rb +1 -1
  301. data/test/fixtures/product/operation/nfe_autorizacao/nfe_signed.xml +1 -0
  302. data/test/fixtures/product/response/v3.10/nfe_autorizacao/async_fail.xml +21 -0
  303. data/test/fixtures/product/response/v3.10/nfe_autorizacao/async_success.xml +25 -0
  304. data/test/fixtures/product/response/v3.10/nfe_autorizacao/nfe/with_proc.xml +1 -0
  305. data/test/fixtures/product/response/v3.10/nfe_autorizacao/nfe/without_proc.xml +1 -0
  306. data/test/fixtures/product/response/v3.10/nfe_autorizacao/original_xml.xml +1 -0
  307. data/test/fixtures/product/response/v3.10/nfe_autorizacao/sync_fail.xml +32 -0
  308. data/test/fixtures/product/response/v3.10/nfe_autorizacao/sync_success.xml +33 -0
  309. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_1.xml +1 -0
  310. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_2.xml +1 -0
  311. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_3.xml +1 -0
  312. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_cancel.xml +1 -0
  313. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/one_event.xml +1 -0
  314. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/fail.xml +22 -0
  315. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/nfe_original/with_proc.xml +1 -0
  316. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/nfe_original/without_proc.xml +1 -0
  317. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_many_with_cancel.xml +198 -0
  318. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_many_without_cancel.xml +199 -0
  319. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_one.xml +89 -0
  320. data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_without.xml +34 -0
  321. data/test/fixtures/product/response/v3.10/nfe_inutilizacao/fail.xml +29 -0
  322. data/test/fixtures/product/response/v3.10/nfe_inutilizacao/success.xml +30 -0
  323. data/test/fixtures/product/response/v3.10/nfe_recepcao_evento/cancelamento/fail.xml +34 -0
  324. data/test/fixtures/product/response/v3.10/nfe_recepcao_evento/cancelamento/success.xml +36 -0
  325. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_fail.xml +22 -0
  326. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_fail.xml +33 -0
  327. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_fail_and_one_ok.xml +46 -0
  328. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_ok.xml +34 -0
  329. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_two_invoice_fail.xml +46 -0
  330. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_two_invoice_ok.xml +46 -0
  331. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_2_with_protocol.xml +1 -0
  332. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_2_without_protocol.xml +1 -0
  333. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_3_with_protocol.xml +1 -0
  334. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_3_without_protocol.xml +1 -0
  335. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/lot.xml +2 -0
  336. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/nfe.xml +2 -0
  337. data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/nfeProc.xml +4 -0
  338. data/test/fixtures/product/response/v3.10/nfe_status_servico/fail.xml +23 -0
  339. data/test/fixtures/product/response/v3.10/nfe_status_servico/success.xml +22 -0
  340. data/test/fixtures/product/schemas/CCe_v1.00.xsd +11 -0
  341. data/test/fixtures/product/schemas/EPEC_v1.00.xsd +9 -0
  342. data/test/fixtures/product/schemas/LeiauteCadastroEmissorDFe_v1.01.xsd +234 -0
  343. data/test/fixtures/product/schemas/SuframaInternaliza_v1.00.xsd +9 -0
  344. data/test/fixtures/product/schemas/SuframaVistoria_v1.00.xsd +9 -0
  345. data/test/fixtures/product/schemas/atuCadEmiDFe_v1.01.xsd +9 -0
  346. data/test/fixtures/product/schemas/cabecMsg_v1.02.xsd +29 -0
  347. data/test/fixtures/product/schemas/cadEmiDFe_v1.01.xsd +9 -0
  348. data/test/fixtures/product/schemas/cancNFe_v2.00.xsd +9 -0
  349. data/test/fixtures/product/schemas/confRecebto_v1.00.xsd +9 -0
  350. data/test/fixtures/product/schemas/consCad_v2.00.xsd +9 -0
  351. data/test/fixtures/product/schemas/consDPEC_v1.01.xsd +9 -0
  352. data/test/fixtures/product/schemas/consNFeDest_v1.01.xsd +10 -0
  353. data/test/fixtures/product/schemas/consReciNFe_v2.00.xsd +9 -0
  354. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consReciNFe_v3.10.xsd +8 -8
  355. data/test/fixtures/product/schemas/consSitNFe_v2.01.xsd +10 -0
  356. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consSitNFe_v3.10.xsd +8 -8
  357. data/test/fixtures/product/schemas/consStatServ_v2.00.xsd +9 -0
  358. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consStatServ_v3.10.xsd +8 -8
  359. data/test/fixtures/product/schemas/distDFeInt_v1.00.xsd +71 -0
  360. data/test/fixtures/product/schemas/downloadNFe_v1.00.xsd +10 -0
  361. data/test/fixtures/product/schemas/e110110_v1.00.xsd +58 -0
  362. data/test/fixtures/product/schemas/e110111_v1.00.xsd +42 -0
  363. data/test/fixtures/product/schemas/e110140_v1.00.xsd +124 -0
  364. data/test/fixtures/product/schemas/e111500_v1.00.xsd +69 -0
  365. data/test/fixtures/product/schemas/e111501_v1.00.xsd +69 -0
  366. data/test/fixtures/product/schemas/e111502_v1.00.xsd +50 -0
  367. data/test/fixtures/product/schemas/e111503_v1.00.xsd +50 -0
  368. data/test/fixtures/product/schemas/e210200_v1.00.xsd +32 -0
  369. data/test/fixtures/product/schemas/e210210_v1.00.xsd +32 -0
  370. data/test/fixtures/product/schemas/e210220_v1.00.xsd +45 -0
  371. data/test/fixtures/product/schemas/e210240_v1.00.xsd +44 -0
  372. data/test/fixtures/product/schemas/e411500_v1.00.xsd +134 -0
  373. data/test/fixtures/product/schemas/e411501_v1.00.xsd +134 -0
  374. data/test/fixtures/product/schemas/e411502_v1.00.xsd +95 -0
  375. data/test/fixtures/product/schemas/e411503_v1.00.xsd +95 -0
  376. data/test/fixtures/product/schemas/e990900_v1.00.xsd +87 -0
  377. data/test/fixtures/product/schemas/e990910_v1.00.xsd +81 -0
  378. data/test/fixtures/product/schemas/envCCe_v1.00.xsd +10 -0
  379. data/test/fixtures/product/schemas/envCancelPProrrogNFe_v1.0.xsd +50 -0
  380. data/test/fixtures/product/schemas/envConfRecebto_v1.00.xsd +9 -0
  381. data/test/fixtures/product/schemas/envDPEC_v1.01.xsd +9 -0
  382. data/test/fixtures/product/schemas/envEPEC_v1.00.xsd +9 -0
  383. data/test/fixtures/product/schemas/envEventoCancNFe_v1.00.xsd +9 -0
  384. data/test/fixtures/product/schemas/envEvento_v1.00.xsd +9 -0
  385. data/test/fixtures/product/schemas/envFiscoNfe_v1.0.xsd +179 -0
  386. data/test/fixtures/product/schemas/envPProrrogNFe_v1.0.xsd +65 -0
  387. data/test/fixtures/product/schemas/envRemIndus_v1.00.xsd +9 -0
  388. data/test/fixtures/product/schemas/envSuframaInternaliza_v1.00.xsd +10 -0
  389. data/test/fixtures/product/schemas/envSuframaVistoria_v1.00.xsd +10 -0
  390. data/test/fixtures/product/schemas/enviNFe_v2.00.xsd +9 -0
  391. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/enviNFe_v3.10.xsd +8 -8
  392. data/test/fixtures/product/schemas/eventoCancNFe_v1.00.xsd +9 -0
  393. data/test/fixtures/product/schemas/eventoEPEC_v0.01.xsd +267 -0
  394. data/test/fixtures/product/schemas/eventoEPEC_v1.00.xsd +267 -0
  395. data/test/fixtures/product/schemas/eventoRemIndus_v1.00.xsd +9 -0
  396. data/test/fixtures/product/schemas/inutNFe_v2.00.xsd +9 -0
  397. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/inutNFe_v3.10.xsd +8 -8
  398. data/test/fixtures/product/schemas/leiauteCCe_v1.00.xsd +418 -0
  399. data/test/fixtures/product/schemas/leiauteCancNFe_v2.00.xsd +143 -0
  400. data/test/fixtures/product/schemas/leiauteConfRecebto_v1.00.xsd +406 -0
  401. data/test/fixtures/product/schemas/leiauteConsNFeDest_v1.01.xsd +483 -0
  402. data/test/fixtures/product/schemas/leiauteConsSitNFe_v2.01.xsd +548 -0
  403. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteConsSitNFe_v3.10.xsd +502 -502
  404. data/test/fixtures/product/schemas/leiauteConsStatServ_v2.00.xsd +98 -0
  405. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteConsStatServ_v3.10.xsd +97 -97
  406. data/test/fixtures/product/schemas/leiauteConsultaCadastro_v1.01.xsd +355 -0
  407. data/test/fixtures/product/schemas/leiauteConsultaCadastro_v2.00.xsd +404 -0
  408. data/test/fixtures/product/schemas/leiauteDPEC_v1.01.xsd +464 -0
  409. data/test/fixtures/product/schemas/leiauteDownloadNFe_v1.00.xsd +149 -0
  410. data/test/fixtures/product/schemas/leiauteEPEC_v1.00.xsd +459 -0
  411. data/test/fixtures/product/schemas/leiauteEventoCancNFe_v1.00.xsd +394 -0
  412. data/test/fixtures/product/schemas/leiauteEvento_v1.00.xsd +373 -0
  413. data/test/fixtures/product/schemas/leiauteInutNFe_v2.00.xsd +193 -0
  414. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteInutNFe_v3.10.xsd +192 -192
  415. data/test/fixtures/product/schemas/leiauteNFe_v2.00.xsd +6661 -0
  416. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteNFe_v3.10.xsd +6060 -6060
  417. data/test/fixtures/product/schemas/leiauteRemIndus_v1.00.xsd +382 -0
  418. data/test/fixtures/product/schemas/leiauteSRE_v1.00.xsd +372 -0
  419. data/test/fixtures/product/schemas/leiauteSuframaInternaliza_v1.00.xsd +642 -0
  420. data/test/fixtures/product/schemas/leiauteSuframaVistoria_v1.00.xsd +648 -0
  421. data/test/fixtures/product/schemas/nfe_v2.00.xsd +9 -0
  422. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/nfe_v3.10.xsd +8 -8
  423. data/test/fixtures/product/schemas/procCCeNFe_v1.00.xsd +10 -0
  424. data/test/fixtures/product/schemas/procCancNFe_v2.00.xsd +9 -0
  425. data/test/fixtures/product/schemas/procConfRecebtoNFe_v1.00.xsd +9 -0
  426. data/test/fixtures/product/schemas/procEPEC_v1.00.xsd +9 -0
  427. data/test/fixtures/product/schemas/procEventoCancNFe_v1.00.xsd +9 -0
  428. data/test/fixtures/product/schemas/procEventoNFe_v1.00.xsd +9 -0
  429. data/test/fixtures/product/schemas/procEventoNFe_v99.99.xsd +37 -0
  430. data/test/fixtures/product/schemas/procInutNFe_v2.00.xsd +9 -0
  431. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/procInutNFe_v3.10.xsd +8 -8
  432. data/test/fixtures/product/schemas/procNFe_v2.00.xsd +9 -0
  433. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/procNFe_v3.10.xsd +8 -8
  434. data/test/fixtures/product/schemas/procRemIndus_v1.00.xsd +9 -0
  435. data/test/fixtures/product/schemas/resEvento_v1.00.xsd +94 -0
  436. data/test/fixtures/product/schemas/resNFe_v1.00.xsd +110 -0
  437. data/test/fixtures/product/schemas/retAtuCadEmiDFe_v1.01.xsd +9 -0
  438. data/test/fixtures/product/schemas/retCancNFe_v2.00.xsd +9 -0
  439. data/test/fixtures/product/schemas/retConsCad_v2.00.xsd +9 -0
  440. data/test/fixtures/product/schemas/retConsDPEC_v1.01.xsd +9 -0
  441. data/test/fixtures/product/schemas/retConsReciNFe_v2.00.xsd +9 -0
  442. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsReciNFe_v3.10.xsd +8 -8
  443. data/test/fixtures/product/schemas/retConsSitNFe_v2.01.xsd +10 -0
  444. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsSitNFe_v3.10.xsd +8 -8
  445. data/test/fixtures/product/schemas/retConsStatServ_v2.00.xsd +9 -0
  446. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsStatServ_v3.10.xsd +8 -8
  447. data/test/fixtures/product/schemas/retDPEC_v1.01.xsd +9 -0
  448. data/test/fixtures/product/schemas/retDistDFeInt_v1.00.xsd +84 -0
  449. data/test/fixtures/product/schemas/retDownloadNFe_v1.00.xsd +9 -0
  450. data/test/fixtures/product/schemas/retEnvCCe_v1.00.xsd +10 -0
  451. data/test/fixtures/product/schemas/retEnvCancelPProrrogNFe_v1.0.xsd +231 -0
  452. data/test/fixtures/product/schemas/retEnvConfRecebto_v1.00.xsd +9 -0
  453. data/test/fixtures/product/schemas/retEnvEPEC_v1.00.xsd +9 -0
  454. data/test/fixtures/product/schemas/retEnvEventoCancNFe_v1.00.xsd +9 -0
  455. data/test/fixtures/product/schemas/retEnvEvento_v1.00.xsd +9 -0
  456. data/test/fixtures/product/schemas/retEnvFiscoNFe_v1.0.xsd +234 -0
  457. data/test/fixtures/product/schemas/retEnvRemIndus_v1.00.xsd +9 -0
  458. data/test/fixtures/product/schemas/retEnvSuframaInternaliza_v1.00.xsd +9 -0
  459. data/test/fixtures/product/schemas/retEnvSuframaVistoria_v1.00.xsd +9 -0
  460. data/test/fixtures/product/schemas/retEnviNFe_v2.00.xsd +9 -0
  461. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retEnviNFe_v3.10.xsd +8 -8
  462. data/test/fixtures/product/schemas/retEventoEPEC_v0.01.xsd +207 -0
  463. data/test/fixtures/product/schemas/retInutNFe_v2.00.xsd +9 -0
  464. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retInutNFe_v3.10.xsd +8 -8
  465. data/test/fixtures/product/schemas/retPProrrogNFe_v1.0.xsd +233 -0
  466. data/test/fixtures/product/schemas/retconsNFeDest_v1.01.xsd +9 -0
  467. data/test/fixtures/product/schemas/tiposBasico_v1.03.xsd +816 -0
  468. data/test/fixtures/product/schemas/tiposBasico_v1.03_OPENSSL.xsd +816 -0
  469. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/tiposBasico_v3.10.xsd +571 -571
  470. data/test/fixtures/product/schemas/tiposBasico_v3.10_OPENSSL.xsd +877 -0
  471. data/test/fixtures/product/schemas/tiposDistDFe_v1.00.xsd +217 -0
  472. data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/xmldsig-core-schema_v1.01.xsd +97 -97
  473. data/test/fixtures/product/wsdl/NFeRetAutorizacao.xml +80 -0
  474. data/test/fixtures/product/wsdl/NfeAutorizacao.xml +107 -0
  475. data/test/fixtures/product/wsdl/NfeConsulta2.xml +80 -0
  476. data/test/fixtures/product/wsdl/NfeStatusServico2.xml +70 -0
  477. data/test/fixtures/product/wsdl/nfeinutilizacao2.xml +80 -0
  478. data/test/fixtures/service/wsdl/betha/v1/cancelar_nfse.xml +178 -0
  479. data/test/fixtures/service/wsdl/betha/v1/consultar_lote_rps.xml +339 -0
  480. data/test/fixtures/service/wsdl/betha/v1/consultar_nfse.xml +348 -0
  481. data/test/fixtures/service/wsdl/betha/v1/consultar_nfse_por_rps.xml +365 -0
  482. data/test/fixtures/service/wsdl/betha/v1/consultar_situacao_lote_rps.xml +74 -0
  483. data/test/fixtures/service/wsdl/betha/v1/recepcionar_lote_rps.xml +299 -0
  484. data/test/fixtures/service/wsdl/simpliss/v1/nfseservice.xml +1 -0
  485. data/test/fixtures/service/wsdl/thema/v1/nfse_cancelamento.xml +82 -0
  486. data/test/fixtures/service/wsdl/thema/v1/nfse_consulta.xml +235 -0
  487. data/test/fixtures/service/wsdl/thema/v1/nfse_remessa.xml +185 -0
  488. data/test/test_helper.rb +369 -1
  489. metadata +711 -33
  490. data/lib/br_nfe/product/base.rb +0 -82
  491. data/lib/br_nfe/product/consulta_status_servico.rb +0 -35
  492. data/lib/br_nfe/product/value_nf.rb +0 -9
  493. data/lib/br_nfe/product/xml/v3_10/consulta_status_servico.xml.slim +0 -4
  494. data/test/br_nfe/product/base_test.rb +0 -150
  495. data/test/br_nfe/product/consulta_status_servico_test.rb +0 -59
@@ -22,8 +22,8 @@ describe HaveIntermediarioTest do
22
22
 
23
23
  it 'deve_manter_o_objeto_intermediario_se_ja_tiver' do
24
24
  subject.intermediario.must_equal intermediario
25
- intermediario.cpf_cnpj = 'nova-www'
26
- subject.intermediario.cpf_cnpj.must_equal 'nova-www'
25
+ intermediario.cpf_cnpj = '00888888812345'
26
+ subject.intermediario.cpf_cnpj.must_equal '00888888812345'
27
27
  end
28
28
 
29
29
  it 'Se_setar_o_intermediario_com_outra_class_deve_ignorar' do
@@ -33,35 +33,35 @@ describe HaveIntermediarioTest do
33
33
 
34
34
  it 'posso_setar_o_intermediario_com_um_hash_com_os_parametros_do_intermediario' do
35
35
  intermediario.assign_attributes(cpf_cnpj: '123456', razao_social: '123465')
36
- subject.intermediario = {cpf_cnpj: '99999', razao_social: '654389'}
37
- subject.intermediario.cpf_cnpj.must_equal '99999'
36
+ subject.intermediario = {cpf_cnpj: '12345678901', razao_social: '654389'}
37
+ subject.intermediario.cpf_cnpj.must_equal '12345678901'
38
38
  subject.intermediario.razao_social.must_equal '654389'
39
39
  end
40
40
 
41
41
  it 'ao_setar_um_intermediario_com_um_hash_e_nao_tiver_um_intermediario_deve_instanciar_um_com_os_parametros' do
42
42
  subject.intermediario = nil
43
- subject.intermediario = {cpf_cnpj: '99999', razao_social: '654389'}
44
- subject.intermediario.cpf_cnpj.must_equal '99999'
43
+ subject.intermediario = {cpf_cnpj: '12345678901234', razao_social: '654389'}
44
+ subject.intermediario.cpf_cnpj.must_equal '12345678901234'
45
45
  subject.intermediario.razao_social.must_equal '654389'
46
46
  end
47
47
 
48
48
  it 'posso_setar_o_intermediario_com_um_bloco' do
49
49
  intermediario.assign_attributes(cpf_cnpj: '123456', razao_social: '11111')
50
50
  subject.intermediario do |address|
51
- address.cpf_cnpj = '99999'
51
+ address.cpf_cnpj = '12345678901234'
52
52
  address.razao_social = '11111'
53
53
  end
54
- subject.intermediario.cpf_cnpj.must_equal '99999'
54
+ subject.intermediario.cpf_cnpj.must_equal '12345678901234'
55
55
  subject.intermediario.razao_social.must_equal '11111'
56
56
  end
57
57
 
58
58
  it 'ao_setar_um_intermediario_com_um_bloco_e_nao_tiver_um_intermediario_deve_instanciar_um_com_os_parametros' do
59
59
  subject.intermediario = nil
60
60
  subject.intermediario do |address|
61
- address.cpf_cnpj = '99999'
61
+ address.cpf_cnpj = '12345678901234'
62
62
  address.razao_social = '11111'
63
63
  end
64
- subject.intermediario.cpf_cnpj.must_equal '99999'
64
+ subject.intermediario.cpf_cnpj.must_equal '12345678901234'
65
65
  subject.intermediario.razao_social.must_equal '11111'
66
66
  end
67
67
 
@@ -1,101 +1,11 @@
1
1
  require 'test_helper'
2
-
3
- module ResponsePathTest
4
- def response_lot_number_path; :response_lot_number_path end
5
- def response_protocol_path; :response_protocol_path end
6
- def response_received_date_path; :response_received_date_path end
7
- def response_situation_path; :response_situation_path end
8
- def response_situation_key_values; {response_situation_key_values: :ok} end
9
- def response_cancelation_date_time_path; :response_cancelation_date_time_path end
10
- def response_message_errors_path; :response_message_errors_path end
11
- def response_message_code_key; :response_message_code_key end
12
- def response_message_msg_key; :response_message_msg_key end
13
- def response_message_solution_key; :response_message_solution_key end
14
- def response_invoices_path; :response_invoices_path end
15
- def response_invoice_numero_nf_path; :response_invoice_numero_nf_path end
16
- def response_invoice_codigo_verificacao_path; :response_invoice_codigo_verificacao_path end
17
- def response_invoice_data_emissao_path; :response_invoice_data_emissao_path end
18
- def response_invoice_url_nf_path; :response_invoice_url_nf_path end
19
- def response_invoice_rps_numero_path; :response_invoice_rps_numero_path end
20
- def response_invoice_rps_serie_path; :response_invoice_rps_serie_path end
21
- def response_invoice_rps_tipo_path; :response_invoice_rps_tipo_path end
22
- def response_invoice_rps_situacao_path; :response_invoice_rps_situacao_path end
23
- def response_invoice_rps_substituido_numero_path; :response_invoice_rps_substituido_numero_path end
24
- def response_invoice_rps_substituido_serie_path; :response_invoice_rps_substituido_serie_path end
25
- def response_invoice_rps_substituido_tipo_path; :response_invoice_rps_substituido_tipo_path end
26
- def response_invoice_data_emissao_rps_path; :response_invoice_data_emissao_rps_path end
27
- def response_invoice_competencia_path; :response_invoice_competencia_path end
28
- def response_invoice_natureza_operacao_path; :response_invoice_natureza_operacao_path end
29
- def response_invoice_regime_especial_tributacao_path; :response_invoice_regime_especial_tributacao_path end
30
- def response_invoice_optante_simples_nacional_path; :response_invoice_optante_simples_nacional_path end
31
- def response_invoice_incentivador_cultural_path; :response_invoice_incentivador_cultural_path end
32
- def response_invoice_outras_informacoes_path; :response_invoice_outras_informacoes_path end
33
- def response_invoice_item_lista_servico_path; :response_invoice_item_lista_servico_path end
34
- def response_invoice_cnae_code_path; :response_invoice_cnae_code_path end
35
- def response_invoice_description_path; :response_invoice_description_path end
36
- def response_invoice_codigo_municipio_path; :response_invoice_codigo_municipio_path end
37
- def response_invoice_valor_total_servicos_path; :response_invoice_valor_total_servicos_path end
38
- def response_invoice_deducoes_path; :response_invoice_deducoes_path end
39
- def response_invoice_valor_pis_path; :response_invoice_valor_pis_path end
40
- def response_invoice_valor_cofins_path; :response_invoice_valor_cofins_path end
41
- def response_invoice_valor_inss_path; :response_invoice_valor_inss_path end
42
- def response_invoice_valor_ir_path; :response_invoice_valor_ir_path end
43
- def response_invoice_valor_csll_path; :response_invoice_valor_csll_path end
44
- def response_invoice_iss_retido_path; :response_invoice_iss_retido_path end
45
- def response_invoice_outras_retencoes_path; :response_invoice_outras_retencoes_path end
46
- def response_invoice_total_iss_path; :response_invoice_total_iss_path end
47
- def response_invoice_base_calculo_path; :response_invoice_base_calculo_path end
48
- def response_invoice_iss_aliquota_path; :response_invoice_iss_aliquota_path end
49
- def response_invoice_valor_liquido_path; :response_invoice_valor_liquido_path end
50
- def response_invoice_desconto_condicionado_path; :response_invoice_desconto_condicionado_path end
51
- def response_invoice_desconto_incondicionado_path; :response_invoice_desconto_incondicionado_path end
52
- def response_invoice_responsavel_retencao_path; :response_invoice_responsavel_retencao_path end
53
- def response_invoice_numero_processo_path; :response_invoice_numero_processo_path end
54
- def response_invoice_municipio_incidencia_path; :response_invoice_municipio_incidencia_path end
55
- def response_invoice_orgao_gerador_municipio_path; :response_invoice_orgao_gerador_municipio_path end
56
- def response_invoice_orgao_gerador_uf_path; :response_invoice_orgao_gerador_uf_path end
57
- def response_invoice_cancelamento_codigo_path; :response_invoice_cancelamento_codigo_path end
58
- def response_invoice_cancelamento_numero_nf_path; :response_invoice_cancelamento_numero_nf_path end
59
- def response_invoice_cancelamento_cnpj_path; :response_invoice_cancelamento_cnpj_path end
60
- def response_invoice_cancelamento_municipio_path; :response_invoice_cancelamento_municipio_path end
61
- def response_invoice_cancelamento_data_hora_path; :response_invoice_cancelamento_data_hora_path end
62
- def response_invoice_nfe_substituidora_path; :response_invoice_nfe_substituidora_path end
63
- def response_invoice_codigo_obra_path; :response_invoice_codigo_obra_path end
64
- def response_invoice_codigo_art_path; :response_invoice_codigo_art_path end
65
- def response_invoice_cancelamento_inscricao_municipal_path; :response_invoice_cancelamento_inscricao_municipal_path end
66
- def response_invoice_emitente_cnpj_path; :response_invoice_emitente_cnpj_path end
67
- def response_invoice_emitente_inscricao_municipal_path; :response_invoice_emitente_inscricao_municipal_path end
68
- def response_invoice_emitente_razao_social_path; :response_invoice_emitente_razao_social_path end
69
- def response_invoice_emitente_nome_fantasia_path; :response_invoice_emitente_nome_fantasia_path end
70
- def response_invoice_emitente_telefone_path; :response_invoice_emitente_telefone_path end
71
- def response_invoice_emitente_email_path; :response_invoice_emitente_email_path end
72
- def response_invoice_emitente_endereco_logradouro_path; :response_invoice_emitente_endereco_logradouro_path end
73
- def response_invoice_emitente_endereco_numero_path; :response_invoice_emitente_endereco_numero_path end
74
- def response_invoice_emitente_endereco_complemento_path; :response_invoice_emitente_endereco_complemento_path end
75
- def response_invoice_emitente_endereco_bairro_path; :response_invoice_emitente_endereco_bairro_path end
76
- def response_invoice_emitente_endereco_codigo_municipio_path; :response_invoice_emitente_endereco_codigo_municipio_path end
77
- def response_invoice_emitente_endereco_uf_path; :response_invoice_emitente_endereco_uf_path end
78
- def response_invoice_emitente_endereco_cep_path; :response_invoice_emitente_endereco_cep_path end
79
- def response_invoice_destinatario_cpf_path; :response_invoice_destinatario_cpf_path end
80
- def response_invoice_destinatario_cnpj_path; :response_invoice_destinatario_cnpj_path end
81
- def response_invoice_destinatario_inscricao_municipal_path; :response_invoice_destinatario_inscricao_municipal_path end
82
- def response_invoice_destinatario_inscricao_estadual_path; :response_invoice_destinatario_inscricao_estadual_path end
83
- def response_invoice_destinatario_inscricao_suframa_path; :response_invoice_destinatario_inscricao_suframa_path end
84
- def response_invoice_destinatario_razao_social_path; :response_invoice_destinatario_razao_social_path end
85
- def response_invoice_destinatario_telefone_path; :response_invoice_destinatario_telefone_path end
86
- def response_invoice_destinatario_email_path; :response_invoice_destinatario_email_path end
87
- def response_invoice_destinatario_endereco_logradouro_path; :response_invoice_destinatario_endereco_logradouro_path end
88
- def response_invoice_destinatario_endereco_numero_path; :response_invoice_destinatario_endereco_numero_path end
89
- def response_invoice_destinatario_endereco_complemento_path; :response_invoice_destinatario_endereco_complemento_path end
90
- def response_invoice_destinatario_endereco_bairro_path; :response_invoice_destinatario_endereco_bairro_path end
91
- def response_invoice_destinatario_endereco_codigo_municipio_path; :response_invoice_destinatario_endereco_codigo_municipio_path end
92
- def response_invoice_destinatario_endereco_uf_path; :response_invoice_destinatario_endereco_uf_path end
93
- def response_invoice_destinatario_endereco_cep_path; :response_invoice_destinatario_endereco_cep_path end
94
- end
95
-
96
2
  describe BrNfe::Service::Base do
97
3
  subject { FactoryGirl.build(:br_nfe_servico_base) }
98
4
 
5
+ before do
6
+ subject.stubs(:response_class).returns(BrNfe::Service::Response::Default)
7
+ end
8
+
99
9
  describe "Included modules" do
100
10
  it "deve ter o module BrNfe::Service::Concerns::ValuesTs::ServiceV1 incluso" do
101
11
  subject.class.included_modules.must_include(BrNfe::Service::Concerns::ValuesTs::ServiceV1)
@@ -217,117 +127,10 @@ describe BrNfe::Service::Base do
217
127
  end
218
128
 
219
129
  describe "#set_response" do
220
- let(:build_response) { BrNfe::Service::Response::Build::Base.new() }
221
- it "deve instanciar o build_response e retornar a resposta" do
222
- build_response
223
- subject.class.send(:include, ResponsePathTest)
224
- subject.expects(:response_root_path).returns(:response_root_path)
225
- subject.expects(:nfse_xml_path).returns(:nfse_xml_path)
226
- subject.expects(:body_xml_path).returns(:body_xml_path)
227
- subject.expects(:response_encoding).returns('ENCODE')
228
- BrNfe::Service::Response::Build::Base.expects(:new).with({
229
- savon_response: :savon_response,
230
- keys_root_path: :response_root_path,
231
- nfe_xml_path: :nfse_xml_path,
232
- body_xml_path: :body_xml_path,
233
- xml_encode: 'ENCODE',
234
- lot_number_path: :response_lot_number_path,
235
- protocol_path: :response_protocol_path,
236
- received_date_path: :response_received_date_path,
237
- situation_path: :response_situation_path,
238
- situation_key_values: {response_situation_key_values: :ok},
239
- cancelation_date_time_path: :response_cancelation_date_time_path,
240
- message_errors_path: :response_message_errors_path,
241
- message_code_key: :response_message_code_key,
242
- message_msg_key: :response_message_msg_key,
243
- message_solution_key: :response_message_solution_key,
244
- invoices_path: :response_invoices_path,
245
- invoice_numero_nf_path: :response_invoice_numero_nf_path,
246
- invoice_codigo_verificacao_path: :response_invoice_codigo_verificacao_path,
247
- invoice_data_emissao_path: :response_invoice_data_emissao_path,
248
- invoice_url_nf_path: :response_invoice_url_nf_path,
249
- invoice_rps_numero_path: :response_invoice_rps_numero_path,
250
- invoice_rps_serie_path: :response_invoice_rps_serie_path,
251
- invoice_rps_tipo_path: :response_invoice_rps_tipo_path,
252
- invoice_rps_situacao_path: :response_invoice_rps_situacao_path,
253
- invoice_rps_substituido_numero_path: :response_invoice_rps_substituido_numero_path,
254
- invoice_rps_substituido_serie_path: :response_invoice_rps_substituido_serie_path,
255
- invoice_rps_substituido_tipo_path: :response_invoice_rps_substituido_tipo_path,
256
- invoice_data_emissao_rps_path: :response_invoice_data_emissao_rps_path,
257
- invoice_competencia_path: :response_invoice_competencia_path,
258
- invoice_natureza_operacao_path: :response_invoice_natureza_operacao_path,
259
- invoice_regime_especial_tributacao_path: :response_invoice_regime_especial_tributacao_path,
260
- invoice_optante_simples_nacional_path: :response_invoice_optante_simples_nacional_path,
261
- invoice_incentivador_cultural_path: :response_invoice_incentivador_cultural_path,
262
- invoice_outras_informacoes_path: :response_invoice_outras_informacoes_path,
263
- invoice_item_lista_servico_path: :response_invoice_item_lista_servico_path,
264
- invoice_cnae_code_path: :response_invoice_cnae_code_path,
265
- invoice_description_path: :response_invoice_description_path,
266
- invoice_codigo_municipio_path: :response_invoice_codigo_municipio_path,
267
- invoice_valor_total_servicos_path: :response_invoice_valor_total_servicos_path,
268
- invoice_deducoes_path: :response_invoice_deducoes_path,
269
- invoice_valor_pis_path: :response_invoice_valor_pis_path,
270
- invoice_valor_cofins_path: :response_invoice_valor_cofins_path,
271
- invoice_valor_inss_path: :response_invoice_valor_inss_path,
272
- invoice_valor_ir_path: :response_invoice_valor_ir_path,
273
- invoice_valor_csll_path: :response_invoice_valor_csll_path,
274
- invoice_iss_retido_path: :response_invoice_iss_retido_path,
275
- invoice_outras_retencoes_path: :response_invoice_outras_retencoes_path,
276
- invoice_total_iss_path: :response_invoice_total_iss_path,
277
- invoice_base_calculo_path: :response_invoice_base_calculo_path,
278
- invoice_iss_aliquota_path: :response_invoice_iss_aliquota_path,
279
- invoice_valor_liquido_path: :response_invoice_valor_liquido_path,
280
- invoice_desconto_condicionado_path: :response_invoice_desconto_condicionado_path,
281
- invoice_desconto_incondicionado_path: :response_invoice_desconto_incondicionado_path,
282
- invoice_responsavel_retencao_path: :response_invoice_responsavel_retencao_path,
283
- invoice_numero_processo_path: :response_invoice_numero_processo_path,
284
- invoice_municipio_incidencia_path: :response_invoice_municipio_incidencia_path,
285
- invoice_orgao_gerador_municipio_path: :response_invoice_orgao_gerador_municipio_path,
286
- invoice_orgao_gerador_uf_path: :response_invoice_orgao_gerador_uf_path,
287
- invoice_cancelamento_codigo_path: :response_invoice_cancelamento_codigo_path,
288
- invoice_cancelamento_numero_nf_path: :response_invoice_cancelamento_numero_nf_path,
289
- invoice_cancelamento_cnpj_path: :response_invoice_cancelamento_cnpj_path,
290
- invoice_cancelamento_municipio_path: :response_invoice_cancelamento_municipio_path,
291
- invoice_cancelamento_data_hora_path: :response_invoice_cancelamento_data_hora_path,
292
- invoice_cancelamento_inscricao_municipal_path: :response_invoice_cancelamento_inscricao_municipal_path,
293
- invoice_nfe_substituidora_path: :response_invoice_nfe_substituidora_path,
294
- invoice_codigo_obra_path: :response_invoice_codigo_obra_path,
295
- invoice_codigo_art_path: :response_invoice_codigo_art_path,
296
- invoice_emitente_cnpj_path: :response_invoice_emitente_cnpj_path,
297
- invoice_emitente_inscricao_municipal_path: :response_invoice_emitente_inscricao_municipal_path,
298
- invoice_emitente_razao_social_path: :response_invoice_emitente_razao_social_path,
299
- invoice_emitente_nome_fantasia_path: :response_invoice_emitente_nome_fantasia_path,
300
- invoice_emitente_telefone_path: :response_invoice_emitente_telefone_path,
301
- invoice_emitente_email_path: :response_invoice_emitente_email_path,
302
- invoice_emitente_endereco_logradouro_path: :response_invoice_emitente_endereco_logradouro_path,
303
- invoice_emitente_endereco_numero_path: :response_invoice_emitente_endereco_numero_path,
304
- invoice_emitente_endereco_complemento_path: :response_invoice_emitente_endereco_complemento_path,
305
- invoice_emitente_endereco_bairro_path: :response_invoice_emitente_endereco_bairro_path,
306
- invoice_emitente_endereco_codigo_municipio_path: :response_invoice_emitente_endereco_codigo_municipio_path,
307
- invoice_emitente_endereco_uf_path: :response_invoice_emitente_endereco_uf_path,
308
- invoice_emitente_endereco_cep_path: :response_invoice_emitente_endereco_cep_path,
309
- invoice_destinatario_cpf_path: :response_invoice_destinatario_cpf_path,
310
- invoice_destinatario_cnpj_path: :response_invoice_destinatario_cnpj_path,
311
- invoice_destinatario_inscricao_municipal_path: :response_invoice_destinatario_inscricao_municipal_path,
312
- invoice_destinatario_inscricao_estadual_path: :response_invoice_destinatario_inscricao_estadual_path,
313
- invoice_destinatario_inscricao_suframa_path: :response_invoice_destinatario_inscricao_suframa_path,
314
- invoice_destinatario_razao_social_path: :response_invoice_destinatario_razao_social_path,
315
- invoice_destinatario_telefone_path: :response_invoice_destinatario_telefone_path,
316
- invoice_destinatario_email_path: :response_invoice_destinatario_email_path,
317
- invoice_destinatario_endereco_logradouro_path: :response_invoice_destinatario_endereco_logradouro_path,
318
- invoice_destinatario_endereco_numero_path: :response_invoice_destinatario_endereco_numero_path,
319
- invoice_destinatario_endereco_complemento_path: :response_invoice_destinatario_endereco_complemento_path,
320
- invoice_destinatario_endereco_bairro_path: :response_invoice_destinatario_endereco_bairro_path,
321
- invoice_destinatario_endereco_codigo_municipio_path: :response_invoice_destinatario_endereco_codigo_municipio_path,
322
- invoice_destinatario_endereco_uf_path: :response_invoice_destinatario_endereco_uf_path,
323
- invoice_destinatario_endereco_cep_path: :response_invoice_destinatario_endereco_cep_path,
324
- }).returns(build_response)
325
- build_response.expects(:response).returns('resposta')
326
-
327
- subject.instance_variable_set(:@original_response, :savon_response)
328
-
329
- subject.send(:set_response).must_equal 'resposta'
330
- subject.instance_variable_get(:@response).must_equal('resposta')
130
+ it "deve ser desenvolvido nas sublasses" do
131
+ assert_raises RuntimeError do
132
+ subject.send(:set_response)
133
+ end
331
134
  end
332
- end
135
+ end
333
136
  end
@@ -18,13 +18,13 @@ describe BrNfe::Service::Betha::V1::CancelaNfse do
18
18
 
19
19
  describe "#wsdl" do
20
20
  context "for env production" do
21
- it { subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-ws/cancelarNfseV02?wsdl' }
21
+ it { subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-ws/cancelarNfse?wsdl' }
22
22
  end
23
23
  context "for env test" do
24
24
  before do
25
25
  subject.env = :test
26
26
  end
27
- it { subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/cancelarNfseV02?wsdl' }
27
+ it { subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/cancelarNfse?wsdl' }
28
28
  end
29
29
  end
30
30
 
@@ -48,12 +48,14 @@ describe BrNfe::Service::Betha::V1::CancelaNfse do
48
48
  end
49
49
 
50
50
  describe "#request and set response" do
51
- before { savon.mock! }
51
+ before do
52
+ savon.mock!
53
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/betha/v1/cancelar_nfse.xml') )
54
+ end
52
55
  after { savon.unmock! }
53
56
 
54
57
  it "Quando cancelou a NF com sucesso" do
55
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/cancela_nfse/success.xml')
56
-
58
+ fixture = read_fixture('service/response/betha/v1/cancela_nfse/success.xml')
57
59
  savon.expects(:cancelar_nfse_envio).returns(fixture)
58
60
  subject.request
59
61
  response = subject.response
@@ -68,7 +70,7 @@ describe BrNfe::Service::Betha::V1::CancelaNfse do
68
70
  end
69
71
 
70
72
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
71
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/cancela_nfse/fault.xml')
73
+ fixture = read_fixture('service/response/betha/v1/cancela_nfse/fault.xml')
72
74
 
73
75
  savon.expects(:cancelar_nfse_envio).returns(fixture)
74
76
  subject.request
@@ -58,11 +58,14 @@ describe BrNfe::Service::Betha::V1::ConsultaLoteRps do
58
58
  end
59
59
 
60
60
  describe "#request and set response" do
61
- before { savon.mock! }
61
+ before do
62
+ savon.mock!
63
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/betha/v1/consultar_lote_rps.xml') )
64
+ end
62
65
  after { savon.unmock! }
63
66
 
64
67
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
65
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_lote_rps/fault.xml')
68
+ fixture = read_fixture('service/response/betha/v1/consulta_lote_rps/fault.xml')
66
69
 
67
70
  savon.expects(:consultar_lote_rps_envio).returns(fixture)
68
71
  subject.request
@@ -78,7 +81,7 @@ describe BrNfe::Service::Betha::V1::ConsultaLoteRps do
78
81
  end
79
82
 
80
83
  it "Quando encontrar uma nota fiscal com as informações preenchidas" do
81
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_lote_rps/success.xml')
84
+ fixture = read_fixture('service/response/betha/v1/consulta_lote_rps/success.xml')
82
85
  savon.expects(:consultar_lote_rps_envio).returns(fixture)
83
86
  subject.request
84
87
  response = subject.response
@@ -59,11 +59,14 @@ describe BrNfe::Service::Betha::V1::ConsultaNfsPorRps do
59
59
  end
60
60
 
61
61
  describe "#request and set response" do
62
- before { savon.mock! }
62
+ before do
63
+ savon.mock!
64
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/betha/v1/consultar_nfse_por_rps.xml') )
65
+ end
63
66
  after { savon.unmock! }
64
67
 
65
68
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
66
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/fault.xml')
69
+ fixture = read_fixture('service/response/betha/v1/consulta_nfse_por_rps/fault.xml')
67
70
 
68
71
  savon.expects(:consultar_nfse_por_rps_envio).returns(fixture)
69
72
  subject.request
@@ -78,7 +81,7 @@ describe BrNfe::Service::Betha::V1::ConsultaNfsPorRps do
78
81
  end
79
82
 
80
83
  it "Quando encontrar uma nota fiscal com as informações preenchidas" do
81
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/success.xml')
84
+ fixture = read_fixture('service/response/betha/v1/consulta_nfse_por_rps/success.xml')
82
85
  savon.expects(:consultar_nfse_por_rps_envio).returns(fixture)
83
86
  subject.request
84
87
  response = subject.response
@@ -58,11 +58,14 @@ describe BrNfe::Service::Betha::V1::ConsultaNfse do
58
58
  end
59
59
 
60
60
  describe "#request and set response" do
61
- before { savon.mock! }
61
+ before do
62
+ savon.mock!
63
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/betha/v1/consultar_nfse.xml') )
64
+ end
62
65
  after { savon.unmock! }
63
66
 
64
67
  it "Se não encontrar nenhuma NFe" do
65
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_nfse/nfs_empty.xml')
68
+ fixture = read_fixture('service/response/betha/v1/consulta_nfse/nfs_empty.xml')
66
69
  savon.expects(:consultar_nfse_envio).returns(fixture)
67
70
  subject.request
68
71
  response = subject.response
@@ -73,7 +76,7 @@ describe BrNfe::Service::Betha::V1::ConsultaNfse do
73
76
  end
74
77
 
75
78
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
76
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_nfse/fault.xml')
79
+ fixture = read_fixture('service/response/betha/v1/consulta_nfse/fault.xml')
77
80
 
78
81
  savon.expects(:consultar_nfse_envio).returns(fixture)
79
82
  subject.request
@@ -88,7 +91,7 @@ describe BrNfe::Service::Betha::V1::ConsultaNfse do
88
91
  end
89
92
 
90
93
  it "Quando encontrar uma nota fiscal com as informações básicas preenchidas" do
91
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_nfse/success.xml')
94
+ fixture = read_fixture('service/response/betha/v1/consulta_nfse/success.xml')
92
95
  savon.expects(:consultar_nfse_envio).returns(fixture)
93
96
  subject.request
94
97
  response = subject.response
@@ -54,15 +54,18 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
54
54
  end
55
55
 
56
56
  describe "#request and set response" do
57
- before { savon.mock! }
57
+ before do
58
+ savon.mock!
59
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/betha/v1/consultar_situacao_lote_rps.xml') )
60
+ end
58
61
  after { savon.unmock! }
59
62
 
60
63
  it "Quando processou o RPS com sucesso deve setar a situation com :success" do
61
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/success.xml')
64
+ fixture = read_fixture('service/response/betha/v1/consulta_situacao_lote_rps/success.xml')
62
65
  savon.expects(:consultar_situacao_lote_rps_envio).returns(fixture)
63
66
  subject.request
64
67
  response = subject.response
65
-
68
+
66
69
  response.must_be_kind_of BrNfe::Service::Response::ConsultaSituacaoLoteRps
67
70
  response.situation.must_equal :success
68
71
  response.numero_lote.must_equal '10'
@@ -71,7 +74,7 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
71
74
  end
72
75
 
73
76
  it "Quando processou o RPS com erros deve setar a situation com :error" do
74
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/error.xml')
77
+ fixture = read_fixture('service/response/betha/v1/consulta_situacao_lote_rps/error.xml')
75
78
  savon.expects(:consultar_situacao_lote_rps_envio).returns(fixture)
76
79
  subject.request
77
80
  response = subject.response
@@ -84,7 +87,7 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
84
87
  end
85
88
 
86
89
  it "Quando não processou o RPS deve setar a situation com :unprocessed" do
87
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed.xml')
90
+ fixture = read_fixture('service/response/betha/v1/consulta_situacao_lote_rps/unprocessed.xml')
88
91
  savon.expects(:consultar_situacao_lote_rps_envio).returns(fixture)
89
92
  subject.request
90
93
  response = subject.response
@@ -97,7 +100,7 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
97
100
  end
98
101
 
99
102
  it "Quando não encontrar o RPS deve setar a situation com :unreceived" do
100
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived.xml')
103
+ fixture = read_fixture('service/response/betha/v1/consulta_situacao_lote_rps/unreceived.xml')
101
104
  savon.expects(:consultar_situacao_lote_rps_envio).returns(fixture)
102
105
  subject.request
103
106
  response = subject.response
@@ -110,7 +113,7 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
110
113
  end
111
114
 
112
115
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
113
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/fault.xml')
116
+ fixture = read_fixture('service/response/betha/v1/consulta_situacao_lote_rps/fault.xml')
114
117
 
115
118
  savon.expects(:consultar_situacao_lote_rps_envio).returns(fixture)
116
119
  subject.request
@@ -128,7 +131,7 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
128
131
  end
129
132
 
130
133
  it "Quando a requisição voltar com erro E4 deve definir a situação como unreceived" do
131
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived_by_code_error.xml')
134
+ fixture = read_fixture('service/response/betha/v1/consulta_situacao_lote_rps/unreceived_by_code_error.xml')
132
135
 
133
136
  savon.expects(:consultar_situacao_lote_rps_envio).returns(fixture)
134
137
  subject.request
@@ -142,7 +145,7 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
142
145
  end
143
146
 
144
147
  it "Quando a requisição voltar com erro E92 deve definir a situação como unprocessed" do
145
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed_by_code_error.xml')
148
+ fixture = read_fixture('service/response/betha/v1/consulta_situacao_lote_rps/unprocessed_by_code_error.xml')
146
149
 
147
150
  savon.expects(:consultar_situacao_lote_rps_envio).returns(fixture)
148
151
  subject.request
@@ -85,11 +85,14 @@ describe BrNfe::Service::Betha::V1::RecepcaoLoteRps do
85
85
  end
86
86
 
87
87
  describe "#request and set response" do
88
- before { savon.mock! }
88
+ before do
89
+ savon.mock!
90
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/betha/v1/recepcionar_lote_rps.xml') )
91
+ end
89
92
  after { savon.unmock! }
90
93
 
91
94
  it "Quando gravou o RPS com sucesso deve setar seus valores corretamente na resposta" do
92
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/recepcao_lote_rps/success.xml')
95
+ fixture = read_fixture('service/response/betha/v1/recepcao_lote_rps/success.xml')
93
96
 
94
97
  savon.expects(:enviar_lote_rps_envio).returns(fixture)
95
98
  subject.request
@@ -104,7 +107,7 @@ describe BrNfe::Service::Betha::V1::RecepcaoLoteRps do
104
107
  end
105
108
 
106
109
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
107
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/betha/v1/recepcao_lote_rps/error.xml')
110
+ fixture = read_fixture('service/response/betha/v1/recepcao_lote_rps/error.xml')
108
111
 
109
112
  savon.expects(:enviar_lote_rps_envio).returns(fixture)
110
113
  subject.request
@@ -201,8 +201,8 @@ describe BrNfe::Service::Rps do
201
201
  end
202
202
 
203
203
  it "atributos pode ser modificados em forma de bloco" do
204
- subject.intermediario = {cpf_cnpj: '123', razao_social: 'razao'}
205
- subject.intermediario.cpf_cnpj.must_equal '123'
204
+ subject.intermediario = {cpf_cnpj: '00000000123', razao_social: 'razao'}
205
+ subject.intermediario.cpf_cnpj.must_equal '00000000123'
206
206
  subject.intermediario.razao_social.must_equal 'RAZAO'
207
207
 
208
208
  subject.intermediario do |dest|
@@ -48,11 +48,14 @@ describe BrNfe::Service::Simpliss::V1::CancelaNfse do
48
48
  end
49
49
 
50
50
  describe "#request and set response" do
51
- before { savon.mock! }
51
+ before do
52
+ savon.mock!
53
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/simpliss/v1/nfseservice.xml') )
54
+ end
52
55
  after { savon.unmock! }
53
56
 
54
57
  it "Quando cancelou a NF com sucesso" do
55
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/cancela_nfse/success.xml')
58
+ fixture = read_fixture('service/response/simpliss/v1/cancela_nfse/success.xml')
56
59
 
57
60
  savon.expects(:cancelar_nfse).returns(fixture)
58
61
  subject.request
@@ -68,7 +71,7 @@ describe BrNfe::Service::Simpliss::V1::CancelaNfse do
68
71
  end
69
72
 
70
73
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
71
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/cancela_nfse/fault.xml')
74
+ fixture = read_fixture('service/response/simpliss/v1/cancela_nfse/fault.xml')
72
75
 
73
76
  savon.expects(:cancelar_nfse).returns(fixture)
74
77
  subject.request
@@ -46,11 +46,14 @@ describe BrNfe::Service::Simpliss::V1::ConsultaLoteRps do
46
46
  end
47
47
 
48
48
  describe "#request and set response" do
49
- before { savon.mock! }
49
+ before do
50
+ savon.mock!
51
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/simpliss/v1/nfseservice.xml') )
52
+ end
50
53
  after { savon.unmock! }
51
54
 
52
55
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
53
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/fault.xml')
56
+ fixture = read_fixture('service/response/simpliss/v1/consulta_lote_rps/fault.xml')
54
57
 
55
58
  savon.expects(:consultar_lote_rps).returns(fixture)
56
59
  subject.request
@@ -68,7 +71,7 @@ describe BrNfe::Service::Simpliss::V1::ConsultaLoteRps do
68
71
  end
69
72
 
70
73
  it "Quando encontrar uma nota fiscal com as informações básicas preenchidas" do
71
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/nfse_simple.xml')
74
+ fixture = read_fixture('service/response/simpliss/v1/consulta_lote_rps/nfse_simple.xml')
72
75
  savon.expects(:consultar_lote_rps).returns(fixture)
73
76
  subject.request
74
77
  response = subject.response
@@ -136,7 +139,7 @@ describe BrNfe::Service::Simpliss::V1::ConsultaLoteRps do
136
139
  end
137
140
 
138
141
  it "Quando encontrar uma nota fiscal com as informações completas" do
139
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/nfse_complete.xml')
142
+ fixture = read_fixture('service/response/simpliss/v1/consulta_lote_rps/nfse_complete.xml')
140
143
  savon.expects(:consultar_lote_rps).returns(fixture)
141
144
  subject.request
142
145
  response = subject.response
@@ -46,11 +46,14 @@ describe BrNfe::Service::Simpliss::V1::ConsultaNfsPorRps do
46
46
  end
47
47
 
48
48
  describe "#request and set response" do
49
- before { savon.mock! }
49
+ before do
50
+ savon.mock!
51
+ stub_request(:get, subject.wsdl).to_return(status: 200, body: read_fixture('service/wsdl/simpliss/v1/nfseservice.xml') )
52
+ end
50
53
  after { savon.unmock! }
51
54
 
52
55
  it "Quando a requisição voltar com erro deve setar os erros corretamente" do
53
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/fault.xml')
56
+ fixture = read_fixture('service/response/simpliss/v1/consulta_nfse_por_rps/fault.xml')
54
57
 
55
58
  savon.expects(:consultar_nfse_por_rps).returns(fixture)
56
59
  subject.request
@@ -65,7 +68,7 @@ describe BrNfe::Service::Simpliss::V1::ConsultaNfsPorRps do
65
68
  end
66
69
 
67
70
  it "Quando encontrar uma nota fiscal com as informações básicas preenchidas" do
68
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/nfse_simple.xml')
71
+ fixture = read_fixture('service/response/simpliss/v1/consulta_nfse_por_rps/nfse_simple.xml')
69
72
  savon.expects(:consultar_nfse_por_rps).returns(fixture)
70
73
  subject.request
71
74
  response = subject.response
@@ -133,7 +136,7 @@ describe BrNfe::Service::Simpliss::V1::ConsultaNfsPorRps do
133
136
  end
134
137
 
135
138
  it "Quando encontrar uma nota fiscal com as informações completas" do
136
- fixture = File.read(BrNfe.root+'/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/nfse_complete.xml')
139
+ fixture = read_fixture('service/response/simpliss/v1/consulta_nfse_por_rps/nfse_complete.xml')
137
140
  savon.expects(:consultar_nfse_por_rps).returns(fixture)
138
141
  subject.request
139
142
  response = subject.response