api_banking 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bcc39fb4a83a34cdc2097a12f6362941fa7d87a
4
- data.tar.gz: 26443a306676f60084181ba17c4b9e084a360b41
3
+ metadata.gz: 008e520dcf8a6f37585f543609e410aa969b0b5b
4
+ data.tar.gz: 510c82969d8e455d81973756efce038b0613a08b
5
5
  SHA512:
6
- metadata.gz: 49025961a3b947e5a781b39cbc760f90ee9d536702cb1668a67ced1ecd70a6316d591a3bd6abe33fe73c1570cb3b07cc763be4614ac5e4b4b74956c828decf67
7
- data.tar.gz: c6a721412769773323b7ab75e1ff4fc0bf654964ac3857f228d30a13899ec5022619f1c2bc33c53bc3efed4dc69fb6e48472a7971d5146bf49b84319516da8ae
6
+ metadata.gz: 974c5e61f8cf40555fd1eebcdc44ab9c388ce05a37b291452a749cc152c2b7ee2c648188e6eb39faaa60f3accffd91b3aa92a439a890733fa8556242cebbf676
7
+ data.tar.gz: ef04cadba56654372809bcd7d422e0bd53b934204439247960f0b4f7a371b965693e7a0f45551ca61f9a743bd7e6f7f0e724a3852a9aa12083b6d476cea9ec8d
data/lib/api_banking.rb CHANGED
@@ -26,6 +26,7 @@ require_relative "api_banking/soap/aadhaarVerificationService"
26
26
  require_relative "api_banking/json/json_client"
27
27
  require_relative "api_banking/json/singlePayment"
28
28
  require_relative "api_banking/json/accountStatement"
29
+ require_relative "api_banking/json/getAccountBalance"
29
30
 
30
31
  module ApiBanking
31
32
 
@@ -7,7 +7,8 @@ module ApiBanking
7
7
  self.ssl_ca_file ||= File.expand_path('./uat.pem', File.dirname(__FILE__))
8
8
  self.endpoints = {
9
9
  SinglePayment: 'https://apideveloper.rblbank.com/test/sb/rbl/v1/payments/corp/payment',
10
- AccountStatement: 'https://apideveloper.rblbank.com/test/sb/rbl/v1/cas/statement'
10
+ AccountStatement: 'https://apideveloper.rblbank.com/test/sb/rbl/v1/cas/statement',
11
+ GetAccountBalance: 'https://apideveloper.rblbank.com/test/sb/rbl/v1/accounts/balance/query'
11
12
  }
12
13
  end
13
14
  end
@@ -95,7 +95,7 @@ module ApiBanking
95
95
  end
96
96
 
97
97
  def self.parsed_money(amount, currency)
98
- Money.new(amount, currency)
98
+ Money.from_amount(amount.to_d, currency)
99
99
  end
100
100
 
101
101
  def self.parsed_datetime(datetime)
@@ -0,0 +1,60 @@
1
+ module ApiBanking
2
+ class GetAccountBalance < JsonClient
3
+
4
+ SERVICE_VERSION = 1
5
+
6
+ attr_accessor :request, :result
7
+
8
+ ReqHeader = Struct.new(:corpID, :approverID)
9
+ ReqBody = Struct.new(:accountNo)
10
+ Request = Struct.new(:header, :body)
11
+
12
+ Result = Struct.new(:balanceAmount)
13
+
14
+ class << self
15
+ attr_accessor :configuration
16
+ end
17
+
18
+ def self.configure
19
+ self.configuration ||= Configuration.new
20
+ yield(configuration)
21
+ end
22
+
23
+ class Configuration
24
+ attr_accessor :environment, :proxy, :timeout
25
+ end
26
+
27
+ def self.get_account_balance(env, request, callbacks = nil)
28
+ dataHash = {}
29
+ dataHash[:getAccountBalanceReq] = {}
30
+ dataHash[:getAccountBalanceReq][:Header] = {}
31
+ dataHash[:getAccountBalanceReq][:Body] = {}
32
+
33
+ dataHash[:getAccountBalanceReq][:Header][:TranID] = '00'
34
+ dataHash[:getAccountBalanceReq][:Header][:Corp_ID] = request.header.corpID
35
+ # the tags Maker_ID and Checker_ID have been removed since Schema Validation Error is returned when these are sent in the request.
36
+ dataHash[:getAccountBalanceReq][:Header][:Approver_ID] = request.header.approverID
37
+
38
+ dataHash[:getAccountBalanceReq][:Body][:AcctId] = request.body.accountNo
39
+
40
+ reply = do_remote_call(env, dataHash, callbacks)
41
+
42
+ parse_reply(reply)
43
+ end
44
+
45
+ private
46
+
47
+ def self.parse_reply(reply)
48
+ if reply.kind_of?Fault
49
+ reply
50
+ else
51
+ balAmt = parsed_money(reply['getAccountBalanceRes']['Body']['BalAmt']['amountValue'], 'INR')
52
+ GetAccountBalance::Result.new(balAmt)
53
+ end
54
+ end
55
+
56
+ def self.parsed_money(amount, currency)
57
+ Money.from_amount(amount.to_d, currency)
58
+ end
59
+ end
60
+ end
@@ -1,3 +1,3 @@
1
1
  module ApiBanking
2
- VERSION = "0.1.22"
2
+ VERSION = "0.1.23"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_banking
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.22
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - akil
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,6 +147,7 @@ files:
147
147
  - lib/api_banking/environment/ybl/env.rb
148
148
  - lib/api_banking/environment/ybl/prd.pem
149
149
  - lib/api_banking/json/accountStatement.rb
150
+ - lib/api_banking/json/getAccountBalance.rb
150
151
  - lib/api_banking/json/json_client.rb
151
152
  - lib/api_banking/json/singlePayment.rb
152
153
  - lib/api_banking/soap/aadhaarVerificationService.rb