api_banking 0.1.1 → 0.1.2

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: 6fb3ab5328b473b53f06e6b72223930a527fed0e
4
- data.tar.gz: dde79ce6b87eeaea4cb67ca3889087d4c94a0ce7
3
+ metadata.gz: 46675c94a4a5bc3aaf5afd02109ad2a9d0dfc6bf
4
+ data.tar.gz: e389195659f4eaa9d0054d1d6007cbd5ce21fcd5
5
5
  SHA512:
6
- metadata.gz: 6f5c64588f9e40ed140cd59ad33a99be2fe4e386378f2b367caf04517653962339baee6afcd5581ddf5db2e382a93ae5dd157361680c2467e2434aab5348dc58
7
- data.tar.gz: 22e9289472462aa42671c1b80f3b63fe206b9911537ea31c5b2547ce3d00f0ea2da2aa0827f104ecee5d8b9e805775006034333604b7e6f971694ff14452609b
6
+ metadata.gz: ca4036c4662b570388285b4b0f9d559315696b1ace7246c9724764c0adb344ecdda17faa60027ff87da1d1632300cf305ccf38161b5f914220ed0ac98ee5c315
7
+ data.tar.gz: 00aededa91b5db014558a72be59773d7fed3f6277a2294a61b137b5ae8356e3ebf6abd7c6a3fa1a218451ae498df20834d07b4c194796af318a3b11f24d582e3
@@ -1,18 +1,24 @@
1
1
  module ApiBanking
2
2
  module Environment
3
3
  module YBL
4
- UAT = Struct.new(:user, :password, :client_id, :client_secret, :url) do
4
+ UAT = Struct.new(:user, :password, :client_id, :client_secret, :endpoints) do
5
5
  def initialize(*)
6
6
  super
7
- self.url ||= 'https://uatsky.yesbank.in/app/uat/'
7
+ self.endpoints = {
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'
11
+ }
8
12
  end
9
13
  end
10
14
 
11
- PRD = Struct.new(:user, :password, :client_id, :client_secret, :ssl_client_cert, :ssl_client_key, :ssl_ca_file, :url) do
15
+ PRD = Struct.new(:user, :password, :client_id, :client_secret, :ssl_client_cert, :ssl_client_key, :ssl_ca_file, :endpoints) do
12
16
  def initialize(*)
13
17
  super
14
18
  self.ssl_ca_file ||= File.expand_path('./prd.pem', File.dirname(__FILE__))
15
- self.url ||= 'https://sky.yesbank.in:444/app/live/ssl'
19
+ self.endpoints = {
20
+ FundsTransferByCustomerService: 'https://sky.yesbank.in:444/app/live/ssl/fundsTransferByCustomerService'
21
+ }
16
22
  end
17
23
  end
18
24
  end
@@ -0,0 +1,69 @@
1
+ module ApiBanking
2
+ class InstantMoneyTransferService < SoapClient
3
+
4
+ SERVICE_NAMESPACE = 'http://www.quantiguous.com/services'
5
+ SERVICE_VERSION = 1
6
+
7
+ attr_accessor :request, :result
8
+
9
+ #transfer
10
+ module InitiateTransfer
11
+ Request = Struct.new(:uniqueRequestNo, :appID, :customerID, :beneficiaryMobileNo, :transferAmount, :passCode, :remitterToBeneficiaryInfo)
12
+ Result = Struct.new(:uniqueResponseNo, :initiateTransferResult)
13
+ TransferResult = Struct.new(:bankReferenceNo, :imtReferenceNo)
14
+ end
15
+
16
+ class << self
17
+ attr_accessor :configuration
18
+ end
19
+
20
+ def self.configure
21
+ self.configuration ||= Configuration.new
22
+ yield(configuration)
23
+ end
24
+
25
+ class Configuration
26
+ attr_accessor :environment, :proxy, :timeout
27
+ end
28
+
29
+ def self.transfer(request)
30
+ reply = do_remote_call do |xml|
31
+ xml.initiateTransfer("xmlns:ns" => SERVICE_NAMESPACE ) do
32
+ xml.parent.namespace = xml.parent.namespace_definitions.first
33
+ xml['ns'].version SERVICE_VERSION
34
+ xml['ns'].uniqueRequestNo request.uniqueRequestNo
35
+ xml['ns'].appID request.appID
36
+ xml['ns'].customerID request.customerID
37
+ xml['ns'].beneficiaryMobileNo request.beneficiaryMobileNo
38
+ xml['ns'].transferAmount request.transferAmount
39
+ xml['ns'].passCode request.passCode
40
+ xml['ns'].remitterToBeneficiaryInfo request.remitterToBeneficiaryInfo
41
+ end
42
+ end
43
+
44
+ parse_reply(:initiateTransfer, reply)
45
+ end
46
+
47
+ private
48
+
49
+ def self.parse_reply(operationName, reply)
50
+ if reply.kind_of?Fault
51
+ return reply
52
+ else
53
+ puts reply
54
+ case operationName
55
+ when :initiateTransfer
56
+ transferResult = InitiateTransfer::TransferResult.new(
57
+ content_at(reply.at_xpath('//ns:initiateTransferResponse/ns:initiateTransferResult/ns:bankReferenceNo', 'ns' => SERVICE_NAMESPACE)),
58
+ content_at(reply.at_xpath('//ns:initiateTransferResponse/ns:initiateTransferResult/ns:imtReferenceNo', 'ns' => SERVICE_NAMESPACE))
59
+ )
60
+ return InitiateTransfer::Result.new(
61
+ content_at(reply.at_xpath('//ns:initiateTransferResponse/ns:uniqueResponseNo', 'ns' => SERVICE_NAMESPACE)),
62
+ transferResult
63
+ )
64
+ end
65
+ end
66
+ end
67
+
68
+ end
69
+ end
@@ -6,16 +6,22 @@ module ApiBanking
6
6
  data = construct_envelope(&block)
