starkit_banking 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -4
- data/lib/starkit_banking/api/client.rb +42 -6
- data/lib/starkit_banking/api/ybl/account/balance.rb +14 -14
- data/lib/starkit_banking/api/ybl/account/mini_statement.rb +9 -9
- data/lib/starkit_banking/api/ybl/beneficiary/imt.rb +29 -29
- data/lib/starkit_banking/api/ybl/payment/ft2.rb +19 -19
- data/lib/starkit_banking/api/ybl/payment/get_status.rb +14 -14
- data/lib/starkit_banking/api/ybl/payment/imt.rb +13 -13
- data/lib/starkit_banking/concerns/api_step_concern.rb +20 -0
- data/lib/starkit_banking/concerns/bank_account.rb +4 -3
- data/lib/starkit_banking/concerns/payment.rb +7 -6
- data/lib/starkit_banking/version.rb +1 -1
- data/lib/starkit_banking.rb +1 -0
- data/starkit_banking.gemspec +2 -1
- metadata +20 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca947af5c2ceb3ca9d23d5173c08c889f940bd61
|
|
4
|
+
data.tar.gz: 052a471978605f89cc64605acf46d343168e5047
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 716aecb37011f615d9f05a9ed3d9b1ae108e18c3978047b0239df38f39bf8f084604c681ef2e1371d8f71bf587ff6fe5403b94ab5e0ec0e427f1cb1d423f2c55
|
|
7
|
+
data.tar.gz: 72d0a547c3230172fe28278a9fd3f3b72f08dcba579189ae519bc919c2f8ba897de09d394fda8bdbb25393fe18ff091c35baad5f8a161bf29990d0a9c3becc55
|
data/Gemfile.lock
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
starkit_banking (0.1.
|
|
4
|
+
starkit_banking (0.1.10)
|
|
5
5
|
activerecord (~> 4.2.7)
|
|
6
6
|
activesupport (~> 4.2.7)
|
|
7
|
-
api_banking (= 0.1.
|
|
7
|
+
api_banking (= 0.1.18)
|
|
8
8
|
money (= 6.7.1)
|
|
9
9
|
railties (~> 4.2.7)
|
|
10
10
|
|
|
@@ -39,11 +39,12 @@ GEM
|
|
|
39
39
|
tzinfo (~> 1.1)
|
|
40
40
|
addressable (2.5.0)
|
|
41
41
|
public_suffix (~> 2.0, >= 2.0.2)
|
|
42
|
-
api_banking (0.1.
|
|
42
|
+
api_banking (0.1.18)
|
|
43
43
|
nokogiri (~> 1.6.8)
|
|
44
44
|
typhoeus (~> 1.1.0)
|
|
45
|
-
arel (6.0.
|
|
45
|
+
arel (6.0.4)
|
|
46
46
|
builder (3.2.2)
|
|
47
|
+
coderay (1.1.1)
|
|
47
48
|
crack (0.4.3)
|
|
48
49
|
safe_yaml (~> 1.0.0)
|
|
49
50
|
erubis (2.7.0)
|
|
@@ -55,6 +56,7 @@ GEM
|
|
|
55
56
|
json (1.8.3)
|
|
56
57
|
loofah (2.0.3)
|
|
57
58
|
nokogiri (>= 1.5.9)
|
|
59
|
+
method_source (0.8.2)
|
|
58
60
|
mini_portile2 (2.1.0)
|
|
59
61
|
minitest (5.9.1)
|
|
60
62
|
money (6.7.1)
|
|
@@ -62,6 +64,10 @@ GEM
|
|
|
62
64
|
sixarm_ruby_unaccent (>= 1.1.1, < 2)
|
|
63
65
|
nokogiri (1.6.8.1)
|
|
64
66
|
mini_portile2 (~> 2.1.0)
|
|
67
|
+
pry (0.10.4)
|
|
68
|
+
coderay (~> 1.1.0)
|
|
69
|
+
method_source (~> 0.8.1)
|
|
70
|
+
slop (~> 3.4)
|
|
65
71
|
public_suffix (2.0.4)
|
|
66
72
|
rack (1.6.5)
|
|
67
73
|
rack-test (0.6.3)
|
|
@@ -82,6 +88,7 @@ GEM
|
|
|
82
88
|
rake (10.5.0)
|
|
83
89
|
safe_yaml (1.0.4)
|
|
84
90
|
sixarm_ruby_unaccent (1.1.1)
|
|
91
|
+
slop (3.6.0)
|
|
85
92
|
thor (0.19.4)
|
|
86
93
|
thread_safe (0.3.5)
|
|
87
94
|
typhoeus (1.1.2)
|
|
@@ -100,6 +107,7 @@ PLATFORMS
|
|
|
100
107
|
DEPENDENCIES
|
|
101
108
|
bundler (~> 1.9)
|
|
102
109
|
minitest (= 5.9.1)
|
|
110
|
+
pry
|
|
103
111
|
rake (~> 10.0)
|
|
104
112
|
starkit_banking!
|
|
105
113
|
vcr (= 3.0.3)
|
|
@@ -6,22 +6,58 @@ module StarkitBanking
|
|
|
6
6
|
def initialize(step_name = nil)
|
|
7
7
|
@step_name = step_name
|
|
8
8
|
end
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
def exec(model)
|
|
11
11
|
env = Environment.build(credentials(model))
|
|
12
12
|
subscription = subscription(model)
|
|
13
13
|
raise ApiFault.new(OpenStruct.new(code: 'sb:412', subCode: nil, reasonText: "#{service_name} is not subscribed")) if subscription.nil?
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
req = request(subscription, model)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
res = invoke(env, req, callbacks(model, req))
|
|
17
|
+
|
|
19
18
|
if res.instance_of?ApiBanking::Fault
|
|
19
|
+
# log fault details
|
|
20
|
+
model.api_step.assign_attributes(
|
|
21
|
+
fault_code: res.code,
|
|
22
|
+
fault_subcode: res.subCode,
|
|
23
|
+
fault_reason: res.reasonText
|
|
24
|
+
)
|
|
20
25
|
# for certain API calls, certain faults are expected, for example, when a retry is made it is not an error
|
|
21
26
|
raise ApiFault.new(res)
|
|
22
27
|
else
|
|
28
|
+
rep_reference_no = res.respond_to?(:uniqueResponseNo) ? res.uniqueResponseNo : nil
|
|
29
|
+
# log fault details
|
|
30
|
+
model.api_step.assign_attributes(
|
|
31
|
+
rep_reference: rep_reference_no
|
|
32
|
+
)
|
|
23
33
|
response(res)
|
|
24
34
|
end
|
|
25
35
|
end
|
|
36
|
+
|
|
37
|
+
def callbacks(model, req)
|
|
38
|
+
req_reference_no = req.respond_to?(:uniqueRequestNo) ? req.uniqueRequestNo : nil
|
|
39
|
+
|
|
40
|
+
ApiBanking::Callbacks.new do |c|
|
|
41
|
+
c.before_send do |r|
|
|
42
|
+
model.api_step = ApiStep.new(
|
|
43
|
+
auditable_type: model.class,
|
|
44
|
+
auditable_id: model.id,
|
|
45
|
+
star_id: model.star_id,
|
|
46
|
+
step_name: @step_name,
|
|
47
|
+
req_reference: req_reference_no,
|
|
48
|
+
req_timestamp: Time.current,
|
|
49
|
+
req_bitstream: r.options[:body]
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
c.on_complete do |r|
|
|
54
|
+
model.api_step.assign_attributes(
|
|
55
|
+
status_code: r.response_code,
|
|
56
|
+
rep_timestamp: Time.current,
|
|
57
|
+
rep_bitstream: r.body
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
26
62
|
end
|
|
27
|
-
end
|
|
63
|
+
end
|
|
@@ -3,40 +3,40 @@ module StarkitBanking
|
|
|
3
3
|
module Account
|
|
4
4
|
class GetBalance
|
|
5
5
|
include ApiClient
|
|
6
|
-
|
|
7
|
-
private
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
9
|
def service_name
|
|
10
10
|
'BALANCE ENQUIRY'
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
def invoke(env, req)
|
|
14
|
-
ApiBanking::FundsTransferByCustomerService2.get_balance(env, req)
|
|
12
|
+
|
|
13
|
+
def invoke(env, req, callbacks)
|
|
14
|
+
ApiBanking::FundsTransferByCustomerService2.get_balance(env, req, callbacks)
|
|
15
15
|
end
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
def response(rep)
|
|
18
18
|
Money.new(rep.accountBalanceAmount, rep.accountCurrencyCode)
|
|
19
19
|
end
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
def credentials(payment_account)
|
|
22
22
|
payment_account.credentials
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
def request(subscription, payment_account)
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
request = ApiBanking::FundsTransferByCustomerService2::GetBalance::Request.new()
|
|
28
28
|
|
|
29
29
|
request.appID = subscription.app_id
|
|
30
30
|
request.customerID = payment_account.customer_id
|
|
31
31
|
request.AccountNumber = payment_account.account_number
|
|
32
|
-
|
|
33
|
-
request
|
|
32
|
+
|
|
33
|
+
request
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
def subscription(payment_account)
|
|
37
37
|
payment_account.service_subscriptions.find_by(service_name: service_name)
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -3,17 +3,17 @@ module StarkitBanking
|
|
|
3
3
|
module Account
|
|
4
4
|
class GetMiniStatement
|
|
5
5
|
include ApiClient
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
private
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def service_name
|
|
10
10
|
'GET TRANSACTIONS'
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
def invoke(env, req)
|
|
14
|
-
ApiBanking::SocialBankingService.getTransactions(env, req)
|
|
12
|
+
|
|
13
|
+
def invoke(env, req, callbacks)
|
|
14
|
+
ApiBanking::SocialBankingService.getTransactions(env, req, callbacks)
|
|
15
15
|
end
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
def response(res)
|
|
18
18
|
entries = Array.new
|
|
19
19
|
|
|
@@ -26,14 +26,14 @@ module StarkitBanking
|
|
|
26
26
|
entries << e
|
|
27
27
|
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
entries
|
|
31
31
|
end
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
def credentials(payment_account)
|
|
34
34
|
payment_account.credentials
|
|
35
35
|
end
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
def request(subscription, payment_account)
|
|
38
38
|
customerIdentity = ApiBanking::SocialBankingService::GetTransactions::CustomerIdentity.new()
|
|
39
39
|
accountIdentity = ApiBanking::SocialBankingService::GetTransactions::AccountIdentity.new()
|
|
@@ -4,81 +4,81 @@ module StarkitBanking
|
|
|
4
4
|
module IMT
|
|
5
5
|
class Add
|
|
6
6
|
include ApiClient
|
|
7
|
-
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
def invoke(env, req)
|
|
11
|
-
ApiBanking::InstantMoneyTransferService.add_beneficiary(env, request)
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def invoke(env, req, callbacks)
|
|
11
|
+
ApiBanking::InstantMoneyTransferService.add_beneficiary(env, request, callbacks)
|
|
12
12
|
end
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
def credentials(beneficiary)
|
|
15
15
|
beneficiary.credentials
|
|
16
16
|
end
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
def request(beneficiary)
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
beneficiaryAddress = ApiBanking::InstantMoneyTransferService::AddBeneficiary::Address.new()
|
|
21
21
|
request = ApiBanking::InstantMoneyTransferService::AddBeneficiary::Request.new()
|
|
22
22
|
|
|
23
23
|
@req_reference = request.uniqueRequestNo = beneficiary.id
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
request.appID = app_id(beneficiary)
|
|
26
26
|
request.customerID = customer_id(beneficiary)
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
request.beneficiaryMobileNo = beneficiary.mobile
|
|
29
29
|
request.beneficiaryName = beneficiary.name
|
|
30
30
|
beneficiaryAddress.addressLine = beneficiary.address_line
|
|
31
31
|
beneficiaryAddress.cityName = beneficiary.city
|
|
32
32
|
beneficiaryAddress.postalCode = beneficiary.postal_code
|
|
33
33
|
request.beneficiaryAddress = beneficiaryAddress
|
|
34
|
-
|
|
35
|
-
request
|
|
34
|
+
|
|
35
|
+
request
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
def customer_id(beneficiary)
|
|
39
39
|
beneficiary.customer_id #TODO customer_id column to be added to bank_beneficiaries table
|
|
40
40
|
end
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
def app_id(beneficiary)
|
|
43
43
|
beneficiary.service_subscriptions.find_by('IMT TRANSFER').app_id
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
class Delete
|
|
49
49
|
include ApiClient
|
|
50
|
-
|
|
51
|
-
private
|
|
52
|
-
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
53
|
def invoke(env, req)
|
|
54
54
|
ApiBanking::InstantMoneyTransferService.delete_beneficiary(env, request)
|
|
55
55
|
end
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
def credentials(beneficiary)
|
|
58
58
|
beneficiary.credentials
|
|
59
59
|
end
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
def request(beneficiary)
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
request = ApiBanking::InstantMoneyTransferService::DeleteBeneficiary::Request.new()
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
request.uniqueRequestNo = SecureRandom.uuid.gsub!('-','')
|
|
66
66
|
request.appID = app_id(beneficiary)
|
|
67
67
|
request.customerID = customer_id(beneficiary)
|
|
68
68
|
request.beneficiaryMobileNo = beneficiary.mobile_no
|
|
69
|
-
|
|
70
|
-
request
|
|
69
|
+
|
|
70
|
+
request
|
|
71
71
|
end
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
def customer_id(beneficiary)
|
|
74
74
|
beneficiary.customer_id #TODO customer_id column to be added to bank_beneficiaries table
|
|
75
75
|
end
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
def app_id(beneficiary)
|
|
78
78
|
beneficiary.service_subscriptions.find_by('IMT TRANSFER').app_id
|
|
79
79
|
end
|
|
80
|
-
|
|
81
|
-
end
|
|
80
|
+
|
|
81
|
+
end
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -3,55 +3,55 @@ module StarkitBanking
|
|
|
3
3
|
module Payment
|
|
4
4
|
class ByFT2
|
|
5
5
|
include ApiClient
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
private
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def service_name
|
|
10
10
|
'FUNDS TRANSFER'
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
def invoke(env, req)
|
|
14
|
-
ApiBanking::FundsTransferByCustomerService2.transfer(env, req)
|
|
12
|
+
|
|
13
|
+
def invoke(env, req, callbacks)
|
|
14
|
+
ApiBanking::FundsTransferByCustomerService2.transfer(env, req, callbacks)
|
|
15
15
|
end
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
def response(res)
|
|
18
18
|
Transfer::Status.new(res.transactionStatus.statusCode, res.transactionStatus.bankReferenceNo, res.transferType)
|
|
19
19
|
end
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
def credentials(payment)
|
|
22
22
|
payment.payment_account.credentials
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
def request(subscription, payment)
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
address = ApiBanking::FundsTransferByCustomerService2::Transfer::Address.new()
|
|
28
28
|
beneficiary = ApiBanking::FundsTransferByCustomerService2::Transfer::Beneficiary.new()
|
|
29
29
|
request = ApiBanking::FundsTransferByCustomerService2::Transfer::Request.new()
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
# every payment is identified by its ID, repeated API attempts can be identified when the ID is used as the URN
|
|
32
|
-
@req_reference = request.uniqueRequestNo = payment.id
|
|
33
|
-
|
|
32
|
+
@req_reference = request.uniqueRequestNo = payment.id
|
|
33
|
+
|
|
34
34
|
request.appID = subscription.app_id
|
|
35
35
|
request.customerID = payment.payment_account.customer_id
|
|
36
36
|
request.debitAccountNo = payment.payment_account.account_number
|
|
37
37
|
request.transferType = payment.transfer_type || payment.transfer_type
|
|
38
38
|
request.transferAmount = payment.transfer_amount
|
|
39
39
|
request.remitterToBeneficiaryInfo = translate(:transfer_description, payment.transfer_description)
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
beneficiary.accountNo = payment.beneficiary_account_number
|
|
42
42
|
beneficiary.accountIFSC = payment.beneficiary_ifsc
|
|
43
43
|
beneficiary.fullName = translate(:bene_name, payment.beneficiary_name)
|
|
44
44
|
beneficiary.address = translate(:address_line1, payment.beneficiary_address_line1)
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
request.beneficiary = beneficiary
|
|
47
|
-
|
|
48
|
-
request
|
|
47
|
+
|
|
48
|
+
request
|
|
49
49
|
end
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
def subscription(payment)
|
|
52
52
|
payment.payment_account.service_subscriptions.find_by(service_name: service_name)
|
|
53
53
|
end
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
def translate(element, value)
|
|
56
56
|
case element
|
|
57
57
|
when :bene_name
|
|
@@ -64,7 +64,7 @@ module StarkitBanking
|
|
|
64
64
|
value.slice(0,119)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -3,40 +3,40 @@ module StarkitBanking
|
|
|
3
3
|
module Payment
|
|
4
4
|
class GetStatus
|
|
5
5
|
include ApiClient
|
|
6
|
-
|
|
7
|
-
private
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
9
|
def service_name
|
|
10
10
|
'STATUS ENQUIRY'
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
def invoke(env, req)
|
|
14
|
-
ApiBanking::FundsTransferByCustomerService2.get_status(env, req)
|
|
12
|
+
|
|
13
|
+
def invoke(env, req, callbacks)
|
|
14
|
+
ApiBanking::FundsTransferByCustomerService2.get_status(env, req, callbacks)
|
|
15
15
|
end
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
def response(res)
|
|
18
18
|
Transfer::Status.new(res.transactionStatus.statusCode, res.transactionStatus.bankReferenceNo, res.transferType)
|
|
19
19
|
end
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
def credentials(payment)
|
|
22
22
|
payment.payment_account.credentials
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
def request(subscription, payment)
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
request = ApiBanking::FundsTransferByCustomerService2::GetStatus::Request.new()
|
|
28
28
|
|
|
29
29
|
request.appID = subscription.app_id
|
|
30
30
|
request.customerID = payment.payment_account.customer_id
|
|
31
31
|
request.requestReferenceNo = payment.id
|
|
32
|
-
|
|
33
|
-
request
|
|
32
|
+
|
|
33
|
+
request
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
def subscription(payment)
|
|
37
37
|
payment.payment_account.service_subscriptions.find_by(service_name: service_name)
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -3,46 +3,46 @@ module StarkitBanking
|
|
|
3
3
|
module Payment
|
|
4
4
|
class ByIMT
|
|
5
5
|
include ApiClient
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
private
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def service_name
|
|
10
10
|
'IMT TRANSFER'
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
def invoke(env, req)
|
|
14
|
-
ApiBanking::InstantMoneyTransferService.transfer(env, req)
|
|
12
|
+
|
|
13
|
+
def invoke(env, req, callbacks)
|
|
14
|
+
ApiBanking::InstantMoneyTransferService.transfer(env, req, callbacks)
|
|
15
15
|
# send email
|
|
16
16
|
end
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
def credentials(payment)
|
|
19
19
|
payment.payment_account.credentials
|
|
20
20
|
end
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
def response(res)
|
|
23
23
|
Transfer::Status.new('INITIATED', res.initiateTransferResult.bankReferenceNo, 'IMT')
|
|
24
24
|
end
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
def request(subscription, payment)
|
|
27
27
|
request = ApiBanking::InstantMoneyTransferService::InitiateTransfer::Request.new()
|
|
28
28
|
|
|
29
29
|
# every payment is identified by its ID, repeated API attempts can be identified when the ID is used as the URN
|
|
30
|
-
@req_reference = request.uniqueRequestNo = payment.id
|
|
31
|
-
|
|
30
|
+
@req_reference = request.uniqueRequestNo = payment.id
|
|
31
|
+
|
|
32
32
|
request.appID = subscription.app_id
|
|
33
33
|
request.customerID = payment.payment_account.customer_id
|
|
34
34
|
request.beneficiaryMobileNo = payment.beneficiary_mobile_no
|
|
35
35
|
request.transferAmount = payment.transfer_amount
|
|
36
36
|
request.passCode = payment.imt_passcode
|
|
37
37
|
request.remitterToBeneficiaryInfo = payment.transfer_description
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
request
|
|
40
40
|
end
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
def subscription(payment)
|
|
43
43
|
payment.payment_account.service_subscriptions.find_by(service_name: service_name)
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'active_support/concern'
|
|
2
|
+
|
|
3
|
+
module StarkitBanking
|
|
4
|
+
module ApiStepConcern
|
|
5
|
+
|
|
6
|
+
module InstanceMethods
|
|
7
|
+
attr_accessor :api_step
|
|
8
|
+
|
|
9
|
+
def save_api_step
|
|
10
|
+
api_step.save! if api_step
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.included(base)
|
|
15
|
+
base.send :include, InstanceMethods
|
|
16
|
+
# base.after_commit :save_api_step
|
|
17
|
+
# base.after_rollback :save_api_step
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -3,7 +3,8 @@ require 'active_support/concern'
|
|
|
3
3
|
module StarkitBanking
|
|
4
4
|
module BankAccount
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
|
-
|
|
6
|
+
include ApiStepConcern
|
|
7
|
+
|
|
7
8
|
def balance(opts = {})
|
|
8
9
|
@password = opts[:api_password]
|
|
9
10
|
StarkitBanking::API::Factory.get_client(self, 'GetBalance').exec(self)
|
|
@@ -13,7 +14,7 @@ module StarkitBanking
|
|
|
13
14
|
@password = opts[:api_password]
|
|
14
15
|
StarkitBanking::API::Factory.get_client(self, 'GetMiniStatement').exec(self)
|
|
15
16
|
end
|
|
16
|
-
|
|
17
|
+
|
|
17
18
|
def credentials
|
|
18
19
|
c = Finance::ApiBankingCred.find_by(environment: self.environment, bank_name: self.bank_name)
|
|
19
20
|
raise ApiFault.new(OpenStruct.new(code: 'sb:412', subCode: nil, reasonText: "Api Banking Credentials Not Available For #{self.bank_name}, #{self.environment}")) if c.nil?
|
|
@@ -21,4 +22,4 @@ module StarkitBanking
|
|
|
21
22
|
c
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
|
-
end
|
|
25
|
+
end
|
|
@@ -3,27 +3,28 @@ require 'active_support/concern'
|
|
|
3
3
|
module StarkitBanking
|
|
4
4
|
module Payment
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
|
-
|
|
6
|
+
include ApiStepConcern
|
|
7
|
+
|
|
7
8
|
def is_imt
|
|
8
9
|
self.transfer_type == 'IMT'
|
|
9
10
|
end
|
|
10
|
-
|
|
11
|
+
|
|
11
12
|
def is_eft
|
|
12
13
|
self.transfer_type != 'IMT'
|
|
13
14
|
end
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
def release(opts = {})
|
|
16
17
|
self.payment_account.instance_variable_set(:@password, opts[:api_password])
|
|
17
18
|
self.environment = self.payment_account.environment
|
|
18
19
|
self.updated_by = opts[:current_user_id]
|
|
19
20
|
self.approve
|
|
20
|
-
self.reference_no = self.id
|
|
21
|
+
self.reference_no = self.id
|
|
21
22
|
self.response = StarkitBanking::API::Factory.get_client(self).exec(self)
|
|
22
23
|
end
|
|
23
|
-
|
|
24
|
+
|
|
24
25
|
def sync_status(opts = {})
|
|
25
26
|
self.payment_account.instance_variable_set(:@password, opts[:api_password])
|
|
26
27
|
self.response = StarkitBanking::API::Factory.get_client(self, 'GetStatus').exec(self)
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
|
-
end
|
|
30
|
+
end
|
data/lib/starkit_banking.rb
CHANGED
|
@@ -20,6 +20,7 @@ require_relative "starkit_banking/api/ybl/payment/get_status"
|
|
|
20
20
|
|
|
21
21
|
require_relative "starkit_banking/api/ybl/beneficiary/imt"
|
|
22
22
|
|
|
23
|
+
require_relative "starkit_banking/concerns/api_step_concern"
|
|
23
24
|
require_relative "starkit_banking/concerns/bank_account"
|
|
24
25
|
require_relative "starkit_banking/concerns/payment"
|
|
25
26
|
|
data/starkit_banking.gemspec
CHANGED
|
@@ -23,10 +23,11 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.add_development_dependency "minitest", "5.9.1"
|
|
24
24
|
spec.add_development_dependency "vcr", "3.0.3"
|
|
25
25
|
spec.add_development_dependency "webmock", "2.1.0"
|
|
26
|
+
spec.add_development_dependency "pry"
|
|
26
27
|
|
|
27
28
|
spec.add_dependency "money", "6.7.1"
|
|
28
29
|
spec.add_dependency "activesupport", "~> 4.2.7"
|
|
29
30
|
spec.add_dependency "activerecord", "~> 4.2.7"
|
|
30
31
|
spec.add_dependency "railties", "~> 4.2.7"
|
|
31
|
-
spec.add_dependency "api_banking", "0.1.
|
|
32
|
+
spec.add_dependency "api_banking", "0.1.18"
|
|
32
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.
|
|
4
|
+
version: 0.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- akil
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-01-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -80,6 +80,20 @@ dependencies:
|
|
|
80
80
|
- - '='
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: 2.1.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: pry
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
83
97
|
- !ruby/object:Gem::Dependency
|
|
84
98
|
name: money
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,14 +156,14 @@ dependencies:
|
|
|
142
156
|
requirements:
|
|
143
157
|
- - '='
|
|
144
158
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: 0.1.
|
|
159
|
+
version: 0.1.18
|
|
146
160
|
type: :runtime
|
|
147
161
|
prerelease: false
|
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
163
|
requirements:
|
|
150
164
|
- - '='
|
|
151
165
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: 0.1.
|
|
166
|
+
version: 0.1.18
|
|
153
167
|
description:
|
|
154
168
|
email:
|
|
155
169
|
- hello@quantiguous.com
|
|
@@ -183,6 +197,7 @@ files:
|
|
|
183
197
|
- lib/starkit_banking/api/ybl/payment/ft2.rb
|
|
184
198
|
- lib/starkit_banking/api/ybl/payment/get_status.rb
|
|
185
199
|
- lib/starkit_banking/api/ybl/payment/imt.rb
|
|
200
|
+
- lib/starkit_banking/concerns/api_step_concern.rb
|
|
186
201
|
- lib/starkit_banking/concerns/bank_account.rb
|
|
187
202
|
- lib/starkit_banking/concerns/payment.rb
|
|
188
203
|
- lib/starkit_banking/models/api_step.rb
|
|
@@ -210,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
210
225
|
version: '0'
|
|
211
226
|
requirements: []
|
|
212
227
|
rubyforge_project:
|
|
213
|
-
rubygems_version: 2.4.
|
|
228
|
+
rubygems_version: 2.4.5
|
|
214
229
|
signing_key:
|
|
215
230
|
specification_version: 4
|
|
216
231
|
summary: StarKit Banking Interface
|