starkit_banking 0.1.11 → 0.1.12

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: 3c7c1cc611fa6d71fdcc35806d9bb20c883dc2af
4
- data.tar.gz: 2dd975cb2707b833ea65622e35d599ba98a8a65c
3
+ metadata.gz: 6542c489c18f375f166b513161a3b18533515071
4
+ data.tar.gz: 920e0a36aff60bb5b2ed251492d33027bf2c1c5d
5
5
  SHA512:
6
- metadata.gz: 4a276deaa8c381c6a9c64ac308402d2546ef8be5f793f23260bae6cb19f3ab85f0f30fe6a01757dd5903cd9b6978ba63266b7baf9cdee26208105b4be48f72ac
7
- data.tar.gz: 7b9f31bc94ab58a36fe166f95bef2b61eadb793a80079680871608acd1ddca6f5ade0cc6385c3d047204b7de030eb52a94a7c7d04330dca0d53ac66c6ad49974
6
+ metadata.gz: 919a4a642514dbf1ec3f5e0c0719fe4988544e95015dc50de1f048fb0946689d0cb2bc570c42b4bf6af6a7c8e94eee9b72d3df24b3788430c3584947f04f9737
7
+ data.tar.gz: 5d0a7b91b3221548dea493f4bf2b15edcab3b5006f76b1676c8d16fd8c6d7699535ab6725e9813bb550e4536c65bb6b76abbac2b37a1ffd061f87068b8bff897
data/Gemfile.lock CHANGED
@@ -1,45 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- starkit_banking (0.1.10)
4
+ starkit_banking (0.1.11)
5
5
  activerecord (~> 4.2.7)
6
6
  activesupport (~> 4.2.7)
7
- api_banking (= 0.1.19)
7
+ api_banking (= 0.1.22)
8
8
  money (= 6.7.1)
9
9
  railties (~> 4.2.7)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actionpack (4.2.7.1)
15
- actionview (= 4.2.7.1)
16
- activesupport (= 4.2.7.1)
14
+ actionpack (4.2.8)
15
+ actionview (= 4.2.8)
16
+ activesupport (= 4.2.8)
17
17
  rack (~> 1.6)
18
18
  rack-test (~> 0.6.2)
19
19
  rails-dom-testing (~> 1.0, >= 1.0.5)
20
20
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (4.2.7.1)
22
- activesupport (= 4.2.7.1)
21
+ actionview (4.2.8)
22
+ activesupport (= 4.2.8)
23
23
  builder (~> 3.1)
24
24
  erubis (~> 2.7.0)
25
25
  rails-dom-testing (~> 1.0, >= 1.0.5)
26
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- activemodel (4.2.7.1)
28
- activesupport (= 4.2.7.1)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
+ activemodel (4.2.8)
28
+ activesupport (= 4.2.8)
29
29
  builder (~> 3.1)
30
- activerecord (4.2.7.1)
31
- activemodel (= 4.2.7.1)
32
- activesupport (= 4.2.7.1)
30
+ activerecord (4.2.8)
31
+ activemodel (= 4.2.8)
32
+ activesupport (= 4.2.8)
33
33
  arel (~> 6.0)
34
- activesupport (4.2.7.1)
34
+ activesupport (4.2.8)
35
35
  i18n (~> 0.7)
36
- json (~> 1.7, >= 1.7.7)
37
36
  minitest (~> 5.1)
38
37
  thread_safe (~> 0.3, >= 0.3.4)
39
38
  tzinfo (~> 1.1)
40
39
  addressable (2.5.0)
41
40
  public_suffix (~> 2.0, >= 2.0.2)
42
- api_banking (0.1.19)
41
+ api_banking (0.1.22)
42
+ money (= 6.7.1)
43
43
  nokogiri (~> 1.6.8)
44
44
  typhoeus (~> 1.1.0)
45
45
  arel (6.0.4)
@@ -50,10 +50,9 @@ GEM
50
50
  erubis (2.7.0)
51
51
  ethon (0.10.1)
52
52
  ffi (>= 1.3.0)
53
- ffi (1.9.17)
53
+ ffi (1.9.18)
54
54
  hashdiff (0.3.1)
55
55
  i18n (0.7.0)
56
- json (1.8.6)
57
56
  loofah (2.0.3)
58
57
  nokogiri (>= 1.5.9)
59
58
  method_source (0.8.2)
@@ -80,9 +79,9 @@ GEM
80
79
  rails-deprecated_sanitizer (>= 1.0.1)
81
80
  rails-html-sanitizer (1.0.3)
82
81
  loofah (~> 2.0)
83
- railties (4.2.7.1)
84
- actionpack (= 4.2.7.1)
85
- activesupport (= 4.2.7.1)
82
+ railties (4.2.8)
83
+ actionpack (= 4.2.8)
84
+ activesupport (= 4.2.8)
86
85
  rake (>= 0.8.7)
87
86
  thor (>= 0.18.1, < 2.0)
88
87
  rake (10.5.0)
@@ -90,7 +89,7 @@ GEM
90
89
  sixarm_ruby_unaccent (1.1.1)
91
90
  slop (3.6.0)
92
91
  thor (0.19.4)
93
- thread_safe (0.3.5)
92
+ thread_safe (0.3.6)
94
93
  typhoeus (1.1.2)
95
94
  ethon (>= 0.9.0)
96
95
  tzinfo (1.2.2)
@@ -1,14 +1,26 @@
1
1
  module StarkitBanking
2
2
  class Environment
3
3
  def self.build(credentials)
