class ApiBanking::AccountStatement
Constants
- CODE_NO_TXN_FOUND
- ReqBody
- ReqHeader
- Request
- Result
- SERVICE_VERSION
- Transactions
Attributes
configuration[RW]
request[RW]
result[RW]
Public Class Methods
configure() { |configuration| ... }
click to toggle source
# File lib/api_banking/json/accountStatement.rb, line 20 def self.configure self.configuration ||= Configuration.new yield(configuration) end
get_statement(env, request, callbacks = nil)
click to toggle source
# File lib/api_banking/json/accountStatement.rb, line 29 def self.get_statement(env, request, callbacks = nil) dataHash = {} dataHash[:Acc_Stmt_DtRng_Req] = {} dataHash[:Acc_Stmt_DtRng_Req][:Header] = {} dataHash[:Acc_Stmt_DtRng_Req][:Body] = {} dataHash[:Acc_Stmt_DtRng_Req][:Header][:TranID] = '00' dataHash[:Acc_Stmt_DtRng_Req][:Header][:Corp_ID] = request.header.corpID # the tags Maker_ID and Checker_ID have been removed since Schema Validation Error is returned when these are sent in the request. dataHash[:Acc_Stmt_DtRng_Req][:Header][:Approver_ID] = request.header.approverID dataHash[:Acc_Stmt_DtRng_Req][:Body][:Acc_No] = request.body.accountNo dataHash[:Acc_Stmt_DtRng_Req][:Body][:Tran_Type] = request.body.transactionType dataHash[:Acc_Stmt_DtRng_Req][:Body][:From_Dt] = request.body.fromDate dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details] = {} dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details][:Last_Balance] = {} dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details][:Last_Balance][:Amount_Value] = '' dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details][:Last_Balance][:Currency_Code] = '' dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details][:Last_Pstd_Date] = '' dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details][:Last_Txn_Date] = '' dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details][:Last_Txn_Id] = '' dataHash[:Acc_Stmt_DtRng_Req][:Body][:Pagination_Details][:Last_Txn_SrlNo] = '' dataHash[:Acc_Stmt_DtRng_Req][:Body][:To_Dt] = request.body.toDate reply = do_remote_call(env, dataHash, callbacks) parse_reply(:getStatement, reply) end
Private Class Methods
parse_reply(operationName, reply)
click to toggle source
# File lib/api_banking/json/accountStatement.rb, line 63 def self.parse_reply(operationName, reply) if reply.kind_of?Fault reply.code == CODE_NO_TXN_FOUND ? AccountStatement::Result.new([]) : reply else case operationName when :getStatement sortedTxnArray = Array.new txnArray = reply['Acc_Stmt_DtRng_Res']['Body']['transactionDetails'].sort_by { |e| parsed_datetime(e['pstdDate'])} txnArray.each do |txn| txnAmt = parsed_money( txn['transactionSummary']['txnAmt']['amountValue'], txn['transactionSummary']['txnAmt']['currencyCode'] ) txnBalance = parsed_money( txn['txnBalance']['amountValue'], txn['txnBalance']['currencyCode'] ) sortedTxnArray << AccountStatement::Transactions.new( parsed_datetime(txn['pstdDate']), txn['transactionSummary']['txnType'], txnAmt, txn['transactionSummary']['txnDesc'], txn['txnId'], txnBalance ) end return AccountStatement::Result.new( sortedTxnArray ) end end end
parsed_datetime(datetime)
click to toggle source
# File lib/api_banking/json/accountStatement.rb, line 101 def self.parsed_datetime(datetime) DateTime.parse(datetime) end
parsed_money(amount, currency)
click to toggle source
# File lib/api_banking/json/accountStatement.rb, line 97 def self.parsed_money(amount, currency) Money.from_amount(amount.to_d, currency) end