Class: Hbci::Services::TransactionsReceiver

Inherits:
BaseReceiver show all
Defined in:
lib/hbci/services/transactions_receiver.rb

Instance Attribute Summary collapse

Attributes inherited from BaseReceiver

#connector, #dialog, #iban

Instance Method Summary collapse

Methods inherited from BaseReceiver

#initialize

Constructor Details

This class inherits a constructor from Hbci::Services::BaseReceiver

Instance Attribute Details

#next_attachObject (readonly)

Returns the value of attribute next_attach.



6
7
8
# File 'lib/hbci/services/transactions_receiver.rb', line 6

def next_attach
  @next_attach
end

Instance Method Details

#perform(start_date, end_date) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hbci/services/transactions_receiver.rb', line 8

def perform(start_date, end_date)
  @start_date = start_date
  @end_date = end_date

  transactions = []
  loop do
    request_message = MessageFactory.build(connector, dialog) do |hnvsd|
      hnvsd.add_segment(build_hkkaz)
    end
    request_message.compile

    @response = Response.new(connector.post(request_message))

    raise @response.to_s unless request_successful?

    hikaz = @response.find('HNVSD').find('HIKAZ')
    transactions.concat(parse_transactions(hikaz.booked)) if hikaz

    break if @response.find('HNVSD').find('HIRMS').ret_val_1.code != '3040'

    @next_attach = @response.find('HNVSD').find('HIRMS').ret_val_1.parm
  end
  transactions
end