br_nfe 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/br_nfe/active_model_base.rb +0 -5
  4. data/lib/br_nfe/base.rb +116 -7
  5. data/lib/br_nfe/helper/values_ts/service_v1.rb +15 -11
  6. data/lib/br_nfe/response/service/build_response.rb +230 -53
  7. data/lib/br_nfe/response/service/nota_fiscal.rb +9 -0
  8. data/lib/br_nfe/response/service/paths/base.rb +93 -59
  9. data/lib/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta.rb +2 -2
  10. data/lib/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta.rb +2 -2
  11. data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta.rb +2 -2
  12. data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta.rb +2 -2
  13. data/lib/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta.rb +4 -4
  14. data/lib/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta.rb +8 -8
  15. data/lib/br_nfe/response/service/paths/v1/tc_nfse.rb +201 -57
  16. data/lib/br_nfe/service/base.rb +104 -5
  17. data/lib/br_nfe/service/betha/base.rb +5 -0
  18. data/lib/br_nfe/service/betha/v1/cancelamento_nfs.rb +1 -4
  19. data/lib/br_nfe/service/betha/v1/consulta_lote_rps.rb +1 -4
  20. data/lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb +1 -4
  21. data/lib/br_nfe/service/betha/v1/consulta_nfse.rb +1 -4
  22. data/lib/br_nfe/service/betha/v1/consulta_situacao_lote_rps.rb +1 -3
  23. data/lib/br_nfe/service/betha/v1/gateway.rb +1 -1
  24. data/lib/br_nfe/service/betha/v1/recepcao_lote_rps.rb +1 -3
  25. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta.rb +5 -1
  26. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta.rb +5 -1
  27. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +5 -1
  28. data/lib/br_nfe/service/concerns/rules/cancelamento_nfs.rb +5 -0
  29. data/lib/br_nfe/service/rps.rb +13 -4
  30. data/lib/br_nfe/service/simpliss/v1/base.rb +79 -0
  31. data/lib/br_nfe/service/simpliss/v1/cancela_nfse.rb +30 -0
  32. data/lib/br_nfe/service/simpliss/v1/consulta_lote_rps.rb +38 -0
  33. data/lib/br_nfe/service/simpliss/v1/consulta_nfs_por_rps.rb +31 -0
  34. data/lib/br_nfe/service/simpliss/v1/consulta_nfse.rb +30 -0
  35. data/lib/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps.rb +29 -0
  36. data/lib/br_nfe/service/simpliss/v1/recepcao_lote_rps.rb +35 -0
  37. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_cancelar_nfse_resposta.rb +22 -0
  38. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_lote_rps_resposta.rb +25 -0
  39. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_resposta.rb +25 -0
  40. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +25 -0
  41. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_situacao_lote_rps_resposta.rb +31 -0
  42. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_enviar_lote_rps_resposta.rb +36 -0
  43. data/lib/br_nfe/service/simpliss/v1/xml/_login.xml.slim +3 -0
  44. data/lib/br_nfe/service/simpliss/v1/xml/_tc_dados_servico.xml.slim +18 -0
  45. data/lib/br_nfe/service/simpliss/v1/xml/_tc_item_servico.xml.slim +3 -0
  46. data/lib/br_nfe/service/simpliss/v1/xml/servico_cancelar_nfse_envio.xml.slim +11 -0
  47. data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_lote_rps_envio.xml.slim +7 -0
  48. data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_nfse_envio.xml.slim +22 -0
  49. data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_nfse_rps_envio.xml.slim +8 -0
  50. data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_situacao_lote_rps_envio.xml.slim +7 -0
  51. data/lib/br_nfe/service/simpliss/v1/xml/servico_enviar_lote_rps_envio.xml.slim +11 -0
  52. data/lib/br_nfe/service/thema/v1/base.rb +48 -2
  53. data/lib/br_nfe/service/thema/v1/cancela_nfse.rb +14 -5
  54. data/lib/br_nfe/service/thema/v1/consulta_lote_rps.rb +5 -4
  55. data/lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb +5 -4
  56. data/lib/br_nfe/service/thema/v1/consulta_nfse.rb +5 -4
  57. data/lib/br_nfe/service/thema/v1/consulta_situacao_lote_rps.rb +1 -4
  58. data/lib/br_nfe/service/thema/v1/recepcao_lote_rps.rb +19 -5
  59. data/lib/br_nfe/service/thema/v1/recepcao_lote_rps_limitado.rb +1 -1
  60. data/lib/br_nfe/service/thema/v1/response_paths/servico_cancelar_nfse_resposta.rb +17 -0
  61. data/lib/br_nfe/service/thema/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +19 -0
  62. data/lib/br_nfe/service/xml/v1/_tc_contato.xml.slim +2 -2
  63. data/lib/br_nfe/service/xml/v1/_tc_cpf_cnpj.xml.slim +2 -2
  64. data/lib/br_nfe/service/xml/v1/_tc_dados_construcao_civil.xml.slim +2 -2
  65. data/lib/br_nfe/service/xml/v1/_tc_dados_prestador.xml.slim +5 -5
  66. data/lib/br_nfe/service/xml/v1/_tc_dados_servico.xml.slim +6 -6
  67. data/lib/br_nfe/service/xml/v1/_tc_dados_tomador.xml.slim +4 -4
  68. data/lib/br_nfe/service/xml/v1/_tc_endereco.xml.slim +7 -7
  69. data/lib/br_nfe/service/xml/v1/_tc_identificacao_intermediario_servico.xml.slim +3 -3
  70. data/lib/br_nfe/service/xml/v1/_tc_identificacao_nfse.xml.slim +4 -4
  71. data/lib/br_nfe/service/xml/v1/_tc_identificacao_orgao_gerador.xml.slim +2 -2
  72. data/lib/br_nfe/service/xml/v1/_tc_identificacao_prestador.xml.slim +2 -2
  73. data/lib/br_nfe/service/xml/v1/_tc_identificacao_rps.xml.slim +3 -3
  74. data/lib/br_nfe/service/xml/v1/_tc_identificacao_tomador.xml.slim +2 -2
  75. data/lib/br_nfe/service/xml/v1/_tc_inf_pedido_cancelamento.xml.slim +2 -2
  76. data/lib/br_nfe/service/xml/v1/_tc_inf_rps.xml.slim +13 -13
  77. data/lib/br_nfe/service/xml/v1/_tc_lote_rps.xml.slim +6 -6
  78. data/lib/br_nfe/service/xml/v1/_tc_pedido_cancelamento.xml.slim +1 -1
  79. data/lib/br_nfe/service/xml/v1/_tc_rps.xml.slim +2 -2
  80. data/lib/br_nfe/service/xml/v1/_tc_valores.xml.slim +16 -17
  81. data/lib/br_nfe/service/xml/v1/servico_cancelar_nfse_envio.xml.slim +3 -4
  82. data/lib/br_nfe/service/xml/v1/servico_consultar_lote_rps_envio.xml.slim +3 -3
  83. data/lib/br_nfe/service/xml/v1/servico_consultar_nfse_envio.xml.slim +8 -8
  84. data/lib/br_nfe/service/xml/v1/servico_consultar_nfse_rps_envio.xml.slim +3 -3
  85. data/lib/br_nfe/service/xml/v1/servico_consultar_situacao_lote_rps_envio.xml.slim +3 -3
  86. data/lib/br_nfe/service/xml/v1/servico_enviar_lote_rps_envio.xml.slim +3 -3
  87. data/lib/br_nfe/version.rb +1 -1
  88. data/lib/br_nfe/xml/_signed_info_sh1.xml.slim +9 -9
  89. data/lib/br_nfe/xml/signature_sh1.xml.slim +5 -5
  90. data/lib/br_nfe.rb +26 -10
  91. data/test/br_nfe/base_test.rb +5 -5
  92. data/test/br_nfe/helper/values_ts/service_v1_test.rb +376 -0
  93. data/test/br_nfe/response/service/build_response_test.rb +1 -173
  94. data/test/br_nfe/response/service/paths/base_test.rb +61 -64
  95. data/test/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta_test.rb +2 -2
  96. data/test/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta_test.rb +2 -2
  97. data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta_test.rb +2 -2
  98. data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta_test.rb +2 -2
  99. data/test/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta_test.rb +3 -3
  100. data/test/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta_test.rb +4 -4
  101. data/test/br_nfe/response/service/paths/v1/tc_nfse_test.rb +27 -31
  102. data/test/br_nfe/service/base_test.rb +206 -11
  103. data/test/br_nfe/service/betha/base_test.rb +9 -0
  104. data/test/br_nfe/service/betha/v1/cancelamento_nfs_test.rb +0 -6
  105. data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +0 -6
  106. data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +0 -4
  107. data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +0 -4
  108. data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +1 -5
  109. data/test/br_nfe/service/betha/v1/gateway_test.rb +4 -2
  110. data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +0 -4
  111. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta_test.rb +1 -1
  112. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta_test.rb +1 -1
  113. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta_test.rb +1 -1
  114. data/test/br_nfe/service/rps_test.rb +39 -6
  115. data/test/br_nfe/service/simpliss/v1/base_test.rb +102 -0
  116. data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +97 -0
  117. data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +241 -0
  118. data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +239 -0
  119. data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +226 -0
  120. data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +122 -0
  121. data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +105 -0
  122. data/test/br_nfe/service/simpliss/v1/xsd/nfse_3.xsd +735 -0
  123. data/test/br_nfe/service/simpliss/v1/xsd/xmldsig-core-schema20020212.xsd +318 -0
  124. data/test/br_nfe/service/thema/v1/base_test.rb +23 -2
  125. data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +69 -3
  126. data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +134 -4
  127. data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +131 -4
  128. data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +214 -4
  129. data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +97 -4
  130. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +109 -0
  131. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +72 -4
  132. data/test/factories/service/rps.rb +17 -16
  133. data/test/factories/service/{sc/gaspar/recepcao_lote_rps_limitado.rb → simpliss/v1/base.rb} +1 -3
  134. data/test/factories/service/{sc/gaspar → simpliss/v1}/cancela_nfse.rb +2 -2
  135. data/test/factories/service/simpliss/v1/consulta_lote_rps.rb +7 -0
  136. data/test/factories/service/{sc/gaspar → simpliss/v1}/consulta_nfs_por_rps.rb +1 -1
  137. data/test/factories/service/{sc/gaspar → simpliss/v1}/consulta_nfse.rb +1 -1
  138. data/test/factories/service/simpliss/v1/consulta_situacao_lote_rps.rb +6 -0
  139. data/test/factories/service/{sc/gaspar → simpliss/v1}/recepcao_lote_rps.rb +1 -1
  140. data/test/fixtures/service/response/simpliss/v1/cancela_nfse/fault.xml +21 -0
  141. data/test/fixtures/service/response/simpliss/v1/cancela_nfse/success.xml +26 -0
  142. data/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/fault.xml +21 -0
  143. data/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/nfse_complete.xml +134 -0
  144. data/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/nfse_simple.xml +100 -0
  145. data/test/fixtures/service/response/simpliss/v1/consulta_nfse/fault.xml +16 -0
  146. data/test/fixtures/service/response/simpliss/v1/consulta_nfse/nfs_empty.xml +10 -0
  147. data/test/fixtures/service/response/simpliss/v1/consulta_nfse/nfse_complete.xml +134 -0
  148. data/test/fixtures/service/response/simpliss/v1/consulta_nfse/nfse_simple.xml +100 -0
  149. data/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/fault.xml +16 -0
  150. data/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/nfse_complete.xml +132 -0
  151. data/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/nfse_simple.xml +98 -0
  152. data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/error.xml +11 -0
  153. data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/fault.xml +16 -0
  154. data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/success.xml +11 -0
  155. data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/unprocessed.xml +11 -0
  156. data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/unreceived.xml +11 -0
  157. data/test/fixtures/service/response/simpliss/v1/recepcao_lote_rps/error.xml +16 -0
  158. data/test/fixtures/service/response/simpliss/v1/recepcao_lote_rps/success.xml +12 -0
  159. data/test/fixtures/service/response/thema/v1/cancela_nfse/fault.xml +33 -0
  160. data/test/fixtures/service/response/thema/v1/cancela_nfse/success.xml +30 -0
  161. data/test/fixtures/service/response/thema/v1/consulta_lote_rps/fault.xml +19 -0
  162. data/test/fixtures/service/response/thema/v1/consulta_lote_rps/nfse_complete.xml +109 -0
  163. data/test/fixtures/service/response/thema/v1/consulta_nfse/fault.xml +20 -0
  164. data/test/fixtures/service/response/thema/v1/consulta_nfse/nfs_empty.xml +14 -0
  165. data/test/fixtures/service/response/thema/v1/consulta_nfse/nfse_complete.xml +111 -0
  166. data/test/fixtures/service/response/thema/v1/consulta_nfse/nfse_simple.xml +111 -0
  167. data/test/fixtures/service/response/thema/v1/consulta_nfse_por_rps/fault.xml +23 -0
  168. data/test/fixtures/service/response/thema/v1/consulta_nfse_por_rps/nfse_complete.xml +110 -0
  169. data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/error.xml +14 -0
  170. data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/fault.xml +15 -0
  171. data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/success.xml +14 -0
  172. data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/unprocessed.xml +14 -0
  173. data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/unreceived.xml +19 -0
  174. data/test/fixtures/service/response/thema/v1/recepcao_lote_rps/error.xml +17 -0
  175. data/test/fixtures/service/response/thema/v1/recepcao_lote_rps/success.xml +15 -0
  176. data/test/fixtures/service/response/thema/v1/recepcao_lote_rps_limitado/error.xml +19 -0
  177. data/test/fixtures/service/response/thema/v1/recepcao_lote_rps_limitado/success.xml +15 -0
  178. data/test/fixtures/service/thema/v1/cancelar_nfse_envio.xml +1 -0
  179. data/test/fixtures/service/thema/v1/cancelar_nfse_envio_signed.xml +2 -0
  180. data/test/fixtures/service/thema/v1/enviar_lote_rps.xml +1 -0
  181. data/test/fixtures/service/thema/v1/enviar_lote_rps_signed.xml +2 -0
  182. data/test/test_helper.rb +5 -0
  183. metadata +146 -37
  184. data/lib/br_nfe/service/sc/gaspar/cancela_nfse.rb +0 -13
  185. data/lib/br_nfe/service/sc/gaspar/consulta_lote_rps.rb +0 -13
  186. data/lib/br_nfe/service/sc/gaspar/consulta_nfs_por_rps.rb +0 -13
  187. data/lib/br_nfe/service/sc/gaspar/consulta_nfse.rb +0 -17
  188. data/lib/br_nfe/service/sc/gaspar/consulta_situacao_lote_rps.rb +0 -13
  189. data/lib/br_nfe/service/sc/gaspar/recepcao_lote_rps.rb +0 -13
  190. data/lib/br_nfe/service/sc/gaspar/recepcao_lote_rps_limitado.rb +0 -13
  191. data/test/br_nfe/service/sc/gaspar/cancela_nfse_test.rb +0 -21
  192. data/test/br_nfe/service/sc/gaspar/consulta_nfs_por_rps_test.rb +0 -21
  193. data/test/br_nfe/service/sc/gaspar/consulta_nfse_test.rb +0 -21
  194. data/test/br_nfe/service/sc/gaspar/consulta_situacao_lote_rps_test.rb +0 -21
  195. data/test/br_nfe/service/sc/gaspar/recepcao_lote_rps_limitado_test.rb +0 -22
  196. data/test/br_nfe/service/sc/gaspar/recepcao_lote_rps_test.rb +0 -22
  197. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test_limitado.rb +0 -50
  198. data/test/factories/service/sc/gaspar/consulta_lote_rps.rb +0 -7
  199. data/test/factories/service/sc/gaspar/consulta_situacao_lote_rps.rb +0 -6
