dapi 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dapi.gemspec +27 -0
- data/lib/dapi.rb +105 -0
- data/lib/dapi/products/Auth.rb +57 -0
- data/lib/dapi/products/DataAPI.rb +128 -0
- data/lib/dapi/products/Jobs.rb +45 -0
- data/lib/dapi/products/Payment.rb +61 -0
- data/lib/dapi/version.rb +3 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7f6ecd0b4e688fe97ac4a1a7aff6693b092b1ccba86cb876f3f8cd648ce9512e
|
4
|
+
data.tar.gz: 25919294f207fe1d068256b417fb733e92159b3c19dbea3187e1a4064ed94c9a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a485af320a0b2b0b31c72d202311256a92416645092a3e3178256896a9713263cbd5cc361b3fe08141217ff70fee324bee568532632114b806dcf4aea56a9d3
|
7
|
+
data.tar.gz: fa674408d4ab4874e1c8d661196aabe0be449722f25786d15a9813bdc65f8febacff4161c93a9cae5b279361004fcd0c0f8a0605184b74dd1ad62be701c6bf2a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Shaheen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Dapi
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'dapi'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install dapi
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require Dapi
|
23
|
+
|
24
|
+
client = DapiClient(app_secret)
|
25
|
+
```
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dapi-co/dapi-ruby.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dapi"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/dapi.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "dapi/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dapi"
|
8
|
+
spec.version = Dapi::VERSION
|
9
|
+
spec.authors = ["Dapi"]
|
10
|
+
spec.email = ["dev@dapi.co"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby Library for Dapi Connect API.}
|
13
|
+
spec.homepage = "https://github.com/dapi-co/dapi-ruby"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
end
|
data/lib/dapi.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
require "dapi/version"
|
2
|
+
require 'json'
|
3
|
+
require_relative "dapi/products/auth"
|
4
|
+
require_relative "dapi/products/jobs"
|
5
|
+
require_relative "dapi/products/dataAPI"
|
6
|
+
require_relative "dapi/products/payment"
|
7
|
+
|
8
|
+
include Auth
|
9
|
+
include Jobs
|
10
|
+
include DataAPI
|
11
|
+
include Payment
|
12
|
+
|
13
|
+
module Dapi
|
14
|
+
class DapiClient
|
15
|
+
def initialize(secret)
|
16
|
+
@appSecret=secret
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
###### Authentication API #####
|
21
|
+
|
22
|
+
|
23
|
+
def exchangeToken(userSecret, accessCode, connectionID)
|
24
|
+
JSON.parse(Auth.exchangeToken(@appSecret, accessCode, connectionID).to_s, object_class: OpenStruct)
|
25
|
+
end
|
26
|
+
|
27
|
+
def checkLogin(userSecret, token, sync = false, addresses = [])
|
28
|
+
JSON.parse(Auth.checkLogin(@appSecret, userSecret, sync, addresses).to_s, object_class: OpenStruct)
|
29
|
+
end
|
30
|
+
|
31
|
+
def delinkUser(userSecret, token)
|
32
|
+
JSON.parse(Auth.delinkUser(@appSecret, accessCode).to_s, object_class: OpenStruct)
|
33
|
+
end
|
34
|
+
|
35
|
+
def refreshAccessToken(userSecret, token)
|
36
|
+
JSON.parse(Auth.refreshAccessToken(@appSecret, accessToken).to_s, object_class: OpenStruct)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
###### Data API #####
|
41
|
+
|
42
|
+
|
43
|
+
def getIdentity(userSecret, token, sync = false, addresses = [])
|
44
|
+
JSON.parse(DataAPI.getIdentity(@appSecret, userSecret, token, sync, addresses).to_s, object_class: OpenStruct)
|
45
|
+
end
|
46
|
+
|
47
|
+
def getAccounts(userSecret, token, sync = false, addresses = [])
|
48
|
+
JSON.parse(DataAPI.getAccounts(@appSecret, userSecret, token, sync, addresses).to_s, object_class: OpenStruct)
|
49
|
+
end
|
50
|
+
|
51
|
+
def getCards(userSecret, token, sync = false, addresses = [])
|
52
|
+
JSON.parse(DataAPI.getCards(@appSecret, userSecret, token, sync, addresses).to_s, object_class: OpenStruct)
|
53
|
+
end
|
54
|
+
|
55
|
+
def getBalance(userSecret, accountID, token, sync = false, addresses = [])
|
56
|
+
JSON.parse(DataAPI.getBalance(@appSecret, userSecret, accountID, token, sync, addresses).to_s, object_class: OpenStruct)
|
57
|
+
end
|
58
|
+
|
59
|
+
def getCardBalance(userSecret, cardID, token, sync = false, addresses = [])
|
60
|
+
JSON.parse(DataAPI.getCardBalance(@appSecret, userSecret, cardID, token, sync, addresses).to_s, object_class: OpenStruct)
|
61
|
+
end
|
62
|
+
|
63
|
+
def getTranscations(userSecret, accountID, fromDate, toDate, token, sync = false, addresses = [])
|
64
|
+
JSON.parse(DataAPI.getTranscations(@appSecret, userSecret, accountID, fromDate, toDate, token, sync, addresses).to_s, object_class: OpenStruct)
|
65
|
+
end
|
66
|
+
|
67
|
+
def getCardTransactions(userSecret, cardID, fromDate, toDate, token, sync = false, addresses = [])
|
68
|
+
JSON.parse(DataAPI.getCardTransactions(@appSecret, userSecret, cardID, fromDate, toDate, token, sync, addresses).to_s, object_class: OpenStruct)
|
69
|
+
end
|
70
|
+
|
71
|
+
def getAccountsMetaData(appSecret, userSecret, sync = false, addresses = [])
|
72
|
+
JSON.parse(DataAPI.getAccountsMetaData(@appSecret, userSecret, sync, addresses).to_s, object_class: OpenStruct)
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
###### Payment API #####
|
77
|
+
|
78
|
+
|
79
|
+
def getBeneficiaries(userSecret, token, sync = false, addresses = [])
|
80
|
+
JSON.parse(Payment.getBeneficiaries(@appSecret, userSecret, token, sync, addresses).to_s, object_class: OpenStruct)
|
81
|
+
end
|
82
|
+
|
83
|
+
def createBeneficiary(userSecret, token, swiftCode = "", type = "", name = "", accountNumber = "",
|
84
|
+
address = "", iban = "", sync = false, addresses = [])
|
85
|
+
JSON.parse(Payment.createBeneficiary(@appSecret, userSecret, token, swiftCode, type, name, accountNumber, address, iban, sync, addresses).to_s, object_class: OpenStruct)
|
86
|
+
end
|
87
|
+
|
88
|
+
def createTransfer(userSecret, token, receiverID = "", senderID = "", remark = "", sync = false, addresses = [])
|
89
|
+
JSON.parse(Payment.createTransfer(@appSecret, userSecret, token, receiverID, senderID, remark, sync, addresses).to_s, object_class: OpenStruct)
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
###### Jobs API #####
|
94
|
+
|
95
|
+
|
96
|
+
def resumeJob(userSecret, token, sync = false, addresses = [])
|
97
|
+
JSON.parse(Jobs.resumeJob(appSecret, userSecret, jobID, sync = true, userInputs, addresses).to_s, object_class: OpenStruct)
|
98
|
+
end
|
99
|
+
|
100
|
+
def jobStatus(userSecret, token, sync = false, addresses = [])
|
101
|
+
JSON.parse(Jobs.jobStatus(appSecret, jobID, sync = true, userSecret, addresses).to_s, object_class: OpenStruct)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
module Auth
|
4
|
+
|
5
|
+
def exchangeToken(appSecret, accessCode, connectionID)
|
6
|
+
payload = {
|
7
|
+
appSecret: appSecret,
|
8
|
+
accessCode: accessCode,
|
9
|
+
connectionID: connectionID
|
10
|
+
}
|
11
|
+
headers = {
|
12
|
+
"Content-Type": "application/json"
|
13
|
+
}
|
14
|
+
|
15
|
+
response = HTTParty.post( "http://localhost:80/v1/auth/ExchangeToken", {body: payload.to_json, headers: headers} )
|
16
|
+
end
|
17
|
+
|
18
|
+
def checkLogin(appSecret, userSecret, sync, addresses)
|
19
|
+
payload = {
|
20
|
+
appSecret: appSecret,
|
21
|
+
userSecret: userSecret,
|
22
|
+
sync: sync
|
23
|
+
}
|
24
|
+
headers = {
|
25
|
+
"Content-Type": "application/json"
|
26
|
+
}
|
27
|
+
|
28
|
+
response = HTTParty.post( "https://api.dapi.co/v1/auth/login/check", {body: payload.to_json, headers: headers})
|
29
|
+
end
|
30
|
+
|
31
|
+
def delinkUser(appSecret, accessCode, token)
|
32
|
+
payload = {
|
33
|
+
appSecret: appSecret,
|
34
|
+
accessCode: accessCode
|
35
|
+
}
|
36
|
+
headers = {
|
37
|
+
"Content-Type": "application/json",
|
38
|
+
Authorization: "Bearer #{token}"
|
39
|
+
}
|
40
|
+
|
41
|
+
response = HTTParty.post( "https://api.dapi.co/v1/Users/DelinkUser", {body: payload.to_json, headers: headers} )
|
42
|
+
end
|
43
|
+
|
44
|
+
def refreshAccessToken(appSecret, accessToken)
|
45
|
+
payload = {
|
46
|
+
appSecret: appSecret,
|
47
|
+
accessToken: accessToken
|
48
|
+
}
|
49
|
+
headers = {
|
50
|
+
"Content-Type": "application/json",
|
51
|
+
Authorization: "Bearer #{token}"
|
52
|
+
}
|
53
|
+
|
54
|
+
response = HTTParty.post( "https://api.dapi.co/v1/Users/DelinkUser", {body: payload.to_json, headers: headers} )
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
module DataAPI
|
4
|
+
|
5
|
+
def getIdentity(appSecret, userSecret, token, sync, addresses)
|
6
|
+
payload = {
|
7
|
+
appSecret: appSecret,
|
8
|
+
userSecret: userSecret,
|
9
|
+
sync: sync,
|
10
|
+
addresses: addresses
|
11
|
+
}
|
12
|
+
headers = {
|
13
|
+
"Content-Type": "application/json",
|
14
|
+
Authorization: "Bearer #{token}"
|
15
|
+
}
|
16
|
+
|
17
|
+
response = HTTParty.post( "http://localhost:80/v1/data/identity/get", {body: payload.to_json, headers: headers} )
|
18
|
+
end
|
19
|
+
|
20
|
+
def getAccounts(appSecret, userSecret, token, sync, addresses)
|
21
|
+
payload = {
|
22
|
+
appSecret: appSecret,
|
23
|
+
userSecret: userSecret,
|
24
|
+
sync: sync,
|
25
|
+
addresses: addresses
|
26
|
+
}
|
27
|
+
headers = {
|
28
|
+
"Content-Type": "application/json",
|
29
|
+
Authorization: "Bearer #{token}"
|
30
|
+
}
|
31
|
+
|
32
|
+
response = HTTParty.post( "http://localhost:80/v1/data/accounts/get", {body: payload.to_json, headers: headers} )
|
33
|
+
end
|
34
|
+
|
35
|
+
def getCards(appSecret, userSecret, token, sync, addresses)
|
36
|
+
payload = {
|
37
|
+
appSecret: appSecret,
|
38
|
+
userSecret: userSecret,
|
39
|
+
sync: sync,
|
40
|
+
addresses: addresses
|
41
|
+
}
|
42
|
+
headers = {
|
43
|
+
"Content-Type": "application/json",
|
44
|
+
Authorization: "Bearer #{token}"
|
45
|
+
}
|
46
|
+
|
47
|
+
response = HTTParty.post( "http://localhost:80/v1/data/cards/get", {body: payload.to_json, headers: headers} )
|
48
|
+
end
|
49
|
+
|
50
|
+
def getBalance(appSecret, userSecret, accountID, token, sync, addresses)
|
51
|
+
payload = {
|
52
|
+
appSecret: appSecret,
|
53
|
+
userSecret: userSecret,
|
54
|
+
sync: sync,
|
55
|
+
accountID: accountID,
|
56
|
+
addresses: addresses
|
57
|
+
}
|
58
|
+
headers = {
|
59
|
+
"Content-Type": "application/json",
|
60
|
+
Authorization: "Bearer #{token}"
|
61
|
+
}
|
62
|
+
|
63
|
+
response = HTTParty.post( "http://localhost:80/v1/data/balance/get", {body: payload.to_json, headers: headers} )
|
64
|
+
end
|
65
|
+
|
66
|
+
def getCardBalance(appSecret, userSecret, cardID, token, sync, addresses)
|
67
|
+
payload = {
|
68
|
+
appSecret: appSecret,
|
69
|
+
userSecret: userSecret,
|
70
|
+
sync: sync,
|
71
|
+
cardID: cardID,
|
72
|
+
addresses: addresses
|
73
|
+
}
|
74
|
+
headers = {
|
75
|
+
"Content-Type": "application/json",
|
76
|
+
Authorization: "Bearer #{token}"
|
77
|
+
}
|
78
|
+
|
79
|
+
response = HTTParty.post( "http://localhost:80/v1/data/balance/get", {body: payload.to_json, headers: headers} )
|
80
|
+
end
|
81
|
+
|
82
|
+
def getTranscations(appSecret, userSecret, accountID, fromDate, toDate, token, sync, addresses)
|
83
|
+
payload = {
|
84
|
+
appSecret: appSecret,
|
85
|
+
userSecret: userSecret,
|
86
|
+
sync: sync,
|
87
|
+
accountID: accountID,
|
88
|
+
addresses: addresses
|
89
|
+
}
|
90
|
+
headers = {
|
91
|
+
"Content-Type": "application/json",
|
92
|
+
Authorization: "Bearer #{token}"
|
93
|
+
}
|
94
|
+
|
95
|
+
response = HTTParty.post( "http://localhost:80/v1/data/transactions/get", {body: payload.to_json, headers: headers} )
|
96
|
+
end
|
97
|
+
|
98
|
+
def getCardTransactions(appSecret, userSecret, cardID, fromDate, toDate, token, sync, addresses)
|
99
|
+
payload = {
|
100
|
+
appSecret: appSecret,
|
101
|
+
userSecret: userSecret,
|
102
|
+
sync: sync,
|
103
|
+
cardID: cardID,
|
104
|
+
addresses: addresses
|
105
|
+
}
|
106
|
+
headers = {
|
107
|
+
"Content-Type": "application/json",
|
108
|
+
Authorization: "Bearer #{token}"
|
109
|
+
}
|
110
|
+
|
111
|
+
response = HTTParty.post( "http://localhost:80/v1/data/transactions/get", {body: payload.to_json, headers: headers} )
|
112
|
+
end
|
113
|
+
|
114
|
+
def getAccountsMetaData(appSecret, userSecret, sync, addresses)
|
115
|
+
payload = {
|
116
|
+
appSecret: appSecret,
|
117
|
+
userSecret: userSecret,
|
118
|
+
sync: sync,
|
119
|
+
addresses: addresses
|
120
|
+
}
|
121
|
+
headers = {
|
122
|
+
"Content-Type": "application/json",
|
123
|
+
Authorization: "Bearer #{token}"
|
124
|
+
}
|
125
|
+
|
126
|
+
response = HTTParty.post( "http://localhost:80/v1/data/transactions/get", {body: payload.to_json, headers: headers} )
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
module Jobs
|
4
|
+
|
5
|
+
def resumeJob(appSecret, userSecret, jobID, sync, userInputs, addresses)
|
6
|
+
payload = {
|
7
|
+
appSecret: appSecret,
|
8
|
+
userSecret: userSecret,
|
9
|
+
jobID: jobID,
|
10
|
+
sync: sync,
|
11
|
+
userInputs: userInputs,
|
12
|
+
addresses: addresses
|
13
|
+
}
|
14
|
+
headers = {
|
15
|
+
"Content-Type": "application/json"
|
16
|
+
}
|
17
|
+
|
18
|
+
response = HTTParty.post( "http://localhost:80/v1/job/resume", {body: payload.to_json, headers: headers} )
|
19
|
+
end
|
20
|
+
|
21
|
+
def jobStatus(appSecret, jobID, sync, userSecret, addresses)
|
22
|
+
payload = {
|
23
|
+
appSecret: appSecret,
|
24
|
+
userSecret: userSecret,
|
25
|
+
jobID: jobID,
|
26
|
+
sync: sync,
|
27
|
+
addresses: addresses
|
28
|
+
}
|
29
|
+
if userSecret == ""
|
30
|
+
payload = {
|
31
|
+
appSecret: appSecret,
|
32
|
+
jobID: jobID,
|
33
|
+
sync: sync,
|
34
|
+
addresses: addresses
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
headers = {
|
39
|
+
"Content-Type": "application/json"
|
40
|
+
}
|
41
|
+
|
42
|
+
response = HTTParty.post( "https://api.dapi.co/v1/auth/job/status", {body: payload.to_json, headers: headers})
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
module Payment
|
4
|
+
|
5
|
+
def getBeneficiaries(appSecret, userSecret, token, sync, addresses)
|
6
|
+
payload = {
|
7
|
+
appSecret: appSecret,
|
8
|
+
accessCode: accessCode,
|
9
|
+
sync: sync,
|
10
|
+
addresses: addresses
|
11
|
+
}
|
12
|
+
headers = {
|
13
|
+
"Content-Type": "application/json",
|
14
|
+
Authorization: "Bearer #{token}"
|
15
|
+
}
|
16
|
+
|
17
|
+
response = HTTParty.post( "http://localhost:80/v1/payment/beneficiaries/get", {body: payload.to_json, headers: headers} )
|
18
|
+
end
|
19
|
+
|
20
|
+
def createBeneficiary(appSecret, userSecret, token, params, sync, addresses)
|
21
|
+
payload = {
|
22
|
+
appSecret: appSecret,
|
23
|
+
userSecret: userSecret,
|
24
|
+
name: params[:name],
|
25
|
+
accountNumber: params[:accountNumber],
|
26
|
+
type: params[:type],
|
27
|
+
address: params[:address],
|
28
|
+
country: params[:country],
|
29
|
+
sortCode: params[:sortCode],
|
30
|
+
branchAddress: params[:branchAddress],
|
31
|
+
branchName: params[:branchName],
|
32
|
+
phoneNumber: params[:phoneNumber],
|
33
|
+
iban: params[:iban],
|
34
|
+
swiftCode: params[:swiftCode],
|
35
|
+
sync: sync,
|
36
|
+
addresses: addresses
|
37
|
+
}
|
38
|
+
headers = {
|
39
|
+
"Content-Type": "application/json",
|
40
|
+
Authorization: "Bearer #{token}"
|
41
|
+
}
|
42
|
+
|
43
|
+
response = HTTParty.post( "https://api.dapi.co/v1/payment/beneficiaries/create", {body: payload.to_json, headers: headers})
|
44
|
+
end
|
45
|
+
|
46
|
+
def createTransfer(appSecret, userSecret, token, receiverID, senderID, remark, sync, addresses)
|
47
|
+
payload = {
|
48
|
+
appSecret: appSecret,
|
49
|
+
accessCode: accessCode,
|
50
|
+
sync: sync,
|
51
|
+
addresses: addresses
|
52
|
+
}
|
53
|
+
headers = {
|
54
|
+
"Content-Type": "application/json",
|
55
|
+
Authorization: "Bearer #{token}"
|
56
|
+
}
|
57
|
+
|
58
|
+
response = HTTParty.post( "https://api.dapi.co/v1/payment/transfer/create", {body: payload.to_json, headers: headers} )
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/lib/dapi/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dapi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dapi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- dev@dapi.co
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- dapi.gemspec
|
72
|
+
- lib/dapi.rb
|
73
|
+
- lib/dapi/products/Auth.rb
|
74
|
+
- lib/dapi/products/DataAPI.rb
|
75
|
+
- lib/dapi/products/Jobs.rb
|
76
|
+
- lib/dapi/products/Payment.rb
|
77
|
+
- lib/dapi/version.rb
|
78
|
+
homepage: https://github.com/dapi-co/dapi-ruby
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubygems_version: 3.0.3
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Ruby Library for Dapi Connect API.
|
101
|
+
test_files: []
|