synapse_fi 0.0.3 → 0.0.4

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.
data/samples.md CHANGED
@@ -1,25 +1,75 @@
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
+
1
42
  # Client
2
43
 
3
- ## Initializing Client
44
+ ##### Initialize Client
4
45
 
5
46
  - Set up a .env file to fetch your client_id and client_secret
6
47
  - Returns Client instance
7
- - Set raise_for_202 as true if you want 2FA and MFA to be raised
8
48
 
9
49
  ```bash
10
50
  args = {
51
+ # synapse client_id
11
52
  client_id: ENV.fetch("client_id"),
53
+ # synapse client_secret
12
54
  client_secret: ENV.fetch("client_secret"),
55
+ # a hashed value, either unique to user or static for app
13
56
  fingerprint: "fp",
57
+ # end user's IP
14
58
  ip_address: 'ip',
59
+ # (optional) requests go to sandbox endpoints if true
15
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
16
66
  raise_for_202: true
17
67
  }
18
68
 
19
69
  client = Synapse::Client.new(args)
20
70
  ```
21
71
 
22
- ## Creating USER
72
+ ##### Create User
23
73
 
24
74
  - Returns user instance
25
75
 
@@ -47,15 +97,7 @@ payload = {
47
97
  user = client.create_user(payload: payload)
48
98
  ```
49
99
 
50
- ## Update Headers
51
-
52
- - Updates current headers for future request
53
-
54
- ```bash
55
- headers = client.update_headers(fingerprint:nil, idemopotency_key:nil, ip_address:nil)
56
- ```
57
-
58
- ## Get USER
100
+ ##### Get User
59
101
  - returns USER instance
60
102
 
61
103
  ```bash
@@ -63,124 +105,113 @@ user_id = "1232"
63
105
  user = client.get_user(user_id: user_id,full_dehydrate: true)
64
106
  ```
65
107
 
66
- ## Get all USERS
67
- - returns USERS instance
68
- - Array of users on a platform
108
+ ##### Create Subscription
109
+ - Returns subscription instace
69
110
 
70
111
  ```bash
71
- users = client.get_users(** options)
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)
72
124
  ```
73
125
 
74
- ## Gets all transactions on a platform
75
-
76
- - returns Transactions instance
77
- - array of Transaction instance
126
+ ##### Get Subscription
127
+ - returns a subscription instance
78
128
 
79
129
  ```bash
80
- trans = client.get_transaction(page: nil, per_page: nil, query: nil)
130
+ subscription_id = "2342324"
131
+ subscription = client.get_subscription(subscriptions_id: subscription_id)
81
132
  ```
82
133
 
83
- ## Get all platform nodes
84
- - Returns Nodes instance
85
- - Array of Node instance
86
- - Page (optional params)
87
- - Per Page (optional params)
134
+ #### Update Subscription
135
+
136
+ - Updates a subscription scope, active or url
137
+ - Returns a subscription instance
88
138
 
89
139
  ```bash
90
- Nodes = client.get_all_nodes(** options)
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)
91
151
  ```
92
152
 
93
- ## Get Institutions
94
-
95
- - Returns institutions available for bank logins
96
- - Page (optional params)
97
- - Per Page (optional params)
153
+ ##### Get All Users
154
+ - returns USERS instance
155
+ - Array of users on a platform
98
156
 
99
157
  ```bash
100
- institutions = client.get_all_institutions(** options)
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)
101
161
  ```
102
162
 
103
- ## Create subscription
104
- - Scope must be an array or else method will raise an error
105
- - Returns subscription instace
163
+ #### Get All Client Transactions
164
+
165
+ - returns Transactions instance
166
+ - array of Transaction instance
106
167
 
107
168
  ```bash
108
- scope = ["TRAN|PATCH"]
109
- url = "webhooks.com"
110
- subscription = client.create_subscriptions(scope: scope, url: url )
169
+ trans = client.get_transaction(page: 5, per_page: 5)
111
170
  ```
112
171
 
113
- ## Get all platforms subscription
114
- - Developer has option to
172
+ #### Get All Client Nodes
173
+ - Returns Nodes instance
174
+ - Array of Node instance
115
175
  - Page (optional params)
116
176
  - Per Page (optional params)
117
177
 
118
178
  ```bash
