synapse_api 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,20 @@
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
+ @user_count = user_count
15
+ @payload = payload
16
+ end
17
+ end
18
+ end
19
+
20
+
@@ -0,0 +1,8 @@
1
+ # updating gem version
2
+ # git add and commit changes
3
+ # gem build
4
+ # gem push pkg/<pkg name>
5
+ module Synapse
6
+ # Gem version
7
+ VERSION = '1.0.0'.freeze
8
+ end
@@ -0,0 +1,490 @@
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
+ * [Update Subnet](#update-subnet)
36
+ + [Transactions](#transactions)
37
+ * [Create Transaction](#create-transaction)
38
+ * [Get Transaction](#get-transaction)
39
+ * [Comment on Status](#comment-on-status)
40
+ * [Dispute Transaction](#dispute-transaction)
41
+ * [Cancel Delete Transaction](#cancel-delete-transaction)
42
+
43
+ # Client
44
+
45
+ ##### Initialize Client
46
+
47
+ - Set up a .env file to fetch your client_id and client_secret
48
+ - Returns Client instance
49
+
50
+ ```bash
51
+ args = {
52
+ # synapse client_id
53
+ client_id: ENV.fetch("client_id"),
54
+ # synapse client_secret
55
+ client_secret: ENV.fetch("client_secret"),
56
+ # a hashed value, either unique to user or static for app
57
+ fingerprint: "fp",
58
+ # end user's IP
59
+ ip_address: 'ip',
60
+ # (optional) requests go to sandbox endpoints if true
61
+ development_mode: true,
62
+ # (optional) if true logs requests to stdout
63
+ logging: true,
64
+ # (optional) file path to write logs to
65
+ log_to: nil,
66
+ # (optional) rases for 2FA and MFA if set to true
67
+ raise_for_202: true
68
+ }
69
+
70
+ client = Synapse::Client.new(args)
71
+ ```
72
+
73
+ ##### Create User
74
+
75
+ - Returns user instance
76
+
77
+ ```bash
78
+ ip_address = "127.0.0"
79
+ fingerprint = "234092485wsf"
80
+ idemopotency_key = "222222"
81
+
82
+ payload = {
83
+ "logins": [
84
+ {
85
+ "email": "test@synapsefi.com"
86
+ }
87
+ ],
88
+ "phone_numbers": [
89
+ "901.111.1111",
90
+ "test@synapsefi.com"
91
+ ],
92
+ "legal_names": [
93
+ "Test User"
94
+ ],
95
+ "extra": {
96
+ "supp_id": "122eddfgbeafrfvbbb",
97
+ "cip_tag":1,
98
+ "is_business": false
99
+ }
100
+ }
101
+
102
+ user = client.create_user(payload: payload, ip_address: ip_address, fingerprint: fingerprint, idemopotency_key: idemopotency_key)
103
+ ```
104
+
105
+ ##### Get User
106
+ - returns USER instance
107
+
108
+ ```bash
109
+ user_id = "1232"
110
+ fingerprint = "234092485wsf"
111
+ ip_address = "127.0.0"
112
+
113
+ user = client.get_user(user_id: user_id, ip_address: ip_address, fingerprint: fingerprint, full_dehydrate: true)
114
+ ```
115
+
116
+ ##### Create Subscription
117
+ - Returns subscription instace
118
+
119
+ ```bash
120
+ scope = {
121
+ "scope": [
122
+ "USERS|POST",
123
+ "USER|PATCH",
124
+ "NODES|POST",
125
+ "NODE|PATCH",
126
+ "TRANS|POST",
127
+ "TRAN|PATCH"
128
+ ],
129
+ "url": "https://requestb.in/zp216zzp"
130
+ }
131
+ subscription = client.create_subscriptions(scope: scope)
132
+ ```
133
+
134
+ ##### Get Subscription
135
+ - returns a subscription instance
136
+
137
+ ```bash
138
+ subscription_id = "2342324"
139
+ subscription = client.get_subscription(subscriptions_id: subscription_id)
140
+ ```
141
+
142
+ #### Update Subscription
143
+
144
+ - Updates a subscription scope, active or url
145
+ - Returns a subscription instance
146
+
147
+ ```bash
148
+ subscription_id = "2342324"
149
+ body = {
150
+ "is_active": true,
151
+ "scope": [
152
+ "USERS|POST",
153
+ "NODES|POST",
154
+ "TRANS|POST"
155
+ ]
156
+ "url": 'https://requestb.in/zp216zzp'
157
+ }
158
+ subscription = client.update_subscriptions(subscription_id: subscription_id , body: body)
159
+ ```
160
+
161
+ ##### Get All Users
162
+ - returns USERS instance
163
+ - Array of users on a platform
164
+
165
+ ```bash
166
+ # param page (optional) response will default to 1
167
+ # param per_page [Integer] (optional) response will default to 20
168
+ users = client.get_users(page: 5, per_page: 5)
169
+ ```
170
+
171
+ #### Get All Client Transactions
172
+
173
+ - returns Transactions instance
174
+ - array of Transaction instance
175
+
176
+ ```bash
177
+ trans = client.get_transaction(page: 5, per_page: 5)
178
+ ```
179
+
180
+ #### Get All Client Nodes
181
+ - Returns Nodes instance
182
+ - Array of Node instance
183
+ - Page (optional params)
184
+ - Per Page (optional params)
185
+
186
+ ```bash
187
+ # param page (optional) response will default to 1
188
+ # param per_page [Integer] (optional) response will default to 20
189
+ Nodes = client.get_all_nodes(page: 5, per_page: 5)
190
+ ```
191
+
192
+ #### Get All Client Institutions
193
+
194
+ - Returns institutions available for bank logins
195
+ - Page (optional params)
196
+ - Per Page (optional params)
197
+
198
+ ```bash
199
+ # param page (optional) response will default to 1
200
+ # param per_page [Integer] (optional) response will default to 20
201
+ institutions = client.get_all_institutions(page: 5, per_page: 5)
202
+ ```
203
+
204
+ #### Issue Public Key
205
+
206
+ - Returns api response
207
+
208
+ ```bash
209
+ scope = ["USERS|GET","USER|GET","USER|PATCH"]
210
+ public_key = client.issue_public_key(scope: scope)
211
+ ```
212
+
213
+ # User
214
+
215
+ ##### Get New Oauth
216
+
217
+ ```bash
218
+ scope =["USERS|GET","USER|GET","USER|PATCH"]
219
+ user.authenticate(scope: scope)
220
+ ```
221
+
222
+ ##### Update User or Update/Add Documents
223
+
224
+ ```bash
225
+ body = {
226
+ "update":{
227
+ "login":{
228
+ "email":"test2@synapsefi.com"
229
+ },
230
+ "remove_login":{
231
+ "email":"test@synapsefi.com"
232
+ },
233
+ "phone_number":"901-111-2222",
234
+ "remove_phone_number":"901.111.1111"
235
+ }
236
+ }
237
+ user = user.user_update(payload:body)
238
+ ```
239
+
240
+ ##### Create UBO
241
+
242
+ - Upload an Ultimate Beneficial Ownership or REG GG Form
243
+
244
+ ```bash
245
+ body = {
246
+ "entity_info": {
247
+ "cryptocurrency": True,
248
+ "msb": {
249
+ "federal": True,
250
+ "states": ["AL"]
251
+ },
252
+ "public_company": False,
253
+ "majority_owned_by_listed": False,
254
+ "registered_SEC": False,
255
+ "regulated_financial": False,
256
+ "gambling": False,
257
+ "document_id": "2a4a5957a3a62aaac1a0dd0edcae96ea2cdee688ec6337b20745eed8869e3ac8"
258
+ ...
259
+ }
260
+ user.create_ubo(payload:body)
261
+ ```
262
+
263
+ #### Get All User Nodes
264
+
265
+ ```bash
266
+ Nodes = user.get_all_nodes(page=1, per_page=5, type='ACH-US')
267
+ ```
268
+
269
+ #### Get All User Transactions
270
+
271
+ - Returns transactons instance
272
+
273
+ ```bash
274
+ # param page (optional) response will default to 1
275
+ # param per_page (optional) response will default to 20
276
+ transactions = user.get_user_transactions(page=1, per_page=5)
277
+ ```
278
+
279
+ ### Nodes
280
+ ##### Create Node
281
+ Refer to the following docs for how to setup the payload for a specific Node type:
282
+ - [Deposit Accounts](https://docs.synapsefi.com/v3.1/docs/deposit-accounts)
283
+ - [Card Issuance](https://docs.synapsefi.com/v3.1/docs/card-issuance)
284
+ - [ACH-US with Logins](https://docs.synapsefi.com/v3.1/docs/add-ach-us-node)
285
+ - [ACH-US MFA](https://docs.synapsefi.com/v3.1/docs/add-ach-us-node-via-bank-logins-mfa)
286
+ - [ACH-US with AC/RT](https://docs.synapsefi.com/v3.1/docs/add-ach-us-node-via-acrt-s)
287
+ - [INTERCHANGE-US](https://docs.synapsefi.com/v3.1/docs/interchange-us)
288
+ - [CHECK-US](https://docs.synapsefi.com/v3.1/docs/check-us)
289
+ - [CRYPTO-US](https://docs.synapsefi.com/v3.1/docs/crypto-us)
290
+ - [WIRE-US](https://docs.synapsefi.com/v3.1/docs/add-wire-us-node)
291
+ - [WIRE-INT](https://docs.synapsefi.com/v3.1/docs/add-wire-int-node)
292
+ - [IOU](https://docs.synapsefi.com/v3.1/docs/add-iou-node)
293
+
294
+ ```bash
295
+ body = {
296
+ "type": "DEPOSIT-US",
297
+ "info":{
298
+ "nickname":"My Checking"
299
+ }
300
+ }
301
+ node = user.create_node(payload:, idempotency_key='123456')
302
+ ```
303
+
304
+ ##### Get Node
305
+
306
+ ```bash
307
+ node_id = "5bd9e7b3389f2400adb012ae"
308
+ node = user.get_user_node(node_id: node_id, full_dehydrate: true, force_refresh: true)
309
+ ```
310
+
311
+ #### Get All User Nodes
312
+
313
+ ```bash
314
+ Nodes = user.get_all_nodes(page=1, per_page=5, type='ACH-US')
315
+ ```
316
+
317
+ #### Update Node
318
+
319
+ - Param node_id
320
+ - Param payload
321
+
322
+ ```bash
323
+ node_id = '5ba05ed620b3aa005882c52a'
324
+ body = {
325
+ "supp_id":"new_supp_id_1234"
326
+ }
327
+ node = user.generate(node_id:node_id, payload:body)
328
+ ```
329
+
330
+ #### Ship Card
331
+
332
+ ```bash
333
+ node_id = '5ba05ed620b3aa005882c52a'
334
+
335
+ body = {
336
+ "fee_node_id":"5ba05e7920b3aa006482c5ad",
337
+ "expedite":True
338
+ }
339
+ node = user.ship_card_node(node_id: node_id, payload: body)
340
+ ```
341
+
342
+ #### Reset Debit Cards
343
+
344
+ ```bash
345
+ node_id = '5ba05ed620b3aa005882c52a'
346
+ node = user.reset_card_node(node_id: node_id)
347
+ ```
348
+
349
+ #### Verify Micro Deposit
350
+
351
+ ```bash
352
+ node_id = '5ba05ed620b3aa005882c52a'
353
+ body = {
354
+ "micro":[0.1,0.1]
355
+ }
356
+ node = user.verify_micro_deposit(node_id: node_id, payload: body)
357
+ ```
358
+
359
+ #### Reinitiate Micro Deposit
360
+
361
+ ```bash
362
+ node_id = '5ba05ed620b3aa005882c52a'
363
+ node = user.reinitiate_micro_deposit(node_id: node_id)
364
+ ```
365
+
366
+ ##### Generate Apple Pay
367
+
368
+ ```bash
369
+ node_id = '5ba05ed620b3aa005882c52a'
370
+ body = {
371
+ "certificate": "your applepay cert",
372
+ "nonce": "9c02xxx2",
373
+ "nonce_signature": "4082f883ae62d0700c283e225ee9d286713ef74"
374
+ }
375
+ response = user.generate_apple_pay_token(node_id: node_id, payload: body)
376
+ ```
377
+
378
+ #### Delete Node
379
+
380
+ ```bash
381
+ node_id = '594e606212e17a002f2e3251'
382
+ response = user.delete_node(node_id: node_id)
383
+ ```
384
+
385
+ #### Get All Node Subnets
386
+
387
+ ```bash
388
+ node_id = '594e606212e17a002f2e3251'
389
+ subnets = user.get_all_subnets(node_id:node_id, page=4, per_page=10)
390
+ ```
391
+
392
+ #### Get All Node Transactions
393
+
394
+ ```bash
395
+ node_id = '594e606212e17a002f2e3251'
396
+ nodes = user.get_all_node_transaction(node_id: node_id, page=4, per_page=10)
397
+ ```
398
+
399
+
400
+ ### Subnets
401
+
402
+ ##### Create Subnet
403
+ ```python
404
+ node_id = '594e606212e17a002f2e3251'
405
+ body = {
406
+ "nickname":"Test AC/RT"
407
+ }
408
+ user.create_subnet(node_id: node_id, payload: body)
409
+ ```
410
+
411
+ #### Get Subnet
412
+ ```bash
413
+ node_id = '594e606212e17a002f2e3251'
414
+ subnet_id = '59c9f77cd412960028b99d2b'
415
+ subnet = user.get_subnet(node_id: node_id, subnet_id: subnet_id)
416
+ ```
417
+
418
+ #### Update Subnet
419
+ ```bash
420
+ node_id = '594e606212e17a002f2e3251'
421
+ subnet_id = '59c9f77cd412960028b99d2b'
422
+ body = {
423
+ "preferences": {
424
+ "allow_foreign_transactions":true,
425
+ "daily_atm_withdrawal_limit":100,
426
+ "daily_transaction_limit":900
427
+ }
428
+ }
429
+ subnet = user.update_subnet(node_id: node_id, payload: body, subnet_id: subnet_id)
430
+ ```
431
+
432
+ ### Transactions
433
+
434
+ #### Create Transaction
435
+ ```bash
436
+ node_id = '594e606212e17a002f2e3251'
437
+ body = {
438
+ "to": {
439
+ "type": "ACH-US",
440
+ "id": "594e6e6c12e17a002f2e39e4"
441
+ },
442
+ "amount": {
443
+ "amount": 20.1,
444
+ "currency": "USD"
445
+ },
446
+ "extra": {
447
+ "ip": "192.168.0.1"
448
+ }
449
+ }
450
+ transaction = user.create_transaction(node_id: node_id, payload: body, idempotency_key:"2435")
451
+ ```
452
+
453
+ #### Get Transaction
454
+
455
+ - Param node_id
456
+ - Param trans_id
457
+
458
+ ```bash
459
+ node_id = '594e606212e17a002f2e3251'
460
+ trans_id = '594e72124599e8002fe62e4f'
461
+ transaction = user.get_node_transaction(node_id: node_id, trans_id: trans_id)
462
+ ```
463
+
464
+ #### Comment on status
465
+
466
+ ```bash
467
+ node_id = '594e606212e17a002f2e3251'
468
+ trans_id = '594e72124599e8002fe62e4f'
469
+ body = 'Pending verification...'
470
+ transaction = user.comment_transaction(node_id: node_id, trans_id: trans_id, payload: body)
471
+ ```
472
+
473
+ #### Dispute Transaction
474
+
475
+ ```bash
476
+ node_id = '594e606212e17a002f2e3251'
477
+ trans_id = '594e72124599e8002fe62e4f'
478
+ dispute_reason = {
479
+ "dispute_reason":"CHARGE_BACK"
480
+ }
481
+ response = user.dispute_user_transactions(node_id:, trans_id:)
482
+ ```
483
+
484
+ #### Cancel Delete Transaction
485
+
486
+ ```bash
487
+ node_id = '594e606212e17a002f2e3251'
488
+ trans_id = '594e72124599e8002fe62e4f'
489
+ response = user.cancel_transaction(node_id: node_id, trans_id: trans_id)
490
+ ```