Class: PayPal::ExpressCheckout::Response::Search

Inherits:
Base
  • Object
show all
Defined in:
lib/paypal/express_checkout/response/search.rb

Constant Summary

Constants included from Fields

Fields::ASSOCIATIONS, Fields::ATTRIBUTES

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Base

#build_association, #build_billings, #build_fmfs, #build_payment_items, #build_payments, #build_shipping_options, #build_values, #errors, #initialize, #params, #success?, #valid?

Methods included from Utils

#convert_to_time, #mapping

Methods included from Fields

#field_map, #group_collect, #group_fields, #has_fields?, #has_many?, included, #inverted_field_map

Constructor Details

This class inherits a constructor from PayPal::ExpressCheckout::Response::Base

Instance Method Details

#paymentsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/paypal/express_checkout/response/search.rb', line 6

def payments
  @payments ||= begin
    index = 0
    [].tap do |payments|
      while params["L_TIMESTAMP#{index}"]
        payments << PayPal::ExpressCheckout::Payment.new({
          :timestamp          => params["L_TIMESTAMP#{index}"],
          :time_zone          => params["L_TIMEZONE#{index}"],
          :payment_type       => params["L_TYPE#{index}"],
          :email              => params["L_EMAIL#{index}"],
          :name               => params["L_NAME#{index}"],
          :transaction_id     => params["L_TRANSACTIONID#{index}"],
          :status             => params["L_STATUS#{index}"],
          :amount             => params["L_AMT#{index}"].to_f,
          :currency           => params["L_CURRENCYCODE#{index}"],
          :fee_amount         => params["L_FEEAMT#{index}"].to_f,
          :net_amount         => params["L_NETAMT#{index}"].to_f
        })

        index += 1
      end
    end
  end
end