Sha256: 37f51d91bcc02b62042093cdf2cdaf3896fa95f4b0af9fd61781542da3ff6129
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
module PagSeguro class Transactions < Base STATUSES = { "0" => :initiated, "1" => :waiting_payment, "2" => :in_analysis, "3" => :paid, "4" => :available, "5" => :in_dispute, "6" => :refunded, "7" => :cancelled, "8" => :chargeback_charged, "9" => :contested } def find(code) response = api.get "/v3/transactions/#{code}" do |conn| conn.headers[:accept] = FORMATS[:xml] end parse_body response end def find_by_notification_code(code) response = api.get "/v2/transactions/notifications/#{code}" do |conn| conn.headers[:accept] = FORMATS[:xml] end parse_body response end private def parse_body(response) 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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pagseguro_next-0.4.0 | lib/pagseguro/transactions.rb |
pagseguro_next-0.3.0 | lib/pagseguro/transactions.rb |
pagseguro_next-0.2.0 | lib/pagseguro/transactions.rb |