Sha256: 0c944554c993844c9f0381441df638657f8cab800143b02cafa785eb5f8324cc

Contents?: true

Size: 1.33 KB

Versions: 11

Compression:

Stored size: 1.33 KB

Contents

module Paypal
  module Payment
    class Response::Info < Base
      cattr_reader :attribute_mapping
      @@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,
      }
      attr_accessor *@@attribute_mapping.values
      attr_accessor :amount

      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
paypal-express-0.4.7 lib/paypal/payment/response/info.rb
paypal-express-0.4.6 lib/paypal/payment/response/info.rb
paypal-express-0.4.5 lib/paypal/payment/response/info.rb
paypal-express-0.4.4 lib/paypal/payment/response/info.rb
paypal-express-0.4.3 lib/paypal/payment/response/info.rb
paypal-express-0.4.2 lib/paypal/payment/response/info.rb
paypal-express-0.4.1 lib/paypal/payment/response/info.rb
paypal-express-0.4.0 lib/paypal/payment/response/info.rb
paypal-express-0.4.0.alpha lib/paypal/payment/response/info.rb
paypal-express-0.3.1 lib/paypal/payment/response/info.rb
paypal-express-0.3.0 lib/paypal/payment/response/info.rb