Sha256: b41ebb1d0f939425e47d4152dbe5f8b1c62879cf6f8c4adf1005c00e53eef2f1

Contents?: true

Size: 1.31 KB

Versions: 10

Compression:

Stored size: 1.31 KB

Contents

module Paypal
  module Payment
    class Response < Base
      attr_accessor :amount, :ship_to, :insurance_option_offered, :currency_code, :error_code

      def initialize(attributes = {})
        attrs = attributes.dup
        @amount = Common::Amount.new(
          :total => attrs.delete(:AMT),
          :handing => attrs.delete(:HANDLINGAMT),
          :insurance => attrs.delete(:INSURANCEAMT),
          :ship_disc => attrs.delete(:SHIPDISCAMT),
          :shipping => attrs.delete(:SHIPPINGAMT),
          :tax => attrs.delete(:TAXAMT)
        )
        @ship_to = Payment::Response::ShipTo.new(
          :name => attrs.delete(:SHIPTONAME),
          :zip => attrs.delete(:SHIPTOZIP),
          :street => attrs.delete(:SHIPTOSTREET),
          :city => attrs.delete(:SHIPTOCITY),
          :state => attrs.delete(:SHIPTOSTATE),
          :country_code => attrs.delete(:SHIPTOCOUNTRYCODE),
          :country_name => attrs.delete(:SHIPTOCOUNTRYNAME)
        )
        @insurance_option_offered = attrs.delete(:INSURANCEOPTIONOFFERED) == 'true'
        @currency_code = attrs.delete(:CURRENCYCODE)
        @error_code = attrs.delete(:ERRORCODE)

        # 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

10 entries across 10 versions & 1 rubygems

Version Path
paypal-express-0.2.3 lib/paypal/payment/response.rb
paypal-express-0.2.2 lib/paypal/payment/response.rb
paypal-express-0.2.1 lib/paypal/payment/response.rb
paypal-express-0.2.0 lib/paypal/payment/response.rb
paypal-express-0.1.0 lib/paypal/payment/response.rb
paypal-express-0.0.9 lib/paypal/payment/response.rb
paypal-express-0.0.8 lib/paypal/payment/response.rb
paypal-express-0.0.7 lib/paypal/payment/response.rb
paypal-express-0.0.6 lib/paypal/payment/response.rb
paypal-express-0.0.5 lib/paypal/payment/response.rb