api_banking 0.1.2 → 0.1.3

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: 46675c94a4a5bc3aaf5afd02109ad2a9d0dfc6bf
4
- data.tar.gz: e389195659f4eaa9d0054d1d6007cbd5ce21fcd5
3
+ metadata.gz: 8f7815f524c5f3a301a23b06dedaf78bbdc5e583
4
+ data.tar.gz: 93bb01969b48b89de0580afbbf9c1aa74887588b
5
5
  SHA512:
6
- metadata.gz: ca4036c4662b570388285b4b0f9d559315696b1ace7246c9724764c0adb344ecdda17faa60027ff87da1d1632300cf305ccf38161b5f914220ed0ac98ee5c315
7
- data.tar.gz: 00aededa91b5db014558a72be59773d7fed3f6277a2294a61b137b5ae8356e3ebf6abd7c6a3fa1a218451ae498df20834d07b4c194796af318a3b11f24d582e3
6
+ metadata.gz: 91965c47a8f7e004cab8bc4803beb356eb1ed3dc3b2f67cf023bf74686e50589fa319526f06ad029e7fd123326644de849debf52dec2a5f672b68351fce7b92e
7
+ data.tar.gz: 398738d686b5a2367a44019e9cd02ff17ad686dd724ff77ef7c577dad5289c67e36dc2a471ea0f99a1519e5a1176e17205c5e3a974fc3d9bf2c5749e02d153f8
data/api_banking.gemspec CHANGED
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.9"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "minitest"
24
+ spec.add_development_dependency "vcr"
25
+ spec.add_development_dependency "webmock"
24
26
 
25
27
  spec.add_dependency "typhoeus"
26
- spec.add_dependency "nokogiri"
28
+ spec.add_dependency "nokogiri"
27
29
  end
@@ -0,0 +1,19 @@
1
+ module ApiBanking
2
+ module Environment
3
+ module QG
4
+ DEMO = Struct.new(:user, :password, :endpoints) do
5
+ def initialize(*)
6
+ super
7
+ self.endpoints = {
8
+ FundsTransferByCustomerService: 'https://api.quantiguous.com/fundsTransferByCustomerServiceHttpService',
9
+ FundsTransferByCustomerService2: 'http://10.211.55.6:7801/fundsTransferByCustomerService2',
10
+ InstantMoneyTransferService: 'https://api.quantiguous.com/IMTService',
11
+ DomesticRemittanceByPartnerService: 'https://api.quantiguous.com/DomesticRemittanceByPartnerService',
12
+ NotificationService: 'https://api.quantiguous.com/NotificationService',
13
+ InstantCreditService: 'https://api.quantiguous.com/InstantCreditService'
14
+ }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -6,8 +6,9 @@ module ApiBanking
6
6
  super
7
7
  self.endpoints = {
8
8
  FundsTransferByCustomerService: 'https://uatsky.yesbank.in/app/uat/fundsTransferByCustomerServiceHttpService',
9
- FundsTransferByCustomerService2: 'https://uatsky.yesbank.in/app/uat/fundsTransferByCustomerService2',
10
- InstantMoneyTransferService: 'https://uatsky.yesbank.in:7081/IMTService'
9
+ FundsTransferByCustomerService2: 'http://10.211.55.6:7801/fundsTransferByCustomerService2',
10
+ InstantMoneyTransferService: 'https://uatsky.yesbank.in:7081/IMTService',
11
+ NotificationService: 'http://10.211.55.6:7802/NotificationService'
11
12
  }
12
13
  end
13
14
  end
