Giter Site home page Giter Site logo

bravo's People

Contributors

leanucci avatar miloops avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bravo's Issues

Url de WSFE de producción

Leandro, si no me equivoco en las URL de producción del servicio WSFE te falta agregar al final '?WSDL'

Saludos!

Errors incoming from AFIP are not in the response hash

I was wondering why my bill was being rejected, and it turns out that Savon's response is being overwritten by Bravo in the Bravo::Bill#setup_response method. In this method, the errors key is discarded, instead of being added as one more key/value.

This is the response we get from AFIP, in the Savon response:

=> {"fecae_solicitar_response"=>{"fecae_solicitar_result"=>{"fe_cab_resp"=>{"cuit"=>"30XXXXXXXX4", "pto_vta"=>"5", "cbte_tipo"=>"6", "fch_proceso"=>"20161012102344", "cant_reg"=>"1", "resultado"=>"R", "reproceso"=>"N"}, "fe_det_resp"=>{"fecae_det_response"=>{"concepto"=>"2", "doc_tipo"=>"80", "doc_nro"=>"27XXXXXXXX5", "cbte_desde"=>"127", "cbte_hasta"=>"127", "cbte_fch"=>"20161012", "resultado"=>"R", "cae"=>nil, "cae_fch_vto"=>nil}}, "events"=>{"evt"=>{"code"=>"4", "msg"=>"IMPORTANTE: El 01/11/2016 se renovaran los certificados SSL utilizados por los webservices de AFIP. Los nuevos certificados utilizaran el algoritmo de encriptacion SHA-2. Para mas informacion http://www.afip.gob.ar/ws/comoAfectaElCambio.asp"}}, "errors"=>{"err"=>{"code"=>"10005", "msg"=>"NO AUTORIZADO A EMITIR COMPROBANTES - EL PUNTO DE VENTA INFORMADO DEBE ESTAR DADO DE ALTA Y SER DEL TIPO RECE"}}}, "@xmlns"=>"http://ar.gov.afip.dif.FEV1/"}}

This is the response set up by Bravo:

=> {"header_result"=>"R", "authorized_on"=>"20161011162910", "detail_result"=>"R", "cae_due_date"=>nil, "cae"=>nil, "iva_id"=>"03", "iva_importe"=>0.0, "moneda"=>"PES", "cotizacion"=>1, "iva_base_imp"=>300.0, "doc_num"=>"27XXXXXXXX5", "cant_reg"=>"1", "cbte_tipo"=>"06", "pto_vta"=>"0005", "concepto"=>"02", "doc_tipo"=>"80", "cbte_fch"=>"20161011", "imp_tot_conc"=>0.0, "imp_op_ex"=>0.0, "imp_trib"=>0.0, "imp_neto"=>300.0, "imp_iva"=>0.0, "imp_total"=>300.0, "cbte_hasta"=>127, "cbte_desde"=>127, "fch_serv_desde"=>"20161001", "fch_serv_hasta"=>"20161031", "fch_vto_pago"=>"20161011"}

As you can see, the events value is also discarded, though it's not as important as the errors value, which is not provided by Bravo.

SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A

Hello!

I am getting the following exception when first communicating with the API via Savon:

HTTPI::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:51:in `rescue in request'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:33:in `request'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/httpi-2.4.2/lib/httpi.rb:161:in `request'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/httpi-2.4.2/lib/httpi.rb:127:in `get'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:43:in `load_from_remote'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:33:in `resolve'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/wasabi-3.5.0/lib/wasabi/document.rb:142:in `xml'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/wasabi-3.5.0/lib/wasabi/document.rb:160:in `parse'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/wasabi-3.5.0/lib/wasabi/document.rb:147:in `parser'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/wasabi-3.5.0/lib/wasabi/document.rb:64:in `soap_actions'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/savon-2.11.1/lib/savon/operation.rb:22:in `ensure_exists!'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/savon-2.11.1/lib/savon/operation.rb:15:in `create'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/savon-2.11.1/lib/savon/client.rb:32:in `operation'
    from /home/deployer/27shops.com/shared/bundle/ruby/2.1.0/gems/savon-2.11.1/lib/savon/client.rb:36:in `call'

I've tried using ssl_version: :TLSv1 instead in the Savon client, and it works. Apparently, AFIP doesn't support SSLv2/3. This is our current monkeypatch:

module Bravo
  class Reference
    def self.set_client
      opts = { wsdl: Bravo::AuthData.wsfe_url }.merge! Bravo.logger_options
      @client = Savon.client(opts.merge(ssl_version: :TLSv1))
    end
  end
end

Does it make sense to submit a PR to make sure that we use TLSv1 as default in every Savon.client?

Let me know!

Error al generar @bill = Bravo::Bill.new()

Hola estoy intentando usar la gema y en la linea donde genero Bravo::Bil.new() genera error, no se si esto se debe al estar desarrollando en entorno windows.
Te adjunto el codigo:

require "bravo"
require "savon/logger"

Bravo.cert = "test_sebas.crt"
Bravo.pkey = "sebas.key"

Bravo.sale_point = "001"
Bravo.service_url = "http://wswhomo.afip.gov.ar/wsfev1/service.asmx?WSDL"

Bravo.default_concepto = "01"
Bravo.default_documento = "80"
Bravo.default_moneda = "PES"
Bravo.own_iva_cond = "01"
Bravo.verbose

@header = Bravo::Bill.header("01")
@bill = Bravo::Bill.new()

@bill.net = 1000000
@bill.aliciva_id = 2
@bill.doc_num = "30646483561"
@bill.iva_cond = 2
@bill.concepto = "Servicios"
@bill.authorize
 if @bill.authorized?
  response = @bill.response
  flash.now[:notice] = response.cae
 end
  respond_to do |format|
  format.html # afip.html.erb
  format.xml  { render :xml => @document }
end

Me devuelve el siguiente error

Errno::ENOEXEC in DocumentsController#afip

Exec format error - C:/Ruby193/lib/ruby/gems/1.9.1/gems/bravo-0.4.0/lib/bravo/../../wsaa-client.sh -u  -k sebas.key -c test_sebas.crt

Rails.root: C:/Users/Usuario/afip

Application Trace | Framework Trace | Full Trace
<div id="Application-Trace" style="display: block;">
  <pre><code>app/controllers/documents_controller.rb:111:in `new&#x27;

app/controllers/documents_controller.rb:111:in `afip'

  <pre><code>activesupport (3.0.17) lib/active_support/core_ext/kernel/agnostics.rb:7:in ``&#x27;

activesupport (3.0.17) lib/active_support/core_ext/kernel/agnostics.rb:7:in ``'
bravo (0.4.0) lib/bravo/auth_data.rb:20:infetch&#x27; bravo (0.4.0) lib/bravo/bill.rb:9:in initialize'

Obtener mensaje de error de AFIP

Hola.
Estoy buscando cómo manejar las respuestas de error del servicio web de la AFIP y no encuentro cómo acceder al código o mensaje de error que devuelve la AFIP cuando una solicitud es rechazada.

Algo así:

unless bill.authorized?
    raise 'No autorizado, mensaje de error: ??'
end

¿Estoy haciendo algo mal o esto no está implementado?
Gracias.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.