blockchyp 2.2.1
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.
- checksums.yaml +7 -0
- data/Makefile +71 -0
- data/README.md +997 -0
- data/Rakefile +39 -0
- data/lib/blockchyp.rb +190 -0
- data/lib/blockchyp/version.rb +5 -0
- data/lib/blockchyp_client.rb +346 -0
- data/lib/crypto_utils.rb +25 -0
- data/test/boolean_prompt_test.rb +43 -0
- data/test/capture_signature_test.rb +40 -0
- data/test/gateway_timeout_test.rb +40 -0
- data/test/heartbeat_test.rb +27 -0
- data/test/new_transaction_display_test.rb +78 -0
- data/test/pan_charge_test.rb +53 -0
- data/test/pan_enroll_test.rb +51 -0
- data/test/pan_preauth_test.rb +52 -0
- data/test/simple_batch_close_test.rb +48 -0
- data/test/simple_capture_test.rb +47 -0
- data/test/simple_gift_activate_test.rb +42 -0
- data/test/simple_message_test.rb +40 -0
- data/test/simple_ping_test.rb +39 -0
- data/test/simple_refund_test.rb +48 -0
- data/test/simple_reversal_test.rb +48 -0
- data/test/simple_void_test.rb +48 -0
- data/test/terminal_charge_test.rb +51 -0
- data/test/terminal_clear_test.rb +39 -0
- data/test/terminal_ebt_balance_test.rb +41 -0
- data/test/terminal_ebt_charge_test.rb +53 -0
- data/test/terminal_enroll_test.rb +50 -0
- data/test/terminal_gift_card_balance_test.rb +40 -0
- data/test/terminal_keyed_charge_test.rb +52 -0
- data/test/terminal_manual_ebt_charge_test.rb +54 -0
- data/test/terminal_preauth_test.rb +51 -0
- data/test/terminal_status_test.rb +39 -0
- data/test/terminal_timeout_test.rb +39 -0
- data/test/terms_and_conditions_test.rb +44 -0
- data/test/test_helper.rb +65 -0
- data/test/text_prompt_test.rb +41 -0
- data/test/update_transaction_display_test.rb +78 -0
- metadata +81 -0
@@ -0,0 +1,47 @@
|
|
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 SimpleCaptureTest < TestCase
|
13
|
+
def test_simple_capture
|
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, 'simple_capture_test')
|
25
|
+
# setup request object
|
26
|
+
request = {}
|
27
|
+
request['pan'] = '4111111111111111'
|
28
|
+
request['amount'] = '25.55'
|
29
|
+
request['test'] = true
|
30
|
+
response = blockchyp.preauth(request)
|
31
|
+
|
32
|
+
|
33
|
+
# setup request object
|
34
|
+
request = {}
|
35
|
+
request['transactionId'] = response['transactionId']
|
36
|
+
request['test'] = true
|
37
|
+
|
38
|
+
response = blockchyp.capture(request)
|
39
|
+
|
40
|
+
assert_not_nil(response)
|
41
|
+
# response assertions
|
42
|
+
assert(response['success'])
|
43
|
+
assert(response['approved'])
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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 SimpleGiftActivateTest < TestCase
|
13
|
+
def test_simple_gift_activate
|
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, 'simple_gift_activate_test')
|
25
|
+
|
26
|
+
# setup request object
|
27
|
+
request = {}
|
28
|
+
request['test'] = true
|
29
|
+
request['terminalName'] = 'Test Terminal'
|
30
|
+
request['amount'] = '50.00'
|
31
|
+
|
32
|
+
response = blockchyp.gift_activate(request)
|
33
|
+
|
34
|
+
assert_not_nil(response)
|
35
|
+
# response assertions
|
36
|
+
assert(response['success'])
|
37
|
+
assert(response['approved'])
|
38
|
+
assert(!response['publicKey'].empty?)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -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 SimpleMessageTest < TestCase
|
13
|
+
def test_simple_message
|
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, 'simple_message_test')
|
25
|
+
|
26
|
+
# setup request object
|
27
|
+
request = {}
|
28
|
+
request['test'] = true
|
29
|
+
request['terminalName'] = 'Test Terminal'
|
30
|
+
request['message'] = 'Thank You For Your Business'
|
31
|
+
|
32
|
+
response = blockchyp.message(request)
|
33
|
+
|
34
|
+
assert_not_nil(response)
|
35
|
+
# response assertions
|
36
|
+
assert(response['success'])
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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 SimplePingTest < TestCase
|
13
|
+
def test_simple_ping
|
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, 'simple_ping_test')
|
25
|
+
|
26
|
+
# setup request object
|
27
|
+
request = {}
|
28
|
+
request['test'] = true
|
29
|
+
request['terminalName'] = 'Test Terminal'
|
30
|
+
|
31
|
+
response = blockchyp.ping(request)
|
32
|
+
|
33
|
+
assert_not_nil(response)
|
34
|
+
# response assertions
|
35
|
+
assert(response['success'])
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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 SimpleRefundTest < TestCase
|
13
|
+
def test_simple_refund
|
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, 'simple_refund_test')
|
25
|
+
# setup request object
|
26
|
+
request = {}
|
27
|
+
request['pan'] = '4111111111111111'
|
28
|
+
request['amount'] = '25.55'
|
29
|
+
request['test'] = true
|
30
|
+
request['transactionRef'] = uuid
|
31
|
+
response = blockchyp.charge(request)
|
32
|
+
|
33
|
+
|
34
|
+
# setup request object
|
35
|
+
request = {}
|
36
|
+
request['transactionId'] = response['transactionId']
|
37
|
+
request['test'] = true
|
38
|
+
|
39
|
+
response = blockchyp.refund(request)
|
40
|
+
|
41
|
+
assert_not_nil(response)
|
42
|
+
# response assertions
|
43
|
+
assert(response['success'])
|
44
|
+
assert(response['approved'])
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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 SimpleReversalTest < TestCase
|
13
|
+
def test_simple_reversal
|
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, 'simple_reversal_test')
|
25
|
+
# setup request object
|
26
|
+
request = {}
|
27
|
+
request['pan'] = '4111111111111111'
|
28
|
+
request['amount'] = '25.55'
|
29
|
+
request['test'] = true
|
30
|
+
request['transactionRef'] = uuid
|
31
|
+
response = blockchyp.charge(request)
|
32
|
+
|
33
|
+
|
34
|
+
# setup request object
|
35
|
+
request = {}
|
36
|
+
request['transactionRef'] = response['transactionRef']
|
37
|
+
request['test'] = true
|
38
|
+
|
39
|
+
response = blockchyp.reverse(request)
|
40
|
+
|
41
|
+
assert_not_nil(response)
|
42
|
+
# response assertions
|
43
|
+
assert(response['success'])
|
44
|
+
assert(response['approved'])
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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 SimpleVoidTest < TestCase
|
13
|
+
def test_simple_void
|
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, 'simple_void_test')
|
25
|
+
# setup request object
|
26
|
+
request = {}
|
27
|
+
request['pan'] = '4111111111111111'
|
28
|
+
request['amount'] = '25.55'
|
29
|
+
request['test'] = true
|
30
|
+
request['transactionRef'] = uuid
|
31
|
+
response = blockchyp.charge(request)
|
32
|
+
|
33
|
+
|
34
|
+
# setup request object
|
35
|
+
request = {}
|
36
|
+
request['transactionId'] = response['transactionId']
|
37
|
+
request['test'] = true
|
38
|
+
|
39
|
+
response = blockchyp.void(request)
|
40
|
+
|
41
|
+
assert_not_nil(response)
|
42
|
+
# response assertions
|
43
|
+
assert(response['success'])
|
44
|
+
assert(response['approved'])
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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 TerminalChargeTest < TestCase
|
13
|
+
def test_terminal_charge
|
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, 'terminal_charge_test')
|
25
|
+
|
26
|
+
# setup request object
|
27
|
+
request = {}
|
28
|
+
request['terminalName'] = 'Test Terminal'
|
29
|
+
request['amount'] = '25.15'
|
30
|
+
request['test'] = true
|
31
|
+
|
32
|
+
response = blockchyp.charge(request)
|
33
|
+
|
34
|
+
assert_not_nil(response)
|
35
|
+
# response assertions
|
36
|
+
assert(response['success'])
|
37
|
+
assert(response['approved'])
|
38
|
+
assert(response['test'])
|
39
|
+
assert_equal(response['authCode'].length, 6)
|
40
|
+
assert(!response['transactionId'].empty?)
|
41
|
+
assert(!response['timestamp'].empty?)
|
42
|
+
assert(!response['tickBlock'].empty?)
|
43
|
+
assert_equal('Approved', response['responseDescription'])
|
44
|
+
assert(!response['paymentType'].empty?)
|
45
|
+
assert(!response['maskedPan'].empty?)
|
46
|
+
assert(!response['entryMethod'].empty?)
|
47
|
+
assert_equal('25.15', response['authorizedAmount'])
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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 TerminalClearTest < TestCase
|
13
|
+
def test_terminal_clear
|
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, 'terminal_clear_test')
|
25
|
+
|
26
|
+
# setup request object
|
27
|
+
request = {}
|
28
|
+
request['test'] = true
|
29
|
+
request['terminalName'] = 'Test Terminal'
|
30
|
+
|
31
|
+
response = blockchyp.clear(request)
|
32
|
+
|
33
|
+
assert_not_nil(response)
|
34
|
+
# response assertions
|
35
|
+
assert(response['success'])
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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 TerminalEBTBalanceTest < TestCase
|
13
|
+
def test_terminal_ebt_balance
|
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, 'terminal_ebt_balance_test')
|
25
|
+
|
26
|
+
# setup request object
|
27
|
+
request = {}
|
28
|
+
request['test'] = true
|
29
|
+
request['terminalName'] = 'Test Terminal'
|
30
|
+
request['cardType'] = CardType::EBT
|
31
|
+
|
32
|
+
response = blockchyp.balance(request)
|
33
|
+
|
34
|
+
assert_not_nil(response)
|
35
|
+
# response assertions
|
36
|
+
assert(response['success'])
|
37
|
+
assert(!response['remainingBalance'].empty?)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|