Class: OFX::CreditCardClosingStatementResponse

Inherits:
TransactionalResponse show all
Defined in:
lib/ofx/credit_card_statement_message_set.rb,
lib/ofx/1.0.2/credit_card_statement_message_set.rb

Instance Attribute Summary collapse

Attributes inherited from TransactionalResponse

#client_cookie, #transaction_identifier

Attributes inherited from Response

#status

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TransactionalResponse

#to_ofx_102_s

Methods inherited from Response

#to_ofx_102_s

Instance Attribute Details

#accountObject

Returns the value of attribute account.



77
78
79
# File 'lib/ofx/credit_card_statement_message_set.rb', line 77

def 
  @account
end

#default_currencyObject

Returns the value of attribute default_currency.



76
77
78
# File 'lib/ofx/credit_card_statement_message_set.rb', line 76

def default_currency
  @default_currency
end

#statementsObject

Returns the value of attribute statements.



79
80
81
# File 'lib/ofx/credit_card_statement_message_set.rb', line 79

def statements
  @statements
end

Class Method Details

.from_ofx_102_hash(transaction_hash) ⇒ Object



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/ofx/1.0.2/credit_card_statement_message_set.rb', line 221

def self.from_ofx_102_hash(transaction_hash)
    response = CreditCardClosingStatementResponse.new
               
    response.transaction_identifier = transaction_hash['TRNUID']
    response.status = OFX::Status.from_ofx_102_hash(transaction_hash['STATUS'])
    
    response_hash = transaction_hash['CCSTMTENDRS']
    return unless response_hash
    
    response.default_currency = response_hash['CURDEF']
    response. = CreditCardAccount.from_ofx_102_hash(response_hash['CCACCTFROM'])
    
    response.statements = []
    closings = response_hash['CCCLOSING'] if response_hash['CCCLOSING'].kind_of?(Array)
    closings = [response_hash['CCCLOSING']] if response_hash['CCCLOSING'].kind_of?(Hash)
    closings = [] unless closings
    closings.each do |closing_hash|
        statement = CreditCardClosingStatement.new
        
        statement.currency = closing_hash['CURRENCY'] || closing_hash['ORIGCURRENCY'] || response.default_currency
        
        statement.finanical_institution_transaction_identifier = closing_hash['FITID']

        if closing_hash['DTOPEN'] && closing_hash['DTCLOSE']
            statement.statement_range = closing_hash['DTOPEN'].to_date..closing_hash['DTCLOSE'].to_date
        end
        statement.next_statement_close = closing_hash['DTNEXT'].to_date if closing_hash['DTNEXT']

        statement.opening_balance = closing_hash['BALOPEN'].to_d if closing_hash['BALOPEN']
        statement.closing_balance = closing_hash['BALCLOSE'].to_d if closing_hash['BALCLOSE']
        
        statement.payment_due_date = closing_hash['DTPMTDUE'].to_date if closing_hash['DTPMTDUE']
        statement.minimum_payment_due = closing_hash['MINPMTDUE'].to_d if closing_hash['MINPMTDUE']

        statement.finance_charge  = closing_hash['FINCHG'].to_d if closing_hash['FINCHG']
        statement.total_of_payments_and_charges  = closing_hash['PAYANDCREDIT'].to_d if closing_hash['PAYANDCREDIT']
        statement.total_of_purchases_and_advances  = closing_hash['PURANDADV'].to_d if closing_hash['PURANDADV']
        statement.debit_adjustements  = closing_hash['DEBADJ'].to_d if closing_hash['DEBADJ']
        statement.credit_limit  = closing_hash['CREDITLIMIT'].to_d if closing_hash['CREDITLIMIT']
        
        if closing_hash['DTPOSTSTART'] && closing_hash['DTPOSTEND']
            statement.transaction_range = closing_hash['DTPOSTSTART'].to_date..closing_hash['DTPOSTEND'].to_date
        end
        
        statement.marketing_information = closing_hash['MKTGINFO']
        
        response.statements << statement
    end
    
    response
end

Instance Method Details

#ofx_102_nameObject



213
214
215
# File 'lib/ofx/1.0.2/credit_card_statement_message_set.rb', line 213

def ofx_102_name
    'CCSTMTEND'
end

#ofx_102_response_bodyObject

Raises:

  • (NotImplementedError)


217
218
219
# File 'lib/ofx/1.0.2/credit_card_statement_message_set.rb', line 217

def ofx_102_response_body
    raise NotImplementedError
end