Skip to content
Browse files

Fix transaction notifications

  • Loading branch information...
1 parent 0f0b5b8 commit a9d01ff58c0980a727b6026a45510aa3aee7cb4d @sagmor committed Jan 27, 2012
Showing with 15 additions and 14 deletions.
  1. +1 −0 lib/pag_seguro.rb
  2. +4 −4 lib/pag_seguro/client.rb
  3. +3 −3 lib/pag_seguro/payment.rb
  4. +7 −7 lib/pag_seguro/transaction.rb
View
1 lib/pag_seguro.rb
@@ -5,4 +5,5 @@
require "pag_seguro/version"
require "pag_seguro/item"
require "pag_seguro/payment"
+require "pag_seguro/transaction"
require "pag_seguro/client"
View
8 lib/pag_seguro/client.rb
@@ -16,9 +16,9 @@ def payment(attributes)
payment
end
- def notification(params)
+ def notification(code)
Transaction.new(
- self.get("transactions/notifications/#{params[:notificationCode]}")["transaction"]
+ self.get("transactions/notifications/#{code}")["transaction"]
)
end
@@ -33,15 +33,15 @@ def redirect_url_for(code)
end
def get(url,params = {})
- url = API_HOST+url
+ url = API_HOST + url
params = params.merge({
:email => self.email,
:token => self.token
})
MultiXml.parse(
- RestClient.get(url, params)
+ RestClient.get(url, :params => params)
)
end
View
6 lib/pag_seguro/payment.rb
@@ -39,9 +39,9 @@ def to_xml(options={})
checkout.extraAmount extra_amount if extra_amount
checkout.maxUses max_uses || 1
checkout.maxAge max_age if max_age
- end
- builder.shipping do |shipping|
- shipping.type 3
+ checkout.shipping do |shipping|
+ shipping.type 3
+ end
end
end
View
14 lib/pag_seguro/transaction.rb
@@ -1,13 +1,13 @@
module PagSeguro
class Transaction < Hashie::Mash
module STATUS
- PENDING = 1
- ON_ANALYSIS = 2
- PAYED = 3
- AVAILABLE = 4
- DISPUTED = 5
- REFUNDED = 6
- CANCELED = 7
+ PENDING = "1"
+ ON_ANALYSIS = "2"
+ PAYED = "3"
+ AVAILABLE = "4"
+ DISPUTED = "5"
+ REFUNDED = "6"
+ CANCELED = "7"
end
def success?

0 comments on commit a9d01ff

Please sign in to comment.
Something went wrong with that request. Please try again.