Class: Bankserv::NotifyMeStatement
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Bankserv::NotifyMeStatement
- Defined in:
- lib/bankserv/transmission/notify_me_statement.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.store(file) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bankserv/transmission/notify_me_statement.rb', line 7 def self.store(file) = Absa::NotifyMe::XmlStatement.file_to_hash(file) raise "Expected a document set" unless [:type] == "document" client_code = [:data][:data][0][:data][:client_code] statement = new statement.client_code = client_code statement.data = statement.save! statement end |
Instance Method Details
#process! ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bankserv/transmission/notify_me_statement.rb', line 21 def process! raise "Document already processed" if processed? recon_account_detail_records.each do |record| Bankserv::NotifyMeTransaction.create! data: record[:data], client_code: client_code, bankserv_notify_me_statement_id: id end self.processed = true self.save end |
#recon_account_detail_records ⇒ Object
36 37 38 |
# File 'lib/bankserv/transmission/notify_me_statement.rb', line 36 def recon_account_detail_records recon_transmission_data.select{|item| item[:type] == 'detail'} end |
#recon_transmission_data ⇒ Object
32 33 34 |
# File 'lib/bankserv/transmission/notify_me_statement.rb', line 32 def recon_transmission_data data[:data][:data] end |