synapse_pay_rest 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/synapse_pay_rest.rb +0 -3
- data/lib/synapse_pay_rest/client.rb +4 -8
- data/lib/synapse_pay_rest/error.rb +0 -3
- data/lib/synapse_pay_rest/models/node/unverified_node.rb +3 -14
- data/lib/synapse_pay_rest/models/transaction/transaction.rb +1 -2
- data/lib/synapse_pay_rest/models/user/virtual_document.rb +5 -0
- data/lib/synapse_pay_rest/version.rb +1 -1
- data/samples.md +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ac33ad48e29bfe842ef95fd251245006824f851
|
4
|
+
data.tar.gz: 56bc587fa28769dd1bb9ccf193fdb44431cfcc7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39cabd30d390cc1e5d0928a783668f1f7295bba049ac86d45021d6a44778e9e7ba5ea19b88114a9fcfa0aecd8b039d5d1a4cbcc31c6a5ddf2c945147e4436da
|
7
|
+
data.tar.gz: 02d70a8460231e31471b1bdc3381f69ea0c2abd14c40c2fd78be182e9f8180d9fce8380baf33ee717469a5c5459efe6729d22558e06df53c713ac6afa6d486d6
|
data/lib/synapse_pay_rest.rb
CHANGED
@@ -27,7 +27,6 @@ require 'synapse_pay_rest/models/node/base_node'
|
|
27
27
|
|
28
28
|
# BaseNode subclasses
|
29
29
|
# synapse
|
30
|
-
require 'synapse_pay_rest/models/node/synapse_node'
|
31
30
|
require 'synapse_pay_rest/models/node/synapse_us_node.rb'
|
32
31
|
require 'synapse_pay_rest/models/node/synapse_ind_node.rb'
|
33
32
|
require 'synapse_pay_rest/models/node/synapse_np_node.rb'
|
@@ -35,11 +34,9 @@ require 'synapse_pay_rest/models/node/synapse_np_node.rb'
|
|
35
34
|
require 'synapse_pay_rest/models/node/ach_us_node.rb'
|
36
35
|
require 'synapse_pay_rest/models/node/unverified_node.rb'
|
37
36
|
# eft
|
38
|
-
require 'synapse_pay_rest/models/node/eft_node'
|
39
37
|
require 'synapse_pay_rest/models/node/eft_ind_node.rb'
|
40
38
|
require 'synapse_pay_rest/models/node/eft_np_node.rb'
|
41
39
|
# wire
|
42
|
-
require 'synapse_pay_rest/models/node/wire_node.rb'
|
43
40
|
require 'synapse_pay_rest/models/node/wire_us_node.rb'
|
44
41
|
require 'synapse_pay_rest/models/node/wire_int_node.rb'
|
45
42
|
# reserve
|
@@ -27,16 +27,12 @@ module SynapsePayRest
|
|
27
27
|
# @param log_to [String] (optional) file path to log to file (logging must be true)
|
28
28
|
def initialize(client_id:, client_secret:, ip_address:, fingerprint: nil,
|
29
29
|
development_mode: true, **options)
|
30
|
-
base_url =
|
31
|
-
'https://sandbox.synapsepay.com/api/3'
|
32
|
-
else
|
33
|
-
'https://synapsepay.com/api/3'
|
34
|
-
end
|
30
|
+
base_url = 'https://api-qa.synapsefi.com/v3.1'
|
35
31
|
|
36
32
|
@http_client = HTTPClient.new(base_url: base_url,
|
37
|
-
client_id:
|
38
|
-
client_secret:
|
39
|
-
fingerprint:
|
33
|
+
client_id: 'client_id_b8d24e32b6aa11e6bba40242ac110003',
|
34
|
+
client_secret: 'test1234',
|
35
|
+
fingerprint: 'e716990e50b67a1177736960b6357524b22090ccab093d068b3d7a18dbde3f4c',
|
40
36
|
ip_address: ip_address,
|
41
37
|
**options)
|
42
38
|
@users = Users.new @http_client
|
@@ -50,9 +50,6 @@ module SynapsePayRest
|
|
50
50
|
GatewayTimeout = Class.new(ServerError)
|
51
51
|
|
52
52
|
# HTTP status code to Error subclass mapping
|
53
|
-
#
|
54
|
-
# @todo need to add an error message for various 202 cases (fingerprint, mfa, etc)
|
55
|
-
# @todo doesn't do well when there's an html response from nginx for bad gateway/timeout
|
56
53
|
ERRORS = {
|
57
54
|
400 => SynapsePayRest::Error::BadRequest,
|
58
55
|
401 => SynapsePayRest::Error::Unauthorized,
|
@@ -10,7 +10,6 @@ module SynapsePayRest
|
|
10
10
|
# @return [String] question or MFA prompt from bank that must be answered
|
11
11
|
# @!attribute [r] mfa_verified
|
12
12
|
# @return [Boolean] whether the node is verified yet
|
13
|
-
# @todo should be mfa_verified? in Ruby idiom
|
14
13
|
attr_reader :user, :mfa_access_token, :mfa_message, :mfa_verified
|
15
14
|
|
16
15
|
def initialize(user:, mfa_access_token:, mfa_message:, mfa_verified:)
|
@@ -27,8 +26,6 @@ module SynapsePayRest
|
|
27
26
|
# @raise [SynapsePayRest::Error] if incorrect answer
|
28
27
|
#
|
29
28
|
# @return [Array<SynapsePayRest::AchUsNode>,SynapsePayRest::UnverifiedNode] may contain multiple nodes if successful, else self if new MFA question to answer
|
30
|
-
#
|
31
|
-
# @todo make a new Error subclass for incorrect MFA
|
32
29
|
def answer_mfa(answer)
|
33
30
|
payload = payload_for_answer_mfa(answer: answer)
|
34
31
|
response = user.client.nodes.post(user_id: user.id, payload: payload)
|
@@ -36,6 +33,8 @@ module SynapsePayRest
|
|
36
33
|
handle_answer_mfa_response(response)
|
37
34
|
end
|
38
35
|
|
36
|
+
alias_method :mfa_verified?, :mfa_verified
|
37
|
+
|
39
38
|
private
|
40
39
|
|
41
40
|
def payload_for_answer_mfa(answer:)
|
@@ -47,23 +46,13 @@ module SynapsePayRest
|
|
47
46
|
|
48
47
|
# Determines whether the response is successful in verifying the node, has
|
49
48
|
# follow-up MFA questions, or failed with an incorrect answer.
|
50
|
-
#
|
51
|
-
# @todo Use Error#code instead of parsing the response for the code.
|
52
49
|
def handle_answer_mfa_response(response)
|
53
50
|
if response['error_code'] == '0'
|
54
51
|
# correct answer
|
55
52
|
@mfa_verified = true
|
56
53
|
AchUsNode.multiple_from_response(user, response['nodes'])
|
57
|
-
elsif response['error_code'] == '10' && response['mfa']['message'] == mfa_message
|
58
|
-
# wrong answer (mfa message the same), retry if allowed
|
59
|
-
args = {
|
60
|
-
message: 'incorrect bank login mfa answer',
|
61
|
-
code: response['http_code'],
|
62
|
-
response: response
|
63
|
-
}
|
64
|
-
raise SynapsePayRest::Error, args
|
65
54
|
elsif response['error_code'] == '10'
|
66
|
-
# new
|
55
|
+
# incorrect answer or new MFA question. need to call #answer_mfa with new answer.
|
67
56
|
@mfa_access_token = response['mfa']['access_token']
|
68
57
|
@mfa_message = response['mfa']['message']
|
69
58
|
self
|
@@ -114,7 +114,6 @@ module SynapsePayRest
|
|
114
114
|
#
|
115
115
|
# @note Shouldn't need to call this directly.
|
116
116
|
#
|
117
|
-
# @todo convert the nodes and users in response into User/Node objects
|
118
117
|
# @todo rework to handle multiple fees
|
119
118
|
def from_response(node, response)
|
120
119
|
args = {
|
@@ -208,7 +207,7 @@ module SynapsePayRest
|
|
208
207
|
trans_id: id,
|
209
208
|
payload: payload
|
210
209
|
)
|
211
|
-
self.class.from_response(node, response
|
210
|
+
self.class.from_response(node, response)
|
212
211
|
end
|
213
212
|
|
214
213
|
# Cancels this transaction if it has not already settled.
|
@@ -6,6 +6,7 @@ module SynapsePayRest
|
|
6
6
|
class VirtualDocument < Document
|
7
7
|
# @!attribute [r] question_set
|
8
8
|
# @return [SynapsePayRest::Array<SynapsePayRest::Question>] questions/answer choices returned when document status is MFA|PENDING
|
9
|
+
# @deprecated
|
9
10
|
attr_reader :question_set
|
10
11
|
|
11
12
|
class << self
|
@@ -28,6 +29,8 @@ module SynapsePayRest
|
|
28
29
|
# @return [SynapsePayRest::VirtualDocument] (self)
|
29
30
|
#
|
30
31
|
# @todo should raise error if any questions aren't answered yet.
|
32
|
+
#
|
33
|
+
# @deprecated
|
31
34
|
def submit_kba
|
32
35
|
user = base_document.user
|
33
36
|
user.authenticate()
|
@@ -38,6 +41,8 @@ module SynapsePayRest
|
|
38
41
|
end
|
39
42
|
|
40
43
|
# Maps question set from response to Question objects.
|
44
|
+
#
|
45
|
+
# @deprecated
|
41
46
|
def add_question_set(question_set_data)
|
42
47
|
questions = question_set_data['questions'].map do |question_info|
|
43
48
|
# re-map question/answer hash structure
|
data/samples.md
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: 2.2.
|
4
|
+
version: 2.2.2
|
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: 2016-12-
|
12
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|