@@ -0,0 +1,376 @@
1
+ require 'test_helper'
2
+
3
+ describe BrNfe::Helper::ValuesTs::ServiceV1 do
4
+
5
+ class HelperValuesTsServiceV1Test < BrNfe::ActiveModelBase
6
+ include BrNfe::Helper::ValuesTs::ServiceV1
7
+ end
8
+
9
+ subject { HelperValuesTsServiceV1Test.new }
10
+
11
+ describe "#ts_numero_nfse" do
12
+ it "deve retornar apenas números" do
13
+ subject.ts_numero_nfse('AB123456CD7E').must_equal '1234567'
14
+ end
15
+ it "deve retornar no maximo 15 números" do
16
+ subject.ts_numero_nfse('12345678901234567890').must_equal '123456789012345'
17
+ end
18
+ end
19
+
20
+ describe "#ts_codigo_verificacao" do
21
+ it "deve retornar no maximo 9 caracteres" do
22
+ subject.ts_codigo_verificacao('ABC4567890123').must_equal 'ABC456789'
23
+ end
24
+ end
25
+
26
+ describe "#ts_status_rps" do
27
+ it "deve retornar apenas números" do
28
+ subject.ts_status_rps('A1').must_equal '1'
29
+ end
30
+ it "deve retornar no maximo 1 número" do
31
+ subject.ts_status_rps('A2123').must_equal '2'
32
+ end
33
+ end
34
+
35
+ describe "#ts_status_nfse" do
36
+ it "deve retornar apenas números" do
37
+ subject.ts_status_nfse('A1').must_equal '1'
38
+ end
39
+ it "deve retornar no maximo 1 número" do
40
+ subject.ts_status_nfse('A2123').must_equal '2'
41
+ end
42
+ end
43
+
44
+ describe "#ts_natureza_operacao" do
45
+ it "deve retornar apenas números" do
46
+ subject.ts_natureza_operacao('A1').must_equal '1'
47
+ end
48
+ it "deve retornar no maximo 2 número" do
49
+ subject.ts_natureza_operacao('A2123').must_equal '21'
50
+ end
51
+ end
52
+
53
+ describe "#ts_regime_especial_tributacao" do
54
+ it "deve retornar apenas números" do
55
+ subject.ts_regime_especial_tributacao('A1').must_equal '1'
56
+ end
57
+ it "deve retornar no maximo 2 número" do
58
+ subject.ts_regime_especial_tributacao('A2123').must_equal '21'
59
+ end
60
+ end
61
+
62
+ describe "#ts_sim_nao" do
63
+ it "para valores que representam o valor TRUE/SIM deve retornar 1" do
64
+ [true, '1', 't', 'true', 1, :t].each do |v_true|
65
+ subject.ts_sim_nao(v_true).must_equal '1'
66
+ end
67
+ end
68
+ it "para valores que representam o valor FALSE/NÃO deve retornar 2" do
69
+ [false, 0, '0', 'false', 'qqcoisa'].each do |v_tfalse|
70
+ subject.ts_sim_nao(v_tfalse).must_equal '2'
71
+ end
72
+ end
73
+ end
74
+
75
+ describe "#ts_quantidade_rps" do
76
+ it "deve retornar apenas números" do
77
+ subject.ts_quantidade_rps('X456E').must_equal '456'
78
+ end
79
+ it "deve retornar no maximo 4 número" do
80
+ subject.ts_quantidade_rps('A123456').must_equal '1234'
81
+ end
82
+ end
83
+
84
+ describe "#ts_numero_rps" do
85
+ it "deve retornar apenas números" do
86
+ subject.ts_numero_rps('X456E').must_equal '456'
87
+ end
88
+ it "deve retornar no maximo 15 número" do
89
+ subject.ts_numero_rps('A12345678901234567890BC').must_equal '123456789012345'
90
+ end
91
+ end
92
+
93
+ describe "#ts_serie_rps" do
94
+ it "deve retornar no maximo 5 caracteres" do
95
+ subject.ts_serie_rps('AB123456').must_equal 'AB123'
96
+ end
97
+ end
98
+
99
+ describe "#ts_tipo_rps" do
100
+ it "deve retornar apenas números" do
101
+ subject.ts_tipo_rps('A1').must_equal '1'
102
+ end
103
+ it "deve retornar no maximo 1 número" do
104
+ subject.ts_tipo_rps('A2123').must_equal '2'
105
+ end
106
+ end
107
+
108
+ describe "#ts_outras_informacoes" do
109
+ it "deve retornar no maximo 255 caracteres" do
110
+ v = 'A1'*150 # 300 A1
111
+ subject.ts_outras_informacoes(v).must_equal ('A1'*127)+'A'
112
+ end
113
+ end
114
+
115
+ describe "#ts_valor" do
116
+ it "deve retornar o valor com 2 casas decimais" do
117
+ subject.ts_valor(4_756.5123).must_equal 4_756.51
118
+ end
119
+ it "se passar um valor nil deve retornaar nil" do
120
+ subject.ts_valor(nil).must_be_nil
121
+ end
122
+ end
123
+
124
+ describe "#ts_item_lista_servico" do
125
+ it "se passar um valor já formatado deve retornar esse mesmo valor" do
126
+ subject.ts_item_lista_servico('7.90').must_equal '7.90'
127
+ end
128
+ it "se passar um valor inteiro deve formatar para NN.NN" do
129
+ subject.ts_item_lista_servico(1785).must_equal '17.85'
130
+ end
131
+ it "se passar um valor inteiro com apenas 1 caracter deve retornar esse unico caractere" do
132
+ subject.ts_item_lista_servico(1).must_equal '1'
133
+ end
134
+ it "se passar um valor com mais de 4 posições deve reotrnar apenas 4 numeros e 1 ponto" do
135
+ subject.ts_item_lista_servico(123456).must_equal '12.34'
136
+ end
137
+ it "se passar nil deve retornar o um valor em branco e não da erro" do
138
+ subject.ts_item_lista_servico(nil).must_be_nil
139
+ end
140
+ it "deve ignorar os Zeros da frente do número" do
141
+ subject.ts_item_lista_servico('0458').must_equal '4.58'
142
+ end
143
+ end
144
+
145
+ describe "#ts_codigo_cnae" do
146
+ it "deve retornar apenas números" do
147
+ subject.ts_codigo_cnae('A1456').must_equal '1456'
148
+ end
149
+ it "deve retornar no maximo 7 números" do
150
+ subject.ts_codigo_cnae('A1B2C3D4567890').must_equal '1234567'
151
+ end
152
+ end
153
+
154
+ describe "#ts_codigo_tributacao" do
155
+ it "deve retornar no maximo 20 caracteres" do
156
+ subject.ts_codigo_tributacao('A3'*15).must_equal 'A3'*10
157
+ end
158
+ end
159
+
160
+ describe "#ts_aliquota" do
161
+ it "deve retornar com no máximo 4 posições após a virgula" do
162
+ subject.ts_aliquota(0.123456789).must_equal 0.1235
163
+ end
164
+ end
165
+
166
+ describe "#ts_discriminacao" do
167
+ it "deve retornar no maximo 2_000 caracteres" do
168
+ v = 'A1'*1_001
169
+ subject.ts_discriminacao(v).must_equal ('A1'*1_000)
170
+ end
171
+ end
172
+
173
+ describe "#ts_codigo_municipio_ibge" do
174
+ it "deve retornar apenas números" do
175
+ subject.ts_codigo_municipio_ibge('A1456').must_equal '1456'
176
+ end
177
+ it "deve retornar no maximo 7 números" do
178
+ subject.ts_codigo_municipio_ibge('A1B2C3D4567890').must_equal '1234567'
179
+ end
180
+ end
181
+
182
+ describe "#ts_inscricao_municipal" do
183
+ it "deve retornar no maximo 15 caracteres" do
184
+ v = 'A1'*8
185
+ subject.ts_inscricao_municipal(v).must_equal ('A1'*7)+'A'
186
+ end
187
+ end
188
+
189
+ describe "#ts_razao_social" do
190
+ it "deve retornar no maximo 115 caracteres" do
191
+ v = 'A1'*60
192
+ subject.ts_razao_social(v).must_equal ('A1'*57)+'A'
193
+ end
194
+ end
195
+
196
+ describe "#ts_nome_fantasia" do
197
+ it "deve retornar no maximo 60 caracteres" do
198
+ v = 'A1'*31
199
+ subject.ts_nome_fantasia(v).must_equal ('A1'*30)
200
+ end
201
+ end
202
+
203
+ describe "#ts_cnpj" do
204
+ it "deve trazer apenas os numeros do CNPJ" do
205
+ subject.ts_cnpj('123.456.78/0001-58').must_equal '12345678000158'
206
+ end
207
+
208
+ it "deve trazer no máximo 14 caracteres" do
209
+ subject.ts_cnpj('123.456.78/0001-4499999').must_equal '12345678000144'
210
+ end
211
+ end
212
+
213
+ describe "#ts_endereco" do
214
+ it "deve retornar no maximo 125 caracteres" do
215
+ v = 'A1'*65
216
+ subject.ts_endereco(v).must_equal ('A1'*62)+'A'
217
+ end
218
+ end
219
+
220
+ describe "#ts_numero_endereco" do
221
+ it "deve retornar no maximo 10 caracteres" do
222
+ v = 'A1'*6
223
+ subject.ts_numero_endereco(v).must_equal ('A1'*5)
224
+ end
225
+ end
226
+
227
+ describe "#ts_complemento_endereco" do
228
+ it "deve retornar no maximo 60 caracteres" do
229
+ subject.ts_complemento_endereco(''.rjust(61, 'X')).must_equal ''.rjust(60, 'X')
230
+ end
231
+ end
232
+
233
+ describe "#ts_bairro" do
234
+ it "deve retornar no maximo 60 caracteres" do
235
+ subject.ts_bairro(''.rjust(61, 'X')).must_equal ''.rjust(60, 'X')
236
+ end
237
+ end
238
+
239
+ describe "#ts_uf" do
240
+ it "deve retornar no maximo 2 caracteres" do
241
+ subject.ts_uf('SCP').must_equal 'SC'
242
+ end
243
+ end
244
+
245
+ describe "#ts_cep" do
246
+ it "deve retornar apenas os números do CEP" do
247
+ subject.ts_cep('89885-000').must_equal '89885000'
248
+ end
249
+ it "deve retornar no máximo 8 numeros" do
250
+ subject.ts_cep('89885-00099999').must_equal '89885000'
251
+ end
252
+ it "se não tiver 8 digitos deve preencher a direita com Zero" do
253
+ subject.ts_cep('12345-').must_equal '12345000'
254
+ end
255
+ it "se passar um valor nil ou em branco deve retornar nil" do
256
+ subject.ts_cep(nil).must_be_nil
257
+ subject.ts_cep('').must_be_nil
258
+ end
259
+ end
260
+
261
+ describe "#ts_email" do
262
+ it "deve retornar no maximo 80 caracteres" do
263
+ subject.ts_email(''.rjust(81, 'X')).must_equal ''.rjust(80, 'X')
264
+ end
265
+ end
266
+
267
+ describe "#ts_telefone" do
268
+ it "deve retornar apenas números" do
269
+ subject.ts_telefone('(49) 3645-1500').must_equal '4936451500'
270
+ end
271
+ it "deve retornar no maximo 11 números" do
272
+ subject.ts_telefone('(49) 93645-1500785').must_equal '49936451500'
273
+ end
274
+ end
275
+
276
+ describe "#ts_cpf" do
277
+ it "deve retornar apenas números" do
278
+ subject.ts_cpf('938.542.939-86').must_equal '93854293986'
279
+ end
280
+ it "deve retornar no maximo 11 números" do
281
+ subject.ts_cpf('123.456.789-0123456').must_equal '12345678901'
282
+ end
283
+ end
284
+
285
+ describe "#ts_indicacao_cpf_cnpj" do
286
+ it "deve retornar apenas números" do
287
+ subject.ts_indicacao_cpf_cnpj('A9XX').must_equal '9'
288
+ end
289
+ it "deve retornar no maximo 1 número" do
290
+ subject.ts_indicacao_cpf_cnpj('A&*)780980JKGHH').must_equal '7'
291
+ end
292
+ end
293
+
294
+ describe "#ts_codigo_obra" do
295
+ it "deve retornar no maximo 15 caracteres" do
296
+ subject.ts_codigo_obra(''.rjust(16, 'X')).must_equal ''.rjust(15, 'X')
297
+ end
298
+ end
299
+
300
+ describe "#ts_art" do
301
+ it "deve retornar no maximo 15 caracteres" do
302
+ subject.ts_art(''.rjust(16, 'X')).must_equal ''.rjust(15, 'X')
303
+ end
304
+ end
305
+
306
+ describe "#ts_numero_protocolo" do
307
+ it "deve retornar no maximo 50 caracteres" do
308
+ subject.ts_numero_protocolo('B1'*30).must_equal 'B1'*25
309
+ end
310
+ end
311
+
312
+ describe "#ts_situacao_lote_rps" do
313
+ it "deve retornar apenas números" do
314
+ subject.ts_situacao_lote_rps('A9XX').must_equal '9'
315
+ end
316
+ it "deve retornar no maximo 1 número" do
317
+ subject.ts_situacao_lote_rps('A&*)780980JKGHH').must_equal '7'
318
+ end
319
+ end
320
+
321
+ describe "#ts_codigo_mensagem_alerta" do
322
+ it "deve retornar no maximo 4 caracteres" do
323
+ subject.ts_codigo_mensagem_alerta('12ABCDEFGH').must_equal '12AB'
324
+ end
325
+ end
326
+
327
+ describe "#ts_descricao_mensagem_alerta" do
328
+ it "deve retornar no maximo 200 caracteres" do
329
+ subject.ts_descricao_mensagem_alerta('X'*201).must_equal 'X'*200
330
+ end
331
+ end
332
+
333
+ describe "#ts_codigo_cancelamento_nfse" do
334
+ it "deve retornar no maximo 4 caracteres" do
335
+ subject.ts_codigo_cancelamento_nfse('X'*10).must_equal 'X'*4
336
+ end
337
+ end
338
+
339
+ describe "#ts_id_tag" do
340
+ it "deve retornar no maximo 255 caracteres" do
341
+ subject.ts_id_tag('X'*300).must_equal 'X'*255
342
+ end
343
+ end
344
+
345
+ describe "#ts_datetime" do
346
+ context "deve sempre formatar a datahora no formato YYYY-MM-DDTHH:MM:SS" do
347
+ it "quando passar um objeto do tipo Time" do
348
+ subject.ts_datetime(Time.parse('24/12/2015 03:45:27')).must_equal '2015-12-24T03:45:27'
349
+ end
350
+ it "quando passar um a string" do
351
+ subject.ts_datetime('24/11/2015 14:25').must_equal '2015-11-24T14:25:00'
352
+ end
353
+ it "quando passar um valor com formati inválido deve retornar um valor em branco" do
354
+ subject.ts_datetime('24qwe645/2015 asd:25').must_equal ''
355
+ end
356
+ end
357
+ end
358
+
359
+ describe "#ts_date" do
360
+ context "deve sempre formatar a data no formato YYYY-MM-DD" do
361
+ it "quando passar um objeto do tipo Time" do
362
+ subject.ts_date(Time.parse('24/12/2015 03:45:27')).must_equal '2015-12-24'
363
+ end
364
+ it "quando passar um objeto do tipo Date" do
365
+ subject.ts_date(Date.parse('24/11/2015')).must_equal '2015-11-24'
366
+ end
367
+ it "quando passar um a string" do
368
+ subject.ts_date('31/10/2000').must_equal '2000-10-31'
369
+ end
370
+ it "quando passar um valor com formati inválido deve retornar um valor em branco" do
371
+ subject.ts_date('24qwe645/2015 asd:25').must_equal ''
372
+ end
373
+ end
374
+ end
375
+
376
+ end
@@ -7,26 +7,10 @@ describe BrNfe::Response::Service::BuildResponse do
7
7
  describe "#initialize" do
