intuit_ids_aggcat 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ require 'spec_helper'
2
+
3
+ describe IntuitIdsAggcat::Client::Services do
4
+ before(:all) do
5
+ path = Pathname.new("spec/config/real_config.yml")
6
+ cfg = YAML::load(ERB.new(File.read(path)).result)
7
+ IntuitIdsAggcat.config(cfg)
8
+ end
9
+
10
+ it 'should map datetimes to and from XML correctly using custom date_time node type' do
11
+ al_xml = %q^<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <AccountList><BankingAccount><accountId>400000013892</accountId><status>ACTIVE</status><accountNumber>5053</accountNumber><accountNickname>Interest Checking</accountNickname><displayPosition>3</displayPosition><institutionId>14007</institutionId><description>CHECKING</description><balanceAmount>3.22</balanceAmount><balanceDate>2012-10-23T13:04:03-07:00</balanceDate><lastTxnDate>2012-10-15T00:00:00-07:00</lastTxnDate><aggrSuccessDate>2012-10-23T13:04:03.948-07:00</aggrSuccessDate><aggrAttemptDate>2012-10-23T13:04:03.948-07:00</aggrAttemptDate><aggrStatusCode>0</aggrStatusCode><currencyCode>USD</currencyCode><institutionLoginId>5200187</institutionLoginId><bankingAccountType>CHECKING</bankingAccountType><availableBalanceAmount>3.22</availableBalanceAmount></BankingAccount></AccountList>^
12
+ al_rexml = REXML::Document.new al_xml
13
+ al_obj = IntuitIdsAggcat::AccountList.load_from_xml(al_rexml.root)
14
+ # 2012-10-23T13:04:03.948-07:00
15
+ al_obj.banking_accounts[0].aggregation_success_date.year.should == 2012
16
+ al_obj.banking_accounts[0].aggregation_success_date.month.should == 10
17
+ al_obj.banking_accounts[0].aggregation_success_date.day.should == 23
18
+ al_obj.banking_accounts[0].aggregation_success_date.hour.should == 13
19
+ al_obj.banking_accounts[0].aggregation_success_date.minute.should == 4
20
+ al_obj.banking_accounts[0].aggregation_success_date.second.should == 3
21
+ al_obj.banking_accounts[0].aggregation_success_date.zone.should == "-07:00"
22
+
23
+ # 2012-10-15T00:00:00-07:00
24
+ al_obj.banking_accounts[0].last_transaction_date.year.should == 2012
25
+ al_obj.banking_accounts[0].last_transaction_date.month.should == 10
26
+ al_obj.banking_accounts[0].last_transaction_date.day.should == 15
27
+ al_obj.banking_accounts[0].last_transaction_date.hour.should == 0
28
+ al_obj.banking_accounts[0].last_transaction_date.minute.should == 0
29
+ al_obj.banking_accounts[0].last_transaction_date.second.should == 0
30
+ al_obj.banking_accounts[0].last_transaction_date.zone.should == "-07:00"
31
+
32
+ dt = DateTime.new(2012, 10, 20, 21, 15, 15, '+5')
33
+ b = IntuitIdsAggcat::BankingAccount.new
34
+ b.last_transaction_date = dt
35
+ output_time = b.save_to_xml.each_element("//lastTxnDate"){ |x| x}[0].text
36
+ output_time.should == "2012-10-20T21:15:15+05:00"
37
+
38
+
39
+ end
40
+
41
+ it 'should get financial institutions' do
42
+ institutions = IntuitIdsAggcat::Client::Services.get_institutions
43
+ institutions.should_not be_nil
44
+ institutions[0].name.should_not be_nil
45
+ end
46
+
47
+ it 'should get financial institution detail' do
48
+ i = IntuitIdsAggcat::Client::Services.get_institution_detail 14007
49
+ i.name.should == "Bank of America"
50
+ i.special_text.should == "Please enter your Bank of America Online ID and Passcode required for login."
51
+ end
52
+
53
+ it 'should setup aggregation with username/password, get accounts, get transactions, then delete the customer' do
54
+ # delete customer to ensure we are starting from scratch
55
+ IntuitIdsAggcat::Client::Services.delete_customer "9cj2hbjfgh47cna72"
56
+
57
+ # discover accounts
58
+ x = IntuitIdsAggcat::Client::Services.discover_and_add_accounts_with_credentials 100000, "9cj2hbjfgh47cna72", { "Banking Userid" => "direct", "Banking Password" => "anyvalue" }
59
+ x[:discover_response][:response_code].should == "201"
60
+ x[:accounts].should_not be_nil
61
+ x[:accounts].banking_accounts.count.should be > 2
62
+ x = IntuitIdsAggcat::Client::Services.get_customer_accounts "9cj2hbjfgh47cna72"
63
+ x.should_not be_nil
64
+ x.banking_accounts.count.should be > 2
65
+
66
+ # get transactions from 90 days ago until current
67
+ start = Time.now - (90 * 24 * 60 * 60)
68
+ y = IntuitIdsAggcat::Client::Services.get_account_transactions 1, x.banking_accounts[0].account_id, start
69
+ y.should_not be_nil
70
+ y.banking_transactions[0].id.should_not be_nil
71
+ y.banking_transactions[0].amount.should_not be_nil
72
+
73
+ # delete customer
74
+ x = IntuitIdsAggcat::Client::Services.delete_customer "9cj2hbjfgh47cna72"
75
+ x[:response_code].should == "200"
76
+
77
+ end
78
+
79
+ it 'should setup aggregation with text challenge then delete the customer' do
80
+ IntuitIdsAggcat::Client::Services.delete_customer "9cj2hbjfgh47cna72"
81
+ x = IntuitIdsAggcat::Client::Services.discover_and_add_accounts_with_credentials 100000, "9cj2hbjfgh47cna72", { "Banking Userid" => "tfa_text", "Banking Password" => "anyvalue" }
82
+ x[:discover_response][:response_code].should == "401"
83
+ x[:discover_response][:challenge_node_id].should_not be_nil
84
+ x[:discover_response][:challenge_session_id].should_not be_nil
85
+ x[:challenge_type].should == "text"
86
+ x[:challenge].challenge[0].text.should == "Enter your first pet's name:"
87
+ x = IntuitIdsAggcat::Client::Services.challenge_response 100000, "9cj2hbjfgh47cna72", "test", x[:discover_response][:challenge_session_id], x[:discover_response][:challenge_node_id]
88
+ x[:accounts].should_not be_nil
89
+ x[:accounts].banking_accounts.count.should be > 2
90
+ x = IntuitIdsAggcat::Client::Services.delete_customer "9cj2hbjfgh47cna72"
91
+ x[:response_code].should == "200"
92
+ end
93
+
94
+ it 'should setup aggregation with choice challenge then delete the customer' do
95
+ IntuitIdsAggcat::Client::Services.delete_customer "9cj2hbjfgh47cna72"
96
+ x = IntuitIdsAggcat::Client::Services.discover_and_add_accounts_with_credentials 100000, "9cj2hbjfgh47cna72", { "Banking Userid" => "tfa_choice", "Banking Password" => "anyvalue" }
97
+ x[:discover_response][:response_code].should == "401"
98
+ x[:discover_response][:challenge_node_id].should_not be_nil
99
+ x[:discover_response][:challenge_session_id].should_not be_nil
100
+ x[:challenge_type].should == "choice"
101
+ x[:challenge].challenge[0].text.should == "Which high school did you attend?"
102
+ x = IntuitIdsAggcat::Client::Services.challenge_response 100000, "9cj2hbjfgh47cna72", "test", x[:discover_response][:challenge_session_id], x[:discover_response][:challenge_node_id]
103
+ x[:accounts].should_not be_nil
104
+ x[:accounts].banking_accounts.count.should be > 2
105
+ x = IntuitIdsAggcat::Client::Services.delete_customer "9cj2hbjfgh47cna72"
106
+ x[:response_code].should == "200"
107
+ end
108
+
109
+ end
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+ require 'intuit_ids_aggcat'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ config.formatter = 'documentation'
7
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: intuit_ids_aggcat
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 5
9
+ version: 0.0.5
10
+ platform: ruby
11
+ authors:
12
+ - Chris Hart
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-12-02 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 11
30
+ version: "2.11"
31
+ type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: vcr
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 2
42
+ - 2
43
+ version: "2.2"
44
+ type: :development
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: fakeweb
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 1
55
+ - 3
56
+ version: "1.3"
57
+ type: :development
58
+ version_requirements: *id003
59
+ - !ruby/object:Gem::Dependency
60
+ name: oauth
61
+ prerelease: false
62
+ requirement: &id004 !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ - 4
69
+ version: "0.4"
70
+ type: :runtime
71
+ version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: nokogiri
74
+ prerelease: false
75
+ requirement: &id005 !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 1
81
+ - 5
82
+ version: "1.5"
83
+ type: :runtime
84
+ version_requirements: *id005
85
+ - !ruby/object:Gem::Dependency
86
+ name: xml-mapping
87
+ prerelease: false
88
+ requirement: &id006 !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ type: :runtime
96
+ version_requirements: *id006
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ prerelease: false
100
+ requirement: &id007 !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ type: :runtime
108
+ version_requirements: *id007
109
+ description: Provides a wrapped for the IPP AggCat interfaces
110
+ email:
111
+ - chris@rewardsummit.com
112
+ executables: []
113
+
114
+ extensions: []
115
+
116
+ extra_rdoc_files: []
117
+
118
+ files:
119
+ - README.markdown
120
+ - LICENSE.txt
121
+ - lib/intuit_ids_aggcat/client/intuit_xml_mappings.rb
122
+ - lib/intuit_ids_aggcat/client/saml.rb
123
+ - lib/intuit_ids_aggcat/client/services.rb
124
+ - lib/intuit_ids_aggcat/core/configuration.rb
125
+ - lib/intuit_ids_aggcat/core.rb
126
+ - lib/intuit_ids_aggcat/rails.rb
127
+ - lib/intuit_ids_aggcat/version.rb
128
+ - lib/intuit_ids_aggcat.rb
129
+ has_rdoc: true
130
+ homepage: ""
131
+ licenses: []
132
+
133
+ post_install_message:
134
+ rdoc_options: []
135
+
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ segments:
143
+ - 0
144
+ version: "0"
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ segments:
150
+ - 0
151
+ version: "0"
152
+ requirements: []
153
+
154
+ rubyforge_project: intuit_ids_aggcat
155
+ rubygems_version: 1.3.6
156
+ signing_key:
157
+ specification_version: 3
158
+ summary: Integration for Intuit's aggregation and categorization services
159
+ test_files:
160
+ - spec/config/intuit_ids_aggcat.yml
161
+ - spec/config/test.crt
162
+ - spec/configuration_spec.rb
163
+ - spec/rails_spec.rb
164
+ - spec/saml_spec.rb
165
+ - spec/services_spec.rb
166
+ - spec/spec_helper.rb