ofx_for_ruby 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.externalToolBuilders/Rebuild parsers.launch +10 -0
  2. data/.gitignore +9 -0
  3. data/.loadpath +5 -0
  4. data/.project +27 -0
  5. data/COPYING +674 -0
  6. data/Gemfile +2 -0
  7. data/README +47 -0
  8. data/RELEASE_NOTES +45 -0
  9. data/Rakefile +63 -0
  10. data/lib/ofx.rb +60 -0
  11. data/lib/ofx/1.0.2/banking_message_set.rb +261 -0
  12. data/lib/ofx/1.0.2/credit_card_statement_message_set.rb +269 -0
  13. data/lib/ofx/1.0.2/document.rb +34 -0
  14. data/lib/ofx/1.0.2/email_message_set.rb +34 -0
  15. data/lib/ofx/1.0.2/financial_institution_profile_message_set.rb +155 -0
  16. data/lib/ofx/1.0.2/header.rb +48 -0
  17. data/lib/ofx/1.0.2/interbank_funds_transfer_message_set.rb +30 -0
  18. data/lib/ofx/1.0.2/investment_security_list_message_set.rb +30 -0
  19. data/lib/ofx/1.0.2/investment_statement_message_set.rb +30 -0
  20. data/lib/ofx/1.0.2/lexer.rb +135 -0
  21. data/lib/ofx/1.0.2/message_set.rb +165 -0
  22. data/lib/ofx/1.0.2/ofx_102.racc +90 -0
  23. data/lib/ofx/1.0.2/ofx_102.rex +65 -0
  24. data/lib/ofx/1.0.2/parser.rb +215 -0
  25. data/lib/ofx/1.0.2/payment_message_set.rb +30 -0
  26. data/lib/ofx/1.0.2/serializer.rb +114 -0
  27. data/lib/ofx/1.0.2/signon_message_set.rb +121 -0
  28. data/lib/ofx/1.0.2/signup_message_set.rb +186 -0
  29. data/lib/ofx/1.0.2/statements.rb +54 -0
  30. data/lib/ofx/1.0.2/status.rb +30 -0
  31. data/lib/ofx/1.0.2/wire_funds_transfer_message_set.rb +30 -0
  32. data/lib/ofx/banking_message_set.rb +125 -0
  33. data/lib/ofx/credit_card_statement_message_set.rb +104 -0
  34. data/lib/ofx/document.rb +30 -0
  35. data/lib/ofx/email_message_set.rb +42 -0
  36. data/lib/ofx/file_unique_identifier.rb +28 -0
  37. data/lib/ofx/financial_client.rb +76 -0
  38. data/lib/ofx/financial_institution.rb +83 -0
  39. data/lib/ofx/financial_institution_profile_message_set.rb +67 -0
  40. data/lib/ofx/header.rb +115 -0
  41. data/lib/ofx/http/cacert.pem +3509 -0
  42. data/lib/ofx/http/ofx_http_client.rb +84 -0
  43. data/lib/ofx/interbank_funds_transfer_message_set.rb +33 -0
  44. data/lib/ofx/investment_security_list_message_set.rb +33 -0
  45. data/lib/ofx/investment_statement_message_set.rb +33 -0
  46. data/lib/ofx/message_set.rb +78 -0
  47. data/lib/ofx/payment_message_set.rb +33 -0
  48. data/lib/ofx/serializer.rb +39 -0
  49. data/lib/ofx/signon_message_set.rb +141 -0
  50. data/lib/ofx/signup_message_set.rb +84 -0
  51. data/lib/ofx/statements.rb +49 -0
  52. data/lib/ofx/status.rb +100 -0
  53. data/lib/ofx/transaction_unique_identifier.rb +28 -0
  54. data/lib/ofx/version.rb +82 -0
  55. data/lib/ofx/wire_funds_transfer_message_set.rb +33 -0
  56. data/ofx_for_ruby.gemspec +25 -0
  57. data/planning/OFX Specification completion.ods +0 -0
  58. data/test/capital_one/capital_one_helper.rb +77 -0
  59. data/test/capital_one/fixtures/README +10 -0
  60. data/test/capital_one/fixtures/fipid-5599.xml +98 -0
  61. data/test/capital_one/test_banking_statement.rb +108 -0
  62. data/test/capital_one/test_financial_institution_profile.rb +295 -0
  63. data/test/capital_one/test_ofx_http_client.rb +72 -0
  64. data/test/capital_one/test_signup_account_information.rb +100 -0
  65. data/test/citi/citi_helper.rb +77 -0
  66. data/test/citi/fixtures/README +9 -0
  67. data/test/citi/fixtures/fipid-6642.xml +98 -0
  68. data/test/citi/test_credit_card_statement.rb +159 -0
  69. data/test/citi/test_financial_institution_profile.rb +231 -0
  70. data/test/citi/test_ofx_http_client.rb +71 -0
  71. data/test/citi/test_signup_account_information.rb +85 -0
  72. data/test/test_helper.rb +4 -0
  73. data/test/test_ofx_version.rb +141 -0
  74. metadata +210 -0