8
8
  it "ao inicializar deve chamar o metodo include_module! depois de setar os atributos" do
9
9
  BrNfe::Response::Service::BuildResponse.any_instance.expects(:assign_attributes).in_sequence(sequence_1)
10
- BrNfe::Response::Service::BuildResponse.any_instance.expects(:include_module!).in_sequence(sequence_1)
11
10
  BrNfe::Response::Service::BuildResponse.new(nfe_xml_path: 'path')
12
11
  end
13
12
  end
14
13
 
15
- describe "include_module!" do
16
- module RackModuleTest; end
17
-
18
- it "se tiver valor em module_methods deve incluir o module na classe" do
19
- subject.module_methods = RackModuleTest
20
- subject.class.expects(:send).with(:include, RackModuleTest)
21
- subject.send(:include_module!)
22
- end
23
- it "se não tiver valor em module_methods não deve tenatar incluir module na classe" do
24
- subject.module_methods = nil
25
- subject.class.expects(:send).never
26
- subject.send(:include_module!)
27
- end
28
- end
29
-
30
14
  describe "#response" do
31
15
  it "Deve instanciar se setar na variavel @response um objeto da classe BrNfe::Response::Service::Default" do
32
16
  response
@@ -215,163 +199,7 @@ describe BrNfe::Response::Service::BuildResponse do
215
199
  end
