lib/pagseguro/rake.rb in pagseguro-0.1.1 vs lib/pagseguro/rake.rb in pagseguro-0.1.2

- old
+ new

@@ -87,12 +87,21 @@ order["TransacaoID"] = Digest::MD5.hexdigest(Time.now.to_s) # Set note order["Anotacao"] = ENV["NOTE"].to_s + # Retrieve index + index = proc do |hash, value| + if hash.respond_to?(:key) + hash.key(value) + else + hash.index(value) + end + end + # Set payment method and status - order["TipoPagamento"] = PagSeguro::Notification::PAYMENT_METHOD.key(payment_method) - order["StatusTransacao"] = PagSeguro::Notification::STATUS.key(status) + order["TipoPagamento"] = index[PagSeguro::Notification::PAYMENT_METHOD, payment_method] + order["StatusTransacao"] = index[PagSeguro::Notification::STATUS, status] # Finally, ping the configured return URL uri = URI.parse File.join(PagSeguro.config["base"], PagSeguro.config["return_to"]) Net::HTTP.post_form uri, order end