Sha256: a1f1db35e2b1dd94f777b556e2a0eb029bd4191598e2510014426eec96b02721
Contents?: true
Size: 843 Bytes
Versions: 2
Compression:
Stored size: 843 Bytes
Contents
# frozen_string_literal: true module PagSeguro class Transactions include Restful 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) transform get_xml("/v3/transactions/#{code}") end def find_by_notification_code(code) transform get_xml("/v2/transactions/notifications/#{code}") end private def transform(body) if body.transaction? body.transaction.status = STATUSES[body.transaction.status] body.transaction elsif body.errors? body.errors else body end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pagseguro_next-1.0.2 | lib/pagseguro/transactions.rb |
pagseguro_next-1.0.1 | lib/pagseguro/transactions.rb |