crafters / cielo

Gem para integração com os WebServices da Cielo
www.crafters.com.br
MIT License
85 stars 52 forks source link

parameters[:"url-retorno"] Why doesn't get default value in config? #3

Closed danieldocki closed 12 years ago

danieldocki commented 12 years ago

I need to inform each creating the url-retorno?

    def analysis_parameters(parameters={})
      [:numero, :valor, :bandeira, :"url-retorno"].each do |parameter|
        raise Cielo::MissingArgumentError, "Required parameter #{parameter} not found" unless parameters[parameter]
      end
      parameters.merge!(:moeda => "986") unless parameters[:moeda]
      parameters.merge!(:"data-hora" => Time.now.strftime("%Y-%m-%dT%H:%M:%S")) unless parameters[:"data-hora"]
      parameters.merge!(:idioma => "PT") unless parameters[:idioma]
      parameters.merge!(:produto => "1") unless parameters[:produto]
      parameters.merge!(:parcelas => "1") unless parameters[:parcelas]
      parameters.merge!(:autorizar => "2") unless parameters[:autorizar]
      parameters.merge!(:capturar => "true") unless parameters[:capturar]
      parameters.merge!(:"url-retorno" => Cielo.return_path) unless parameters[:"url-retorno"]
      parameters
    end
felipero commented 12 years ago

You can specify it on your environment files and use it there. In all cases I use the url-retorno is different, because I add the product id, so when the callback happens I know what product it is.