synapse_pay_rest 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7577507829d62a972d335b9befde0467f91ce140
4
- data.tar.gz: 1b89b98e58b40e5351042abd57c428911dcf2a79
3
+ metadata.gz: 2cc3f5c96ebd64735c90cee2bd7f0989bda4a731
4
+ data.tar.gz: baa7445a81cddba8cb95ab2b0cbad69a34fcc4b8
5
5
  SHA512:
6
- metadata.gz: 31a63bd44d0ec751522fcb3cc1af25a542d5b4c1328dd26052b907517c2f670f9bb80d2c18d4024e44f056469852907bbd47d3006d20782ee7c65fa068d5b136
7
- data.tar.gz: 5693e69860e72f275f868297a192de94a8cec2f43d5575bb993daac4c98e5e76e58aaa1fe21dbb1226997313e6dcc2ded82409ef23ff092fbe0928684b48ca6c
6
+ metadata.gz: 44ed5c4e073ad34f76b7e3ae71669790ccd119f6fe6c6653b5fd9130d7c6b594118f59ae14d0c6c4729fa311eb2ca4c0b03fb22a92fcfe73396509177958c50e
7
+ data.tar.gz: dce13e643e09c2844dc2dac338499aa11ae834e1f05be2d25f0e3f2df8407b974f92b9ba2edb20b64e6c0b76e2052d86cad27cb8e1fb0fd46a28f9bc94d900e1
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 SynapsePay LLC
3
+ Copyright (c) 2017 Synapse Financial Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
@@ -7,7 +7,7 @@ module SynapsePayRest
7
7
  class Users
8
8
  # Valid optional args for #get
9
9
  # @todo Should refactor this to HTTPClient
10
- VALID_QUERY_PARAMS = [:query, :page, :per_page].freeze
10
+ VALID_QUERY_PARAMS = [:query, :page, :per_page, :full_dehydrate].freeze
11
11
 
12
12
  # @!attribute [rw] client
13
13
  # @return [SynapsePayRest::HTTPClient]
@@ -26,6 +26,7 @@ module SynapsePayRest
26
26
  # users with matching name/email
27
27
  # @param page [String,Integer] (optional) response will default to 1
28
28
  # @param per_page [String,Integer] (optional) response will default to 20
29
+ # @param full_dehydrate [String, String] (optional) response will inclulde all KYC info on user
29
30
  #
30
31
  # @raise [SynapsePayRest::Error] may return subclasses of error based on
31
32
  # HTTP response from API
@@ -38,8 +39,6 @@ module SynapsePayRest
38
39
  def get(user_id: nil, **options)
39
40
  path = user_path(user_id: user_id)
40
41
 
41
- return client.get(path) if user_id
42
-
43
42
  params = VALID_QUERY_PARAMS.map do |p|
44
43
  options[p] ? "#{p}=#{options[p]}" : nil
45
44
  end.compact
@@ -16,7 +16,7 @@ module SynapsePayRest
16
16
  #
17
17
  # @raise [SynapsePayRest::Error]
18
18
  #
19
- # @return [Array<SynapsePayRest::AchUsNode>] may contain multiple nodes (checking and/or savings)s
19
+ # @return [Array<SynapsePayRest::AchUsNode>] may contain multiple nodes (checking and/or savings)
20
20
  def create_via_bank_login(user:, bank_name:, username:, password:)
21
21
  raise ArgumentError, 'user must be a User object' unless user.is_a?(User)
22
22
  raise ArgumentError, 'bank_name must be a String' unless bank_name.is_a?(String)
@@ -32,6 +32,15 @@ module SynapsePayRest
32
32
  multiple_from_response(user, response['nodes'])
33
33
  end
34
34
  end
35
+
36
+ # Creates an ACH-US node via access token, belonging to user supplied.
37
+ #
38
+ # @param user [SynapsePayRest::User] the user to whom the node belongs
39
+ # @param access_token [String] user's access token
40
+ #
41
+ # @raise [SynapsePayRest::Error]
42
+ #
43
+ # @return [Array<SynapsePayRest::AchUsNode>] may contain multiple nodes (checking and/or savings)
35
44
 
36
45
  def create_via_bank_login_mfa(user:, access_token:)
37
46
  raise ArgumentError, 'user must be a User object' unless user.is_a?(User)
@@ -64,15 +64,16 @@ module SynapsePayRest
64
64
  #