119
- subscriptions = client.get_all_subscriptions(** options)
120
- ```
121
-
122
- ## Get a subscription by id
123
- - returns a subscription instance
124
-
125
- ```bash
126
- subscription_id = "2342324"
127
- subscription = client.get_subscription(subscriptions_id:)
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)
128
182
  ```
129
183
 
130
- ## Update Subscription
184
+ #### Get All Client Institutions
131
185
 
132
- - Updates a subscription scope or url
133
- - Returns a subscription instance
186
+ - Returns institutions available for bank logins
187
+ - Page (optional params)
188
+ - Per Page (optional params)
134
189
 
135
190
  ```bash
136
- subscription_id = "2342324"
137
- scope = ["TRAN|PATCH"]
138
- subscription = client.update_subscriptions(subscription_id: subscription_id , scope: scope)
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)
139
194
  ```
140
195
 
141
- ## Issue Public Key
196
+ #### Issue Public Key
142
197
 
143
198
  - Returns api response
144
199
 
145
200
  ```bash
146
- scope = ["USERS|GET"]
201
+ scope = "USERS|GET,USER|GET,USER|PATCH"
147
202
  public_key = client.issue_public_key(scope: scope)
148
203
  ```
149
- ## Locate ATM
150
- - Returns all atms nearby
151
- - Param zip
152
- - Param radius
153
- - Param lat
154
- - Param lon
155
-
156
- ```bash
157
- atms = client.locate_atm(** options)
158
- ```
159
-
160
- ## Get Crypto Quotes
161
-
162
- - Returns Crypto Currencies Quotes
163
-
164
- ```bash
165
- crypto_quotes = client.get_crypto_quotes()
166
- ```
167
-
168
- ## Get Market Data
169
204
 
170
- - Returns Crypto market data
171
- - Param limit
172
- - Param currency
205
+ # User
173
206
 
207
+ ##### Get New Oauth
174
208
 
175
209
  ```bash
176
- crypto_data = client.get_crypto_market_data(** options)
210
+ scope =["USERS|GET,USER|GET,USER|PATCH"]
211
+ user.authenticate(scope: scope)
177
212
  ```
178
213
 
179
- # User
180
-
181
- ## Update User Documents
182
-
183
- - Updates user documents
214
+ ##### Update User or Update/Add Documents
184
215
 
185
216
  ```bash
186
217
  body = {
@@ -195,261 +226,243 @@ body = {
195
226
  "remove_phone_number":"901.111.1111"
196
227
  }
197
228
  }
198
-
199
-
200
- user = user.user_update(payload:)
201
- ```
202
-
203
- ## Get User Node
204
-
205
- - Gets User node
206
- - Param full_dehydrate or force_refresh
207
-
208
- ```bash
209
- node_id = "5bd9e7b3389f2400adb012ae"
210
-
211
- node = user.get_user_node(node_id: node_id, full_dehydrate: true, force_refresh: true)
212
- ```
213
-
214
- ## Get All User Nodes
215
-
216
- - Options[page, per_page, type]
217
- ```bash
218
- Nodes = user.get_all_nodes(**options)
219
- ```
220
-
221
- ## Authenticate a USER
222
-
223
- - Authenticates users
224
- - Params Scope [Array]
225
- - Param Idempotency_key [String] (optional)
226
-
227
- ```bash
228
- response = user.authenticate(** options)
229
+ user = user.user_update(payload:body)
229
230
  ```
230
231
 
231
- ## Select 2FA device
232
+ ##### Create UBO
232
233
 
233
- - Register new fingerprint
234
- - Param device
235
- - Param Idempotency_key [String] (optional)
234
+ - Upload an Ultimate Beneficial Ownership or REG GG Form
236
235
 
237
236
  ```bash
238
- response = user.select_2fa_device(device:)
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)
239
253
  ```
240
254
 
241
- ## Confirm 2FA pin
242
-
243
- - Supply pin
244
- - Param pin
245
- - Param Idempotency_key [String] (optional)
255
+ #### Get All User Nodes
246
256
 
247
257
  ```bash
