blockchyp 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -0
- data/lib/blockchyp.rb +17 -0
- data/lib/blockchyp/version.rb +1 -1
- data/lib/blockchyp_client.rb +2 -0
- data/test/capture_signature_test.rb +40 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62cfc81bad362a19dba4d7ca8bd75ffc3676ada2edb6f246c65a3ba203a653cc
|
4
|
+
data.tar.gz: 61557465f7c0968199f7b9f74af3dd27b800dd7790e00267914ec576bd9944f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfa386e6fd59390035d4b57c7ad1ceed6de08796141208e185c93cffb74ae1d2b01d91b21a8818a09c9b48ecb28424ad6633440cab82c252a3d63f5cddc814e0
|
7
|
+
data.tar.gz: 4a3b6b5be656c6fbf6cfada0ed37872f3f136f3727891de661d80adc246413f4283b5b89ce6b765ff90d8ead92e85f81f25601ca9f5f0e7c4b6e04ee1bf8ee04
|
data/README.md
CHANGED
@@ -724,6 +724,35 @@ response = blockchyp.terminalStatus(request)
|
|
724
724
|
puts "Response: #{response.inspect}"
|
725
725
|
|
726
726
|
|
727
|
+
```
|
728
|
+
|
729
|
+
#### Capture Signature.
|
730
|
+
|
731
|
+
Captures and returns a signature.
|
732
|
+
|
733
|
+
|
734
|
+
```ruby
|
735
|
+
# frozen_string_literal: true
|
736
|
+
|
737
|
+
require 'blockchyp'
|
738
|
+
|
739
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
740
|
+
ENV['BC_API_KEY'],
|
741
|
+
ENV['BC_BEARER_TOKEN'],
|
742
|
+
ENV['BC_SIGNING_KEY']
|
743
|
+
)
|
744
|
+
|
745
|
+
# setup request object
|
746
|
+
request = {}
|
747
|
+
request['terminalName'] = 'Test Terminal'
|
748
|
+
request['sigFormat'] = SignatureFormat::PNG
|
749
|
+
request['sigWidth'] = 200
|
750
|
+
|
751
|
+
response = blockchyp.captureSignature(request)
|
752
|
+
|
753
|
+
puts "Response: #{response.inspect}"
|
754
|
+
|
755
|
+
|
727
756
|
```
|
728
757
|
|
729
758
|
## Running Integration Tests
|
data/lib/blockchyp.rb
CHANGED
@@ -28,6 +28,18 @@ module PromptType
|
|
28
28
|
PHONE_NUMBER = 'phone'
|
29
29
|
CUSTOMER_NUMBER = 'customer-number'
|
30
30
|
REWARDS_NUMBER = 'rewards-number'
|
31
|
+
FIRST_NAME = 'first-name'
|
32
|
+
LAST_NAME = 'last-name'
|
33
|
+
end
|
34
|
+
|
35
|
+
module AVSResponse
|
36
|
+
NOT_APPLICABLE = ''
|
37
|
+
NOT_SUPPORTED = 'not_supported'
|
38
|
+
RETRY = 'retry'
|
39
|
+
NO_MATCH = 'no_match'
|
40
|
+
ADDRESS_MATCH = 'address_match'
|
41
|
+
POSTAL_CODE_MATCH = 'zip_match'
|
42
|
+
ADDRESS_AND_POSTAL_CODE_MATCH = 'match'
|
31
43
|
end
|
32
44
|
|
33
45
|
module BlockChyp
|
@@ -114,6 +126,11 @@ module BlockChyp
|
|
114
126
|
def terminal_status(request)
|
115
127
|
route_terminal_request('POST', '/api/terminal-status', '/api/terminal-status', request)
|
116
128
|
end
|
129
|
+
|
130
|
+
# Captures and returns a signature.
|
131
|
+
def capture_signature(request)
|
132
|
+
route_terminal_request('POST', '/api/capture-signature', '/api/capture-signature', request)
|
133
|
+
end
|
117
134
|
|
118
135
|
# Executes a manual time out reversal.
|
119
136
|
#
|
data/lib/blockchyp/version.rb
CHANGED
data/lib/blockchyp_client.rb
CHANGED
@@ -101,6 +101,7 @@ module BlockChyp
|
|
101
101
|
def terminal_request(method, route, path, request, open_retry)
|
102
102
|
uri = resolve_terminal_uri(route, path)
|
103
103
|
http = Net::HTTP.new(uri.host, uri.port)
|
104
|
+
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
104
105
|
timeout = get_timeout(request, terminal_timeout)
|
105
106
|
http.open_timeout = timeout
|
106
107
|
http.read_timeout = timeout
|
@@ -168,6 +169,7 @@ module BlockChyp
|
|
168
169
|
def gateway_request(method, path, request = nil, relay = false)
|
169
170
|
uri = resolve_gateway_uri(path, request)
|
170
171
|
http = Net::HTTP.new(uri.host, uri.port)
|
172
|
+
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
171
173
|
timeout = get_timeout(request, relay ? terminal_timeout : gateway_timeout)
|
172
174
|
http.open_timeout = timeout
|
173
175
|
http.read_timeout = timeout
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
|
+
# governed by a license that can be found in the LICENSE file.
|
5
|
+
#
|
6
|
+
# This file was generated automatically. Changes to this file will be lost
|
7
|
+
# every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class CaptureSignatureTest < TestCase
|
13
|
+
def test_capture_signature
|
14
|
+
config = load_test_config
|
15
|
+
|
16
|
+
blockchyp = BlockChyp.new(
|
17
|
+
config['apiKey'],
|
18
|
+
config['bearerToken'],
|
19
|
+
config['signingKey']
|
20
|
+
)
|
21
|
+
blockchyp.gateway_host = config['gatewayHost']
|
22
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
23
|
+
|
24
|
+
test_delay(blockchyp, 'capture_signature_test')
|
25
|
+
|
26
|
+
# setup request object
|
27
|
+
request = {}
|
28
|
+
request['terminalName'] = 'Test Terminal'
|
29
|
+
request['sigFormat'] = SignatureFormat::PNG
|
30
|
+
request['sigWidth'] = 200
|
31
|
+
|
32
|
+
response = blockchyp.capture_signature(request)
|
33
|
+
|
34
|
+
assert_not_nil(response)
|
35
|
+
# response assertions
|
36
|
+
assert(response['success'])
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockchyp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BlockChyp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -24,6 +24,7 @@ files:
|
|
24
24
|
- lib/blockchyp_client.rb
|
25
25
|
- lib/crypto_utils.rb
|
26
26
|
- test/boolean_prompt_test.rb
|
27
|
+
- test/capture_signature_test.rb
|
27
28
|
- test/gateway_timeout_test.rb
|
28
29
|
- test/heartbeat_test.rb
|
29
30
|
- test/new_transaction_display_test.rb
|