lib/pagseguro/transactions.rb in pagseguro_next-0.1.1 vs lib/pagseguro/transactions.rb in pagseguro_next-0.2.0
- old
+ new
@@ -30,11 +30,18 @@
end
private
def parse_body(response)
- parse(response.body["transaction"]).tap do |transaction|
- transaction.status = STATUSES[transaction.status]
+ parse(response.body).yield_self do |body|
+ if body.transaction?
+ body.transaction.status = STATUSES[body.transaction.status]
+ body.transaction
+ elsif body.errors?
+ body.errors
+ else
+ body
+ end
end
end
end
end