65
65
  # @param client [SynapsePayRest::Client]
66
66
  # @param id [String] id of the user to find
67
+ # @param full_dehydrate [String] (optional) if 'yes', returns all KYC on user
67
68
  #
68
69
  # @raise [SynapsePayRest::Error] if user not found or invalid client credentials
69
70
  #
70
71
  # @return [SynapsePayRest::User]
71
- def find(client:, id:)
72
+ def find(client:, id:, full_dehydrate:)
72
73
  raise ArgumentError, 'client must be a SynapsePayRest::Client' unless client.is_a?(Client)
73
74
  raise ArgumentError, 'id must be a String' unless id.is_a?(String)
74
75
 
75
- response = client.users.get(user_id: id)
76
+ response = client.users.get(user_id: id, full_dehydrate: full_dehydrate)
76
77
  from_response(client, response)
77
78
  end
78
79
 
@@ -1,4 +1,4 @@
1
1
  module SynapsePayRest
2
2
  # Gem version
3
- VERSION = '3.2.0'.freeze
3
+ VERSION = '3.2.1'.freeze
4
4
  end
data/samples.md CHANGED
@@ -45,6 +45,8 @@ args = {
45
45
  per_page: 50,
46
46
  # (optional) filters by name/email match
47
47
  query: nil,
48
+ # (optional) returns all KYC on user
49
+ full_dehydrate: yes
48
50
  }
49
51
 
50
52
  users = SynapsePayRest::User.all(args)
@@ -54,7 +56,7 @@ users = SynapsePayRest::User.all(args)
54
56
  #### Find a User by User ID
55
57
 
56
58
  ```ruby
57
- user = SynapsePayRest::User.find(client: client, id: '57e97ab786c2737f4ccd4dc1')
59
+ user = SynapsePayRest::User.find(client: client, id: '57e97ab786c2737f4ccd4dc1', full_dehydrate: 'no')
58
60
  # => #<SynapsePayRest::User>
59
61
  ```
60
62
 
@@ -89,6 +91,7 @@ user_update_settings = {
89
91
  phone_number: '415-555-5555', # add a phone number
90
92
  legal_name: 'Big Bird', # add a legal name
91
93
  remove_phone_number: '555-555-5555', # remove a phone number
94
+ remove_legal_name: 'Big Bird', # remove a legal name
92
95
  remove_login: nil # remove a login email
93
96
  }
94
97
 
@@ -348,6 +351,27 @@ nodes.mfa_verified
348
351
  # => true
349
352
  ```
350
353
 
354
+ ##### Verify Bank Login MFA without existing node object
355
+
356
+ If you are unable to finish MFA in one session with `AchUsNode.create_via_bank_login`, you can create another unverified node with just the access token. Use `AchUsNode.create_via_bank_login_mfa` with the addition of an `access_token` argument.
357
+
358
+ ```ruby
359
+ unverified_node = user.create_ach_us_nodes_via_bank_login_mfa(access_token:)
360
+ ```
361
+
362
+ Then proceed to resolve the MFA question(s) as before:
363
+
364
+ ```ruby
365
+
366
+ nodes = nodes.answer_mfa('test_answer')
367
+ # => [#<SynapsePayRest::AchUsNode>, ...] if successful
368
+ # => SynapsePayRest::UnverifiedNode if additional MFA question (check node.mfa_message)
369
+ # => raises SynapsePayRest::Error if incorrect answer
370
+
371
+ nodes.mfa_verified
372
+ # => true
373
+ ```
374
+
351
375
  #### Create ACH-US Node via Account/Routing Number
352
376
 
353
377
  Can also use `AchUsNode.create` with the addition of a `user` argument.
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: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Broderick
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-05-02 00:00:00.000000000 Z
12
+ date: 2017-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -143,7 +143,6 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - ".env.sample"
147
146
  - ".gitignore"
148
147
  - Gemfile
149
148
  - LICENSE
@@ -1,8 +0,0 @@
1
- # For development in a console
2
- CLIENT_ID=your_sandbox_client_id
3
- CLIENT_SECRET=your_sandbox_client_secret
4
- FINGERPRINT=your_sandbox_fingerprint
5
-
6
- # For running tests
7
- TEST_CLIENT_ID=your_sandbox_client_id
8
- TEST_CLIENT_SECRET=your_sandbox_client_secret