Sha256: 21ab36b9d705b3f256e0cbf2a7b5d3f5db769214b84121b30fad5a021d834358

Contents?: true

Size: 1.46 KB

Versions: 32

Compression:

Stored size: 1.46 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,
        :PAYMENTREQUESTID => :request_id,
        :SELLERPAYPALACCOUNTID => :seller_id,
        :EXCHANGERATE => :exchange_rate
      }
      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

32 entries across 32 versions & 4 rubygems

Version Path
ianfleeton-paypal-express-1.1.0 lib/paypal/payment/response/info.rb
ianfleeton-paypal-express-1.0.0 lib/paypal/payment/response/info.rb
ianfleeton-paypal-express-0.8.7 lib/paypal/payment/response/info.rb
ianfleeton-paypal-express-0.8.6 lib/paypal/payment/response/info.rb
ianfleeton-paypal-express-0.8.5 lib/paypal/payment/response/info.rb
ianfleeton-paypal-express-0.8.4 lib/paypal/payment/response/info.rb
creative-paypal-express-1.4.1 lib/paypal/payment/response/info.rb
creative-paypal-express-1.4.0 lib/paypal/payment/response/info.rb
creative-paypal-express-1.3.0 lib/paypal/payment/response/info.rb
ianfleeton-paypal-express-0.8.3 lib/paypal/payment/response/info.rb
ianfleeton-paypal-express-0.8.2 lib/paypal/payment/response/info.rb
creative-paypal-express-1.2.1 lib/paypal/payment/response/info.rb
creative-paypal-express-1.2.0 lib/paypal/payment/response/info.rb
creative-paypal-express-1.1.0 lib/paypal/payment/response/info.rb
dfg-paypal-0.8.2 lib/paypal/payment/response/info.rb
creative-paypal-express-1.0.1.dev2 lib/paypal/payment/response/info.rb
creative-paypal-express-1.0.1.dev1 lib/paypal/payment/response/info.rb
creative-paypal-express-1.0.0 lib/paypal/payment/response/info.rb
creative-paypal-express-0.8.2.4 lib/paypal/payment/response/info.rb
creative-paypal-express-0.8.2.3 lib/paypal/payment/response/info.rb