class RubyPaypalNvp::Fetcher::Statement

Constants

RESPONSE_PARAMS

Private Instance Methods

api_method() click to toggle source
# File lib/ruby_paypal_nvp/fetcher/statement.rb, line 61
def api_method
  'TransactionSearch'
end
increment() click to toggle source

rubocop:enable Style/GuardClause

# File lib/ruby_paypal_nvp/fetcher/statement.rb, line 43
def increment
  if @resulting_hash[:values].keys.last
    (@resulting_hash[:values].keys.last + 1)
  else
    0
  end
end
load_response() click to toggle source

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength

# File lib/ruby_paypal_nvp/fetcher/statement.rb, line 16
def load_response
  @ack = 'Failure'
  while @ack != 'Success'
    enddate = moved_end ? Time.parse(moved_end).utc.iso8601 : nil
    options = request_options(enddate: enddate)
    response = load_api_response(options)
    parse(response, increment: increment)

    @ack = response['ACK']
    raise response['L_LONGMESSAGE0'] if @ack == 'Failure'
  end
  result = result_with_meta(timestamp: response['TIMESTAMP'])
  @resulting_hash = default_hash
  result[:values] = result[:values].values
  result
end
moved_end() click to toggle source

rubocop:disable Style/GuardClause

# File lib/ruby_paypal_nvp/fetcher/statement.rb, line 36
def moved_end
  if @resulting_hash[:values].keys.last
    @resulting_hash[:values].values.last['L_TIMESTAMP']
  end
end
process_loaded_data(result) click to toggle source
# File lib/ruby_paypal_nvp/fetcher/statement.rb, line 10
def process_loaded_data(result)
  ::RubyPaypalNvp::Model::Statement.new(result)
end
request_options(options = {}) click to toggle source
# File lib/ruby_paypal_nvp/fetcher/statement.rb, line 51
def request_options(options = {})
  additional = {
    startdate: @start_date,
    enddate: options[:enddate] || @end_date,
    transactionclass: @transaction_class,
    currencycode: @currency
  }
  super.merge! additional
end