216
200
  end
217
201
 
218
- describe "#instance_invoice" do
219
- # Sim, sinto vergonha por ter feito um teste dessse ='(
220
- it "deve simplesmente instanciar um NF a partir dos métodos e busca por atrubutos via hash e XML" do
221
- invoice = BrNfe::Response::Service::NotaFiscal.new
222
- subject.stubs(:get_xml_nf).returns('get_xml_nf')
223
- subject.stubs(:invoice_numero_nf_path).returns(:invoice_numero_nf_path)
224
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_numero_nf_path).returns(:invoice_numero_nf_value)
225
- subject.stubs(:invoice_codigo_verificacao_path).returns(:invoice_codigo_verificacao_path)
226
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_codigo_verificacao_path).returns(:invoice_codigo_verificacao_value)
227
- subject.stubs(:invoice_data_emissao_path).returns(:invoice_data_emissao_path)
228
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_data_emissao_path).returns(:invoice_data_emissao_value)
229
- subject.stubs(:invoice_url_nf_path).returns(:invoice_url_nf_path)
230
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_url_nf_path).returns(:invoice_url_nf_value)
231
- subject.stubs(:invoice_rps_numero_path).returns(:invoice_rps_numero_path)
232
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_rps_numero_path).returns(:invoice_rps_numero_value)
233
- subject.stubs(:invoice_rps_serie_path).returns(:invoice_rps_serie_path)
234
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_rps_serie_path).returns(:invoice_rps_serie_value)
235
- subject.stubs(:invoice_rps_tipo_path).returns(:invoice_rps_tipo_path)
236
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_rps_tipo_path).returns(:invoice_rps_tipo_value)
237
- subject.stubs(:invoice_rps_situacao_path).returns(:invoice_rps_situacao_path)
238
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_rps_situacao_path).returns(:invoice_rps_situacao_value)
239
- subject.stubs(:invoice_rps_substituido_numero_path).returns(:invoice_rps_substituido_numero_path)
240
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_rps_substituido_numero_path).returns(:invoice_rps_substituido_numero_value)
241
- subject.stubs(:invoice_rps_substituido_serie_path).returns(:invoice_rps_substituido_serie_path)
242
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_rps_substituido_serie_path).returns(:invoice_rps_substituido_serie_value)
243
- subject.stubs(:invoice_rps_substituido_tipo_path).returns(:invoice_rps_substituido_tipo_path)
244
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_rps_substituido_tipo_path).returns(:invoice_rps_substituido_tipo_value)
245
- subject.stubs(:invoice_data_emissao_rps_path).returns(:invoice_data_emissao_rps_path)
246
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_data_emissao_rps_path).returns(:invoice_data_emissao_rps_value)
247
- subject.stubs(:invoice_competencia_path).returns(:invoice_competencia_path)
248
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_competencia_path).returns(:invoice_competencia_value)
249
- subject.stubs(:invoice_outras_informacoes_path).returns(:invoice_outras_informacoes_path)
250
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_outras_informacoes_path).returns(:invoice_outras_informacoes_value)
251
- subject.stubs(:invoice_item_lista_servico_path).returns(:invoice_item_lista_servico_path)
252
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_item_lista_servico_path).returns(:invoice_item_lista_servico_value)
253
- subject.stubs(:invoice_cnae_code_path).returns(:invoice_cnae_code_path)
254
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cnae_code_path).returns(:invoice_cnae_code_value)
255
- subject.stubs(:invoice_description_path).returns(:invoice_description_path)
256
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_description_path).returns(:invoice_description_value)
257
- subject.stubs(:invoice_codigo_municipio_path).returns(:invoice_codigo_municipio_path)
258
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_codigo_municipio_path).returns(:invoice_codigo_municipio_value)
259
- subject.stubs(:invoice_total_services_path).returns(:invoice_total_services_path)
260
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_total_services_path).returns(:invoice_total_services_value)
261
- subject.stubs(:invoice_deductions_path).returns(:invoice_deductions_path)
262
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_deductions_path).returns(:invoice_deductions_value)
263
- subject.stubs(:invoice_valor_pis_path).returns(:invoice_valor_pis_path)
264
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_valor_pis_path).returns(:invoice_valor_pis_value)
265
- subject.stubs(:invoice_valor_cofins_path).returns(:invoice_valor_cofins_path)
266
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_valor_cofins_path).returns(:invoice_valor_cofins_value)
267
- subject.stubs(:invoice_valor_inss_path).returns(:invoice_valor_inss_path)
268
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_valor_inss_path).returns(:invoice_valor_inss_value)
269
- subject.stubs(:invoice_valor_ir_path).returns(:invoice_valor_ir_path)
270
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_valor_ir_path).returns(:invoice_valor_ir_value)
271
- subject.stubs(:invoice_valor_csll_path).returns(:invoice_valor_csll_path)
272
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_valor_csll_path).returns(:invoice_valor_csll_value)
273
- subject.stubs(:invoice_iss_retained_path).returns(:invoice_iss_retained_path)
274
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_iss_retained_path).returns(:invoice_iss_retained_value)
275
- subject.stubs(:invoice_outras_retencoes_path).returns(:invoice_outras_retencoes_path)
276
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_outras_retencoes_path).returns(:invoice_outras_retencoes_value)
277
- subject.stubs(:invoice_total_iss_path).returns(:invoice_total_iss_path)
278
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_total_iss_path).returns(:invoice_total_iss_value)
279
- subject.stubs(:invoice_base_calculation_path).returns(:invoice_base_calculation_path)
280
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_base_calculation_path).returns(:invoice_base_calculation_value)
281
- subject.stubs(:invoice_iss_tax_rate_path).returns(:invoice_iss_tax_rate_path)
282
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_iss_tax_rate_path).returns(:invoice_iss_tax_rate_value)
283
- subject.stubs(:invoice_valor_liquido_path).returns(:invoice_valor_liquido_path)
284
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_valor_liquido_path).returns(:invoice_valor_liquido_value)
285
- subject.stubs(:invoice_desconto_condicionado_path).returns(:invoice_desconto_condicionado_path)
286
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_desconto_condicionado_path).returns(:invoice_desconto_condicionado_value)
287
- subject.stubs(:invoice_desconto_incondicionado_path).returns(:invoice_desconto_incondicionado_path)
288
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_desconto_incondicionado_path).returns(:invoice_desconto_incondicionado_value)
289
- subject.stubs(:invoice_responsavel_retencao_path).returns(:invoice_responsavel_retencao_path)
290
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_responsavel_retencao_path).returns(:invoice_responsavel_retencao_value)
291
- subject.stubs(:invoice_numero_processo_path).returns(:invoice_numero_processo_path)
292
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_numero_processo_path).returns(:invoice_numero_processo_value)
293
- subject.stubs(:invoice_municipio_incidencia_path).returns(:invoice_municipio_incidencia_path)
294
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_municipio_incidencia_path).returns(:invoice_municipio_incidencia_value)
295
- subject.stubs(:invoice_orgao_gerador_municipio_path).returns(:invoice_orgao_gerador_municipio_path)
296
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_orgao_gerador_municipio_path).returns(:invoice_orgao_gerador_municipio_value)
297
- subject.stubs(:invoice_orgao_gerador_uf_path).returns(:invoice_orgao_gerador_uf_path)
298
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_orgao_gerador_uf_path).returns(:invoice_orgao_gerador_uf_value)
299
- subject.stubs(:invoice_cancelamento_codigo_path).returns(:invoice_cancelamento_codigo_path)
300
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cancelamento_codigo_path).returns(:invoice_cancelamento_codigo_value)
301
- subject.stubs(:invoice_cancelamento_numero_nf_path).returns(:invoice_cancelamento_numero_nf_path)
302
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cancelamento_numero_nf_path).returns(:invoice_cancelamento_numero_nf_value)
303
- subject.stubs(:invoice_cancelamento_cnpj_path).returns(:invoice_cancelamento_cnpj_path)
304
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cancelamento_cnpj_path).returns(:invoice_cancelamento_cnpj_value)
305
- subject.stubs(:invoice_cancelamento_inscricao_municipal_path).returns(:invoice_cancelamento_inscricao_municipal_path)
306
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cancelamento_inscricao_municipal_path).returns(:invoice_cancelamento_inscricao_municipal_value)
307
- subject.stubs(:invoice_cancelamento_municipio_path).returns(:invoice_cancelamento_municipio_path)
308
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cancelamento_municipio_path).returns(:invoice_cancelamento_municipio_value)
309
- subject.stubs(:invoice_cancelamento_sucesso_path).returns(:invoice_cancelamento_sucesso_path)
310
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cancelamento_sucesso_path).returns(:invoice_cancelamento_sucesso_value)
311
- subject.stubs(:invoice_cancelamento_data_hora_path).returns(:invoice_cancelamento_data_hora_path)
312
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_cancelamento_data_hora_path).returns(:invoice_cancelamento_data_hora_value)
313
- subject.stubs(:invoice_nfe_substituidora_path).returns(:invoice_nfe_substituidora_path)
314
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_nfe_substituidora_path).returns(:invoice_nfe_substituidora_value)
315
- subject.stubs(:invoice_codigo_obra_path).returns(:invoice_codigo_obra_path)
316
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_codigo_obra_path).returns(:invoice_codigo_obra_value)
317
- subject.stubs(:invoice_codigo_art_path).returns(:invoice_codigo_art_path)
318
- subject.stubs(:find_value_for_keys).with(:hash_nf, :invoice_codigo_art_path).returns(:invoice_codigo_art_value)
319
-
320
- BrNfe::Response::Service::NotaFiscal.expects(:new).with({
321
- xml_nf: 'get_xml_nf',
322
- numero_nf: :invoice_numero_nf_value,
323
- codigo_verificacao: :invoice_codigo_verificacao_value,
324
- data_emissao: :invoice_data_emissao_value,
325
- url_nf: :invoice_url_nf_value,
326
- rps_numero: :invoice_rps_numero_value,
327
- rps_serie: :invoice_rps_serie_value,
328
- rps_tipo: :invoice_rps_tipo_value,
329
- rps_situacao: :invoice_rps_situacao_value,
330
- rps_substituido_numero: :invoice_rps_substituido_numero_value,
331
- rps_substituido_serie: :invoice_rps_substituido_serie_value,
332
- rps_substituido_tipo: :invoice_rps_substituido_tipo_value,
333
- data_emissao_rps: :invoice_data_emissao_rps_value,
334
- competencia: :invoice_competencia_value,
335
- outras_informacoes: :invoice_outras_informacoes_value,
336
- item_lista_servico: :invoice_item_lista_servico_value,
337
- cnae_code: :invoice_cnae_code_value,
338
- description: :invoice_description_value,
339
- codigo_municipio: :invoice_codigo_municipio_value,
340
- total_services: :invoice_total_services_value,
341
- deductions: :invoice_deductions_value,
342
- valor_pis: :invoice_valor_pis_value,
343
- valor_cofins: :invoice_valor_cofins_value,
344
- valor_inss: :invoice_valor_inss_value,
345
- valor_ir: :invoice_valor_ir_value,
346
- valor_csll: :invoice_valor_csll_value,
347
- iss_retained: :invoice_iss_retained_value,
348
- outras_retencoes: :invoice_outras_retencoes_value,
349
- total_iss: :invoice_total_iss_value,
350
- base_calculation: :invoice_base_calculation_value,
351
- iss_tax_rate: :invoice_iss_tax_rate_value,
352
- valor_liquido: :invoice_valor_liquido_value,
353
- desconto_condicionado: :invoice_desconto_condicionado_value,
354
- desconto_incondicionado: :invoice_desconto_incondicionado_value,
355
- responsavel_retencao: :invoice_responsavel_retencao_value,
356
- numero_processo: :invoice_numero_processo_value,
357
- municipio_incidencia: :invoice_municipio_incidencia_value,
358
- orgao_gerador_municipio: :invoice_orgao_gerador_municipio_value,
359
- orgao_gerador_uf: :invoice_orgao_gerador_uf_value,
360
- cancelamento_codigo: :invoice_cancelamento_codigo_value,
361
- cancelamento_numero_nf: :invoice_cancelamento_numero_nf_value,
362
- cancelamento_cnpj: :invoice_cancelamento_cnpj_value,
363
- cancelamento_inscricao_municipal: :invoice_cancelamento_inscricao_municipal_value,
364
- cancelamento_municipio: :invoice_cancelamento_municipio_value,
365
- cancelamento_sucesso: :invoice_cancelamento_sucesso_value,
366
- cancelamento_data_hora: :invoice_cancelamento_data_hora_value,
367
- nfe_substituidora: :invoice_nfe_substituidora_value,
368
- codigo_obra: :invoice_codigo_obra_value,
369
- codigo_art: :invoice_codigo_art_value
370
- }).returns(invoice)
371
-
372
- subject.instance_invoice(:hash_nf).must_equal invoice
373
- end
374
- end
202
+ # O método instance invoice e demais são testados dando o build no XML das NFSs
375
203
  end
376
204
 
377
205
  end