248
- response = user.confirm_2fa_pin(pin:)
258
+ Nodes = user.get_all_nodes(page=1, per_page=5, type='ACH-US')
249
259
  ```
250
260
 
251
- ## Get user transactions
261
+ #### Get All User Transactions
252
262
 
253
263
  - Returns transactons instance
254
- - Options[page, per_page, type]
255
-
256
- ```bash
257
- transactions = user.get_user_transactions(** options)
258
- ```
259
-
260
- ## Create Node
261
-
262
- - Creates Node
263
- - Param node payload
264
- - Param Idempotency_key [String] (optional)
265
- - Returns node or access token depending on node
266
264
 
267
265
  ```bash
268
- node = user.create_node(payload:, options)
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
269
  ```
270
270
 
271
- ## ACH MFA
272
-
273
- - Submit MFA question and access token
274
- - Param MFA payload
275
- - Param Idempotency_key [String] (optional)
276
- - Returns node or access token depending on node
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)
277
285
 
278
286
  ```bash
279
- node = user.ach_mfa(payload:, options)
287
+ body = {
288
+ "type": "DEPOSIT-US",
289
+ "info":{
290
+ "nickname":"My Checking"
291
+ }
292
+ }
293
+ node = user.create_node(payload:, idempotency_key='123456')
280
294
  ```
281
295
 
282
- ## Create UBO
283
-
284
- - Upload an Ultimate Beneficial Ownership or REG GG Form
296
+ ##### Get Node
285
297
 
286
298
  ```bash
287
- response = user.create_ubo(payload:)
299
+ node_id = "5bd9e7b3389f2400adb012ae"
300
+ node = user.get_user_node(node_id: node_id, full_dehydrate: true, force_refresh: true)
288
301
  ```
289
302
 
290
- ## Get User Statement
291
-
292
- - Gets user statements
293
- - Options[page, per_page, type]
303
+ #### Get All User Nodes
294
304
 
295
305
  ```bash
296
- statement = user.get_user_statement()
306
+ Nodes = user.get_all_nodes(page=1, per_page=5, type='ACH-US')
297
307
  ```
298
308
 
299
- ## Ship Card
309
+ #### Update Node
300
310
 
301
- - Initate card shipment
302
311
  - Param node_id
303
312
  - Param payload
304
313
 
305
314
  ```bash
306
- node = user.ship_card()
315
+ node_id = '5ba05ed620b3aa005882c52a'
316
+ body = {
317
+ "supp_id":"new_supp_id_1234"
318
+ }
319
+ node = user.generate(node_id:node_id, payload:body)
307
320
  ```
308
321
 
309
- ## Reset Debit Cards
310
-
311
- - Get new card number and cvv
312
- - Param node_id
322
+ #### Ship Card
313
323
 
314
324
  ```bash
315
- node = user.reset_debit_card(node_id:)
316
- ```
317
-
318
- ## Create Transaction
319
-
320
- - Create a node transaction
321
- - Param node_id
322
- - Param payload
323
- - Param Idempotency_key [String] (optional)
325
+ node_id = '5ba05ed620b3aa005882c52a'
324
326
 
325
- ```bash
326
- transaction = user.create_transaction(node_id:, payload:, ** options)
327
+ body = {
328
+ "fee_node_id":"5ba05e7920b3aa006482c5ad",
329
+ "expedite":True
330
+ }
331
+ node = user.ship_card(node_id: node_id, payload: body)
327
332
  ```
328
333
 
329
- ## Get Node Transaction
330
-
331
- - Param node_id
332
- - Param trans_id
334
+ #### Reset Debit Cards
333
335
 
334
336
  ```bash
335
- transaction = user.get_node_transaction(node_id:, trans_id:)
337
+ node_id = '5ba05ed620b3aa005882c52a'
338
+ node = user.reset_debit_card(node_id: node_id)
336
339
  ```
337
340
 
338
- ## Get all node transaction
339
-
340
- - Param node_id
341
- - Options[page, per_page, type]
341
+ #### Verify Micro Deposit
342
342
 
343
343
  ```bash
344
- nodes = user.get_all_node_transaction(node_id:, options)
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)
345
349
  ```
346
350
 
347
- ## Verify Micro Deposit
348
-
349
- - Param node_id
350
- - Param payload
351
+ #### Reinitiate Micro Deposit
351
352
 
352
353
  ```bash
