synapse_pay_rest 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +12 -8
- data/README.md +2 -3
- data/lib/synapse_pay_rest/api/nodes.rb +2 -3
- data/lib/synapse_pay_rest/api/trans.rb +1 -1
- data/lib/synapse_pay_rest/api/users.rb +50 -18
- data/lib/synapse_pay_rest/http_client.rb +4 -3
- data/lib/synapse_pay_rest/version.rb +1 -1
- data/samples.md +161 -132
- data/synapse_pay_rest.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eb067fcbf87836159c1afdfeb9fdf13a0b64c6a
|
4
|
+
data.tar.gz: 8e41c3f89e3de30798a252645ec77310d4cc39e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b981fbc586dec4a9cfe4f08e973f8a333d7993a7aa5520124e330020cf0be64e8f421d9caa0b0b3f8e6e38288729edcc7209ebbca94eb8a171cf8c8e046d20a
|
7
|
+
data.tar.gz: 249ed0c41fad41c2ec69703df4eb17d5370981bd0fa8fb51f713436ffe958543cb2a54cff29383476e71e32711b8a7d05d8aac3897e5306486d3d592a8c8303d
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synapse_pay_rest (0.0.
|
4
|
+
synapse_pay_rest (0.0.13)
|
5
5
|
rest-client
|
6
6
|
|
7
7
|
GEM
|
@@ -9,11 +9,14 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
ansi (1.5.0)
|
11
11
|
builder (3.2.2)
|
12
|
-
domain_name (0.5.
|
12
|
+
domain_name (0.5.20160826)
|
13
13
|
unf (>= 0.0.5, < 1.0.0)
|
14
|
+
dotenv (2.1.1)
|
14
15
|
http-cookie (1.0.2)
|
15
16
|
domain_name (~> 0.5)
|
16
|
-
mime-types (
|
17
|
+
mime-types (3.1)
|
18
|
+
mime-types-data (~> 3.2015)
|
19
|
+
mime-types-data (3.2016.0521)
|
17
20
|
minitest (5.8.2)
|
18
21
|
minitest-reporters (1.1.5)
|
19
22
|
ansi
|
@@ -22,24 +25,25 @@ GEM
|
|
22
25
|
ruby-progressbar
|
23
26
|
netrc (0.11.0)
|
24
27
|
rake (10.4.2)
|
25
|
-
rest-client (
|
28
|
+
rest-client (2.0.0)
|
26
29
|
http-cookie (>= 1.0.2, < 2.0)
|
27
|
-
mime-types (>= 1.16, <
|
28
|
-
netrc (~> 0.
|
30
|
+
mime-types (>= 1.16, < 4.0)
|
31
|
+
netrc (~> 0.8)
|
29
32
|
ruby-progressbar (1.7.5)
|
30
33
|
unf (0.1.4)
|
31
34
|
unf_ext
|
32
|
-
unf_ext (0.0.7.
|
35
|
+
unf_ext (0.0.7.2)
|
33
36
|
|
34
37
|
PLATFORMS
|
35
38
|
ruby
|
36
39
|
|
37
40
|
DEPENDENCIES
|
38
41
|
bundler (~> 1.10)
|
42
|
+
dotenv
|
39
43
|
minitest
|
40
44
|
minitest-reporters
|
41
45
|
rake (~> 10.0)
|
42
46
|
synapse_pay_rest!
|
43
47
|
|
44
48
|
BUNDLED WITH
|
45
|
-
1.
|
49
|
+
1.13.0
|
data/README.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
## SynapsePayRest-Ruby
|
2
2
|
|
3
|
-
Simple API wrapper for SynapsePay REST V3 API. This wrapper aims to handle the headers for each API request and appropriate error handling.
|
4
|
-
|
3
|
+
Simple API wrapper for SynapsePay REST V3 API. This wrapper aims to handle the headers for each API request and appropriate error handling. Not all API endpoints are supported.
|
5
4
|
|
6
5
|
## Code Example
|
7
6
|
|
8
|
-
Check out
|
7
|
+
Check out [samples.md](https://github.com/synapsepay/SynapsePayRest-Ruby/blob/master/samples.md) and our [API documentation](http://docs.synapsepay.com/v3.1) for examples.
|
9
8
|
|
10
9
|
## Installation
|
11
10
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module SynapsePayRest
|
2
2
|
class Nodes
|
3
|
-
|
4
3
|
attr_accessor :client
|
5
4
|
|
6
5
|
def initialize(client)
|
@@ -10,7 +9,7 @@ module SynapsePayRest
|
|
10
9
|
def create_node_path(node_id: nil)
|
11
10
|
path = ['/users', client.user_id, 'nodes' ]
|
12
11
|
path << node_id if node_id
|
13
|
-
|
12
|
+
path.join('/')
|
14
13
|
end
|
15
14
|
|
16
15
|
def add(payload: raise("payload is required"))
|
@@ -25,6 +24,7 @@ module SynapsePayRest
|
|
25
24
|
client.get(path)
|
26
25
|
end
|
27
26
|
|
27
|
+
# separate this into different methods
|
28
28
|
def verify(node_id: nil, payload: raise("payload is required"))
|
29
29
|
if node_id
|
30
30
|
# verify microdeposits
|
@@ -35,7 +35,6 @@ module SynapsePayRest
|
|
35
35
|
path = create_node_path
|
36
36
|
response = @client.post(path, payload)
|
37
37
|
end
|
38
|
-
response
|
39
38
|
end
|
40
39
|
|
41
40
|
def delete(node_id: raise("node_id is required"))
|
@@ -3,6 +3,7 @@ require 'base64'
|
|
3
3
|
require 'open-uri'
|
4
4
|
|
5
5
|
module SynapsePayRest
|
6
|
+
# should maybe create User class
|
6
7
|
class Users
|
7
8
|
# Should refactor this to HTTPClient
|
8
9
|
VALID_QUERY_PARAMS = [:query, :page, :per_page].freeze
|
@@ -13,29 +14,25 @@ module SynapsePayRest
|
|
13
14
|
@client = client
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
-
path = ['/users']
|
18
|
-
path << user_id if user_id
|
19
|
-
return path.join('/')
|
20
|
-
end
|
21
|
-
|
17
|
+
# refactor to automate oauth
|
22
18
|
def refresh(payload: raise("payload is required"))
|
23
19
|
path = "/oauth/#{@client.user_id}"
|
24
20
|
response = @client.post(path, payload)
|
25
21
|
client.update_headers(oauth_key: response['oauth_key']) if response['oauth_key']
|
26
|
-
|
22
|
+
response
|
27
23
|
end
|
28
24
|
|
29
|
-
def get(user_id: nil, options
|
25
|
+
def get(user_id: nil, **options)
|
30
26
|
path = create_user_path(user_id: user_id)
|
31
27
|
|
32
|
-
|
28
|
+
# factor single user and all users into separate methods
|
29
|
+
if user_id
|
33
30
|
response = client.get(path)
|
34
31
|
client.update_headers(user_id: response['_id']) if response['_id']
|
35
32
|
return response
|
36
33
|
end
|
37
34
|
|
38
|
-
# Should factor this out into HTTPClient
|
35
|
+
# Should factor this out into HTTPClient and separate args for paginate/search(name/email)/per_page
|
39
36
|
params = VALID_QUERY_PARAMS.map do |p|
|
40
37
|
options[p] ? "#{p}=#{options[p]}" : nil
|
41
38
|
end.compact
|
@@ -49,29 +46,53 @@ module SynapsePayRest
|
|
49
46
|
|
50
47
|
def update(payload: raise("payload is required"))
|
51
48
|
path = create_user_path(user_id: client.user_id)
|
52
|
-
client.patch(path, payload)
|
49
|
+
response = client.patch(path, payload)
|
50
|
+
client.update_headers(user_id: response['_id']) if response['_id']
|
51
|
+
response
|
53
52
|
end
|
54
53
|
|
55
54
|
def create(payload: raise("payload is required"))
|
56
55
|
path = create_user_path
|
57
56
|
response = client.post(path, payload)
|
58
57
|
client.update_headers(user_id: response['_id']) if response['_id']
|
59
|
-
|
58
|
+
response
|
60
59
|
end
|
61
60
|
|
62
|
-
def
|
63
|
-
|
64
|
-
|
61
|
+
def encode_attachment(file_path: raise("file_path is required"), file_type: nil)
|
62
|
+
# try to find file_type
|
63
|
+
if file_type.nil?
|
64
|
+
content_types = MIME::Types.type_for(file_path)
|
65
|
+
file_type = content_types.first.content_type if content_types.any?
|
66
|
+
end
|
67
|
+
|
68
|
+
# if file_type not found in previous step
|
69
|
+
if file_type.nil?
|
70
|
+
raise("File type not found. Specify a file_type argument.")
|
71
|
+
end
|
72
|
+
|
73
|
+
file_contents = open(file_path) { |f| f.read }
|
74
|
+
encoded = Base64.encode64(file_contents)
|
75
|
+
mime_padding = "data:#{file_type};base64,"
|
76
|
+
mime_padding + encoded
|
65
77
|
end
|
66
78
|
|
79
|
+
# this is just an alias for update. leaving here for legacy users.
|
67
80
|
def answer_kba(payload: raise("payload is required"))
|
68
|
-
|
69
|
-
|
81
|
+
update(payload: payload)
|
82
|
+
end
|
83
|
+
|
84
|
+
# this is just an alias for update. leaving here for legacy users.
|
85
|
+
def add_doc(payload: raise("payload is required"))
|
86
|
+
update(payload: payload)
|
70
87
|
end
|
71
88
|
|
89
|
+
# deprecated
|
72
90
|
def attach_file(file_path: raise("file_path is required"))
|
91
|
+
warn caller.first + " DEPRECATION WARNING: the method #{self.class}##{__method__} is deprecated. Use SynapsePayRest::Users::update with encode_attachment instead."
|
92
|
+
|
73
93
|
file_contents = open(file_path) { |f| f.read }
|
74
|
-
|
94
|
+
content_types = MIME::Types.type_for(file_path)
|
95
|
+
file_type = content_types.first.content_type if content_types.any?
|
75
96
|
if file_type.nil?
|
76
97
|
raise("File type not found. Use attach_file_with_file_type(file_path: <file_path>, file_type: <file_type>)")
|
77
98
|
else
|
@@ -79,7 +100,10 @@ module SynapsePayRest
|
|
79
100
|
end
|
80
101
|
end
|
81
102
|
|
103
|
+
# deprecated
|
82
104
|
def attach_file_with_file_type(file_path: raise("file_path is required"), file_type: raise("file_type is required"))
|
105
|
+
warn caller.first + " DEPRECATION WARNING: the method #{self.class}##{__method__} is deprecated. Use SynapsePayRest::Users::update with encode_attachment instead."
|
106
|
+
|
83
107
|
path = create_user_path(user_id: @client.user_id)
|
84
108
|
file_contents = open(file_path) { |f| f.read }
|
85
109
|
encoded = Base64.encode64(file_contents)
|
@@ -93,5 +117,13 @@ module SynapsePayRest
|
|
93
117
|
}
|
94
118
|
client.patch(path, payload)
|
95
119
|
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
def create_user_path(user_id: nil)
|
124
|
+
path = ['/users']
|
125
|
+
path << user_id if user_id
|
126
|
+
path.join('/')
|
127
|
+
end
|
96
128
|
end
|
97
129
|
end
|
@@ -3,7 +3,6 @@ require 'json'
|
|
3
3
|
|
4
4
|
module SynapsePayRest
|
5
5
|
class HTTPClient
|
6
|
-
|
7
6
|
attr_accessor :base_url, :config, :headers, :user_id
|
8
7
|
|
9
8
|
def initialize(config, base_url, user_id: nil)
|
@@ -14,6 +13,7 @@ module SynapsePayRest
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def get_headers
|
16
|
+
# refactor to use symbols
|
17
17
|
user = "#{config['oauth_key']}|#{config['fingerprint']}"
|
18
18
|
gateway = "#{config['client_id']}|#{config['client_secret']}"
|
19
19
|
headers = {
|
@@ -26,7 +26,9 @@ module SynapsePayRest
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def update_headers(user_id: nil, oauth_key: nil, fingerprint: nil, client_id: nil, client_secret: nil, ip_address: nil)
|
29
|
-
|
29
|
+
# this doesn't really belongs in headers
|
30
|
+
self.user_id = user_id if user_id
|
31
|
+
|
30
32
|
config['fingerprint'] = fingerprint if fingerprint
|
31
33
|
config['oauth_key'] = oauth_key if oauth_key
|
32
34
|
config['client_id'] = client_id if client_id
|
@@ -34,7 +36,6 @@ module SynapsePayRest
|
|
34
36
|
config['ip_address'] = ip_address if ip_address
|
35
37
|
end
|
36
38
|
|
37
|
-
|
38
39
|
def post(path, payload)
|
39
40
|
response = with_error_handling { RestClient.post(full_url(path), payload.to_json, get_headers) }
|
40
41
|
JSON.parse(response)
|
data/samples.md
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
|
2
1
|
## Initialization
|
3
2
|
|
4
3
|
```ruby
|
5
4
|
require 'synapse_pay_rest'
|
6
5
|
|
7
6
|
options = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
'oauth_key' => OAUTH_KEY, # Optional
|
8
|
+
'fingerprint' => FINGERPRINT,
|
9
|
+
'client_id' => CLIENT_ID,
|
10
|
+
'client_secret' => CLIENT_SECRET,
|
11
|
+
'ip_address' => IP_ADDRESS,
|
12
|
+
'development_mode' => true # true will ping sandbox.synapsepay.com while false will ping synapsepay.com
|
14
13
|
}
|
15
14
|
|
16
|
-
USER_ID =
|
15
|
+
USER_ID = USER_ID # Optional (it the client will automatically update it after a GET or UPDATE call)
|
17
16
|
|
18
17
|
client = SynapsePayRest::Client.new options: options, user_id: USER_ID
|
19
18
|
|
@@ -32,104 +31,134 @@ users_response = client.users.get
|
|
32
31
|
# Create User
|
33
32
|
|
34
33
|
create_payload = {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
34
|
+
"logins" => [
|
35
|
+
{
|
36
|
+
"email" => "rubyTest@synapsepay.com",
|
37
|
+
"password" => "test1234",
|
38
|
+
"read_only" => false
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"phone_numbers" => [
|
42
|
+
"901.111.1111"
|
43
|
+
],
|
44
|
+
"legal_names" => [
|
45
|
+
"RUBY TEST USER"
|
46
|
+
],
|
47
|
+
"extra" => {
|
48
|
+
"note" => "Interesting user",
|
49
|
+
"supp_id" => "122eddfgbeafrfvbbb",
|
50
|
+
"is_business" => false
|
51
|
+
}
|
53
52
|
}
|
54
53
|
|
55
|
-
|
54
|
+
create_user_response = client.users.create(payload: create_payload)
|
56
55
|
|
57
56
|
|
58
57
|
# Get User
|
59
58
|
|
60
|
-
user_response = client.users.get(user_id:
|
59
|
+
user_response = client.users.get(user_id: create_user_response['_id'])
|
61
60
|
|
62
61
|
|
63
|
-
# Update a User
|
64
62
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
"email" => "test2ruby@email.com",
|
70
|
-
"password" => "test1234",
|
71
|
-
"read_only" => true
|
72
|
-
},
|
73
|
-
"phone_number" => "9019411111",
|
74
|
-
"legal_name" => "Some new name"
|
75
|
-
}
|
63
|
+
# Refresh User
|
64
|
+
|
65
|
+
oauth_payload = {
|
66
|
+
"refresh_token" => user_response['refresh_token']
|
76
67
|
}
|
77
68
|
|
78
|
-
client.users.
|
69
|
+
oauth_response = client.users.refresh(payload: oauth_payload)
|
79
70
|
|
80
71
|
|
81
|
-
#
|
82
|
-
|
83
|
-
ssn_payload = {
|
84
|
-
"doc" => {
|
85
|
-
"birth_day" => 4,
|
86
|
-
"birth_month" => 2,
|
87
|
-
"birth_year" => 1940,
|
88
|
-
"name_first" => "John",
|
89
|
-
"name_last" => "doe",
|
90
|
-
"address_street1" => "1 Infinite Loop",
|
91
|
-
"address_postal_code" => "95014",
|
92
|
-
"address_country_code" => "US",
|
93
|
-
"document_value" => "3333",
|
94
|
-
"document_type" => "SSN"
|
95
|
-
}
|
96
|
-
}
|
72
|
+
# Update a User
|
97
73
|
|
98
|
-
|
74
|
+
update_payload = {
|
75
|
+
"refresh_token" => user_response['refresh_token'],
|
76
|
+
"update" => {
|
77
|
+
"login" => {
|
78
|
+
"email" => "test2ruby@email.com",
|
79
|
+
"password" => "test1234",
|
80
|
+
"read_only" => true
|
81
|
+
},
|
82
|
+
"phone_number" => "9019411111",
|
83
|
+
"legal_name" => "Some new name"
|
84
|
+
}
|
85
|
+
}
|
99
86
|
|
87
|
+
client.users.update(payload: update_payload)
|
100
88
|
|
101
|
-
# Answer KBA Questions
|
102
89
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
90
|
+
# Add Documents
|
91
|
+
|
92
|
+
# use users#encode_attachment to base64 encode a file for inclusion in the payload
|
93
|
+
govt_id_attachment = client.users.encode_attachment(file_path: FILE_PATH)
|
94
|
+
selfie_attachment = client.users.encode_attachment(file_path: FILE_PATH)
|
95
|
+
|
96
|
+
add_documents_payload = {
|
97
|
+
'documents' => [{
|
98
|
+
'email' => 'test2@test.com',
|
99
|
+
'phone_number' => '901-942-8167',
|
100
|
+
'ip' => '12134323',
|
101
|
+
'name' => 'Snoopie',
|
102
|
+
'alias' => 'Meow',
|
103
|
+
'entity_type' => 'M',
|
104
|
+
'entity_scope' => 'Arts & Entertainment',
|
105
|
+
'day' => 2,
|
106
|
+
'month' => 5,
|
107
|
+
'year' => 2009,
|
108
|
+
'address_street' => 'Some Farm',
|
109
|
+
'address_city' => 'SF',
|
110
|
+
'address_subdivision' => 'CA',
|
111
|
+
'address_postal_code' => '94114',
|
112
|
+
'address_country_code' => 'US',
|
113
|
+
'virtual_docs' => [{
|
114
|
+
'document_value' => '111-111-3333',
|
115
|
+
'document_type' => 'SSN'
|
116
|
+
}],
|
117
|
+
'physical_docs' => [{
|
118
|
+
'document_value' => govt_id_attachment,
|
119
|
+
'document_type' => 'GOVT_ID'
|
120
|
+
},
|
121
|
+
{
|
122
|
+
'document_value' => selfie_attachment,
|
123
|
+
'document_type' => 'SELFIE'
|
124
|
+
}],
|
125
|
+
'social_docs' => [{
|
126
|
+
'document_value' => 'https://www.facebook.com/sankaet',
|
127
|
+
'document_type' => 'FACEBOOK'
|
128
|
+
}]
|
129
|
+
}]
|
114
130
|
}
|
115
131
|
|
116
|
-
|
132
|
+
add_docs_response = client.users.update(payload: add_documents_payload)
|
117
133
|
|
118
134
|
|
119
|
-
#
|
120
|
-
|
121
|
-
file_response = client.users.attach_file(file_path: 'PATH_TO_FILE')
|
135
|
+
# Answer KBA Questions
|
122
136
|
|
137
|
+
kyc_document = add_docs_response['documents'].last # to get most recent (or only) submitted set of KYC docs
|
123
138
|
|
124
|
-
|
139
|
+
ssn = kyc_document['virtual_docs'].find { |doc| doc['status'] == 'SUBMITTED|MFA_PENDING'}
|
125
140
|
|
126
|
-
|
127
|
-
|
141
|
+
kba_payload = {
|
142
|
+
'documents' => [{
|
143
|
+
'id' => kyc_document['id'],
|
144
|
+
'virtual_docs' => [{
|
145
|
+
'id' => ssn['id'],
|
146
|
+
'meta' => {
|
147
|
+
'question_set' => {
|
148
|
+
'answers' => [
|
149
|
+
{ 'question_id' => 1, 'answer_id' => 1 },
|
150
|
+
{ 'question_id' => 2, 'answer_id' => 1 },
|
151
|
+
{ 'question_id' => 3, 'answer_id' => 1 },
|
152
|
+
{ 'question_id' => 4, 'answer_id' => 1 },
|
153
|
+
{ 'question_id' => 5, 'answer_id' => 1 }
|
154
|
+
]
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}]
|
158
|
+
}]
|
128
159
|
}
|
129
160
|
|
130
|
-
|
131
|
-
|
132
|
-
```
|
161
|
+
kba_response = client.users.update(payload: kba_payload)
|
133
162
|
|
134
163
|
|
135
164
|
## Node API Calls
|
@@ -145,13 +174,13 @@ nodes_response = client.nodes.get
|
|
145
174
|
# Add SYNAPSE-US Node
|
146
175
|
|
147
176
|
synapse_node_payload = {
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
177
|
+
"type" => "SYNAPSE-US",
|
178
|
+
"info" => {
|
179
|
+
"nickname" => "My Synapse Wallet"
|
180
|
+
},
|
181
|
+
"extra" => {
|
182
|
+
"supp_id" => "123sa"
|
183
|
+
}
|
155
184
|
}
|
156
185
|
|
157
186
|
synapse_node_response = client.nodes.add(payload: synapse_node_payload)
|
@@ -160,12 +189,12 @@ synapse_node_response = client.nodes.add(payload: synapse_node_payload)
|
|
160
189
|
# Add ACH-US node through account login
|
161
190
|
|
162
191
|
login_payload = {
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
192
|
+
"type" => "ACH-US",
|
193
|
+
"info" => {
|
194
|
+
"bank_id" => "synapse_good",
|
195
|
+
"bank_pw" => "test1234",
|
196
|
+
"bank_name" => "fake"
|
197
|
+
}
|
169
198
|
}
|
170
199
|
|
171
200
|
login_response = client.nodes.add(payload: login_payload)
|
@@ -174,8 +203,8 @@ login_response = client.nodes.add(payload: login_payload)
|
|
174
203
|
# Verify ACH-US Node via MFA
|
175
204
|
|
176
205
|
mfa_payload = {
|
177
|
-
|
178
|
-
|
206
|
+
"access_token" => ACCESS_TOKEN_IN_LOGIN_RESPONSE,
|
207
|
+
"mfa_answer" => "test_answer"
|
179
208
|
}
|
180
209
|
|
181
210
|
mfa_response = client.nodes.verify(payload: mfa_payload)
|
@@ -184,18 +213,18 @@ mfa_response = client.nodes.verify(payload: mfa_payload)
|
|
184
213
|
# Add ACH-US Node through Account and Routing Number Details
|
185
214
|
|
186
215
|
acct_rout_payload = {
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
216
|
+
"type" => "ACH-US",
|
217
|
+
"info" => {
|
218
|
+
"nickname" => "Ruby Library Savings Account",
|
219
|
+
"name_on_account" => "Ruby Library",
|
220
|
+
"account_num" => "72347235423",
|
221
|
+
"routing_num" => "051000017",
|
222
|
+
"type" => "PERSONAL",
|
223
|
+
"class" => "CHECKING"
|
224
|
+
},
|
225
|
+
"extra" => {
|
226
|
+
"supp_id" => "123sa"
|
227
|
+
}
|
199
228
|
}
|
200
229
|
|
201
230
|
acct_rout_response = client.nodes.add(payload: acct_rout_payload)
|
@@ -204,7 +233,7 @@ acct_rout_response = client.nodes.add(payload: acct_rout_payload)
|
|
204
233
|
# Verify ACH-US Node via Micro-Deposits
|
205
234
|
|
206
235
|
micro_payload = {
|
207
|
-
|
236
|
+
"micro" => [0.1,0.1]
|
208
237
|
}
|
209
238
|
|
210
239
|
micro_response = client.nodes.verify(node_id: NODE_ID, payload: micro_payload)
|
@@ -228,28 +257,28 @@ transactions_response = client.trans.get(node_id: NODE_ID)
|
|
228
257
|
#Create a Transaction
|
229
258
|
|
230
259
|
trans_payload = {
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
260
|
+
"to" => {
|
261
|
+
"type" => "SYNAPSE-US",
|
262
|
+
"id" => "560adb4e86c27331bb5ac86e"
|
263
|
+
},
|
264
|
+
"amount" => {
|
265
|
+
"amount" => 1.10,
|
266
|
+
"currency" => "USD"
|
267
|
+
},
|
268
|
+
"extra" => {
|
269
|
+
"supp_id" => "1283764wqwsdd34wd13212",
|
270
|
+
"note" => "Deposit to bank account",
|
271
|
+
"webhook" => "http => //requestb.in/q94kxtq9",
|
272
|
+
"process_on" => 1,
|
273
|
+
"ip" => "192.168.0.1"
|
274
|
+
},
|
275
|
+
"fees" => [{
|
276
|
+
"fee" => 1.00,
|
277
|
+
"note" => "Facilitator Fee",
|
278
|
+
"to" => {
|
279
|
+
"id" => "55d9287486c27365fe3776fb"
|
280
|
+
}
|
281
|
+
}]
|
253
282
|
}
|
254
283
|
|
255
284
|
create_response = client.trans.create(node_id: NODE_ID, payload: trans_payload)
|
@@ -263,7 +292,7 @@ transaction_response = client.trans.get(node_id: NODE_ID, trans_id: TRANS_ID)
|
|
263
292
|
# Update Transaction
|
264
293
|
|
265
294
|
update_payload = {
|
266
|
-
|
295
|
+
"comment" => "hi"
|
267
296
|
}
|
268
297
|
|
269
298
|
update_response = client.trans.update(node_id: NODE_ID, trans_id: TRANS_ID, payload: update_payload)
|
@@ -273,4 +302,4 @@ update_response = client.trans.update(node_id: NODE_ID, trans_id: TRANS_ID, payl
|
|
273
302
|
|
274
303
|
delete_trans_response = client.trans.delete(node_id: NODE_ID, trans_id: TRANS_ID)
|
275
304
|
|
276
|
-
```
|
305
|
+
```
|
data/synapse_pay_rest.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synapse_pay_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Hipps
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: dotenv
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: rest-client
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|