@@ -0,0 +1,242 @@
1
+ module ApiBanking
2
+ class DomesticRemittanceByPartnerService < SoapClient
3
+
4
+ SERVICE_NAMESPACE = 'http://www.quantiguous.com/services'
5
+ SERVICE_VERSION = 1
6
+
7
+ attr_accessor :request, :result
8
+
9
+ #remit
10
+ module Remit
11
+ Address = Struct.new(:address1, :address2, :address3, :postalCode, :city, :stateOrProvince, :country)
12
+ Contact = Struct.new(:mobileNo, :emailID)
13
+ Request = Struct.new(:uniqueRequestNo, :partnerCode, :customerID, :debitAccountNo, :remitterAccountNo,
14
+ :remitterIFSC, :remitterName, :remitterAddress, :remitterContact, :beneficiaryName, :beneficiaryAddress,
15
+ :beneficiaryContact, :beneficiaryAccountNo, :beneficiaryIFSC, :transferType, :transferCurrencyCode, :transferAmount,
16
+ :remitterToBeneficiaryInfo)
17
+
18
+ TransactionStatus = Struct.new(:statusCode, :subStatusCode, :bankReferenceNo, :beneficiaryReferenceNo, :reason)
19
+
20
+ Result = Struct.new(:version, :uniqueResponseNo, :attemptNo, :requestReferenceNo, :transferType, :lowBalanceAlert,
21
+ :transactionStatus)
22
+ end
23
+
24
+ #getStatus
25
+ module GetStatus
26
+ Request = Struct.new(:version, :partnerCode, :requestReferenceNo)
27
+ TransactionStatus = Struct.new(:statusCode, :subStatusCode, :bankReferenceNo, :beneficiaryReferenceNo, :reason)
28
+
29
+ Result = Struct.new(:version, :transferType, :reqTransferType, :transactionDate, :transferAmount, :transferCurrencyCode,
30
+ :transactionStatus)
31
+ end
32
+
33
+ #getBalance
34
+ module GetBalance
35
+ Request = Struct.new(:version, :partnerCode, :customerID, :accountNo)
36
+
37
+ Result = Struct.new(:version, :accountCurrencyCode, :accountBalanceAmount, :lowBalanceAlert)
38
+ end
39
+
40
+ #getTransactions
41
+ module GetTransactions
42
+ Request = Struct.new(:version, :partnerCode, :customerID, :accountNo, :dateRange)
43
+
44
+ DateRange = Struct.new(:fromDate, :toDate)
45
+ TransactionsArray = Struct.new(:transaction)
46
+ Transaction = Struct.new(:transactionDateTime, :transactionType, :amount, :narrative, :referenceNo, :balance)
47
+
48
+ Result = Struct.new(:version, :openingBalance, :numDebits, :numCredits, :closingBalance, :numTransactions, :transactionsArray)
49
+ end
50
+
51
+ class << self
52
+ attr_accessor :configuration
53
+ end
54
+
55
+ def self.configure
56
+ self.configuration ||= Configuration.new
57
+ yield(configuration)
58
+ end
59
+
60
+ class Configuration
61
+ attr_accessor :environment, :proxy, :timeout
62
+ end
63
+
64
+ def self.remit(request)
65
+ reply = do_remote_call do |xml|
66
+ xml.remit("xmlns:ns" => SERVICE_NAMESPACE ) do
67
+ xml.parent.namespace = xml.parent.namespace_definitions.first
68
+ xml['ns'].version SERVICE_VERSION
69
+ xml['ns'].uniqueRequestNo request.uniqueRequestNo
70
+ xml['ns'].partnerCode request.partnerCode
71
+ xml['ns'].customerID request.customerID
72
+ xml['ns'].debitAccountNo request.debitAccountNo
73
+ xml['ns'].remitterAccountNo request.remitterAccountNo
74
+ xml['ns'].remitterIFSC request.remitterIFSC
75
+ xml['ns'].remitterName request.remitterName
76
+ xml['ns'].remitterAddress do |xml|
77
+ if request.remitterAddress.kind_of? Remit::Address
78
+ xml.address1 request.remitterAddress.address1
79
+ xml.address2 request.remitterAddress.address2 unless request.remitterAddress.address2.nil?
80
+ xml.address3 request.remitterAddress.address3 unless request.remitterAddress.address3.nil?
81
+ xml.postalCode request.remitterAddress.postalCode unless request.remitterAddress.postalCode.nil?
82
+ xml.city request.remitterAddress.city unless request.remitterAddress.city.nil?
83
+ xml.stateOrProvince request.remitterAddress.stateOrProvince unless request.remitterAddress.stateOrProvince.nil?
84
+ xml.country request.remitterAddress.country unless request.remitterAddress.country.nil?
85
+ else
86
+ xml.address1 request.remitterAddress
87
+ end
88
+ end
89
+ xml['ns'].remitterContact do |xml|
90
+ xml.mobileNo request.remitterContact.mobileNo unless request.remitterContact.mobileNo.nil?
91
+ xml.emailID request.remitterContact.emailID unless request.remitterContact.emailID.nil?
92
+ end
93
+ xml['ns'].beneficiaryName request.beneficiaryName
94
+ xml['ns'].beneficiaryAddress do |xml|
95
+ if request.beneficiaryAddress.kind_of? Remit::Address
96
+ xml.address1 request.beneficiaryAddress.address1
97
+ xml.address2 request.beneficiaryAddress.address2 unless request.beneficiaryAddress.address2.nil?
98
+ xml.address3 request.beneficiaryAddress.address3 unless request.beneficiaryAddress.address3.nil?
99
+ xml.postalCode request.beneficiaryAddress.postalCode unless request.beneficiaryAddress.postalCode.nil?
100
+ xml.city request.beneficiaryAddress.city unless request.beneficiaryAddress.city.nil?
101
+ xml.stateOrProvince request.beneficiaryAddress.stateOrProvince unless request.beneficiaryAddress.stateOrProvince.nil?
102
+ xml.country request.beneficiaryAddress.country unless request.beneficiaryAddress.country.nil?
103
+ else
104
+ xml.address1 request.beneficiaryAddress
105
+ end
106
+ end
107
+ xml['ns'].beneficiaryContact do |xml|
108
+ xml.mobileNo request.beneficiaryContact.mobileNo unless request.beneficiaryContact.mobileNo.nil?
109
+ xml.emailID request.beneficiaryContact.emailID unless request.beneficiaryContact.emailID.nil?
110
+ end
111
+ xml['ns'].beneficiaryAccountNo request.beneficiaryAccountNo
112
+ xml['ns'].beneficiaryIFSC request.beneficiaryIFSC
113
+ xml['ns'].transferType request.transferType
114
+ xml['ns'].transferCurrencyCode 'INR'
115
+ xml['ns'].transferAmount request.transferAmount
116
+ xml['ns'].remitterToBeneficiaryInfo request.remitterToBeneficiaryInfo
117
+ end
118
+ end
119
+ parse_reply(:remit, reply)
120
+ end
121
+
122
+ def self.get_status(request)
123
+ reply = do_remote_call do |xml|
124
+ xml.getRemittanceStatus("xmlns:ns" => SERVICE_NAMESPACE ) do
125
+ xml.parent.namespace = xml.parent.namespace_definitions.first
126
+ xml['ns'].version SERVICE_VERSION
127
+ xml['ns'].partnerCode request.partnerCode
128
+ xml['ns'].requestReferenceNo request.requestReferenceNo
129
+ end
130
+ end
131
+ parse_reply(:getRemittanceStatus, reply)
132
+ end
133
+
134
+ def self.get_balance(request)
135
+ reply = do_remote_call do |xml|
136
+ xml.getBalance("xmlns:ns" => SERVICE_NAMESPACE ) do
137
+ xml.parent.namespace = xml.parent.namespace_definitions.first
138
+ xml['ns'].version SERVICE_VERSION
139
+ xml['ns'].partnerCode request.partnerCode
140
+ xml['ns'].customerID request.customerID
141
+ xml['ns'].accountNo request.accountNo
142
+ end
143
+ end
144
+ parse_reply(:getBalance, reply)
145
+ end
146
+
147
+ def self.get_transactions(request)
148
+ reply = do_remote_call do |xml|
149
+ xml.getTransactions("xmlns:ns" => SERVICE_NAMESPACE ) do
150
+ xml.parent.namespace = xml.parent.namespace_definitions.first
151
+ xml['ns'].version SERVICE_VERSION
152
+ xml['ns'].partnerCode request.partnerCode
153
+ xml['ns'].customerID request.customerID
154
+ xml['ns'].accountNo request.accountNo
155
+ xml.dateRange do |xml|
156
+ xml.fromDate request.dateRange.fromDate unless request.dateRange.fromDate.nil?
157
+ xml.toDate request.dateRange.toDate unless request.dateRange.toDate.nil?
158
+ end
159
+ end
160
+ end
161
+ parse_reply(:getTransactions, reply)
162
+ end
163
+
164
+ def self.parse_reply(operationName, reply)
165
+ if reply.kind_of?Fault
166
+ return reply
167
+ else
168
+ case operationName
169
+ when :remit
170
+ transactionStatus = Remit::TransactionStatus.new(
171
+ content_at(reply.at_xpath('//ns:remitResponse/ns:transactionStatus/ns:statusCode', 'ns' => SERVICE_NAMESPACE)),
172
+ content_at(reply.at_xpath('//ns:remitResponse/ns:transactionStatus/ns:subStatusCode', 'ns' => SERVICE_NAMESPACE)),
173
+ content_at(reply.at_xpath('//ns:remitResponse/ns:transactionStatus/ns:bankReferenceNo', 'ns' => SERVICE_NAMESPACE)),
174
+ content_at(reply.at_xpath('//ns:remitResponse/ns:transactionStatus/ns:beneficiaryReferenceNo', 'ns' => SERVICE_NAMESPACE)),
175
+ content_at(reply.at_xpath('//ns:remitResponse/ns:transactionStatus/ns:reason', 'ns' => SERVICE_NAMESPACE))
176
+ )
177
+ return Remit::Result.new(
178
+ content_at(reply.at_xpath('//ns:remitResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
179
+ content_at(reply.at_xpath('//ns:remitResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE)),
180
+ content_at(reply.at_xpath('//ns:remitResponse/ns:attemptNo', 'ns' => SERVICE_NAMESPACE)),
181
+ content_at(reply.at_xpath('//ns:remitResponse/ns:requestReferenceNo', 'ns' => SERVICE_NAMESPACE)),
182
+ content_at(reply.at_xpath('//ns:remitResponse/ns:transferType', 'ns' => SERVICE_NAMESPACE)),
183
+ content_at(reply.at_xpath('//ns:remitResponse/ns:lowBalanceAlert', 'ns' => SERVICE_NAMESPACE)),
184
+ transactionStatus
185
+ )
186
+ when :getRemittanceStatus
187
+ transactionStatus = GetStatus::TransactionStatus.new(
188
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transactionStatus/ns:statusCode', 'ns' => SERVICE_NAMESPACE)),
189
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transactionStatus/ns:subStatusCode', 'ns' => SERVICE_NAMESPACE)),
190
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transactionStatus/ns:bankReferenceNo', 'ns' => SERVICE_NAMESPACE)),
191
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transactionStatus/ns:beneficiaryReferenceNo', 'ns' => SERVICE_NAMESPACE))
192
+ )
193
+ return GetStatus::Result.new(
194
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
195
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transferType', 'ns' => SERVICE_NAMESPACE)),
196
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:reqTransferType', 'ns' => SERVICE_NAMESPACE)),
197
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transactionDate', 'ns' => SERVICE_NAMESPACE)),
198
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transferAmount', 'ns' => SERVICE_NAMESPACE)),
199
+ content_at(reply.at_xpath('//ns:getRemittanceStatusResponse/ns:transferCurrencyCode', 'ns' => SERVICE_NAMESPACE)),
200
+ transactionStatus
201
+ )
202
+ when :getBalance
203
+ return GetBalance::Result.new(
204
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
205
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:accountCurrencyCode', 'ns' => SERVICE_NAMESPACE)),
206
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:accountBalanceAmount', 'ns' => SERVICE_NAMESPACE)),
207
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:lowBalanceAlert', 'ns' => SERVICE_NAMESPACE))
208
+ )
209
+ when :getTransactions
210
+ txnsArray = Array.new
211
+ i = 1
212
+ numTxns = content_at(reply.at_xpath('//ns:getTransactionsResponse/ns:numTransactions', 'ns' => SERVICE_NAMESPACE)).to_i
213
+ until i > numTxns
214
+ txnsArray << GetTransactions::Transaction.new(
215
+ content_at(reply.at_xpath("//ns:getTransactionsResponse/ns:transactionsArray/ns:transaction[#{i}]/ns:transactionDateTime", 'ns' => SERVICE_NAMESPACE)),
216
+ content_at(reply.at_xpath("//ns:getTransactionsResponse/ns:transactionsArray/ns:transaction[#{i}]/ns:transactionType", 'ns' => SERVICE_NAMESPACE)),
217
+ content_at(reply.at_xpath("//ns:getTransactionsResponse/ns:transactionsArray/ns:transaction[#{i}]/ns:amount", 'ns' => SERVICE_NAMESPACE)),
218
+ content_at(reply.at_xpath("//ns:getTransactionsResponse/ns:transactionsArray/ns:transaction[#{i}]/ns:narrative", 'ns' => SERVICE_NAMESPACE)),
219
+ content_at(reply.at_xpath("//ns:getTransactionsResponse/ns:transactionsArray/ns:transaction[#{i}]/ns:referenceNo", 'ns' => SERVICE_NAMESPACE)),
220
+ content_at(reply.at_xpath("//ns:getTransactionsResponse/ns:transactionsArray/ns:transaction[#{i}]/ns:balance", 'ns' => SERVICE_NAMESPACE))
221
+ )
222
+ i = i + 1;
223
+ end;
224
+ transactionsArray = GetTransactions::TransactionsArray.new(txnsArray)
225
+ return GetTransactions::Result.new(
226
+ content_at(reply.at_xpath('//ns:getTransactionsResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
227
+ content_at(reply.at_xpath('//ns:getTransactionsResponse/ns:openingBalance', 'ns' => SERVICE_NAMESPACE)),
228
+ content_at(reply.at_xpath('//ns:getTransactionsResponse/ns:numDebits', 'ns' => SERVICE_NAMESPACE)),
229
+ content_at(reply.at_xpath('//ns:getTransactionsResponse/ns:numCredits', 'ns' => SERVICE_NAMESPACE)),
230
+ content_at(reply.at_xpath('//ns:getTransactionsResponse/ns:closingBalance', 'ns' => SERVICE_NAMESPACE)),
231
+ content_at(reply.at_xpath('//ns:getTransactionsResponse/ns:numTransactions', 'ns' => SERVICE_NAMESPACE)),
232
+ transactionsArray
233
+ )
234
+ end
235
+ end
236
+ end
237
+
238
+ def url
239
+ return '/DomesticRemittanceByPartnerService'
240
+ end
241
+ end
242
+ end
@@ -23,6 +23,12 @@ module ApiBanking
23
23
  Result = Struct.new(:version, :transferType, :reqTransferType, :transactionDate, :transferAmount, :transferCurrencyCode, :transactionStatus)
24
24
  end
25
25
 
26
+ #getBalance
27
+ module GetBalance
28
+ Request = Struct.new(:version, :appID, :customerID, :AccountNumber)
29
+ Result = Struct.new(:Version, :accountCurrencyCode, :accountBalanceAmount, :lowBalanceAlert)
30
+ end
31
+
26
32
  class << self
27
33
  attr_accessor :configuration
28
34
  end
@@ -93,6 +99,19 @@ module ApiBanking
93
99
  end
94
100
  parse_reply(:getStatus, reply)
95
101
  end
102
+
103
+ def self.get_balance(request)
104
+ reply = do_remote_call do |xml|
105
+ xml.getBalance("xmlns:ns" => SERVICE_NAMESPACE ) do
106
+ xml.parent.namespace = xml.parent.namespace_definitions.first
107
+ xml['ns'].version SERVICE_VERSION
108
+ xml['ns'].appID request.appID
109
+ xml['ns'].customerID request.customerID
110
+ xml['ns'].AccountNumber request.AccountNumber
111
+ end
112
+ end
113
+ parse_reply(:getBalance, reply)
114
+ end
96
115
 
97
116
  private
98
117
 
@@ -128,13 +147,20 @@ module ApiBanking
128
147
  content_at(reply.at_xpath('//ns:getStatusResponse/ns:transactionStatus/ns:beneficiaryReferenceNo', 'ns' => SERVICE_NAMESPACE))
129
148
  )
130
149
  return GetStatus::Result.new(
131
- content_at(reply.at_xpath('//ns:getStatusResponse//ns:version', 'ns' => SERVICE_NAMESPACE)),
150
+ content_at(reply.at_xpath('//ns:getStatusResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
132
151
  content_at(reply.at_xpath('//ns:getStatusResponse/ns:transferType', 'ns' => SERVICE_NAMESPACE)),
133
152
  content_at(reply.at_xpath('//ns:getStatusResponse/ns:reqTransferType', 'ns' => SERVICE_NAMESPACE)),
134
153
  content_at(reply.at_xpath('//ns:getStatusResponse/ns:transactionDate', 'ns' => SERVICE_NAMESPACE)),
135
154
  content_at(reply.at_xpath('//ns:getStatusResponse/ns:transferAmount', 'ns' => SERVICE_NAMESPACE)),
136
155
  content_at(reply.at_xpath('//ns:getStatusResponse/ns:transferCurrencyCode', 'ns' => SERVICE_NAMESPACE)),
137
156
  transactionStatus
157
+ )
158
+ when :getBalance
159
+ return GetBalance::Result.new(
160
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:Version', 'ns' => SERVICE_NAMESPACE)),
161
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:accountCurrencyCode', 'ns' => SERVICE_NAMESPACE)),
162
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:accountBalanceAmount', 'ns' => SERVICE_NAMESPACE)),
163
+ content_at(reply.at_xpath('//ns:getBalanceResponse/ns:lowBalanceAlert', 'ns' => SERVICE_NAMESPACE))
138
164
  )
139
165
  end
140
166
  end
@@ -0,0 +1,110 @@
1
+ module ApiBanking
2
+ class InstantCreditService < SoapClient
3
+
4
+ SERVICE_NAMESPACE = 'http://www.quantiguous.com/services'
5
+ SERVICE_VERSION = 1
6
+
7
+ attr_accessor :request, :result
8
+
9
+ #payNow
10
+ module PayNow
11
+ InvoiceDetail = Struct.new(:invoiceNo, :invoiceDate, :dueDate, :invoiceAmount)
12
+ Request = Struct.new(:version, :uniqueRequestNo, :customerID, :appID, :supplierCode, :invoiceDetail, :discountedAmount, :feeAmount)
13
+ Result = Struct.new(:version, :requestReferenceNo, :creditReferenceNo)
14
+ end
15
+
16
+ #getStatus
17
+ module GetStatus
18
+ Request = Struct.new(:version, :appID, :customerID, :requestReferenceNo)
19
+ Status = Struct.new(:statusCode, :subStatusCode, :subStatusText)
20
+ Result = Struct.new(:version, :requestReferenceNo, :status, :creditReferenceNo)
21
+ end
22
+
23
+ class << self
24
+ attr_accessor :configuration
25
+ end
26
+
27
+ def self.configure
28
+ self.configuration ||= Configuration.new
29
+ yield(configuration)
30
+ end
31
+
32
+ class Configuration
33
+ attr_accessor :environment, :proxy, :timeout
34
+ end
35
+
36
+ def self.pay_now(request)
37
+ reply = do_remote_call do |xml|
38
+ xml.payNow("xmlns:ns" => SERVICE_NAMESPACE ) do
39
+ xml.parent.namespace = xml.parent.namespace_definitions.first
40
+ xml['ns'].version SERVICE_VERSION
41
+ xml['ns'].uniqueRequestNo request.uniqueRequestNo
42
+ xml['ns'].customerID request.customerID
43
+ xml['ns'].appID request.appID
44
+ xml['ns'].supplierCode request.supplierCode
45
+ xml['ns'].invoiceDetail do |xml|
46
+ xml.invoiceNo request.invoiceDetail.invoiceNo
47
+ xml.invoiceDate request.invoiceDetail.invoiceDate
48
+ xml.dueDate request.invoiceDetail.dueDate
49
+ xml.invoiceAmount request.invoiceDetail.invoiceAmount
50
+ end
51
+ xml.discountedAmount request.discountedAmount
52
+ xml.feeAmount request.feeAmount
53
+ end
54
+ end
55
+ parse_reply(:payNow, reply)
56
+ end
57
+
58
+
59
+ def self.get_status(request)
60
+ reply = do_remote_call do |xml|
61
+ xml.getStatus("xmlns:ns" => SERVICE_NAMESPACE ) do
62
+ xml.parent.namespace = xml.parent.namespace_definitions.first
63
+ xml['ns'].version SERVICE_VERSION
64
+ xml['ns'].customerID request.customerID
65
+ xml['ns'].appID request.appID
66
+ xml['ns'].requestReferenceNo request.requestReferenceNo
67
+ end
68
+ end
69
+ parse_reply(:getStatus, reply)
70
+ end
71
+
72
+ private
73
+
74
+ def self.uri()
75
+ return '/InstantCreditService'
76
+ end
77
+
78
+ def self.parse_reply(operationName, reply)
79
+ if reply.kind_of?Fault
80
+ return reply
81
+ else
82
+ case operationName
83
+ when :payNow
84
+ return PayNow::Result.new(
85
+ content_at(reply.at_xpath('//ns:payNowResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
86
+ content_at(reply.at_xpath('//ns:payNowResponse/ns:requestReferenceNo', 'ns' => SERVICE_NAMESPACE)),
87
+ content_at(reply.at_xpath('//ns:payNowResponse/ns:creditReferenceNo', 'ns' => SERVICE_NAMESPACE))
88
+ )
89
+ when :getStatus
90
+ status = GetStatus::Status.new(
91
+ content_at(reply.at_xpath('//ns:getStatusResponse/ns:status/ns:statusCode', 'ns' => SERVICE_NAMESPACE)),
92
+ content_at(reply.at_xpath('//ns:getStatusResponse/ns:status/ns:subStatusCode', 'ns' => SERVICE_NAMESPACE)),
93
+ content_at(reply.at_xpath('//ns:getStatusResponse/ns:status/ns:subStatusText', 'ns' => SERVICE_NAMESPACE))
94
+ )
95
+ return GetStatus::Result.new(
96
+ content_at(reply.at_xpath('//ns:getStatusResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
97
+ content_at(reply.at_xpath('//ns:getStatusResponse/ns:requestReferenceNo', 'ns' => SERVICE_NAMESPACE)),
98
+ status,
99
+ content_at(reply.at_xpath('//ns:getStatusResponse/ns:creditReferenceNo', 'ns' => SERVICE_NAMESPACE))
100
+ )
101
+ end
102
+ end
103
+ end
104
+
105
+ def url
106
+ return '/InstantCreditService'
107
+ end
108
+
109
+ end
110
+ end
@@ -5,6 +5,35 @@ module ApiBanking
5
5
  SERVICE_VERSION = 1
6
6
 
7
7
  attr_accessor :request, :result
8
+
9
+ module AddBeneficiary
10
+ Request = Struct.new(:uniqueRequestNo, :appID, :customerID, :beneficiaryMobileNo, :beneficiaryName, :beneficiaryAddress)
11
+ Address = Struct.new(:addressLine, :cityName, :postalCode)
12
+
13
+ Result = Struct.new(:uniqueResponseNo)
14
+ end
15
+
16
+ module CancelTransfer
17
+ Request = Struct.new(:uniqueRequestNo, :appID, :customerID, :initiateTransferRequestNo, :reasonToCancel)
18
+ Result = Struct.new(:uniqueResponseNo, :cancelResult)
19
+ CancelResult = Struct.new(:imtReferenceNo, :bankReferenceNo)
20
+ end
21
+
22
+ module DeleteBeneficiary
23
+ Request = Struct.new(:uniqueRequestNo, :appID, :customerID, :beneficiaryMobileNo)
24
+
25
+ Result = Struct.new(:uniqueResponseNo)
26
+ end
27
+
28
+ module GetBeneficiaries
29
+ Request = Struct.new(:uniqueRequestNo, :appID, :customerID, :dateRange, :numBeneficiaries)
30
+
31
+ DateRange = Struct.new(:fromDate, :toDate)
32
+ BeneficiariesArray = Struct.new(:beneficiary)
33
+ Beneficiary = Struct.new(:beneficiaryName, :beneficiaryMobileNo, :registrationDate, :addressLine, :postalCode)
34
+
35
+ Result = Struct.new(:numBeneficiaries, :beneficiariesArray)
36
+ end
8
37
 
9
38
  #transfer
10
39
  module InitiateTransfer
@@ -43,6 +72,80 @@ module ApiBanking
43
72
 
44
73
  parse_reply(:initiateTransfer, reply)
45
74
  end
75
+
76
+ def self.add_beneficiary(request)
77
+ reply = do_remote_call do |xml|
78
+ xml.addBeneficiary("xmlns:ns" => SERVICE_NAMESPACE ) do
79
+ xml.parent.namespace = xml.parent.namespace_definitions.first
80
+ xml['ns'].version SERVICE_VERSION
81
+ xml['ns'].uniqueRequestNo request.uniqueRequestNo
82
+ xml['ns'].appID request.appID
83
+ xml['ns'].customerID request.customerID
84
+ xml['ns'].beneficiaryMobileNo request.beneficiaryMobileNo
85
+ xml['ns'].beneficiaryName request.beneficiaryName
86
+ xml['ns'].beneficiaryAddress do |xml|
87
+ if request.beneficiaryAddress.kind_of? AddBeneficiary::Address
88
+ xml.addressLine request.beneficiaryAddress.addressLine
89
+ xml.cityName request.beneficiaryAddress.cityName unless request.beneficiaryAddress.cityName.nil?
90
+ xml.postalCode request.beneficiaryAddress.postalCode unless request.beneficiaryAddress.postalCode.nil?
91
+ else
92
+ xml.addressLine request.beneficiaryAddress
93
+ end
94
+ end
95
+ end
96
+ end
97
+
98
+ parse_reply(:addBeneficiary, reply)
99
+ end
100
+
101
+ def self.delete_beneficiary(request)
102
+ reply = do_remote_call do |xml|
103
+ xml.deleteBeneficiary("xmlns:ns" => SERVICE_NAMESPACE ) do
104
+ xml.parent.namespace = xml.parent.namespace_definitions.first
105
+ xml['ns'].version SERVICE_VERSION
106
+ xml['ns'].uniqueRequestNo request.uniqueRequestNo
107
+ xml['ns'].appID request.appID
108
+ xml['ns'].customerID request.customerID
109
+ xml['ns'].beneficiaryMobileNo request.beneficiaryMobileNo
110
+ end
111
+ end
112
+
113
+ parse_reply(:deleteBeneficiary, reply)
114
+ end
115
+
116
+ def self.get_beneficiaries(request)
117
+ reply = do_remote_call do |xml|
118
+ xml.getBeneficiaries("xmlns:ns" => SERVICE_NAMESPACE ) do
119
+ xml.parent.namespace = xml.parent.namespace_definitions.first
120
+ xml['ns'].version SERVICE_VERSION
121
+ xml['ns'].uniqueRequestNo request.uniqueRequestNo
122
+ xml['ns'].appID request.appID
123
+ xml['ns'].customerID request.customerID
124
+ xml.dateRange do |xml|
125
+ xml.fromDate request.dateRange.fromDate unless request.dateRange.fromDate.nil?
126
+ xml.toDate request.dateRange.toDate unless request.dateRange.toDate.nil?
127
+ end
128
+ xml['ns'].numBeneficiaries request.numBeneficiaries
129
+ end
130
+ end
131
+ parse_reply(:getBeneficiaries, reply)
132
+ end
133
+
134
+ def self.cancel_transfer(request)
135
+ reply = do_remote_call do |xml|
136
+ xml.cancelTransfer("xmlns:ns" => SERVICE_NAMESPACE ) do
137
+ xml.parent.namespace = xml.parent.namespace_definitions.first
138
+ xml['ns'].version SERVICE_VERSION
139
+ xml['ns'].uniqueRequestNo request.uniqueRequestNo
140
+ xml['ns'].appID request.appID
141
+ xml['ns'].customerID request.customerID
142
+ xml['ns'].initiateTransferRequestNo request.initiateTransferRequestNo
143
+ xml['ns'].reasonToCancel request.reasonToCancel
144
+ end
145
+ end
146
+
147
+ parse_reply(:deleteBeneficiary, reply)
148
+ end
46
149
 
47
150
  private
48
151
 
@@ -61,6 +164,43 @@ module ApiBanking
61
164
  content_at(reply.at_xpath('//ns:initiateTransferResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE)),
62
165
  transferResult
63
166
  )
167
+ when :addBeneficiary
168
+ return AddBeneficiary::Result.new(
169
+ content_at(reply.at_xpath('//ns:addBeneficiaryResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE)),
170
+ )
171
+ when :deleteBeneficiary
172
+ return DeleteBeneficiary::Result.new(
173
+ content_at(reply.at_xpath('//ns:deleteBeneficiaryResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE)),
174
+ )
175
+ when :getBeneficiaries
176
+ beneficiariesArray = Array.new
177
+ i = 1
178
+ numBeneficiaries = content_at(reply.at_xpath('//ns:getBeneficiariesResponse/ns:numBeneficiaries', 'ns' => SERVICE_NAMESPACE)).to_i
179
+ until i > numBeneficiaries
180
+ BeneficiariesArray << getBeneficiaries::Beneficiary.new(
181
+ content_at(reply.at_xpath("//ns:getBeneficiariesResponse/ns:BeneficiariesArray/ns:beneficiary[#{i}]/ns:beneficiaryName", 'ns' => SERVICE_NAMESPACE)),
182
+ content_at(reply.at_xpath("//ns:getBeneficiariesResponse/ns:BeneficiariesArray/ns:beneficiary[#{i}]/ns:beneficiaryMobileNo", 'ns' => SERVICE_NAMESPACE)),
183
+ content_at(reply.at_xpath("//ns:getBeneficiariesResponse/ns:BeneficiariesArray/ns:beneficiary[#{i}]/ns:registrationDate", 'ns' => SERVICE_NAMESPACE)),
184
+ content_at(reply.at_xpath("//ns:getBeneficiariesResponse/ns:BeneficiariesArray/ns:beneficiary[#{i}]/ns:addressLine", 'ns' => SERVICE_NAMESPACE)),
185
+ content_at(reply.at_xpath("//ns:getBeneficiariesResponse/ns:BeneficiariesArray/ns:beneficiary[#{i}]/ns:postalCode", 'ns' => SERVICE_NAMESPACE))
186
+ )
187
+ i = i + 1;
188
+ end;
189
+ beneArray = getBeneficiaries::BeneficiariesArray.new(beneficiariesArray)
190
+ return getBeneficiaries::Result.new(
191
+ content_at(reply.at_xpath('//ns:getBeneficiariesResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
192
+ content_at(reply.at_xpath('//ns:getBeneficiariesResponse/ns:numBeneficiaries', 'ns' => SERVICE_NAMESPACE)),
193
+ beneArray
194
+ )
195
+ when :cancelTransfer
196
+ cancelResult = CancelTransfer::CancelResult.new(
197
+ content_at(reply.at_xpath('//ns:cancelTransferResponse/ns:cancelResult/ns:imtReferenceNo', 'ns' => SERVICE_NAMESPACE)),
198
+ content_at(reply.at_xpath('//ns:cancelTransferResponse/ns:cancelResult/ns:bankReferenceNo', 'ns' => SERVICE_NAMESPACE))
199
+ )
200
+ return CancelTransfer::Result.new(
201
+ content_at(reply.at_xpath('//ns:cancelTransferResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE)),
202
+ cancelResult
203
+ )
64
204
  end
65
205
  end
66
206
  end
@@ -0,0 +1,396 @@
1
+ module ApiBanking
2
+ class NotificationService < SoapClient
3
+
4
+ SERVICE_NAMESPACE = 'http://www.quantiguous.com/services'
5
+ SERVICE_VERSION = 1
6
+
7
+ attr_accessor :request, :result
8
+
9
+ #getTopics
10
+ module GetTopics
11
+ ReqCriteria = Struct.new(:topicGroup, :subscriber)
12
+ Subscriber = Struct.new(:customerID, :subscribed, :unsubscribed)
13
+ Request = Struct.new(:version, :appID, :criteria)
14
+
15
+ TopicsArray = Struct.new(:topic)
16
+ Topic = Struct.new(:topicName, :topicDisplayName, :topicGroup, :needsSubscription, :notifyByEmail, :notifyBySMS, :canBeBatched, :subscriptionProvider, :criteriaDefinitionArray, :subscription)
17
+ CriteriaDefinitionArray = Struct.new(:criteriaDefinition)
18
+ CriteriaDefinition = Struct.new(:name, :valueDataType, :condition)
19
+ Subscription = Struct.new(:subscribedAt, :criteriaArray)
20
+ CriteriaArray = Struct.new(:criteria)
21
+ RepCriteria = Struct.new(:name, :value)
22
+ Value = Struct.new(:decimalValue, :dateValue, :stringValue)
23
+ Result = Struct.new(:version, :topicsArray)
24
+ end
25
+
26
+ #setSubscription
27
+ module SetSubscription
28
+ Request = Struct.new(:version, :appID, :topicName, :notifyByEmail, :notifyBySMS, :subscriber, :criteriaArray)
29
+ Subscriber = Struct.new(:customerID, :accountNo, :contact)
30
+ Contact = Struct.new(:emailID, :mobileNo)
31
+ CriteriaArray = Struct.new(:criteria)
32
+ Criteria = Struct.new(:name, :value)
33
+ Value = Struct.new(:decimalValue, :dateValue, :stringValue)
34
+ Result = Struct.new(:version, :subscribedAt)
35
+ end
36
+
37
+ #deleteSubscription
38
+ module DeleteSubscription
39
+ Request = Struct.new(:version, :appID, :topicName, :subscriber)
40
+ Subscriber = Struct.new(:customerID, :accountNo)
41
+ Result = Struct.new(:version, :subscribedAt)
42
+ end
43
+
44
+ #sendMessage
45
+ module SendMessage
46
+ Request = Struct.new(:version, :appID, :topicName, :recipient, :mergeVarArray, :criteriaArray, :referenceNo, :sendAt, :attachment)
47
+ Recipient = Struct.new(:subscriber, :guest)
48
+ Subscriber = Struct.new(:customerID, :accountNo, :contact)
49
+ Contact = Struct.new(:emailID, :mobileNo)
50
+ Guest = Struct.new(:emailID, :mobileNo)
51
+ MergeVarArray = Struct.new(:mergeVar)
52
+ MergeVar = Struct.new(:name, :content)
53
+ Content = Struct.new(:stringContent, :dateContent, :dateTimeContent, :decimalContent)
54
+ CriteriaArray = Struct.new(:criteria)
55
+ Criteria = Struct.new(:name, :value)
56
+ Value = Struct.new(:decimalValue, :dateValue, :stringValue)
57
+ Attachment = Struct.new(:filePath, :contentType)
58
+ Result = Struct.new(:version, :uniqueResponseNo)
59
+ end
60
+
61
+ #dispatchMessage
62
+ module DispatchMessage
63
+ Request = Struct.new(:version, :appID, :topicName, :recipient, :criteriaArray, :message, :referenceNo, :sendAt)
64
+ Recipient = Struct.new(:subscriber, :guest)
65
+ Subscriber = Struct.new(:customerID, :accountNo, :contact)
66
+ Contact = Struct.new(:emailID, :mobileNo)
67
+ Guest = Struct.new(:emailID, :mobileNo)
68
+ CriteriaArray = Struct.new(:criteria)
69
+ Criteria = Struct.new(:name, :value)
70
+ Value = Struct.new(:decimalValue, :dateValue, :stringValue)
71
+ Message = Struct.new(:smsText, :email)
72
+ Email = Struct.new(:subject, :bodyContent, :attachment)
73
+ Attachment = Struct.new(:filePath, :contentType)
74
+ Result = Struct.new(:version, :uniqueResponseNo)
75
+ end
76
+
77
+ class << self
78
+ attr_accessor :configuration
79
+ end
80
+
81
+ def self.configure
82
+ self.configuration ||= Configuration.new
83
+ yield(configuration)
84
+ end
85
+
86
+ class Configuration
87
+ attr_accessor :environment, :proxy, :timeout
88
+ end
89
+
90
+ def self.getTopics(request)
91
+ reply = do_remote_call do |xml|
92
+ xml.getTopics("xmlns:ns" => SERVICE_NAMESPACE ) do
93
+ xml.parent.namespace = xml.parent.namespace_definitions.first
94
+ xml['ns'].version SERVICE_VERSION
95
+ xml['ns'].appID request.appID
96
+ unless request.criteria.nil?
97
+ xml['ns'].criteria do |xml|
98
+ xml.topicGroup request.criteria.topicGroup unless request.criteria.topicGroup.nil?
99
+ unless request.criteria.subscriber.nil?
100
+ xml.subscriber do |xml|
101
+ xml.customerID request.criteria.subscriber.customerID unless request.criteria.subscriber.customerID.nil?
102
+ xml.subscribed request.criteria.subscriber.subscribed unless request.criteria.subscriber.subscribed.nil?
103
+ xml.unsubscribed request.criteria.subscriber.unsubscribed unless request.criteria.subscriber.unsubscribed.nil?
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ parse_reply(:getTopics, reply)
111
+ end
112
+
113
+ def self.setSubscription(request)
114
+ reply = do_remote_call do |xml|
115
+ xml.setSubscription("xmlns:ns" => SERVICE_NAMESPACE ) do
116
+ xml.parent.namespace = xml.parent.namespace_definitions.first
117
+ xml['ns'].version SERVICE_VERSION
118
+ xml['ns'].appID request.appID
119
+ xml['ns'].topicName request.topicName
120
+ xml['ns'].notifyByEmail request.notifyByEmail
121
+ xml['ns'].notifyBySMS request.notifyBySMS
122
+ xml['ns'].subscriber do |xml|
123
+ xml.customerID request.subscriber.customerID
124
+ xml.accountNo request.subscriber.accountNo
125
+ unless request.subscriber.contact.nil?
126
+ xml.contact do |xml|
127
+ xml.emailID request.subscriber.contact.emailID unless request.subscriber.contact.emailID.nil?
128
+ xml.mobileNo request.subscriber.contact.mobileNo unless request.subscriber.contact.mobileNo.nil?
129
+ end
130
+ end
131
+ end
132
+ unless request.criteriaArray.nil?
133
+ xml['ns'].criteriaArray do |xml|
134
+ unless request.criteriaArray.criteria.nil?
135
+ xml.criteria do |xml|
136
+ xml.name request.criteriaArray.criteria.name
137
+ xml.value do |xml|
138
+ xml.decimalValue request.criteriaArray.criteria.value.decimalValue unless request.criteriaArray.criteria.value.decimalValue.nil?
139
+ xml.dateValue request.criteriaArray.criteria.value.dateValue unless request.criteriaArray.criteria.value.dateValue.nil?
140
+ xml.stringValue request.criteriaArray.criteria.value.stringValue unless request.criteriaArray.criteria.value.stringValue.nil?
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ parse_reply(:setSubscription, reply)
149
+ end
150
+
151
+ def self.deleteSubscription(request)
152
+ reply = do_remote_call do |xml|
153
+ xml.deleteSubscription("xmlns:ns" => SERVICE_NAMESPACE ) do
154
+ xml.parent.namespace = xml.parent.namespace_definitions.first
155
+ xml['ns'].version SERVICE_VERSION
156
+ xml['ns'].appID request.appID
157
+ xml['ns'].topicName request.topicName
158
+ unless request.subscriber.nil?
159
+ xml.subscriber do |xml|
160
+ xml.customerID request.subscriber.customerID
161
+ xml.accountNo request.subscriber.accountNo unless request.subscriber.accountNo.nil?
162
+ end
163
+ end
164
+ end
165
+ end
166
+ parse_reply(:deleteSubscription, reply)
167
+ end
168
+
169
+ def self.sendMessage(request)
170
+ reply = do_remote_call do |xml|
171
+ xml.sendMessage("xmlns:ns" => SERVICE_NAMESPACE ) do
172
+ xml.parent.namespace = xml.parent.namespace_definitions.first
173
+ xml['ns'].version SERVICE_VERSION
174
+ xml['ns'].appID request.appID
175
+ xml['ns'].topicName request.topicName
176
+ xml.recipient do |xml|
177
+ xml.subscriber do |xml|
178
+ xml.customerID request.recipient.subscriber.customerID
179
+ xml.accountNo request.recipient.subscriber.accountNo unless request.recipient.subscriber.accountNo.nil?
180
+ unless request.recipient.subscriber.contact.nil?
181
+ xml.contact do |xml|
182
+ xml.emailID request.recipient.subscriber.contact.emailID unless request.recipient.subscriber.contact.emailID.nil?
183
+ xml.mobileNo request.recipient.subscriber.contact.mobileNo unless request.recipient.subscriber.contact.mobileNo.nil?
184
+ end
185
+ end
186
+ end
187
+ unless request.recipient.guest.nil?
188
+ xml.guest do |xml|
189
+ xml.emailID request.recipient.guest.emailID unless request.recipient.guest.emailID.nil?
190
+ xml.mobileNo request.recipient.guest.mobileNo unless request.recipient.guest.mobileNo.nil?
191
+ end
192
+ end
193
+ end
194
+ unless request.mergeVarArray.nil?
195
+ xml.mergeVarArray do |xml|
196
+ xml.mergeVar do |xml|
197
+ xml.name request.mergeVarArray.mergeVar.name
198
+ xml.content do |xml|
199
+ xml.stringContent request.mergeVarArray.mergeVar.content.stringContent unless request.mergeVarArray.mergeVar.content.stringContent.nil?
200
+ xml.dateContent request.mergeVarArray.mergeVar.content.dateContent unless request.mergeVarArray.mergeVar.content.dateContent.nil?
201
+ xml.dateTimeContent request.mergeVarArray.mergeVar.content.dateTimeContent unless request.mergeVarArray.mergeVar.content.dateTimeContent.nil?
202
+ xml.decimalContent request.mergeVarArray.mergeVar.content.decimalContent unless request.mergeVarArray.mergeVar.content.decimalContent.nil?
203
+ end
204
+ end
205
+ end
206
+ end
207
+ unless request.criteriaArray.nil?
208
+ xml.criteriaArray do |xml|
209
+ xml.criteria do |xml|
210
+ xml.name request.criteriaArray.criteria.name
211
+ xml.value do |xml|
212
+ xml.decimalValue request.criteriaArray.criteria.value.decimalValue unless request.criteriaArray.criteria.value.decimalValue.nil?
213
+ xml.dateValue request.criteriaArray.criteria.value.dateValue unless request.criteriaArray.criteria.value.dateValue.nil?
214
+ xml.stringValue request.criteriaArray.criteria.value.stringValue unless request.criteriaArray.criteria.value.stringValue.nil?
215
+ end
216
+ end
217
+ end
218
+ end
219
+ xml['ns'].referenceNo request.referenceNo unless request.referenceNo.nil?
220
+ xml['ns'].sendAt request.sendAt unless request.sendAt.nil?
221
+ unless request.attachment.nil?
222
+ xml['ns'].attachment do |xml|
223
+ xml.filePath request.attachment.filePath
224
+ xml.contentType request.attachment.contentType
225
+ end
226
+ end
227
+ end
228
+ end
229
+ parse_reply(:sendMessage, reply)
230
+ end
231
+
232
+ def self.dispatchMessage(request)
233
+ reply = do_remote_call do |xml|
234
+ xml.dispatchMessage("xmlns:ns" => SERVICE_NAMESPACE ) do
235
+ xml.parent.namespace = xml.parent.namespace_definitions.first
236
+ xml['ns'].version SERVICE_VERSION
237
+ xml['ns'].appID request.appID
238
+ xml['ns'].topicName request.topicName
239
+ xml.recipient do |xml|
240
+ xml.subscriber do |xml|
241
+ xml.customerID request.recipient.subscriber.customerID
242
+ xml.accountNo request.recipient.subscriber.accountNo unless request.recipient.subscriber.accountNo.nil?
243
+ unless request.recipient.subscriber.contact.nil?
244
+ xml.contact do |xml|
245
+ xml.emailID request.recipient.subscriber.contact.emailID unless request.recipient.subscriber.contact.emailID.nil?
246
+ xml.mobileNo request.recipient.subscriber.contact.mobileNo unless request.recipient.subscriber.contact.mobileNo.nil?
247
+ end
248
+ end
249
+ end
250
+ unless request.recipient.guest.nil?
251
+ xml.guest do |xml|
252
+ xml.emailID request.recipient.guest.emailID unless request.recipient.guest.emailID.nil?
253
+ xml.mobileNo request.recipient.guest.mobileNo unless request.recipient.guest.mobileNo.nil?
254
+ end
255
+ end
256
+ end
257
+ unless request.criteriaArray.nil?
258
+ xml.criteriaArray do |xml|
259
+ xml.criteria do |xml|
260
+ xml.name request.criteriaArray.criteria.name
261
+ xml.value do |xml|
262
+ xml.decimalValue request.criteriaArray.criteria.value.decimalValue unless request.criteriaArray.criteria.value.decimalValue.nil?
263
+ xml.dateValue request.criteriaArray.criteria.value.dateValue unless request.criteriaArray.criteria.value.dateValue.nil?
264
+ xml.stringValue request.criteriaArray.criteria.value.stringValue unless request.criteriaArray.criteria.value.stringValue.nil?
265
+ end
266
+ end
267
+ end
268
+ end
269
+ xml.message do |xml|
270
+ xml.smsText request.message.smsText unless request.message.smsText.nil?
271
+ unless request.message.email.nil?
272
+ xml.email do |xml|
273
+ xml.subject request.message.email.subject unless request.message.email.subject.nil?
274
+ xml.bodyContent request.message.email.bodyContent unless request.message.email.bodyContent.nil?
275
+ unless request.message.email.attachment.nil?
276
+ xml.attachment do |xml|
277
+ xml.filePath request.attachment.filePath
278
+ xml.contentType request.attachment.contentType
279
+ end
280
+ end
281
+ end
282
+ end
283
+ end
284
+ xml['ns'].referenceNo request.referenceNo unless request.referenceNo.nil?
285
+ xml['ns'].sendAt request.sendAt unless request.sendAt.nil?
286
+ end
287
+ end
288
+ parse_reply(:dispatchMessage, reply)
289
+ end
290
+
291
+ private
292
+
293
+ def self.uri()
294
+ return '/NotificationService'
295
+ end
296
+
297
+ def self.parse_reply(operationName, reply)
298
+ if reply.kind_of?Fault
299
+ return reply
300
+ else
301
+ case operationName
302
+ when :getTopics
303
+ tpcsArray = Array.new
304
+ criteriaDefArray = Array.new
305
+ criArray = Array.new
306
+
307
+ i = 1
308
+ numTopics = reply.xpath('//ns:getTopicsResponse/ns:topicsArray/ns:topic', 'ns' => SERVICE_NAMESPACE).count
309
+ until i > numTopics
310
+ numCriDef = reply.xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:criteriaDefinitionArray/ns:criteriaDefinition", 'ns' => SERVICE_NAMESPACE).count
311
+ j = 1
312
+ until j > numCriDef
313
+ criteriaDefArray << GetTopics::CriteriaDefinition.new(
314
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:criteriaDefinitionArray/ns:criteriaDefinition[#{j}]/ns:name", 'ns' => SERVICE_NAMESPACE)),
315
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:criteriaDefinitionArray/ns:criteriaDefinition[#{j}]/ns:valueDataType", 'ns' => SERVICE_NAMESPACE)),
316
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:criteriaDefinitionArray/ns:criteriaDefinition[#{j}]/ns:condition", 'ns' => SERVICE_NAMESPACE))
317
+ )
318
+ j = j + 1;
319
+ end
320
+
321
+ criteriaDefinitionArray = GetTopics::CriteriaDefinitionArray.new(criteriaDefArray)
322
+ criteriaDefArray = []
323
+
324
+ numCriteria = reply.xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:subscription/ns:criteriaArray/ns:criteria", 'ns' => SERVICE_NAMESPACE).count
325
+ j = 1
326
+ until j > numCriteria
327
+ value = GetTopics::Value.new(
328
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:subscription/ns:criteriaArray/ns:criteria[#{j}]/ns:value/ns:decimalValue", 'ns' => SERVICE_NAMESPACE)),
329
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:subscription/ns:criteriaArray/ns:criteria[#{j}]/ns:value/ns:dateValue", 'ns' => SERVICE_NAMESPACE)),
330
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:subscription/ns:criteriaArray/ns:criteria[#{j}]/ns:value/ns:stringValue", 'ns' => SERVICE_NAMESPACE))
331
+ )
332
+ criArray << GetTopics::RepCriteria.new(
333
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:subscription/ns:criteriaArray/ns:criteria[#{j}]/ns:name", 'ns' => SERVICE_NAMESPACE)),
334
+ value
335
+ )
336
+ j = j + 1;
337
+ end
338
+
339
+ criteriaArray = GetTopics::CriteriaArray.new(criArray)
340
+ criArray = []
341
+
342
+ subscription = GetTopics::Subscription.new(
343
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:subscription/ns:subscribedAt", 'ns' => SERVICE_NAMESPACE)),
344
+ criteriaArray
345
+ )
346
+
347
+ tpcsArray << GetTopics::Topic.new(
348
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:topicName", 'ns' => SERVICE_NAMESPACE)),
349
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:topicDisplayName", 'ns' => SERVICE_NAMESPACE)),
350
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:topicGroup", 'ns' => SERVICE_NAMESPACE)),
351
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:needsSubscription", 'ns' => SERVICE_NAMESPACE)),
352
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:notifyByEmail", 'ns' => SERVICE_NAMESPACE)),
353
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:notifyBySMS", 'ns' => SERVICE_NAMESPACE)),
354
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:canBeBatched", 'ns' => SERVICE_NAMESPACE)),
355
+ content_at(reply.at_xpath("//ns:getTopicsResponse/ns:topicsArray/ns:topic[#{i}]/ns:subscriptionProvider", 'ns' => SERVICE_NAMESPACE)),
356
+ (criteriaDefinitionArray.criteriaDefinition.empty? ? nil : criteriaDefinitionArray),
357
+ (subscription.subscribedAt.nil? ? nil : subscription)
358
+ )
359
+ i = i + 1;
360
+ end;
361
+
362
+ topicsArray = GetTopics::TopicsArray.new(tpcsArray)
363
+ return GetTopics::Result.new(
364
+ content_at(reply.at_xpath('//ns:getTopicsResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
365
+ (topicsArray.topic.empty? ? nil : topicsArray)
366
+ )
367
+ when :setSubscription
368
+ return SetSubscription::Result.new(
369
+ content_at(reply.at_xpath('//ns:setSubscriptionResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
370
+ content_at(reply.at_xpath('//ns:setSubscriptionResponse/ns:subscribedAt', 'ns' => SERVICE_NAMESPACE))
371
+ )
372
+ when :deleteSubscription
373
+ return DeleteSubscription::Result.new(
374
+ content_at(reply.at_xpath('//ns:deleteSubscriptionResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
375
+ content_at(reply.at_xpath('//ns:deleteSubscriptionResponse/ns:subscribedAt', 'ns' => SERVICE_NAMESPACE))
376
+ )
377
+ when :sendMessage
378
+ return SendMessage::Result.new(
379
+ content_at(reply.at_xpath('//ns:sendMessageResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
380
+ content_at(reply.at_xpath('//ns:sendMessageResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE))
381
+ )
382
+ when :dispatchMessage
383
+ return DispatchMessage::Result.new(
384
+ content_at(reply.at_xpath('//ns:dispatchMessageResponse/ns:version', 'ns' => SERVICE_NAMESPACE)),
385
+ content_at(reply.at_xpath('//ns:dispatchMessageResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE))
386
+ )
387
+ end
388
+ end
389
+ end
390
+
391
+ def url
392
+ return '/NotificationService'
393
+ end
394
+
395
+ end
396
+ end
@@ -6,7 +6,6 @@ module ApiBanking
6
6
  data = construct_envelope(&block)
7
7
  options = {}
8
8
  options[:method] = :post
9
- puts data.to_xml
10
9
  options[:body] = data.to_xml
11
10
 
12
11
  options[:headers] = {'Content-Type' => "application/xml; charset=utf-8"}
@@ -42,6 +41,8 @@ module ApiBanking
42
41
  options[:userpwd] = "#{self.configuration.environment.user}:#{self.configuration.environment.password}"
43
42
  options[:headers]["X-IBM-Client-Id"] = self.configuration.environment.client_id
44
43
  options[:headers]["X-IBM-Client-Secret"] = self.configuration.environment.client_secret
44
+ elsif self.configuration.environment.kind_of?ApiBanking::Environment::QG::DEMO
45
+ options[:userpwd] = "#{self.configuration.environment.user}:#{self.configuration.environment.password}"
45
46
  end
46
47
  end
47
48
 
@@ -96,10 +97,16 @@ module ApiBanking
96
97
  code = content_at(reply.at_xpath('//soapenv12:Fault/soapenv12:Code/soapenv12:Subcode/soapenv12:Value', 'soapenv12' => 'http://www.w3.org/2003/05/soap-envelope'))
97
98
  subcode = content_at(reply.at_xpath('//soapenv12:Fault/soapenv12:Code/soapenv12:Subcode/soapenv12:Subcode/soapenv12:Value', 'soapenv12' => 'http://www.w3.org/2003/05/soap-envelope'))
98
99
  reasonText = content_at(reply.at_xpath('//soapenv12:Fault/soapenv12:Reason/soapenv12:Text', 'soapenv12' => 'http://www.w3.org/2003/05/soap-envelope'))
99
- puts reply
100
+ # detail = parse_detail(reply.at_xpath('//soapenv12:Fault/soapenv12:Detail', 'soapenv12' => 'http://www.w3.org/2003/05/soap-envelope'))
101
+
102
+ code ||= 'ns:E500' # in certain cases, a fault code isn't set by the server
100
103
  return Fault.new(code, subcode, reasonText)
101
104
  end
102
105
 
106
+ def self.parse_detail(node)
107
+ return content_at(node.at_xpath('Text')) #
108
+ end
109
+
103
110
  def self.content_at(node)
104
111
  node.content unless node.nil?
105
112
  end
@@ -1,3 +1,3 @@
1
1
  module ApiBanking
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/api_banking.rb CHANGED
@@ -4,12 +4,16 @@ require "api_banking/version"
4
4
  require_relative "api_banking/config"
5
5
  require_relative "api_banking/environment/rbl/env"
6
6
  require_relative "api_banking/environment/ybl/env"
7
+ require_relative "api_banking/environment/qg/env"
7
8
 
8
9
  require_relative "api_banking/soap/fault"
9
10
  require_relative "api_banking/soap/soap_client"
10
11
  require_relative "api_banking/soap/fundsTransferByCustomerService"
11
12
  require_relative "api_banking/soap/fundsTransferByCustomerService2"
12
13
  require_relative "api_banking/soap/instantMoneyTransferService"
14
+ require_relative "api_banking/soap/domesticRemittanceByPartnerService"
15
+ require_relative "api_banking/soap/notificationService"
16
+ require_relative "api_banking/soap/instantCreditService"
13
17
 
14
18
  require_relative "api_banking/json/json_client"
15
19
  require_relative "api_banking/json/singlePayment"
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - akil
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-14 00:00:00.000000000 Z
11
+ date: 2016-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: typhoeus
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -99,16 +127,20 @@ files:
99
127
  - bin/setup
100
128
  - lib/api_banking.rb
101
129
  - lib/api_banking/config.rb
130
+ - lib/api_banking/environment/qg/env.rb
102
131
  - lib/api_banking/environment/rbl/env.rb
103
132
  - lib/api_banking/environment/rbl/uat.pem
104
133
  - lib/api_banking/environment/ybl/env.rb
105
134
  - lib/api_banking/environment/ybl/prd.pem
106
135
  - lib/api_banking/json/json_client.rb
107
136
  - lib/api_banking/json/singlePayment.rb
137
+ - lib/api_banking/soap/domesticRemittanceByPartnerService.rb
108
138
  - lib/api_banking/soap/fault.rb
109
139
  - lib/api_banking/soap/fundsTransferByCustomerService.rb
110
140
  - lib/api_banking/soap/fundsTransferByCustomerService2.rb
141
+ - lib/api_banking/soap/instantCreditService.rb
111
142
  - lib/api_banking/soap/instantMoneyTransferService.rb
143
+ - lib/api_banking/soap/notificationService.rb
112
144
  - lib/api_banking/soap/soap_client.rb
113
145
  - lib/api_banking/version.rb
114
146
  homepage: http://apibanking.com