Class: Paypal::Payment::Response::Info

Inherits:
Base
  • Object
show all
Defined in:
lib/paypal/payment/response/info.rb

Constant Summary collapse

@@attribute_mapping =
{
  :ACK => :ack,
  :CURRENCYCODE => :currency_code,
  :ERRORCODE => :error_code,
  :ORDERTIME => :order_time,
  :PAYMENTSTATUS => :payment_status,
  :PAYMENTTYPE => :payment_type,
  :PENDINGREASON => :pending_reason,
  :PROTECTIONELIGIBILITY => :protection_eligibility,
  :PROTECTIONELIGIBILITYTYPE => :protection_eligibility_type,
  :REASONCODE => :reason_code,
  :RECEIPTID => :receipt_id,
  :SECUREMERCHANTACCOUNTID => :secure_merchant_account_id,
  :TRANSACTIONID => :transaction_id,
  :TRANSACTIONTYPE => :transaction_type,
  :PAYMENTREQUESTID => :request_id,
  :SELLERPAYPALACCOUNTID => :seller_id,
  :EXCHANGERATE => :exchange_rate
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

#==, formatted_amount, #numeric_attribute?, to_numeric

Constructor Details

#initialize(attributes = {}) ⇒ Info

Returns a new instance of Info.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/paypal/payment/response/info.rb', line 27

def initialize(attributes = {})
  attrs = attributes.dup
  @@attribute_mapping.each do |key, value|
    self.send "#{value}=", attrs.delete(key)
  end
  @amount = Common::Amount.new(
    :total => attrs.delete(:AMT),
    :fee => attrs.delete(:FEEAMT),
    :tax => attrs.delete(:TAXAMT)
  )

  # warn ignored params
  attrs.each do |key, value|
    Paypal.log "Ignored Parameter (#{self.class}): #{key}=#{value}", :warn
  end
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



25
26
27
# File 'lib/paypal/payment/response/info.rb', line 25

def amount
  @amount
end