diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..cb50681 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.0.0-p247 diff --git a/Gemfile b/Gemfile index 33cac1d..1c3fd47 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,2 @@ -source :rubygems -gemspec \ No newline at end of file +source "https://rubygems.org" +gemspec diff --git a/Rakefile b/Rakefile index 316ea68..7522328 100644 --- a/Rakefile +++ b/Rakefile @@ -21,7 +21,7 @@ Bundler::GemHelper.install_tasks require 'rake' require 'rake/clean' require 'rake/testtask' -require 'rake/rdoctask' +require 'rdoc/task' Rake::TestTask.new do |t| @@ -37,17 +37,8 @@ Rake::RDocTask.new do |rd| rd.rdoc_dir = "documentation/api" end -# RCOV command, run as though from the commandline. Amend as required or perhaps move to config/environment.rb? -RCOV = "bundle exec rcov -Ilib --xref --profile" - -desc "generate a unit coverage report in coverage" -task :"coverage" do - sh "#{RCOV} --output coverage test/test_*.rb test/**/test_*.rb" -end - -desc "runs coverage and rdoc" -task :default => [:coverage, :rdoc] - +desc "runs tests and rdoc" +task :default => [:test, :rdoc] desc "recreates parsers" task :parsers do @@ -56,8 +47,7 @@ task :parsers do end task :test => :parsers -task :coverage => :parsers task :rdoc => :parsers task :build => :parsers task :release => :parsers -task :install => :parsers \ No newline at end of file +task :install => :parsers diff --git a/lib/ofx.rb b/lib/ofx.rb index 3a88573..9a834b8 100644 --- a/lib/ofx.rb +++ b/lib/ofx.rb @@ -57,4 +57,4 @@ # = Specifications # OFX 1.0.2:: http://www.ofx.net/ofx/downloads/ofx102spec.zip module OFX -end \ No newline at end of file +end diff --git a/lib/ofx/1.0.2/header.rb b/lib/ofx/1.0.2/header.rb index c872935..630f782 100644 --- a/lib/ofx/1.0.2/header.rb +++ b/lib/ofx/1.0.2/header.rb @@ -45,4 +45,4 @@ def self.from_ofx_102_s(header_string) header end end -end \ No newline at end of file +end diff --git a/lib/ofx/1.0.2/lexer.rb b/lib/ofx/1.0.2/lexer.rb index 8919cb9..e9c81b3 100644 --- a/lib/ofx/1.0.2/lexer.rb +++ b/lib/ofx/1.0.2/lexer.rb @@ -1,6 +1,6 @@ #-- # DO NOT MODIFY!!!! -# This file is automatically generated by rex 1.0.2 +# This file is automatically generated by rex 1.0.5 # from lexical definition file "ofx_102.rex". #++ @@ -29,89 +29,94 @@ class Parser < Racc::Parser class ScanError < StandardError ; end - attr_reader :lineno - attr_reader :filename + attr_reader :lineno + attr_reader :filename + attr_accessor :state - def scan_setup ; end + def scan_setup(str) + @ss = StringScanner.new(str) + @lineno = 1 + @state = nil + end - def action &block + def action yield end - def scan_str( str ) - scan_evaluate str + def scan_str(str) + scan_setup(str) do_parse end + alias :scan :scan_str def load_file( filename ) @filename = filename open(filename, "r") do |f| - scan_evaluate f.read + scan_setup(f.read) end end def scan_file( filename ) - load_file filename + load_file(filename) do_parse end + def next_token - @rex_tokens.shift + return if @ss.eos? + + # skips empty actions + until token = _next_token or @ss.eos?; end + token end - def scan_evaluate( str ) - scan_setup - @rex_tokens = [] - @lineno = 1 - ss = StringScanner.new(str) - state = nil - until ss.eos? - text = ss.peek(1) - @lineno += 1 if text == "\n" - case state - when nil - case - when (text = ss.scan(/\<\//)) - @rex_tokens.push action { state = :TAG; [:etag_in, text] } - - when (text = ss.scan(/\/)) - @rex_tokens.push action { state = nil; [:tag_out, text] } - - when (text = ss.scan(/[\w\-\.]+/)) - @rex_tokens.push action { [:element, text] } - - else - text = ss.string[ss.pos .. -1] - raise ScanError, "can not match: '" + text + "'" - end # if + def _next_token + text = @ss.peek(1) + @lineno += 1 if text == "\n" + token = case @state + when nil + case + when (text = @ss.scan(/\<\//)) + action { @state = :TAG; [:etag_in, text] } + + when (text = @ss.scan(/\/)) + action { @state = nil; [:tag_out, text] } + + when (text = @ss.scan(/[\w\-\.]+/)) + action { [:element, text] } else - raise ScanError, "undefined state: '" + state.to_s + "'" - end # case state - end # until ss - end # def scan_evaluate + text = @ss.string[@ss.pos .. -1] + raise ScanError, "can not match: '" + text + "'" + end # if + + else + raise ScanError, "undefined state: '" + state.to_s + "'" + end # case state + token + end # def _next_token end # class diff --git a/lib/ofx/1.0.2/ofx_102.rex b/lib/ofx/1.0.2/ofx_102.rex index c902f81..d4b2d3b 100644 --- a/lib/ofx/1.0.2/ofx_102.rex +++ b/lib/ofx/1.0.2/ofx_102.rex @@ -28,10 +28,10 @@ macro rule # [:state] pattern [actions] - {ETAG_IN} { state = :TAG; [:etag_in, text] } - {TAG_IN} { state = :TAG; [:tag_in, text] } + {ETAG_IN} { @state = :TAG; [:etag_in, text] } + {TAG_IN} { @state = :TAG; [:tag_in, text] } - :TAG {TAG_OUT} { state = nil; [:tag_out, text] } + :TAG {TAG_OUT} { @state = nil; [:tag_out, text] } :TAG [\w\-\.]+ { [:element, text] } diff --git a/lib/ofx/1.0.2/parser.rb b/lib/ofx/1.0.2/parser.rb index 9257804..aa0c068 100644 --- a/lib/ofx/1.0.2/parser.rb +++ b/lib/ofx/1.0.2/parser.rb @@ -62,36 +62,36 @@ def end_tag(tag_name) ##### State transition tables begin ### racc_action_table = [ - 1, 6, 1, 14, 15, 14, 15, 8, 9, 5, - 17, 19, 20, 1 ] + 4, 16, 4, 10, 12, 10, 12, 8, 5, 7, + 17, 19, 20, 4 ] racc_action_check = [ - 18, 2, 7, 18, 18, 7, 7, 5, 6, 1, - 14, 16, 17, 0 ] + 18, 7, 6, 18, 18, 6, 6, 5, 1, 4, + 10, 15, 17, 0 ] racc_action_pointer = [ - 11, 6, 1, nil, nil, 3, 8, 0, nil, nil, - nil, nil, nil, nil, 7, nil, 5, 8, -2, nil, + 11, 8, nil, nil, 6, 7, 0, -3, nil, nil, + 7, nil, nil, nil, nil, 5, nil, 8, -2, nil, nil, nil ] racc_action_default = [ - -1, -13, -13, -2, -6, -13, -13, -13, -4, 22, - -3, -7, -9, -10, -13, -8, -6, -13, -13, -12, + -1, -13, -2, -6, -13, -13, -13, -13, 22, -3, + -13, -7, -8, -9, -10, -6, -4, -13, -13, -12, -5, -11 ] racc_goto_table = [ - 7, 4, 10, 3, 2, nil, nil, nil, nil, nil, - nil, nil, 18, 21 ] + 9, 6, 3, 2, 1, nil, nil, nil, nil, nil, + nil, nil, 21, 18 ] racc_goto_check = [ - 4, 3, 5, 2, 1, nil, nil, nil, nil, nil, - nil, nil, 4, 5 ] + 5, 4, 3, 2, 1, nil, nil, nil, nil, nil, + nil, nil, 5, 4 ] racc_goto_pointer = [ - nil, 4, 3, 1, -4, -5, nil, nil, nil ] + nil, 4, 3, 2, -2, -6, nil, nil, nil ] racc_goto_default = [ - nil, nil, nil, 16, nil, nil, 11, 12, 13 ] + nil, nil, nil, 15, nil, nil, 11, 13, 14 ] racc_reduce_table = [ 0, 0, :racc_error, diff --git a/lib/ofx/1.0.2/serializer.rb b/lib/ofx/1.0.2/serializer.rb index 0bc6ff9..f4eaa5c 100644 --- a/lib/ofx/1.0.2/serializer.rb +++ b/lib/ofx/1.0.2/serializer.rb @@ -49,12 +49,14 @@ def to_http_post_body(document) end body += "\n" - #print body + # puts body body end def from_http_response_body(body) + # puts "Raw response:\n#{body}" + header_pattern = /(\w+\:.*\n)+/ header_match = header_pattern.match(body) @@ -62,15 +64,15 @@ def from_http_response_body(body) header = Header.from_ofx_102_s(header_match[0].strip) parser = OFX::OFX102::Parser.new + parser.scan_str body if parser.documents.length > 1 raise NotImplementedError, "Multiple response documents" end - #require 'pp' - #print body - #pp parser.ofx_hashes[0] + # require 'pp' + # pp parser.ofx_hashes[0] document = parser.documents[0] document.header = header diff --git a/lib/ofx/1.0.2/signon_message_set.rb b/lib/ofx/1.0.2/signon_message_set.rb index a2de441..be19c93 100644 --- a/lib/ofx/1.0.2/signon_message_set.rb +++ b/lib/ofx/1.0.2/signon_message_set.rb @@ -56,7 +56,8 @@ def ofx_102_request_body " #{language}\n" + financial_institution_identification.to_ofx_102_s + "\n" + (" #{session_cookie}\n" if session_cookie).to_s + - application_identification.to_ofx_102_s + application_identification.to_ofx_102_s + "\n" + + (" #{client_unique_identifier}" if client_unique_identifier).to_s end def self.from_ofx_102_hash(request_hash) raise NotImplementedError @@ -118,4 +119,4 @@ def self.from_ofx_102_hash(response_hash) response end end -end \ No newline at end of file +end diff --git a/lib/ofx/financial_client.rb b/lib/ofx/financial_client.rb index 5303a66..b467863 100644 --- a/lib/ofx/financial_client.rb +++ b/lib/ofx/financial_client.rb @@ -23,6 +23,7 @@ class FinancialClient @financial_institutions_and_credentials = [] attr_accessor :date_of_last_profile_update + attr_accessor :client_unique_identifier def initialize(financial_institutions_and_credentials) @financial_institutions_and_credentials = financial_institutions_and_credentials @@ -56,6 +57,7 @@ def create_signon_request_message(financial_institution_id) signonRequest.financial_institution_identification = self.financial_institution_identification_for(financial_institution_id) signonRequest.session_cookie = nil signonRequest.application_identification = self.application_identification + signonRequest.client_unique_identifier = self.client_unique_identifier signonMessageSet.requests << signonRequest signonMessageSet @@ -73,4 +75,4 @@ def create_profile_update_request_message() profileMessageSet end end -end \ No newline at end of file +end diff --git a/lib/ofx/financial_institution.rb b/lib/ofx/financial_institution.rb index dc2df65..567c31e 100644 --- a/lib/ofx/financial_institution.rb +++ b/lib/ofx/financial_institution.rb @@ -53,6 +53,10 @@ def create_request_document() document.header.header_version = OFX::Version.new("1.0.0") document.header.content_type = "OFXSGML" document.header.document_version = OFX::Version.new("1.0.2") + when OFX::Version.new("1.0.3") + document.header.header_version = OFX::Version.new("1.0.0") + document.header.content_type = "OFXSGML" + document.header.document_version = OFX::Version.new("1.0.3") else raise NotImplementedError end @@ -80,4 +84,4 @@ def send(document) return serializer.from_http_response_body(response_body) end end -end \ No newline at end of file +end diff --git a/lib/ofx/header.rb b/lib/ofx/header.rb index f0de5c1..d3c2440 100644 --- a/lib/ofx/header.rb +++ b/lib/ofx/header.rb @@ -112,4 +112,4 @@ def previous_unique_identifier=(value) @headers['OLDFILEUID'] = value end end -end \ No newline at end of file +end diff --git a/lib/ofx/serializer.rb b/lib/ofx/serializer.rb index 2b49ece..0f6272c 100644 --- a/lib/ofx/serializer.rb +++ b/lib/ofx/serializer.rb @@ -21,7 +21,7 @@ module OFX class Serializer def self.get(version) case version - when OFX::Version.new("1.0.2") + when OFX::Version.new("1.0.2"), OFX::Version.new("1.0.3") return OFX::OFX102::Serializer.new else raise NotImplementedError @@ -36,4 +36,4 @@ def from_http_request_body(document) raise NotImplementedError end end -end \ No newline at end of file +end diff --git a/lib/ofx/signon_message_set.rb b/lib/ofx/signon_message_set.rb index 732b2b9..4039e2b 100644 --- a/lib/ofx/signon_message_set.rb +++ b/lib/ofx/signon_message_set.rb @@ -79,6 +79,7 @@ class SignonRequest < Request attr_accessor :financial_institution_identification attr_accessor :session_cookie attr_accessor :application_identification + attr_accessor :client_unique_identifier def satisfies_requirements? raise NotImplementedError @@ -138,4 +139,4 @@ def financial_institution_certificate_identifier raise NotImplementedError end end -end \ No newline at end of file +end diff --git a/ofx_for_ruby.gemspec b/ofx_for_ruby.gemspec index 1106997..7d85c37 100644 --- a/ofx_for_ruby.gemspec +++ b/ofx_for_ruby.gemspec @@ -7,9 +7,9 @@ Gem::Specification.new do |s| s.version = OFX::VERSION.to_dotted_s s.platform = Gem::Platform::RUBY - s.authors = ["Chris Guidry"] + s.authors = ["Chris Guidry", "Patrick Bacon"] s.description = "OFX for Ruby is a pure Ruby implementation of Open Financial Exchange specifications (1.0.2 through 2.1.1) for building both financial clients and servers, providing parsers/serializers for each version, and a uniform object model across all versions." - s.email = ["chrisguidry@gmail.com"] + s.email = ["bacon@atomicobject.com"] s.summary = "Pure Ruby implementation of Open Financial Exchange specifications" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") @@ -20,6 +20,6 @@ Gem::Specification.new do |s| s.add_dependency "activesupport" s.add_development_dependency "racc" - s.add_development_dependency "rex" - s.add_development_dependency "rcov" + s.add_development_dependency "rexical" + s.add_development_dependency "pry" end diff --git a/test/capital_one/test_banking_statement.rb b/test/capital_one/test_banking_statement.rb index 7e6d3cf..b61cc68 100644 --- a/test/capital_one/test_banking_statement.rb +++ b/test/capital_one/test_banking_statement.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/capital_one_helper' -class CapitalOneBankingStatmentTest < Test::Unit::TestCase +class CapitalOneBankingStatmentTest < Minitest::Test include CapitalOneHelper @@ -27,6 +27,7 @@ def setup end def test_requesting_last_seven_days_statement_from_capital_one + skip 'Need Capital One Account' financial_institution = OFX::FinancialInstitution.get_institution('Capital One') requestDocument = financial_institution.create_request_document @@ -105,4 +106,4 @@ def test_requesting_last_seven_days_statement_from_capital_one assert_equal 366.15.to_d, total_of_transactions end -end \ No newline at end of file +end diff --git a/test/capital_one/test_financial_institution_profile.rb b/test/capital_one/test_financial_institution_profile.rb index 91c985f..39919c7 100644 --- a/test/capital_one/test_financial_institution_profile.rb +++ b/test/capital_one/test_financial_institution_profile.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/capital_one_helper' -class CapitalOneFinancialInstitutionProfileTest < Test::Unit::TestCase +class CapitalOneFinancialInstitutionProfileTest < Minitest::Test include CapitalOneHelper @@ -26,6 +26,7 @@ def setup end def test_requesting_fresh_fi_profile_from_capital_one + skip 'Need Capital One Account' financial_institution = OFX::FinancialInstitution.get_institution('Capital One') requestDocument = financial_institution.create_request_document @@ -240,6 +241,7 @@ def test_requesting_fresh_fi_profile_from_capital_one end def test_requesting_up_to_date_fi_profile_from_capital_one + skip 'Need Capital One Account' financial_institution = OFX::FinancialInstitution.get_institution('Capital One') requestDocument = financial_institution.create_request_document @@ -292,4 +294,4 @@ def test_requesting_up_to_date_fi_profile_from_capital_one assert_not_equal nil, profile_response.signon_realms assert_equal 0, profile_response.signon_realms.length end -end \ No newline at end of file +end diff --git a/test/capital_one/test_ofx_http_client.rb b/test/capital_one/test_ofx_http_client.rb index 88bbe1c..24b59d4 100644 --- a/test/capital_one/test_ofx_http_client.rb +++ b/test/capital_one/test_ofx_http_client.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/capital_one_helper' -class CapitalOneOFXHTTPClientTest < Test::Unit::TestCase +class CapitalOneOFXHTTPClientTest < Minitest::Test include CapitalOneHelper @@ -26,6 +26,7 @@ def setup end def test_account_info_request_to_capital_one + skip 'Need Capital One Account' account_info_request = "OFXHEADER:100 DATA:OFXSGML @@ -69,4 +70,4 @@ def test_account_info_request_to_capital_one assert account_info_response[0..12] == 'OFXHEADER:100' end -end \ No newline at end of file +end diff --git a/test/capital_one/test_signup_account_information.rb b/test/capital_one/test_signup_account_information.rb index c259e46..ca33075 100644 --- a/test/capital_one/test_signup_account_information.rb +++ b/test/capital_one/test_signup_account_information.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/capital_one_helper' -class CapitalOneSignupAccountInformationTest < Test::Unit::TestCase +class CapitalOneSignupAccountInformationTest < Minitest::Test include CapitalOneHelper @@ -27,6 +27,7 @@ def setup end def test_requesting_fresh_fi_profile_from_capital_one + skip 'Need Capital One Account' financial_institution = OFX::FinancialInstitution.get_institution('Capital One') requestDocument = financial_institution.create_request_document @@ -97,4 +98,4 @@ def test_requesting_fresh_fi_profile_from_capital_one assert_equal true, savings.account_information.transfer_destination assert_equal :active, savings.account_information.status end -end \ No newline at end of file +end diff --git a/test/citi/test_credit_card_statement.rb b/test/citi/test_credit_card_statement.rb index 455de1d..af28cb9 100644 --- a/test/citi/test_credit_card_statement.rb +++ b/test/citi/test_credit_card_statement.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/citi_helper' -class CitiCreditCardStatmentTest < Test::Unit::TestCase +class CitiCreditCardStatmentTest < Minitest::Test include CitiHelper @@ -27,6 +27,7 @@ def setup end def test_requesting_last_seven_days_statement_from_citi + skip 'Need Citi Account' financial_institution = OFX::FinancialInstitution.get_institution('Citi') requestDocument = financial_institution.create_request_document @@ -93,6 +94,7 @@ def test_requesting_last_seven_days_statement_from_citi end def test_requesting_closing_statement_from_citi + skip 'Need Citi Account' financial_institution = OFX::FinancialInstitution.get_institution('Citi') requestDocument = financial_institution.create_request_document @@ -156,4 +158,4 @@ def test_requesting_closing_statement_from_citi assert_equal nil, closing.marketing_information end end -end \ No newline at end of file +end diff --git a/test/citi/test_financial_institution_profile.rb b/test/citi/test_financial_institution_profile.rb index 8743e02..d2898eb 100644 --- a/test/citi/test_financial_institution_profile.rb +++ b/test/citi/test_financial_institution_profile.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/citi_helper' -class CitiFinancialInstitutionProfileTest < Test::Unit::TestCase +class CitiFinancialInstitutionProfileTest < Minitest::Test include CitiHelper @@ -26,6 +26,7 @@ def setup end def test_requesting_fresh_fi_profile_from_citi + skip 'Need Citi Account' financial_institution = OFX::FinancialInstitution.get_institution('Citi') requestDocument = financial_institution.create_request_document @@ -228,4 +229,4 @@ def test_requesting_fresh_fi_profile_from_citi # assert_not_equal nil, profile_response.signon_realms # assert_equal 0, profile_response.signon_realms.length # end -end \ No newline at end of file +end diff --git a/test/citi/test_ofx_http_client.rb b/test/citi/test_ofx_http_client.rb index 745c7f1..c959b61 100644 --- a/test/citi/test_ofx_http_client.rb +++ b/test/citi/test_ofx_http_client.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/citi_helper' -class CitiOFXHTTPClientTest < Test::Unit::TestCase +class CitiOFXHTTPClientTest < Minitest::Test include CitiHelper @@ -26,6 +26,7 @@ def setup end def test_account_info_request_to_citi + skip 'Need Citi Account' account_info_request = "OFXHEADER:100 DATA:OFXSGML @@ -68,4 +69,4 @@ def test_account_info_request_to_citi assert account_info_response != nil assert account_info_response[0..12] == 'OFXHEADER:100' end -end \ No newline at end of file +end diff --git a/test/citi/test_signup_account_information.rb b/test/citi/test_signup_account_information.rb index 9072770..8a3ee64 100644 --- a/test/citi/test_signup_account_information.rb +++ b/test/citi/test_signup_account_information.rb @@ -17,7 +17,7 @@ require File.dirname(__FILE__) + '/citi_helper' -class CitiSignupAccountInformationTest < Test::Unit::TestCase +class CitiSignupAccountInformationTest < Minitest::Test include CitiHelper @@ -27,6 +27,7 @@ def setup end def test_requesting_fresh_fi_profile_from_capital_one + skip 'Need Citi Account' financial_institution = OFX::FinancialInstitution.get_institution('Citi') requestDocument = financial_institution.create_request_document @@ -82,4 +83,4 @@ def test_requesting_fresh_fi_profile_from_capital_one assert_equal false, credit_card.account_information.transfer_destination assert_equal :active, credit_card.account_information.status end -end \ No newline at end of file +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 5c11a3e..a748073 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,4 +1,7 @@ require 'rubygems' require 'bundler/setup' -require 'test/unit' -require 'ofx' \ No newline at end of file +# require 'test/unit' +require 'minitest/autorun' +require 'minitest/test' +require 'pry' +require 'ofx' diff --git a/test/test_ofx_version.rb b/test/test_ofx_version.rb index 0bfebc3..d5fc4ba 100644 --- a/test/test_ofx_version.rb +++ b/test/test_ofx_version.rb @@ -17,7 +17,7 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper') -class OFXVersionTest < Test::Unit::TestCase +class OFXVersionTest < Minitest::Test def test_creating_from_array version = OFX::Version.new([1, 2, 3]) @@ -138,4 +138,4 @@ def test_as_hash_key assert_equal 2, hash[OFX::Version.new('2')] assert_equal nil, hash[OFX::Version.new('3')] end -end \ No newline at end of file +end diff --git a/test/test_parser.rb b/test/test_parser.rb new file mode 100644 index 0000000..2ea5437 --- /dev/null +++ b/test/test_parser.rb @@ -0,0 +1,37 @@ +require File.expand_path(File.dirname(__FILE__) + '/test_helper') + +class OFXParserTest < Minitest::Test + + def test_creating_from_array + body = <<-EOS + 0INFOSUCCESS20151223151556.657[-5:EST]ENGAB12345201512231515550INFO1USD0712345139876543123547CHECKING20131223151557.601[-5:EST]20151222190000.000[-5:EST]CHECK20151221120000[0:GMT]370.992111111101REMOTE ONLINE DEPOSIT #11000.3520151222190000.000[-5:EST]1200.0920151221190000.000[-5:EST] + EOS + parser = OFX::OFX102::Parser.new + + parser.scan_str body + + # require 'pp' + # pp parser.ofx_hashes[0] + + document = parser.documents[0] + + signon_message_set = document.message_sets[0] + signon_response = signon_message_set.responses[0] + + banking_statement_message_set = document.message_sets[1] + banking_statement_response = banking_statement_message_set.responses[0] + + assert_equal '9876543123547', banking_statement_response.account.account_identifier + assert_equal '071234513', banking_statement_response.account.bank_identifier + assert_equal '1200.09', banking_statement_response.available_balance.amount + assert_equal '1000.35', banking_statement_response.ledger_balance.amount + + transactions = banking_statement_response.transactions + assert_equal 1, transactions.size + + transaction = transactions.first + assert_equal '370.99', transaction.amount.to_f.to_s + assert_equal 'REMOTE ONLINE DEPOSIT #', transaction.payee + assert_equal :check, transaction.transaction_type + end +end