Class: BrNfe::Servico::Betha::V2::Gateway
- Inherits:
-
Base
show all
- Defined in:
- lib/br_nfe/servico/betha/v2/gateway.rb
Instance Attribute Summary collapse
#lote_rps, #numero_lote_rps, #operacao
Attributes inherited from Base
#certificate_pkcs12_password, #certificate_pkcs12_path, #certificate_pkcs12_value, #env
Instance Method Summary
collapse
#initialize
Methods inherited from Base
#certificado_obrigatorio?, #certificate, #certificate=, #certificate_key, #certificate_key=, #certificate_pkcs12, #certificate_pkcs12=, #client_wsdl, #env_namespace, #method_wsdl, #original_response, #response, #wsdl_encoding, #xml_builder
#emitente, #emitente=
#assign_attributes, #default_values, #initialize
Instance Attribute Details
#codigo_cancelamento ⇒ Object
Returns the value of attribute codigo_cancelamento.
8
9
10
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 8
def codigo_cancelamento
@codigo_cancelamento
end
|
#numero_nfse ⇒ Object
Returns the value of attribute numero_nfse.
7
8
9
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 7
def numero_nfse
@numero_nfse
end
|
Instance Method Details
#builder ⇒ Object
39
40
41
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 39
def builder
@builder
end
|
#cabecalho ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 43
def cabecalho
Nokogiri::XML::Builder.new do
nfseCabecMsg do
cdata(Nokogiri::XML::Builder.new do |xml|
xml.cabecalho(xmlns: "http://www.betha.com.br/e-nota-contribuinte-ws", versao: "2.02"){
xml.versaoDados 2.02
}
end.doc.root)
end
end.doc.root.to_s.gsub(/\n/,'').gsub(/\t/,'')
end
|
#canonical_xml_builder ⇒ Object
63
64
65
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 63
def canonical_xml_builder
canonicalize xml_builder.doc.root
end
|
#content_xml ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 55
def content_xml
Nokogiri::XML::Builder.new do
nfseDadosMsg do
cdata(canonical_xml_builder)
end
end.doc.root.to_s
end
|
#namespace_identifier ⇒ Object
14
15
16
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 14
def namespace_identifier
:e
end
|
#namespaces ⇒ Object
10
11
12
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 10
def namespaces
{"xmlns:e" => "http://www.betha.com.br/e-nota-contribuinte-ws"}
end
|
#request ⇒ Object
26
27
28
29
30
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 26
def request
set_response( client_wsdl.call(method_wsdl, message: "#{cabecalho}#{content_xml}") )
rescue Savon::SOAPFault => error
return @response = BrNfe::Servico::Response::Default.new(success: false, error_messages: [error.message])
end
|
#set_response(resp) ⇒ Object
32
33
34
35
36
37
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 32
def set_response(resp)
method_response = (method_wsdl.to_s + "_response").to_sym
@builder = BrNfe::Servico::Betha::V2::BuildResponse.new(xml: resp.hash[:envelope][:body][method_response][:return], nfe_method: method_wsdl)
@original_response = @builder.messages
@response = @builder.response
end
|
#version ⇒ Object
18
19
20
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 18
def version
:v2
end
|
#wsdl ⇒ Object
22
23
24
|
# File 'lib/br_nfe/servico/betha/v2/gateway.rb', line 22
def wsdl
"http://e-gov.betha.com.br/e-nota-contribuinte-#{'test-' if env == :test}ws/nfseWS?wsdl"
end
|