synapseruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ module Synapse
2
+
3
+ class Users
4
+
5
+ attr_reader :page, :page_count, :limit, :http_client,:payload, :user_count
6
+
7
+ attr_accessor
8
+
9
+ def initialize(page:, page_count:, limit:, http_client:,payload:, user_count:)
10
+ @http_client = http_client
11
+ @page = page
12
+ @page_count = page_count
13
+ @limit =limit
14
+ @payload = payload
15
+ end
16
+ end
17
+ end
18
+
19
+
@@ -0,0 +1,11 @@
1
+ # updating gem version
2
+ # git add and commit changes
3
+ # rake build
4
+ # rake install
5
+ # rake release
6
+ module Synapse
7
+ # Gem version
8
+ VERSION = '1.0.0'.freeze
9
+ end
10
+
11
+
data/lib/synapse_fi.rb ADDED
@@ -0,0 +1,28 @@
1
+ # client
2
+ require "synapse_api/client"
3
+ # error
4
+ require "synapse_api/error"
5
+ # http_request
6
+ require "synapse_api/http_request"
7
+ # node
8
+ require "synapse_api/node"
9
+ # nodes
10
+ require "synapse_api/nodes"
11
+ # subnet
12
+ require "synapse_api/subnet"
13
+ # subnets
14
+ require "synapse_api/subnets"
15
+ # subscription
16
+ require "synapse_api/subscription"
17
+ # subscriptions
18
+ require "synapse_api/subscriptions"
19
+ # transaction
20
+ require "synapse_api/transaction"
21
+ # transactions
22
+ require "synapse_api/transactions"
23
+ # user
24
+ require "synapse_api/user"
25
+ # users
26
+ require "synapse_api/users"
27
+ # version
28
+ require "synapse_api/version"
Binary file
Binary file
Binary file
Binary file
data/samples.md ADDED
@@ -0,0 +1,468 @@
1
+ # Table of Contents
2
+ - [Client](#client)
3
+ * [Initialize Client](#initialize-client)
4
+ * [Create User](#create-user)
5
+ * [Get User](#get-user)
6
+ * [Get Subscription](#get-subscription)
7
+ * [Update Subscription](#update-subscription)
8
+ * [Get All Users](#get-all-users)
9
+ * [Get All Client Transactions](#get-all-client-transactions)
10
+ * [Get All Client Nodes](#get-all-client-nodes)
11
+ * [Get All Client Institutions](#get-all-client-institutions)
12
+ * [Issue Public Key](#issue-public-key)
13
+ - [User](#user)
14
+ * [Get New Oauth](#get-new-oauth)
15
+ * [Update User or Update/Add Documents](#update-user-or-update-add-documents)
16
+ * [Generate UBO](#generate-ubo)
17
+ * [Get All User Nodes](#get-all-user-nodes)
18
+ * [Get All User Transactions](#get-all-user-transactions)
19
+ + [Nodes](#nodes)
20
+ * [Create Node](#create-node)
21
+ * [Get Node](#get-node)
22
+ * [Get All User Nodes](#get-all-user-nodes-1)
23
+ * [Update Node](#update-node)
24
+ * [Ship Debit](#ship-debit)
25
+ * [Reset Debit](#reset-debit)
26
+ * [Verify Micro Deposit](#verify-micro-deposit)
27
+ * [Reinitiate Micro Deposit](#reinitiate-micro-deposit)
28
+ * [Generate Apple Pay](#generate-apple-pay)
29
+ * [Delete Node](#delete-node)
30
+ * [Get All Node Subnets](#get-all-node-subnets)
31
+ * [Get All Node Transactions](#get-all-node-transactions)
32
+ + [Subnets](#subnets)
33
+ * [Create Subnet](#create-subnet)
34
+ * [Get Subnet](#get-subnet)
35
+ + [Transactions](#transactions)
36
+ * [Create Transaction](#create-transaction)
37
+ * [Get Transaction](#get-transaction)
38
+ * [Comment on Status](#comment-on-status)
39
+ * [Dispute Transaction](#dispute-transaction)
40
+ * [Cancel Delete Transaction](#cancel-delete-transaction)
41
+
42
+ # Client
43
+
44
+ ##### Initialize Client
45
+
46
+ - Set up a .env file to fetch your client_id and client_secret
47
+ - Returns Client instance
48
+
49
+ ```bash
50
+ args = {
51
+ # synapse client_id
52
+ client_id: ENV.fetch("client_id"),
53
+ # synapse client_secret
54
+ client_secret: ENV.fetch("client_secret"),
55
+ # a hashed value, either unique to user or static for app
56
+ fingerprint: "fp",
57
+ # end user's IP
58
+ ip_address: 'ip',
59
+ # (optional) requests go to sandbox endpoints if true
60
+ development_mode: true,
61
+ # (optional) if true logs requests to stdout
62
+ logging: true,
63
+ # (optional) file path to write logs to
64
+ log_to: nil,
65
+ # (optional) rases for 2FA and MFA if set to true
66
+ raise_for_202: true
67
+ }
68
+
69
+ client = Synapse::Client.new(args)
70
+ ```
71
+
72
+ ##### Create User
73
+
74
+ - Returns user instance
75
+
76
+ ```bash
77
+ payload = {
78
+ "logins": [
79
+ {
80
+ "email": "test@synapsefi.com"
81
+ }
82
+ ],
83
+ "phone_numbers": [
84
+ "901.111.1111",
85
+ "test@synapsefi.com"
86
+ ],
87
+ "legal_names": [
88
+ "Test User"
89
+ ],
90
+ "extra": {
91
+ "supp_id": "122eddfgbeafrfvbbb",
92
+ "cip_tag":1,
93
+ "is_business": false
94
+ }
95
+ }
96
+
97
+ user = client.create_user(payload: payload)
98
+ ```
99
+
100
+ ##### Get User
101
+ - returns USER instance
102
+
103
+ ```bash
104
+ user_id = "1232"
105
+ user = client.get_user(user_id: user_id,full_dehydrate: true)
106
+ ```
107
+
108
+ ##### Create Subscription
109
+ - Returns subscription instace
110
+
111
+ ```bash
112
+ scope = {
113
+ "scope": [
114
+ "USERS|POST",
115
+ "USER|PATCH",
116
+ "NODES|POST",
117
+ "NODE|PATCH",
118
+ "TRANS|POST",
119
+ "TRAN|PATCH"
120
+ ],
121
+ "url": "https://requestb.in/zp216zzp"
122
+ }
123
+ subscription = client.create_subscriptions(scope: scope)
124
+ ```
125
+
126
+ ##### Get Subscription
127
+ - returns a subscription instance
128
+
129
+ ```bash
130
+ subscription_id = "2342324"
131
+ subscription = client.get_subscription(subscriptions_id: subscription_id)
132
+ ```
133
+
134
+ #### Update Subscription
135
+
136
+ - Updates a subscription scope, active or url
137
+ - Returns a subscription instance
138
+
139
+ ```bash
140
+ subscription_id = "2342324"
141
+ body = {
142
+ "is_active": true,
143
+ "scope": [
144
+ "USERS|POST",
145
+ "NODES|POST",
146
+ "TRANS|POST"
147
+ ]
148
+ "url": 'https://requestb.in/zp216zzp'
149
+ }
150
+ subscription = client.update_subscriptions(subscription_id: subscription_id , body: body)
151
+ ```
152
+
153
+ ##### Get All Users
154
+ - returns USERS instance
155
+ - Array of users on a platform
156
+
157
+ ```bash
158
+ # param page (optional) response will default to 1
159
+ # param per_page [Integer] (optional) response will default to 20
160
+ users = client.get_users(page: 5, per_page: 5)
161
+ ```
162
+
163
+ #### Get All Client Transactions
164
+
165
+ - returns Transactions instance
166
+ - array of Transaction instance
167
+
168
+ ```bash
169
+ trans = client.get_transaction(page: 5, per_page: 5)
170
+ ```
171
+
172
+ #### Get All Client Nodes
173
+ - Returns Nodes instance
174
+ - Array of Node instance
175
+ - Page (optional params)
176
+ - Per Page (optional params)
177
+
178
+ ```bash
179
+ # param page (optional) response will default to 1
180
+ # param per_page [Integer] (optional) response will default to 20
181
+ Nodes = client.get_all_nodes(page: 5, per_page: 5)
182
+ ```
183
+
184
+ #### Get All Client Institutions
185
+
186
+ - Returns institutions available for bank logins
187
+ - Page (optional params)
188
+ - Per Page (optional params)
189
+
190
+ ```bash
191
+ # param page (optional) response will default to 1
192
+ # param per_page [Integer] (optional) response will default to 20
193
+ institutions = client.get_all_institutions(page: 5, per_page: 5)
194
+ ```
195
+
196
+ #### Issue Public Key
197
+
198
+ - Returns api response
199
+
200
+ ```bash
201
+ scope = "USERS|GET,USER|GET,USER|PATCH"
202
+ public_key = client.issue_public_key(scope: scope)
203
+ ```
204
+
205
+ # User
206
+
207
+ ##### Get New Oauth
208
+
209
+ ```bash
210
+ scope =["USERS|GET,USER|GET,USER|PATCH"]
211
+ user.authenticate(scope: scope)
212
+ ```
213
+
214
+ ##### Update User or Update/Add Documents
215
+
216
+ ```bash
217
+ body = {
218
+ "update":{
219
+ "login":{
220
+ "email":"test2@synapsefi.com"
221
+ },
222
+ "remove_login":{
223
+ "email":"test@synapsefi.com"
224
+ },
225
+ "phone_number":"901-111-2222",
226
+ "remove_phone_number":"901.111.1111"
227
+ }
228
+ }
229
+ user = user.user_update(payload:body)
230
+ ```
231
+
232
+ ##### Create UBO
233
+
234
+ - Upload an Ultimate Beneficial Ownership or REG GG Form
235
+
236
+ ```bash
237
+ body = {
238
+ "entity_info": {
239
+ "cryptocurrency": True,
240
+ "msb": {
241
+ "federal": True,
242
+ "states": ["AL"]
243
+ },
244
+ "public_company": False,
245
+ "majority_owned_by_listed": False,
246
+ "registered_SEC": False,
247
+ "regulated_financial": False,
248
+ "gambling": False,
249
+ "document_id": "2a4a5957a3a62aaac1a0dd0edcae96ea2cdee688ec6337b20745eed8869e3ac8"
250
+ ...
251
+ }
252
+ user.create_ubo(payload:body)
253
+ ```
254
+
255
+ #### Get All User Nodes
256
+
257
+ ```bash
258
+ Nodes = user.get_all_nodes(page=1, per_page=5, type='ACH-US')
259
+ ```
260
+
261
+ #### Get All User Transactions
262
+
263
+ - Returns transactons instance
264
+
265
+ ```bash
266
+ # param page (optional) response will default to 1
267
+ # param per_page (optional) response will default to 20
268
+ transactions = user.get_user_transactions(page=1, per_page=5)
269
+ ```
270
+
271
+ ### Nodes
272
+ ##### Create Node
273
+ Refer to the following docs for how to setup the payload for a specific Node type:
274
+ - [Deposit Accounts](https://docs.synapsefi.com/v3.1/docs/deposit-accounts)
275
+ - [Card Issuance](https://docs.synapsefi.com/v3.1/docs/card-issuance)
276
+ - [ACH-US with Logins](https://docs.synapsefi.com/v3.1/docs/add-ach-us-node)
277
+ - [ACH-US MFA](https://docs.synapsefi.com/v3.1/docs/add-ach-us-node-via-bank-logins-mfa)
278
+ - [ACH-US with AC/RT](https://docs.synapsefi.com/v3.1/docs/add-ach-us-node-via-acrt-s)
279
+ - [INTERCHANGE-US](https://docs.synapsefi.com/v3.1/docs/interchange-us)
280
+ - [CHECK-US](https://docs.synapsefi.com/v3.1/docs/check-us)
281
+ - [CRYPTO-US](https://docs.synapsefi.com/v3.1/docs/crypto-us)
282
+ - [WIRE-US](https://docs.synapsefi.com/v3.1/docs/add-wire-us-node)
283
+ - [WIRE-INT](https://docs.synapsefi.com/v3.1/docs/add-wire-int-node)
284
+ - [IOU](https://docs.synapsefi.com/v3.1/docs/add-iou-node)
285
+
286
+ ```bash
287
+ body = {
288
+ "type": "DEPOSIT-US",
289
+ "info":{
290
+ "nickname":"My Checking"
291
+ }
292
+ }
293
+ node = user.create_node(payload:, idempotency_key='123456')
294
+ ```
295
+
296
+ ##### Get Node
297
+
298
+ ```bash
299
+ node_id = "5bd9e7b3389f2400adb012ae"
300
+ node = user.get_user_node(node_id: node_id, full_dehydrate: true, force_refresh: true)
301
+ ```
302
+
303
+ #### Get All User Nodes
304
+
305
+ ```bash
306
+ Nodes = user.get_all_nodes(page=1, per_page=5, type='ACH-US')
307
+ ```
308
+
309
+ #### Update Node
310
+
311
+ - Param node_id
312
+ - Param payload
313
+
314
+ ```bash
315
+ node_id = '5ba05ed620b3aa005882c52a'
316
+ body = {
317
+ "supp_id":"new_supp_id_1234"
318
+ }
319
+ node = user.generate(node_id:node_id, payload:body)
320
+ ```
321
+
322
+ #### Ship Card
323
+
324
+ ```bash
325
+ node_id = '5ba05ed620b3aa005882c52a'
326
+
327
+ body = {
328
+ "fee_node_id":"5ba05e7920b3aa006482c5ad",
329
+ "expedite":True
330
+ }
331
+ node = user.ship_card(node_id: node_id, payload: body)
332
+ ```
333
+
334
+ #### Reset Debit Cards
335
+
336
+ ```bash
337
+ node_id = '5ba05ed620b3aa005882c52a'
338
+ node = user.reset_debit_card(node_id: node_id)
339
+ ```
340
+
341
+ #### Verify Micro Deposit
342
+
343
+ ```bash
344
+ node_id = '5ba05ed620b3aa005882c52a'
345
+ body = {
346
+ "micro":[0.1,0.1]
347
+ }
348
+ node = user.verify_micro_deposit(node_id: node_id, payload: body)
349
+ ```
350
+
351
+ #### Reinitiate Micro Deposit
352
+
353
+ ```bash
354
+ node_id = '5ba05ed620b3aa005882c52a'
355
+ node = user.reinitiate_micro_deposit(node_id: node_id)
356
+ ```
357
+
358
+ ##### Generate Apple Pay
359
+
360
+ ```bash
361
+ node_id = '5ba05ed620b3aa005882c52a'
362
+ body = {
363
+ "certificate": "your applepay cert",
364
+ "nonce": "9c02xxx2",
365
+ "nonce_signature": "4082f883ae62d0700c283e225ee9d286713ef74"
366
+ }
367
+ response = user.generate_apple_pay_token(node_id: node_id, payload: body)
368
+ ```
369
+
370
+ #### Delete Node
371
+
372
+ ```bash
373
+ node_id = '594e606212e17a002f2e3251'
374
+ response = user.delete_node(node_id: node_id)
375
+ ```
376
+
377
+ #### Get All Node Subnets
378
+
379
+ ```bash
380
+ node_id = '594e606212e17a002f2e3251'
381
+ subnets = user.get_all_subnets(node_id:node_id, page=4, per_page=10)
382
+ ```
383
+
384
+ #### Get All Node Transactions
385
+
386
+ ```bash
387
+ node_id = '594e606212e17a002f2e3251'
388
+ nodes = user.get_all_node_transaction(node_id: node_id, page=4, per_page=10)
389
+ ```
390
+
391
+
392
+ ### Subnets
393
+
394
+ ##### Create Subnet
395
+ ```python
396
+ node_id = '594e606212e17a002f2e3251'
397
+ body = {
398
+ "nickname":"Test AC/RT"
399
+ }
400
+ user.create_subnet(node_id: node_id, payload: body)
401
+ ```
402
+
403
+ #### Get Subnet
404
+ ```bash
405
+ node_id = '594e606212e17a002f2e3251'
406
+ subn_id = '59c9f77cd412960028b99d2b'
407
+ subnet = user.get_subnet(node_id:, subnet_id:)
408
+ ```
409
+
410
+ ### Transactions
411
+
412
+ #### Create Transaction
413
+ ```bash
414
+ node_id = '594e606212e17a002f2e3251'
415
+ body = {
416
+ "to": {
417
+ "type": "ACH-US",
418
+ "id": "594e6e6c12e17a002f2e39e4"
419
+ },
420
+ "amount": {
421
+ "amount": 20.1,
422
+ "currency": "USD"
423
+ },
424
+ "extra": {
425
+ "ip": "192.168.0.1"
426
+ }
427
+ }
428
+ transaction = user.create_transaction(node_id: node_id, payload: body, idempotency_key:"2435")
429
+ ```
430
+
431
+ #### Get Transaction
432
+
433
+ - Param node_id
434
+ - Param trans_id
435
+
436
+ ```bash
437
+ node_id = '594e606212e17a002f2e3251'
438
+ trans_id = '594e72124599e8002fe62e4f'
439
+ transaction = user.get_node_transaction(node_id: node_id, trans_id: trans_id)
440
+ ```
441
+
442
+ #### Comment on status
443
+
444
+ ```bash
445
+ node_id = '594e606212e17a002f2e3251'
446
+ trans_id = '594e72124599e8002fe62e4f'
447
+ body = 'Pending verification...'
448
+ transaction = user.comment_transaction(node_id: node_id, trans_id: trans_id, payload: body)
449
+ ```
450
+
451
+ #### Dispute Transaction
452
+
453
+ ```bash
454
+ node_id = '594e606212e17a002f2e3251'
455
+ trans_id = '594e72124599e8002fe62e4f'
456
+ dispute_reason = {
457
+ "dispute_reason":"CHARGE_BACK"
458
+ }
459
+ response = user.dispute_user_transactions(node_id:, trans_id:)
460
+ ```
461
+
462
+ #### Cancel Delete Transaction
463
+
464
+ ```bash
465
+ node_id = '594e606212e17a002f2e3251'
466
+ trans_id = '594e72124599e8002fe62e4f'
467
+ response = user.cancel_transaction(node_id: node_id, trans_id: trans_id)
468
+ ```
@@ -0,0 +1,78 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'date'
4
+ require 'synapse_api/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'synapseruby'
8
+ s.version = Synapse::VERSION
9
+ s.date = Date.today.to_s
10
+ s.author = ['Emmanuel Mawutor']
11
+ s.email = 'help@synapsepay.com'
12
+ s.summary = 'SynapseFI v3 Rest Native API Library'
13
+ s.homepage = 'https://rubygems.org/gems/synapseruby'
14
+ s.license = 'MIT'
15
+
16
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ s.bindir = 'exe'
18
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ s.require_paths = ['lib']
20
+
21
+ s.required_ruby_version = '>= 2.1.0'
22
+
23
+ s.add_dependency 'rest-client', '~> 2.0'
24
+
25
+ s.add_development_dependency 'bundler', '~> 1.10'
26
+ s.add_development_dependency 'rake', '~> 10.0'
27
+ s.add_development_dependency 'minitest', '~> 5.8.2'
28
+ s.add_development_dependency 'minitest-reporters', '~> 1.1.5'
29
+ s.add_development_dependency 'dotenv', '~> 2.1.1'
30
+ end
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
data/yarn.lock ADDED
@@ -0,0 +1,8 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ dotenv@^6.2.0:
6
+ version "6.2.0"
7
+ resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
8
+ integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==