4
- if credentials.environment.try(:upcase) == 'UAT'
5
- ::ApiBanking::Environment::YBL::UAT.new(
6
- credentials.decrypt_username,
7
- credentials.password,
8
- credentials.decrypt_client_id,
9
- credentials.decrypt_client_secret
10
- )
11
- elsif credentials.environment.try(:upcase) == 'PROD'
4
+ if credentials.environment.try(:upcase) == 'UAT'
5
+ if credentials.bank_name == 'YBL'
6
+ ::ApiBanking::Environment::YBL::UAT.new(
7
+ credentials.decrypt_username,
8
+ credentials.password,
9
+ credentials.decrypt_client_id,
10
+ credentials.decrypt_client_secret
11
+ )
12
+ else
13
+ ::ApiBanking::Environment::RBL::UAT.new(
14
+ credentials.decrypt_username,
15
+ credentials.password,
16
+ credentials.decrypt_client_id,
17
+ credentials.decrypt_client_secret,
18
+ credentials.client_certificate.path,
19
+ credentials.client_private_key.path,
20
+ credentials.decrypt_client_private_key_pwd
21
+ )
22
+ end
23
+ elsif credentials.environment.try(:upcase) == 'PROD'
12
24
  ::ApiBanking::Environment::YBL::PRD.new(
13
25
  credentials.decrypt_username,
14
26
  credentials.password,
@@ -17,7 +29,7 @@ module StarkitBanking
17
29
  credentials.client_certificate.path,
18
30
  credentials.client_private_key.path,
19
31
  credentials.decrypt_client_private_key_pwd
20
- )
32
+ ) if credentials.bank_name == 'YBL'
21
33
  end
22
34
  end
23
35
  end
@@ -16,9 +16,10 @@ module StarkitBanking
16
16
  return "StarkitBanking::#{model.bank_name}::Account::#{action}".constantize.new(action)
17
17
  when 'BankBeneficiary'
18
18
  return "StarkitBanking::#{model.bank_name}::Beneficiary::#{model.transfer_type}::#{action}".constantize.new(action)
19
- end
19
+ end
20
+ rescue
21
+ raise ApiFault.new(OpenStruct.new(code: 'sb:413', subCode: nil, reasonText: "API is not yet implemeneted!"))
20
22
  end
21
-
22
23
  end
23
24
  end
24
25
  end
@@ -0,0 +1,63 @@
1
+ module StarkitBanking
2
+ module RBL
3
+ module Account
4
+ class GetMiniStatement
5
+ include ApiClient
6
+
7
+ private
8
+
9
+ def service_name
10
+ 'GET TRANSACTIONS'
11
+ end
12
+
13
+ def invoke(env, req, callbacks)
14
+ ApiBanking::AccountStatement.get_statement(env, req, callbacks)
15
+ end
16
+
17
+ def response(res)
18
+ entries = Array.new
19
+
20
+ res.transactions.each do |r|
21
+ if (r.transactionType == "D" && r.amount.amount > 0) || (r.transactionType == "C" && r.amount.amount < 0)
22
+ e = MiniStatement::Entry.new(r.transactionDateTime, r.amount, nil, r.narrative)
23
+ else
24
+ e = MiniStatement::Entry.new(r.transactionDateTime, nil, r.amount, r.narrative)
25
+ end
26
+ entries << e
27
+
28
+ end
29
+
30
+ entries
31
+ end
32
+
33
+ def credentials(payment_account)
34
+ payment_account.credentials
35
+ end
36
+
37
+ def request(subscription, payment_account)
38
+ header = ApiBanking::AccountStatement::ReqHeader.new()
39
+ reqBody = ApiBanking::AccountStatement::ReqBody.new()
40
+ request = ApiBanking::AccountStatement::Request.new()
41
+
42
+ header.corpID = subscription.app_id
43
+ header.approverID = payment_account.created_by
44
+
45
+ reqBody.accountNo = payment_account.account_number
46
+ reqBody.transactionType = 'B'
47
+ reqBody.fromDate = Date.today - 1.month
48
+ reqBody.toDate = Date.today
49
+
50
+ request.header = header
51
+ request.body = reqBody
52
+
53
+ request
54
+ end
55
+
56
+ def subscription(payment_account)
57
+ payment_account.service_subscriptions.find_by(service_name: service_name)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+
@@ -1,3 +1,3 @@
1
1
  module StarkitBanking
2
- VERSION = '0.1.11'
2
+ VERSION = '0.1.12'
3
3
  end
@@ -24,6 +24,8 @@ require_relative "starkit_banking/concerns/api_step_concern"
24
24
  require_relative "starkit_banking/concerns/bank_account"
25
25
  require_relative "starkit_banking/concerns/payment"
26
26
 
27
+ require_relative "starkit_banking/api/rbl/account/mini_statement"
28
+
27
29
  module StarkitBanking
28
30
  # Your code goes here...
29
31
  end
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "activesupport", "~> 4.2.7"
30
30
  spec.add_dependency "activerecord", "~> 4.2.7"
31
31
  spec.add_dependency "railties", "~> 4.2.7"
32
- spec.add_dependency "api_banking", "0.1.19"
32
+ spec.add_dependency "api_banking", "0.1.22"
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starkit_banking
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - akil
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-17 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.1.19
159
+ version: 0.1.22
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.1.19
166
+ version: 0.1.22
167
167
  description:
168
168
  email:
169
169
  - hello@quantiguous.com
@@ -188,6 +188,7 @@ files:
188
188
  - lib/starkit_banking/api/environment.rb
189
189
  - lib/starkit_banking/api/factory.rb
190
190
  - lib/starkit_banking/api/fault.rb
191
+ - lib/starkit_banking/api/rbl/account/mini_statement.rb
191
192
  - lib/starkit_banking/api/response.rb
192
193
  - lib/starkit_banking/api/ybl/account/balance.rb
193
194
  - lib/starkit_banking/api/ybl/account/mini_statement.rb