353
- node = user.verify_micro_deposit(node_id:, payload:)
354
+ node_id = '5ba05ed620b3aa005882c52a'
355
+ node = user.reinitiate_micro_deposit(node_id: node_id)
354
356
  ```
355
357
 
356
- ## Reinitiate Micro Deposit
357
-
358
- - Param node_id
358
+ ##### Generate Apple Pay
359
359
 
360
360
  ```bash
361
- node = user.reinitiate_micro_deposit(node_id:)
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)
362
368
  ```
363
369
 
364
- ## Generate Apple pay Token
365
-
366
- - Param node_id
367
- - Param payload
370
+ #### Delete Node
368
371
 
369
372
  ```bash
370
- response = user.generate_apple_pay_token(node_id:, payload:)
373
+ node_id = '594e606212e17a002f2e3251'
374
+ response = user.delete_node(node_id: node_id)
371
375
  ```
372
376
 
373
- ## Update Node
374
-
375
- - Param node_id
376
- - Param payload
377
+ #### Get All Node Subnets
377
378
 
378
379
  ```bash
379
- node = user.generate(node_id:, payload:)
380
+ node_id = '594e606212e17a002f2e3251'
381
+ subnets = user.get_all_subnets(node_id:node_id, page=4, per_page=10)
380
382
  ```
381
383
 
382
- ## Delete Node
383
-
384
- - Param node_id
384
+ #### Get All Node Transactions
385
385
 
386
386
  ```bash
387
- response = user.delete_node(node_id:)
387
+ node_id = '594e606212e17a002f2e3251'
388
+ nodes = user.get_all_node_transaction(node_id: node_id, page=4, per_page=10)
388
389
  ```
389
390
 
390
- ## Dummy Transactions
391
391
 
392
- - initiates a dummy transaction to a node
393
- - Param node_id [String]
394
- - Param is_credit [Boolean]
392
+ ### Subnets
395
393
 
396
- ```bash
397
- response = user.dummy_transactions(node_id:, is_credit:)
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)
398
401
  ```
399
402
 
400
-
401
- ## Comment on status
402
-
403
- - Param node_id
404
- - Param trans_id
405
- - Param payload
406
-
403
+ #### Get Subnet
407
404
  ```bash
408
- transaction = user.comment_transaction(node_id:, trans_id:, payload:)
405
+ node_id = '594e606212e17a002f2e3251'
406
+ subn_id = '59c9f77cd412960028b99d2b'
407
+ subnet = user.get_subnet(node_id:, subnet_id:)
409
408
  ```
410
409
 
411
- ## Cancel Transaction
412
-
413
- - Param node_id
414
- - Param trans_id
410
+ ### Transactions
415
411
 
412
+ #### Create Transaction
416
413
  ```bash
417
- response = user.cancel_transaction(node_id:, trans_id:)
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")
418
429
  ```
419
430
 
420
- ## Dispute Card Transactions
431
+ #### Get Transaction
421
432
 
422
433
  - Param node_id
423
434
  - Param trans_id
424
435
 
425
436
  ```bash
426
- response = user.dispute_user_transactions(node_id:, trans_id:)
437
+ node_id = '594e606212e17a002f2e3251'
438
+ trans_id = '594e72124599e8002fe62e4f'
439
+ transaction = user.get_node_transaction(node_id: node_id, trans_id: trans_id)
427
440
  ```
428
441
 
429
- ## Get All Subnets
430
-
431
- - Param node_id
432
- - Options[page, per_page, type]
442
+ #### Comment on status
433
443
 
434
444
  ```bash
435
- subnets = user.get_all_subnets(node_id:, options)
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)
436
449
  ```
437
450
 
438
- ## Get Subnet
439
-
440
- - Param node_id
441
- - Param subnet_id
451
+ #### Dispute Transaction
442
452
 
443
453
  ```bash
444
- subnet = user.get_subnet(node_id:, subnet_id:)
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:)
445
460
  ```
446
- ## Get Node Statements
447
461
 
448
- - Param node_id
449
- - Options[page, per_page, type]
462
+ #### Cancel Delete Transaction
450
463
 
451
464
  ```bash
452
- response = get_node_statements(node_id:, ** options)
465
+ node_id = '594e606212e17a002f2e3251'
466
+ trans_id = '594e72124599e8002fe62e4f'
467
+ response = user.cancel_transaction(node_id: node_id, trans_id: trans_id)
453
468
  ```
454
-
455
-