blockchyp 2.0.0.pre.alpha7
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 +38 -0
- data/README.md +807 -0
- data/Rakefile +39 -0
- data/lib/blockchyp.rb +137 -0
- data/lib/blockchyp/version.rb +5 -0
- data/lib/blockchyp_client.rb +334 -0
- data/lib/crypto_utils.rb +25 -0
- data/test/boolean_prompt_test.rb +35 -0
- data/test/heartbeat_test.rb +27 -0
- data/test/new_transaction_display_test.rb +70 -0
- data/test/pan_charge_test.rb +44 -0
- data/test/pan_enroll_test.rb +42 -0
- data/test/pan_preauth_test.rb +43 -0
- data/test/simple_batch_close_test.rb +40 -0
- data/test/simple_capture_test.rb +38 -0
- data/test/simple_gift_activate_test.rb +33 -0
- data/test/simple_message_test.rb +32 -0
- data/test/simple_ping_test.rb +31 -0
- data/test/simple_refund_test.rb +39 -0
- data/test/simple_reversal_test.rb +39 -0
- data/test/simple_void_test.rb +39 -0
- data/test/terminal_charge_test.rb +42 -0
- data/test/terminal_clear_test.rb +31 -0
- data/test/terminal_ebt_balance_test.rb +33 -0
- data/test/terminal_ebt_charge_test.rb +44 -0
- data/test/terminal_enroll_test.rb +41 -0
- data/test/terminal_gift_card_balance_test.rb +32 -0
- data/test/terminal_keyed_charge_test.rb +43 -0
- data/test/terminal_manual_ebt_charge_test.rb +45 -0
- data/test/terminal_preauth_test.rb +42 -0
- data/test/terms_and_conditions_test.rb +36 -0
- data/test/test_helper.rb +65 -0
- data/test/text_prompt_test.rb +33 -0
- data/test/update_transaction_display_test.rb +70 -0
- metadata +77 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class SimpleRefundTest < TestCase
|
7
|
+
def test_simple_refund
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'SimpleRefundTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['pan'] = '4111111111111111'
|
22
|
+
request['amount'] = '25.55'
|
23
|
+
request['test'] = true
|
24
|
+
request['transactionRef'] = uuid
|
25
|
+
response = blockchyp.charge(request)
|
26
|
+
|
27
|
+
# setup request object
|
28
|
+
request = {}
|
29
|
+
request['transactionId'] = response['transactionId']
|
30
|
+
request['test'] = true
|
31
|
+
response = blockchyp.refund(request)
|
32
|
+
|
33
|
+
assert_not_nil(response)
|
34
|
+
# response assertions
|
35
|
+
assert(response['approved'])
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class SimpleReversalTest < TestCase
|
7
|
+
def test_simple_reversal
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'SimpleReversalTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['pan'] = '4111111111111111'
|
22
|
+
request['amount'] = '25.55'
|
23
|
+
request['test'] = true
|
24
|
+
request['transactionRef'] = uuid
|
25
|
+
response = blockchyp.charge(request)
|
26
|
+
|
27
|
+
# setup request object
|
28
|
+
request = {}
|
29
|
+
request['transactionRef'] = response['transactionRef']
|
30
|
+
request['test'] = true
|
31
|
+
response = blockchyp.reverse(request)
|
32
|
+
|
33
|
+
assert_not_nil(response)
|
34
|
+
# response assertions
|
35
|
+
assert(response['approved'])
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class SimpleVoidTest < TestCase
|
7
|
+
def test_simple_void
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'SimpleVoidTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['pan'] = '4111111111111111'
|
22
|
+
request['amount'] = '25.55'
|
23
|
+
request['test'] = true
|
24
|
+
request['transactionRef'] = uuid
|
25
|
+
response = blockchyp.charge(request)
|
26
|
+
|
27
|
+
# setup request object
|
28
|
+
request = {}
|
29
|
+
request['transactionId'] = response['transactionId']
|
30
|
+
request['test'] = true
|
31
|
+
response = blockchyp.void(request)
|
32
|
+
|
33
|
+
assert_not_nil(response)
|
34
|
+
# response assertions
|
35
|
+
assert(response['approved'])
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalChargeTest < TestCase
|
7
|
+
def test_terminal_charge
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalChargeTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['terminalName'] = 'Test Terminal'
|
22
|
+
request['amount'] = '25.15'
|
23
|
+
request['test'] = true
|
24
|
+
response = blockchyp.charge(request)
|
25
|
+
|
26
|
+
assert_not_nil(response)
|
27
|
+
# response assertions
|
28
|
+
assert(response['approved'])
|
29
|
+
assert(response['test'])
|
30
|
+
assert_equal(response['authCode'].length, 6)
|
31
|
+
assert(!response['transactionId'].empty?)
|
32
|
+
assert(!response['timestamp'].empty?)
|
33
|
+
assert(!response['tickBlock'].empty?)
|
34
|
+
assert_equal('Approved', response['responseDescription'])
|
35
|
+
assert(!response['paymentType'].empty?)
|
36
|
+
assert(!response['maskedPan'].empty?)
|
37
|
+
assert(!response['entryMethod'].empty?)
|
38
|
+
assert_equal('25.15', response['authorizedAmount'])
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalClearTest < TestCase
|
7
|
+
def test_terminal_clear
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalClearTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['test'] = true
|
22
|
+
request['terminalName'] = 'Test Terminal'
|
23
|
+
response = blockchyp.clear(request)
|
24
|
+
|
25
|
+
assert_not_nil(response)
|
26
|
+
# response assertions
|
27
|
+
assert(response['success'])
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalEBTBalanceTest < TestCase
|
7
|
+
def test_terminal_ebt_balance
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalEBTBalanceTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['test'] = true
|
22
|
+
request['terminalName'] = 'Test Terminal'
|
23
|
+
request['cardType'] = CardType::EBT
|
24
|
+
response = blockchyp.balance(request)
|
25
|
+
|
26
|
+
assert_not_nil(response)
|
27
|
+
# response assertions
|
28
|
+
assert(response['success'])
|
29
|
+
assert(!response['remainingBalance'].empty?)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalEBTChargeTest < TestCase
|
7
|
+
def test_terminal_ebt_charge
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalEBTChargeTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['terminalName'] = 'Test Terminal'
|
22
|
+
request['amount'] = '25.00'
|
23
|
+
request['test'] = true
|
24
|
+
request['cardType'] = CardType::EBT
|
25
|
+
response = blockchyp.charge(request)
|
26
|
+
|
27
|
+
assert_not_nil(response)
|
28
|
+
# response assertions
|
29
|
+
assert(response['approved'])
|
30
|
+
assert(response['test'])
|
31
|
+
assert_equal(response['authCode'].length, 6)
|
32
|
+
assert(!response['transactionId'].empty?)
|
33
|
+
assert(!response['timestamp'].empty?)
|
34
|
+
assert(!response['tickBlock'].empty?)
|
35
|
+
assert_equal('Approved', response['responseDescription'])
|
36
|
+
assert(!response['paymentType'].empty?)
|
37
|
+
assert(!response['maskedPan'].empty?)
|
38
|
+
assert(!response['entryMethod'].empty?)
|
39
|
+
assert_equal('25.00', response['authorizedAmount'])
|
40
|
+
assert_equal('75.00', response['remainingBalance'])
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalEnrollTest < TestCase
|
7
|
+
def test_terminal_enroll
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalEnrollTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['terminalName'] = 'Test Terminal'
|
22
|
+
request['test'] = true
|
23
|
+
response = blockchyp.enroll(request)
|
24
|
+
|
25
|
+
assert_not_nil(response)
|
26
|
+
# response assertions
|
27
|
+
assert(response['approved'])
|
28
|
+
assert(response['test'])
|
29
|
+
assert_equal(response['authCode'].length, 6)
|
30
|
+
assert(!response['transactionId'].empty?)
|
31
|
+
assert(!response['timestamp'].empty?)
|
32
|
+
assert(!response['tickBlock'].empty?)
|
33
|
+
assert_equal('Approved', response['responseDescription'])
|
34
|
+
assert(!response['paymentType'].empty?)
|
35
|
+
assert(!response['maskedPan'].empty?)
|
36
|
+
assert(!response['entryMethod'].empty?)
|
37
|
+
assert(!response['token'].empty?)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalGiftCardBalanceTest < TestCase
|
7
|
+
def test_terminal_gift_card_balance
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalGiftCardBalanceTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['test'] = true
|
22
|
+
request['terminalName'] = 'Test Terminal'
|
23
|
+
response = blockchyp.balance(request)
|
24
|
+
|
25
|
+
assert_not_nil(response)
|
26
|
+
# response assertions
|
27
|
+
assert(response['success'])
|
28
|
+
assert(!response['remainingBalance'].empty?)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalKeyedChargeTest < TestCase
|
7
|
+
def test_terminal_keyed_charge
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalKeyedChargeTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['terminalName'] = 'Test Terminal'
|
22
|
+
request['amount'] = '11.11'
|
23
|
+
request['manualEntry'] = true
|
24
|
+
request['test'] = true
|
25
|
+
response = blockchyp.charge(request)
|
26
|
+
|
27
|
+
assert_not_nil(response)
|
28
|
+
# response assertions
|
29
|
+
assert(response['approved'])
|
30
|
+
assert(response['test'])
|
31
|
+
assert_equal(response['authCode'].length, 6)
|
32
|
+
assert(!response['transactionId'].empty?)
|
33
|
+
assert(!response['timestamp'].empty?)
|
34
|
+
assert(!response['tickBlock'].empty?)
|
35
|
+
assert_equal('Approved', response['responseDescription'])
|
36
|
+
assert(!response['paymentType'].empty?)
|
37
|
+
assert(!response['maskedPan'].empty?)
|
38
|
+
assert(!response['entryMethod'].empty?)
|
39
|
+
assert_equal('11.11', response['authorizedAmount'])
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalManualEBTChargeTest < TestCase
|
7
|
+
def test_terminal_manual_ebt_charge
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalManualEBTChargeTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['terminalName'] = 'Test Terminal'
|
22
|
+
request['amount'] = '27.00'
|
23
|
+
request['test'] = true
|
24
|
+
request['cardType'] = CardType::EBT
|
25
|
+
request['manualEntry'] = true
|
26
|
+
response = blockchyp.charge(request)
|
27
|
+
|
28
|
+
assert_not_nil(response)
|
29
|
+
# response assertions
|
30
|
+
assert(response['approved'])
|
31
|
+
assert(response['test'])
|
32
|
+
assert_equal(response['authCode'].length, 6)
|
33
|
+
assert(!response['transactionId'].empty?)
|
34
|
+
assert(!response['timestamp'].empty?)
|
35
|
+
assert(!response['tickBlock'].empty?)
|
36
|
+
assert_equal('Approved', response['responseDescription'])
|
37
|
+
assert(!response['paymentType'].empty?)
|
38
|
+
assert(!response['maskedPan'].empty?)
|
39
|
+
assert(!response['entryMethod'].empty?)
|
40
|
+
assert_equal('27.00', response['authorizedAmount'])
|
41
|
+
assert_equal('73.00', response['remainingBalance'])
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TerminalPreauthTest < TestCase
|
7
|
+
def test_terminal_preauth
|
8
|
+
config = load_test_config
|
9
|
+
|
10
|
+
blockchyp = BlockChyp.new(
|
11
|
+
config['apiKey'],
|
12
|
+
config['bearerToken'],
|
13
|
+
config['signingKey']
|
14
|
+
)
|
15
|
+
blockchyp.gateway_host = config['gatewayHost']
|
16
|
+
blockchyp.test_gateway_host = config['testGatewayHost']
|
17
|
+
|
18
|
+
test_delay(blockchyp, 'TerminalPreauthTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['terminalName'] = 'Test Terminal'
|
22
|
+
request['amount'] = '15.15'
|
23
|
+
request['test'] = true
|
24
|
+
response = blockchyp.preauth(request)
|
25
|
+
|
26
|
+
assert_not_nil(response)
|
27
|
+
# response assertions
|
28
|
+
assert(response['approved'])
|
29
|
+
assert(response['test'])
|
30
|
+
assert_equal(response['authCode'].length, 6)
|
31
|
+
assert(!response['transactionId'].empty?)
|
32
|
+
assert(!response['timestamp'].empty?)
|
33
|
+
assert(!response['tickBlock'].empty?)
|
34
|
+
assert_equal('Approved', response['responseDescription'])
|
35
|
+
assert(!response['paymentType'].empty?)
|
36
|
+
assert(!response['maskedPan'].empty?)
|
37
|
+
assert(!response['entryMethod'].empty?)
|
38
|
+
assert_equal('15.15', response['authorizedAmount'])
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|