Class: OFX::AccountInformationResponse
Instance Attribute Summary collapse
#client_cookie, #transaction_identifier
Attributes inherited from Response
#status
Class Method Summary
collapse
Instance Method Summary
collapse
#to_ofx_102_s
Methods inherited from Response
#to_ofx_102_s
Instance Attribute Details
#accounts ⇒ Object
Returns the value of attribute accounts.
76
77
78
|
# File 'lib/ofx/signup_message_set.rb', line 76
def accounts
@accounts
end
|
#date_of_last_account_update ⇒ Object
Returns the value of attribute date_of_last_account_update.
75
76
77
|
# File 'lib/ofx/signup_message_set.rb', line 75
def date_of_last_account_update
@date_of_last_account_update
end
|
Class Method Details
.from_ofx_102_hash(transaction_hash) ⇒ Object
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 120
def self.from_ofx_102_hash(transaction_hash)
response = AccountInformationResponse.new
response.transaction_identifier = transaction_hash['TRNUID']
response.status = OFX::Status.from_ofx_102_hash(transaction_hash['STATUS'])
response_hash = transaction_hash['ACCTINFORS']
if not response_hash
return response
end
response.date_of_last_account_update = response_hash['DTACCTUP'].to_datetime if response_hash['DTACCTUP']
response.accounts = []
account_infos = response_hash['ACCTINFO'] if response_hash['ACCTINFO'].kind_of?(Array)
account_infos = [response_hash['ACCTINFO']] if response_hash['ACCTINFO'].kind_of?(Hash)
account_infos = [] unless account_infos
account_infos.each do |account_info_hash|
account_info = OFX::AccountInformation.new
account_info.description = account_info_hash['DESC']
account_info.phone_number = account_info_hash['PHONE']
if account_info_hash['BANKACCTINFO']
bank_acct_info_hash = account_info_hash['BANKACCTINFO']
account_info.account_information = OFX::BankingAccountInformation.new
acct_from_hash = bank_acct_info_hash['BANKACCTFROM']
account_info.account_information.account = OFX::BankingAccount.new
account_info.account_information.account.bank_identifier = acct_from_hash['BANKID']
account_info.account_information.account.branch_identifier = acct_from_hash['BRANCHID']
account_info.account_information.account.account_identifier = acct_from_hash['ACCTID']
account_info.account_information.account.account_type = case acct_from_hash['ACCTTYPE']
when 'CHECKING' then :checking
when 'SAVINGS' then :savings
when 'MONEYMRKT' then :money_market
when 'CREDITLINE' then :line_of_credit
else raise NotImplementedError
end
account_info.account_information.account.account_key = acct_from_hash['ACCTKEY']
account_info.account_information.supports_transaction_detail_downloads = bank_acct_info_hash['SUPTXDL'] == 'Y'
account_info.account_information.transfer_source = bank_acct_info_hash['XFERSRC'] == 'Y'
account_info.account_information.transfer_destination = bank_acct_info_hash['XFERDEST'] == 'Y'
account_info.account_information.status = case bank_acct_info_hash['SVCSTATUS']
when 'AVAIL' then :available
when 'PEND' then :pending
when 'ACTIVE' then :active
else raise NotImplementedError
end
elsif account_info_hash['CCACCTINFO']
cc_acct_info_hash = account_info_hash['CCACCTINFO']
account_info.account_information = OFX::CreditCardAccountInformation.new
acct_from_hash = cc_acct_info_hash['CCACCTFROM']
account_info.account_information.account = OFX::CreditCardAccount.new
account_info.account_information.account.account_identifier = acct_from_hash['ACCTID']
account_info.account_information.account.account_key = acct_from_hash['ACCTKEY']
account_info.account_information.supports_transaction_detail_downloads = cc_acct_info_hash['SUPTXDL'] == 'Y'
account_info.account_information.transfer_source = cc_acct_info_hash['XFERSRC'] == 'Y'
account_info.account_information.transfer_destination = cc_acct_info_hash['XFERDEST'] == 'Y'
account_info.account_information.status = case cc_acct_info_hash['SVCSTATUS']
when 'AVAIL' then :available
when 'PEND' then :pending
when 'ACTIVE' then :active
else raise NotImplementedError
end
elsif account_info_hash['INVACCTINFO']
cc_acct_info_hash = account_info_hash['INVACCTINFO']
account_info.account_information = OFX::CreditCardAccountInformation.new
acct_from_hash = cc_acct_info_hash['INVACCTFROM']
account_info.account_information.account = OFX::CreditCardAccount.new
account_info.account_information.account.account_identifier = acct_from_hash['ACCTID']
account_info.account_information.status = case cc_acct_info_hash['SVCSTATUS']
when 'AVAIL' then :available
when 'PEND' then :pending
when 'ACTIVE' then :active
else raise NotImplementedError
end
else
raise NotImplementedError
end
response.accounts << account_info
end
response
end
|
Instance Method Details
#account_identifier(account_id = nil) ⇒ Object
113
114
115
116
117
118
|
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 113
def account_identifier(account_id=nil)
account_id = 0 if not account_id
info = accounts[account_id].account_information if accounts and accounts.size > account_id
id = info.account.account_identifier if info
return id
end
|
#ofx_102_name ⇒ Object
105
106
107
|
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 105
def ofx_102_name
'ACCTINFO'
end
|
#ofx_102_response_body ⇒ Object
109
110
111
|
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 109
def ofx_102_response_body
raise NotImplementedError
end
|