7
7
  options = {}
8
8
  options[:method] = :post
9
+ puts data.to_xml
9
10
  options[:body] = data.to_xml
10
11
 
11
12
  options[:headers] = {'Content-Type' => "application/xml; charset=utf-8"}
13
+
14
+ # SOAPAction header is not allowed for Soap12
15
+ # options[:headers][:SOAPAction] = data.doc.at_xpath('/soapenv12:Envelope/soapenv12:Body/*', 'soapenv12' => 'http://www.w3.org/2003/05/soap-envelope').name
12
16
 
13
17
  options[:proxy] = self.configuration.proxy
14
18
  options[:timeout] = self.configuration.timeout
15
19
 
16
20
  set_options_for_environment(options)
17
-
18
- request = Typhoeus::Request.new(self.configuration.environment.url + uri, options)
21
+
22
+ options[:headers]['User-Agent'] = "Quantiguous; API Banking, Ruby Gem #{ApiBanking::VERSION}"
23
+
24
+ request = Typhoeus::Request.new(self.configuration.environment.endpoints[self.name.split('::').last.to_sym], options)
19
25
  response = request.run
20
26
 
21
27
  parse_response(response)
@@ -90,6 +96,7 @@ module ApiBanking
90
96
  code = content_at(reply.at_xpath('//soapenv12:Fault/soapenv12:Code/soapenv12:Subcode/soapenv12:Value', 'soapenv12' => 'http://www.w3.org/2003/05/soap-envelope'))
91
97
  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'))
92
98
  reasonText = content_at(reply.at_xpath('//soapenv12:Fault/soapenv12:Reason/soapenv12:Text', 'soapenv12' => 'http://www.w3.org/2003/05/soap-envelope'))
99
+ puts reply
93
100
  return Fault.new(code, subcode, reasonText)
94
101
  end
95
102
 
@@ -1,3 +1,3 @@
1
1
  module ApiBanking
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/api_banking.rb CHANGED
@@ -9,6 +9,7 @@ require_relative "api_banking/soap/fault"
9
9
  require_relative "api_banking/soap/soap_client"
10
10
  require_relative "api_banking/soap/fundsTransferByCustomerService"
11
11
  require_relative "api_banking/soap/fundsTransferByCustomerService2"
12
+ require_relative "api_banking/soap/instantMoneyTransferService"
12
13
 
13
14
  require_relative "api_banking/json/json_client"
14
15
  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.1
4
+ version: 0.1.2
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-13 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,7 @@ files:
108
108
  - lib/api_banking/soap/fault.rb
109
109
  - lib/api_banking/soap/fundsTransferByCustomerService.rb
110
110
  - lib/api_banking/soap/fundsTransferByCustomerService2.rb
111
+ - lib/api_banking/soap/instantMoneyTransferService.rb
111
112
  - lib/api_banking/soap/soap_client.rb
112
113
  - lib/api_banking/version.rb
113
114
  homepage: http://apibanking.com