class PagSeguro::Transaction

Constants

PAYMENT_STATUS

Attributes

response[R]

Public Class Methods

new(response) click to toggle source
# File lib/pagseguro/transaction.rb, line 13
def initialize(response)
  @response = response
end

Public Instance Methods

cancellation_source() click to toggle source
# File lib/pagseguro/transaction.rb, line 45
def cancellation_source
  transaction['cancellationSource']
end
code() click to toggle source
# File lib/pagseguro/transaction.rb, line 25
def code
  transaction['code']
end
date() click to toggle source
# File lib/pagseguro/transaction.rb, line 17
def date
  transaction['date']
end
discount_amount() click to toggle source
# File lib/pagseguro/transaction.rb, line 61
def discount_amount
  transaction['discountAmount']
end
errors() click to toggle source
# File lib/pagseguro/transaction.rb, line 97
def errors
  response['errors'] ||= {'error' => []}

  [response['errors']['error']].flatten
end
escrow_end_date() click to toggle source
# File lib/pagseguro/transaction.rb, line 65
def escrow_end_date
  transaction['escrowEndDate']
end
extra_amount() click to toggle source
# File lib/pagseguro/transaction.rb, line 73
def extra_amount
  transaction['extraAmount']
end
fee_amount() click to toggle source
# File lib/pagseguro/transaction.rb, line 103
def fee_amount
  transaction['feeAmount'] || creditor_fees.fee_amount
end
gross_amount() click to toggle source
# File lib/pagseguro/transaction.rb, line 57
def gross_amount
  transaction['grossAmount']
end
installment_count() click to toggle source
# File lib/pagseguro/transaction.rb, line 77
def installment_count
  transaction['installmentCount']
end
items() click to toggle source
# File lib/pagseguro/transaction.rb, line 81
def items
  Items.new(transaction['paymentMethod'], transaction['itemCount'])
end
last_event_date() click to toggle source
# File lib/pagseguro/transaction.rb, line 21
def last_event_date
  transaction['lastEventDate']
end
net_amount() click to toggle source
# File lib/pagseguro/transaction.rb, line 69
def net_amount
  transaction['netAmount']
end
payment_method() click to toggle source
# File lib/pagseguro/transaction.rb, line 49
def payment_method
  PaymentMethod.new(transaction['paymentMethod'])
end
reference() click to toggle source
# File lib/pagseguro/transaction.rb, line 29
def reference
  transaction['reference']
end
sender() click to toggle source
# File lib/pagseguro/transaction.rb, line 85
def sender
  Sender.new(transaction['sender']) if transaction['sender']
end
shipping() click to toggle source
# File lib/pagseguro/transaction.rb, line 89
def shipping
  Shipping.new(transaction['shipping'])
end
status() click to toggle source
# File lib/pagseguro/transaction.rb, line 37
def status
  transaction['status']
end
status_name() click to toggle source
# File lib/pagseguro/transaction.rb, line 41
def status_name
  PAYMENT_STATUS[status]
end
type() click to toggle source
# File lib/pagseguro/transaction.rb, line 33
def type
  transaction['type']
end
valid?() click to toggle source
# File lib/pagseguro/transaction.rb, line 93
def valid?
  !transaction.blank?
end

Private Instance Methods

creditor_fees() click to toggle source
# File lib/pagseguro/transaction.rb, line 112
def creditor_fees
  @creditor_fees ||= CreditorFees.new(transaction['creditorFees'])
end
transaction() click to toggle source
# File lib/pagseguro/transaction.rb, line 108
def transaction
  @transaction ||= response['transaction']
end