@@ -0,0 +1,10 @@
1
+ If you want to run tests for Capital One, you will need to place two files here called capital-one-accounts and capital-one-credentials. These
2
+ should contain valid Capital One account numbers and logins.
3
+
4
+ Examples:
5
+ capital-one-accounts:
6
+ checking,123123123
7
+ savings,456456456
8
+
9
+ capital-one-credentials:
10
+ my_user_name,my_password
@@ -0,0 +1,98 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <MSNOnlSvcInfo Version="2.0" xmlns:msxml="urn:schemas-microsoft-com:xslt">
3
+ <ProviderSettings>
4
+ <FIPID>5599</FIPID>
5
+ <Name>Capital One bank</Name>
6
+ <Address1>PO Box 61540</Address1>
7
+ <Address2></Address2>
8
+ <Address3></Address3>
9
+ <City>New Orleans</City>
10
+ <State>LA</State>
11
+ <Zip>70161-1540</Zip>
12
+ <Country>USA</Country>
13
+ <Phone>8774423764</Phone>
14
+ <InternetMail></InternetMail>
15
+ <Website1>https://onlinebanking.capitalone.com/</Website1>
16
+ <hfi>{8ACC96F3-20DD-4CDF-AB44-2DC1C66EE5DB}</hfi>
17
+ <hfisvc>{FCF51E18-A96E-41E3-ADDE-0EBFF1891BA8}</hfisvc>
18
+ <DriverType>O</DriverType>
19
+ <StandAlone>0</StandAlone>
20
+ <Org>Hibernia</Org>
21
+ <FID>1001</FID>
22
+ <AcctListAvail>1</AcctListAvail>
23
+ <ClientActReq>0</ClientActReq>
24
+ <BrokerID></BrokerID>
25
+ <OFXHeaderVer>102</OFXHeaderVer>
26
+ <FullSyncSupp>0</FullSyncSupp>
27
+ <DisallowUSASCIIEncoding>0</DisallowUSASCIIEncoding>
28
+ <DisallowUNICODEEncoding>1</DisallowUNICODEEncoding>
29
+ <DisallowUTF8Encoding>1</DisallowUTF8Encoding>
30
+ <DisallowGenMail>0</DisallowGenMail>
31
+ <DisallowPinChange>0</DisallowPinChange>
32
+ <Min>8</Min>
33
+ <Max>12</Max>
34
+ <Alpha>1</Alpha>
35
+ <Numeric>1</Numeric>
36
+ <Special>0</Special>
37
+ <Spaces>0</Spaces>
38
+ <ChangePin>0</ChangePin>
39
+ <TANRequired>0</TANRequired>
40
+ <ProviderURL>https://onlinebanking.capitalone.com/scripts/serverext.dll</ProviderURL>
41
+ <ServiceUpdateURL></ServiceUpdateURL>
42
+ <SmallLogoURL>https://www.microsoft.com/Money/Money2005/USA/451.bmp</SmallLogoURL>
43
+ <ProvUpdateDescURL></ProvUpdateDescURL>
44
+ <CommentsTXT>If you have any questions or concerns, please feel free to contact Capital One Bank Customer Service toll-free at 1-877-442-3764 or visit our website listed above.\r\n\r\nWe look forward to providing you with on-line banking and bill payment services.\r\n</CommentsTXT>
45
+ <UserIDString>User ID</UserIDString>
46
+ <PasswordString>Password</PasswordString>
47
+ <ServiceVersion>2</ServiceVersion>
48
+ <StatementLogonURL></StatementLogonURL>
49
+ <PaymentLogonURL></PaymentLogonURL>
50
+ <WebServicesURL></WebServicesURL>
51
+ <BrandingDate>3/17/2006</BrandingDate>
52
+ </ProviderSettings>
53
+ <BankingCapabilities>
54
+ <Bank>1</Bank>
55
+ <BankMail>1</BankMail>
56
+ <IntraXferCanSched>0</IntraXferCanSched>
57
+ <CreditCard>1</CreditCard>
58
+ <DfltDays>0</DfltDays>
59
+ <IntraXferSupp>1</IntraXferSupp>
60
+ <IntraSyncSupp>0</IntraSyncSupp>
61
+ </BankingCapabilities>
62
+ <BillPayCapabilities>
63
+ <Pay>1</Pay>
64
+ <BillPayMail>1</BillPayMail>
65
+ <DfltDaysWith>4</DfltDaysWith>
66
+ <DfltDaysToPay>4</DfltDaysToPay>
67
+ <XferDfltDaysWith>0</XferDfltDaysWith>
68
+ <XferDfltDaysToPay>0</XferDfltDaysToPay>
69
+ <IdDfltDaysWith>0</IdDfltDaysWith>
70
+ <IdDfltDaysToPay>0</IdDfltDaysToPay>
71
+ <CountNonBusDays>0</CountNonBusDays>
72
+ <PmtByAddr>1</PmtByAddr>
73
+ <PmtByXfer>0</PmtByXfer>
74
+ <PmtByPayeeID>0</PmtByPayeeID>
75
+ <DisallowRecPmt>0</DisallowRecPmt>
76
+ <DisallowCreditCardPmt>1</DisallowCreditCardPmt>
77
+ <UseProcessDateModel>0</UseProcessDateModel>
78
+ <BillPay2AddrLines>0</BillPay2AddrLines>
79
+ </BillPayCapabilities>
80
+ <InvestmentCapabilities>
81
+ <BrkStmt>0</BrkStmt>
82
+ <InvMail>0</InvMail>
83
+ <DisallowInvTranDownload>1</DisallowInvTranDownload>
84
+ <DisallowOODownload>1</DisallowOODownload>
85
+ <DisallowPositionDownload>1</DisallowPositionDownload>
86
+ <DisallowInvBalanceDownload>1</DisallowInvBalanceDownload>
87
+ </InvestmentCapabilities>
88
+ <PinWiz>
89
+ <SignupType>3</SignupType>
90
+ <URLPin>https://onlinebanking.capitalone.com/CAPITALONE/Enrollment.aspx</URLPin>
91
+ <PhonePin></PhonePin>
92
+ <Charge>0.0000</Charge>
93
+ <ChargeFrq>1</ChargeFrq>
94
+ <ConnectionSurchargeLimit>0</ConnectionSurchargeLimit>
95
+ <UsesWebPwd>0</UsesWebPwd>
96
+ <SeparateEnroll>0</SeparateEnroll>
97
+ </PinWiz>
98
+ </MSNOnlSvcInfo>
@@ -0,0 +1,108 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require File.dirname(__FILE__) + '/capital_one_helper'
19
+
20
+ class CapitalOneBankingStatmentTest < Test::Unit::TestCase
21
+
22
+ include CapitalOneHelper
23
+
24
+ def setup
25
+ setup_capital_one_credentials
26
+ setup_capital_one_accounts
27
+ end
28
+
29
+ def test_requesting_last_seven_days_statement_from_capital_one
30
+ financial_institution = OFX::FinancialInstitution.get_institution('Capital One')
31
+ requestDocument = financial_institution.create_request_document
32
+
33
+ client = OFX::FinancialClient.new([[OFX::FinancialInstitutionIdentification.new('Hibernia', '1001'),
34
+ OFX::UserCredentials.new(@user_name, @password)]])
35
+ requestDocument.message_sets << client.create_signon_request_message('1001')
36
+
37
+
38
+ banking_message_set = OFX::BankingMessageSet.new
39
+ statement_request = OFX::BankingStatementRequest.new
40
+
41
+ statement_request.transaction_identifier = OFX::TransactionUniqueIdentifier.new
42
+ statement_request.account = OFX::BankingAccount.new
43
+ statement_request.account.bank_identifier = '065002030'
44
+ statement_request.account.branch_identifier = nil
45
+ statement_request.account.account_identifier = @accounts[:checking]
46
+ statement_request.account.account_type = :checking
47
+ statement_request.account.account_key = nil
48
+
49
+ statement_request.include_transactions = true
50
+ statement_request.included_range = ('2007-06-01'.to_date)..('2007-06-07'.to_date)
51
+
52
+ banking_message_set.requests << statement_request
53
+ requestDocument.message_sets << banking_message_set
54
+
55
+ response_document = financial_institution.send(requestDocument)
56
+ assert response_document != nil
57
+
58
+ verify_capital_one_header response_document
59
+
60
+ assert_not_equal nil, response_document.message_sets
61
+ assert_equal 2, response_document.message_sets.length
62
+
63
+ verify_capital_one_signon_response response_document
64
+
65
+ banking_message_set = response_document.message_sets[1]
66
+ assert_not_equal nil, banking_message_set
67
+ assert banking_message_set.kind_of?(OFX::BankingMessageSet)
68
+ assert_equal 1, banking_message_set.responses.length
69
+ statement = banking_message_set.responses[0]
70
+ assert_not_equal nil, statement
71
+ assert_equal 'USD', statement.default_currency
72
+ assert_not_equal nil, statement.account
73
+ assert_equal '065002030', statement.account.bank_identifier
74
+ assert_equal @accounts[:checking], statement.account.account_identifier
75
+ assert_equal :checking, statement.account.account_type
76
+
77
+ assert_equal nil, statement.marketing_information
78
+
79
+ assert_not_equal nil, statement.ledger_balance
80
+ assert_not_equal nil, statement.ledger_balance.amount
81
+ assert_not_equal nil, statement.ledger_balance.as_of
82
+
83
+ assert_not_equal nil, statement.available_balance
84
+ assert_not_equal nil, statement.available_balance.amount
85
+ assert_not_equal nil, statement.available_balance.as_of
86
+
87
+ assert_not_equal nil, statement.transaction_range
88
+ assert_equal '2007-06-01'.to_date, statement.transaction_range.begin
89
+ assert_equal '2007-06-07'.to_date, statement.transaction_range.end
90
+ assert_not_equal nil, statement.transactions
91
+ assert_equal 18, statement.transactions.length
92
+
93
+ padded_range = (statement.transaction_range.begin - 1.day)..(statement.transaction_range.end + 1.day)
94
+ total_of_transactions = 0.0.to_d
95
+ statement.transactions.each do |transaction|
96
+ assert_not_equal nil, transaction.transaction_type
97
+ assert_not_equal nil, transaction.date_posted
98
+ assert_not_equal nil, transaction.amount
99
+ assert_not_equal nil, transaction.financial_institution_transaction_identifier
100
+
101
+ assert padded_range === transaction.date_posted
102
+
103
+ total_of_transactions += transaction.amount
104
+ end
105
+
106
+ assert_equal 366.15.to_d, total_of_transactions
107
+ end
108
+ end
@@ -0,0 +1,295 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require File.dirname(__FILE__) + '/capital_one_helper'
19
+
20
+ class CapitalOneFinancialInstitutionProfileTest < Test::Unit::TestCase
21
+
22
+ include CapitalOneHelper
23
+
24
+ def setup
25
+ setup_capital_one_credentials
26
+ end
27
+
28
+ def test_requesting_fresh_fi_profile_from_capital_one
29
+ financial_institution = OFX::FinancialInstitution.get_institution('Capital One')
30
+ requestDocument = financial_institution.create_request_document
31
+
32
+ client = OFX::FinancialClient.new([[OFX::FinancialInstitutionIdentification.new('Hibernia', '1001'),
33
+ OFX::UserCredentials.new(@user_name, @password)]])
34
+ requestDocument.message_sets << client.create_signon_request_message('1001')
35
+
36
+ client.date_of_last_profile_update = DateTime.new(2001, 1, 1)
37
+ requestDocument.message_sets << client.create_profile_update_request_message()
38
+
39
+ response_document = financial_institution.send(requestDocument)
40
+ assert response_document != nil
41
+
42
+ verify_capital_one_header response_document
43
+
44
+ assert_not_equal nil, response_document.message_sets
45
+ assert_equal 2, response_document.message_sets.length
46
+
47
+ verify_capital_one_signon_response response_document
48
+
49
+ profile_message = response_document.message_sets[1]
50
+ assert profile_message.kind_of?(OFX::FinancialInstitutionProfileMessageSet)
51
+ assert_equal 1, profile_message.responses.length
52
+ profile_response = profile_message.responses[0]
53
+ assert profile_response.kind_of?(OFX::FinancialInstitutionProfileResponse)
54
+ assert_not_equal nil, profile_response.transaction_identifier
55
+ assert_not_equal nil, profile_response.status
56
+ assert profile_response.status.kind_of?(OFX::Information)
57
+ assert profile_response.status.kind_of?(OFX::Success)
58
+ assert_equal 0, profile_response.status.code
59
+ assert_equal :information, profile_response.status.severity
60
+ assert_not_equal nil, profile_response.status.message
61
+
62
+ assert_not_equal nil, profile_response.date_of_last_profile_update
63
+ assert_equal "Capital One Bank", profile_response.financial_institution_name
64
+ assert_equal "PO Box 61540", profile_response.address
65
+ assert_equal "New Orleans", profile_response.city
66
+ assert_equal "LA", profile_response.state
67
+ assert_equal "70161", profile_response.postal_code
68
+ assert_equal "USA", profile_response.country
69
+ assert_equal "1-877-442-3764", profile_response.customer_service_telephone
70
+ assert_equal "1-877-442-3764", profile_response.technical_support_telephone
71
+ assert_equal nil, profile_response.facsimile_telephone
72
+ assert_equal URI.parse("https://onlinebanking.capitalone.com"), profile_response.url
73
+ assert_equal "emailus@capitaloneinfo.com", profile_response.email_address
74
+
75
+
76
+
77
+ assert_not_equal nil, profile_response.message_sets
78
+ assert_equal 6, profile_response.message_sets.length
79
+
80
+ # unsupported message sets
81
+ assert_equal nil, profile_response.message_sets[OFX::CreditCardStatementMessageSet]
82
+ assert_equal nil, profile_response.message_sets[OFX::InvestmentStatementMessageSet]
83
+ assert_equal nil, profile_response.message_sets[OFX::InterbankFundsTransferMessageSet]
84
+ assert_equal nil, profile_response.message_sets[OFX::WireFundsTransferMessageSet]
85
+ assert_equal nil, profile_response.message_sets[OFX::InvestmentSecurityListMessageSet]
86
+
87
+ # signon
88
+ assert_not_equal nil, profile_response.message_sets[OFX::SignonMessageSet]
89
+ assert_equal 1, profile_response.message_sets[OFX::SignonMessageSet].length
90
+ profile = profile_response.message_sets[OFX::SignonMessageSet][OFX::Version.new(1)]
91
+ assert_not_equal nil, profile
92
+ assert profile.kind_of?(OFX::SignonMessageSetProfile)
93
+ assert_equal OFX::SignonMessageSet, profile.message_set_class
94
+ assert_equal OFX::Version.new(1), profile.version
95
+ assert_equal 'Corillian Corporation', profile.service_provider_name
96
+ assert_equal URI.parse('https://onlinebanking.capitalone.com/scripts/serverext.dll'), profile.message_url
97
+ assert_equal 'NONE', profile.required_ofx_security
98
+ assert_equal true, profile.requires_transport_security?
99
+ assert_equal 'Realm1', profile.signon_realm
100
+ assert_equal 'ENG', profile.language
101
+ assert_equal 'LITE', profile.synchronization_mode
102
+ assert_equal true, profile.supports_response_file_error_recovery?
103
+
104
+ # signup
105
+ assert_not_equal nil, profile_response.message_sets[OFX::SignupMessageSet]
106
+ assert_equal 1, profile_response.message_sets[OFX::SignupMessageSet].length
107
+ profile = profile_response.message_sets[OFX::SignupMessageSet][OFX::Version.new(1)]
108
+ assert_not_equal nil, profile
109
+ assert profile.kind_of?(OFX::SignupMessageSetProfile)
110
+ assert_equal OFX::SignupMessageSet, profile.message_set_class
111
+ assert_equal OFX::Version.new(1), profile.version
112
+ assert_equal 'Corillian Corporation', profile.service_provider_name
113
+ assert_equal URI.parse('https://onlinebanking.capitalone.com/scripts/serverext.dll'), profile.message_url
114
+ assert_equal 'NONE', profile.required_ofx_security
115
+ assert_equal true, profile.requires_transport_security?
116
+ assert_equal 'Realm1', profile.signon_realm
117
+ assert_equal 'ENG', profile.language
118
+ assert_equal 'LITE', profile.synchronization_mode
119
+ assert_equal true, profile.supports_response_file_error_recovery
120
+ assert_not_equal nil, profile.enrollment
121
+ assert profile.enrollment.kind_of?(OFX::Enrollment)
122
+ assert profile.enrollment.kind_of?(OFX::WebEnrollment)
123
+ assert_equal URI.parse('https://onlinebanking.capitalone.com'), profile.enrollment.url
124
+ assert_equal false, profile.user_information_changes_allowed?
125
+ assert_equal true, profile.available_account_requests_allowed?
126
+ assert_equal false, profile.service_activation_requests_allowed?
127
+
128
+ # banking
129
+ assert_not_equal nil, profile_response.message_sets[OFX::BankingMessageSet]
130
+ assert_equal 1, profile_response.message_sets[OFX::BankingMessageSet].length
131
+ profile = profile_response.message_sets[OFX::BankingMessageSet][OFX::Version.new(1)]
132
+ assert_not_equal nil, profile
133
+ assert profile.kind_of?(OFX::BankingMessageSetProfile)
134
+ assert_equal OFX::BankingMessageSet, profile.message_set_class
135
+ assert_equal OFX::Version.new(1), profile.version
136
+ assert_equal 'Corillian Corporation', profile.service_provider_name
137
+ assert_equal URI.parse('https://onlinebanking.capitalone.com/scripts/serverext.dll'), profile.message_url
138
+ assert_equal 'NONE', profile.required_ofx_security
139
+ assert_equal true, profile.requires_transport_security?
140
+ assert_equal 'Realm1', profile.signon_realm
141
+ assert_equal 'ENG', profile.language
142
+ assert_equal 'FULL', profile.synchronization_mode
143
+ assert_equal true, profile.supports_response_file_error_recovery?
144
+ assert_not_equal nil, profile.invalid_account_types
145
+ assert_equal false, profile.closing_statement_available?
146
+
147
+ assert_not_equal nil, profile.intrabank_transfer_profile
148
+ assert_not_equal nil, profile.intrabank_transfer_profile.processing_days_off
149
+ assert_equal 23, profile.intrabank_transfer_profile.processing_end_time_of_day.hour
150
+ assert_equal 0, profile.intrabank_transfer_profile.processing_end_time_of_day.min
151
+ assert_equal 0, profile.intrabank_transfer_profile.processing_end_time_of_day.sec
152
+ assert_equal 0, profile.intrabank_transfer_profile.processing_end_time_of_day.offset
153
+ assert_equal false, profile.intrabank_transfer_profile.supports_scheduled_transfers?
154
+ assert_equal false, profile.intrabank_transfer_profile.supports_recurring_transfers?
155
+ assert_equal false, profile.intrabank_transfer_profile.supports_modification_of_transfers?
156
+ assert_equal false, profile.intrabank_transfer_profile.supports_modification_of_models?
157
+ assert_equal 0, profile.intrabank_transfer_profile.model_window
158
+ assert_equal 0, profile.intrabank_transfer_profile.number_of_days_early_funds_are_withdrawn
159
+ assert_equal 0, profile.intrabank_transfer_profile.default_number_of_days_to_pay
160
+
161
+ assert_equal nil, profile.stop_check_profile
162
+ # assert_not_equal nil, profile.stop_check_profile.processing_days_off
163
+ # assert_equal 23, profile.stop_check_profile.processing_end_time_of_day.hour
164
+ # assert_equal 0, profile.stop_check_profile.processing_end_time_of_day.min
165
+ # assert_equal 0, profile.stop_check_profile.processing_end_time_of_day.sec
166
+ # assert_equal 0, profile.stop_check_profile.processing_end_time_of_day.offset
167
+ # assert_equal false, profile.stop_check_profile.can_stop_a_range_of_checks?
168
+ # assert_equal false, profile.stop_check_profile.can_stop_checks_by_description?
169
+ # assert_equal '', profile.stop_check_profile.default_stop_check_fee
170
+
171
+ assert_not_equal nil, profile.email_profile
172
+ assert_equal true, profile.email_profile.supports_banking_email?
173
+ assert_equal false, profile.email_profile.supports_notifications?
174
+
175
+
176
+ # payments
177
+ assert_not_equal nil, profile_response.message_sets[OFX::PaymentMessageSet]
178
+ assert_equal 1, profile_response.message_sets[OFX::PaymentMessageSet].length
179
+ profile = profile_response.message_sets[OFX::PaymentMessageSet][OFX::Version.new(1)]
180
+ assert_not_equal nil, profile
181
+ assert profile.kind_of?(OFX::PaymentMessageSetProfile)
182
+ assert_equal OFX::PaymentMessageSet, profile.message_set_class
183
+ assert_equal OFX::Version.new(1), profile.version
184
+ assert_equal 'Corillian Corporation', profile.service_provider_name
185
+ assert_equal URI.parse('https://onlinebanking.capitalone.com/scripts/serverext.dll'), profile.message_url
186
+ assert_equal 'NONE', profile.required_ofx_security
187
+ assert_equal true, profile.requires_transport_security?
188
+ assert_equal 'Realm1', profile.signon_realm
189
+ assert_equal 'ENG', profile.language
190
+ assert_equal 'FULL', profile.synchronization_mode
191
+ assert_equal true, profile.supports_response_file_error_recovery?
192
+
193
+ # email
194
+ assert_not_equal nil, profile_response.message_sets[OFX::EmailMessageSet]
195
+ assert_equal 1, profile_response.message_sets[OFX::EmailMessageSet].length
196
+ profile = profile_response.message_sets[OFX::EmailMessageSet][OFX::Version.new(1)]
197
+ assert_not_equal nil, profile
198
+ assert profile.kind_of?(OFX::EmailMessageSetProfile)
199
+ assert_equal OFX::EmailMessageSet, profile.message_set_class
200
+ assert_equal OFX::Version.new(1), profile.version
201
+ assert_equal 'Corillian Corporation', profile.service_provider_name
202
+ assert_equal URI.parse('https://onlinebanking.capitalone.com/scripts/serverext.dll'), profile.message_url
203
+ assert_equal 'NONE', profile.required_ofx_security
204
+ assert_equal true, profile.requires_transport_security?
205
+ assert_equal 'Realm1', profile.signon_realm
206
+ assert_equal 'ENG', profile.language
207
+ assert_equal 'FULL', profile.synchronization_mode
208
+ assert_equal true, profile.supports_response_file_error_recovery?
209
+ assert_equal true, profile.supports_email?
210
+ assert_equal false, profile.supports_mime_messages?
211
+
212
+ # profile
213
+ assert_not_equal nil, profile_response.message_sets[OFX::FinancialInstitutionProfileMessageSet]
214
+ assert_equal 1, profile_response.message_sets[OFX::FinancialInstitutionProfileMessageSet].length
215
+ profile = profile_response.message_sets[OFX::FinancialInstitutionProfileMessageSet][OFX::Version.new(1)]
216
+ assert_not_equal nil, profile
217
+ assert profile.kind_of?(OFX::FinancialInstitutionProfileMessageSetProfile)
218
+ assert_equal OFX::FinancialInstitutionProfileMessageSet, profile.message_set_class
219
+ assert_equal OFX::Version.new(1), profile.version
220
+ assert_equal 'Corillian Corporation', profile.service_provider_name
221
+ assert_equal URI.parse('https://onlinebanking.capitalone.com/scripts/serverext.dll'), profile.message_url
222
+ assert_equal 'NONE', profile.required_ofx_security
223
+ assert_equal true, profile.requires_transport_security?
224
+ assert_equal 'Realm1', profile.signon_realm
225
+ assert_equal 'ENG', profile.language
226
+ assert_equal 'LITE', profile.synchronization_mode
227
+ assert_equal true, profile.supports_response_file_error_recovery?
228
+
229
+ assert_not_equal nil, profile_response.signon_realms
230
+ assert_equal 1, profile_response.signon_realms.length
231
+ signon_realm = profile_response.signon_realms[0]
232
+ assert_equal 'Realm1', signon_realm.name
233
+ assert_equal 8..12, signon_realm.password_length_constraint
234
+ assert_equal :alphabetic_and_numeric, signon_realm.password_characters_constraint
235
+ assert_equal true, signon_realm.case_sensitive
236
+ assert_equal false, signon_realm.allows_special_characters
237
+ assert_equal false, signon_realm.allows_spaces
238
+ assert_equal true, signon_realm.supports_pin_changes
239
+ assert_equal false, signon_realm.requires_initial_pin_change
240
+ end
241
+
242
+ def test_requesting_up_to_date_fi_profile_from_capital_one
243
+ financial_institution = OFX::FinancialInstitution.get_institution('Capital One')
244
+ requestDocument = financial_institution.create_request_document
245
+
246
+ client = OFX::FinancialClient.new([[OFX::FinancialInstitutionIdentification.new('Hibernia', '1001'),
247
+ OFX::UserCredentials.new(@user_name, @password)]])
248
+ requestDocument.message_sets << client.create_signon_request_message('1001')
249
+
250
+ client.date_of_last_profile_update = DateTime.now
251
+ requestDocument.message_sets << client.create_profile_update_request_message()
252
+
253
+ response_document = financial_institution.send(requestDocument)
254
+ assert response_document != nil
255
+
256
+ verify_capital_one_header response_document
257
+
258
+ assert_not_equal nil, response_document.message_sets
259
+ assert_equal 2, response_document.message_sets.length
260
+
261
+ verify_capital_one_signon_response response_document
262
+
263
+ profile_message = response_document.message_sets[1]
264
+ assert profile_message.kind_of?(OFX::FinancialInstitutionProfileMessageSet)
265
+ assert_equal 1, profile_message.responses.length
266
+ profile_response = profile_message.responses[0]
267
+ assert profile_response.kind_of?(OFX::FinancialInstitutionProfileResponse)
268
+ assert_not_equal nil, profile_response.transaction_identifier
269
+ assert_not_equal nil, profile_response.status
270
+ assert profile_response.status.kind_of?(OFX::Information)
271
+ assert profile_response.status.kind_of?(OFX::ClientUpToDate)
272
+ assert_equal 1, profile_response.status.code
273
+ assert_equal :information, profile_response.status.severity
274
+ assert_not_equal nil, profile_response.status.message
275
+
276
+ assert_equal nil, profile_response.date_of_last_profile_update
277
+ assert_equal nil, profile_response.financial_institution_name
278
+ assert_equal nil, profile_response.address
279
+ assert_equal nil, profile_response.city
280
+ assert_equal nil, profile_response.state
281
+ assert_equal nil, profile_response.postal_code
282
+ assert_equal nil, profile_response.country
283
+ assert_equal nil, profile_response.customer_service_telephone
284
+ assert_equal nil, profile_response.technical_support_telephone
285
+ assert_equal nil, profile_response.facsimile_telephone
286
+ assert_equal nil, profile_response.url
287
+ assert_equal nil, profile_response.email_address
288
+
289
+ assert_not_equal nil, profile_response.message_sets
290
+ assert_equal 0, profile_response.message_sets.length
291
+
292
+ assert_not_equal nil, profile_response.signon_realms
293
+ assert_equal 0, profile_response.signon_realms.length
294
+ end
295
+ end