blockchyp 2.3.5 → 2.6.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 +155 -117
- data/lib/blockchyp.rb +6 -1
- data/lib/blockchyp/version.rb +1 -1
- data/lib/blockchyp_client.rb +50 -60
- data/test/batch_history_test.rb +11 -11
- data/test/boolean_prompt_test.rb +12 -12
- data/test/capture_signature_test.rb +9 -9
- data/test/gateway_timeout_test.rb +10 -10
- data/test/get_customer_test.rb +13 -13
- data/test/heartbeat_test.rb +10 -10
- data/test/merchant_profile_test.rb +38 -0
- data/test/new_transaction_display_test.rb +20 -20
- data/test/pan_charge_test.rb +22 -22
- data/test/pan_enroll_test.rb +20 -20
- data/test/pan_preauth_test.rb +21 -21
- data/test/partial_refund_test.rb +51 -0
- data/test/search_customer_test.rb +13 -13
- data/test/send_payment_link_test.rb +26 -26
- data/test/simple_batch_close_test.rb +11 -13
- data/test/simple_capture_test.rb +12 -12
- data/test/simple_gift_activate_test.rb +11 -11
- data/test/simple_message_test.rb +9 -9
- data/test/simple_ping_test.rb +8 -8
- data/test/simple_refund_test.rb +13 -13
- data/test/simple_reversal_test.rb +13 -13
- data/test/simple_void_test.rb +13 -13
- data/test/terminal_charge_test.rb +20 -20
- data/test/terminal_clear_test.rb +8 -8
- data/test/terminal_ebt_balance_test.rb +10 -10
- data/test/terminal_ebt_charge_test.rb +22 -22
- data/test/terminal_enroll_test.rb +19 -19
- data/test/terminal_gift_card_balance_test.rb +9 -9
- data/test/terminal_keyed_charge_test.rb +21 -21
- data/test/terminal_manual_ebt_charge_test.rb +23 -23
- data/test/terminal_preauth_test.rb +20 -20
- data/test/terminal_status_test.rb +8 -8
- data/test/terminal_timeout_test.rb +9 -9
- data/test/terms_and_conditions_test.rb +13 -13
- data/test/test_helper.rb +7 -6
- data/test/text_prompt_test.rb +10 -10
- data/test/transaction_history_test.rb +11 -11
- data/test/update_customer_test.rb +12 -12
- data/test/update_transaction_display_test.rb +20 -20
- metadata +4 -2
data/test/heartbeat_test.rb
CHANGED
@@ -8,20 +8,20 @@ module BlockChyp
|
|
8
8
|
config = load_test_config
|
9
9
|
|
10
10
|
blockchyp = BlockChyp.new(
|
11
|
-
config[
|
12
|
-
config[
|
13
|
-
config[
|
11
|
+
config[:apiKey],
|
12
|
+
config[:bearerToken],
|
13
|
+
config[:signingKey]
|
14
14
|
)
|
15
|
-
blockchyp.gateway_host = config[
|
16
|
-
blockchyp.test_gateway_host = config[
|
15
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
16
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
17
17
|
|
18
18
|
response = blockchyp.heartbeat(true)
|
19
19
|
assert_not_nil(response)
|
20
|
-
assert(response[
|
21
|
-
assert(!response[
|
22
|
-
assert(!response[
|
23
|
-
assert(!response[
|
24
|
-
assert(!response[
|
20
|
+
assert(response[:success])
|
21
|
+
assert(!response[:timestamp].empty?)
|
22
|
+
assert(!response[:clockchain].empty?)
|
23
|
+
assert(!response[:latestTick].empty?)
|
24
|
+
assert(!response[:merchantPk].empty?)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -0,0 +1,38 @@
|
|
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 MerchantProfileTest < TestCase
|
13
|
+
def test_merchant_profile
|
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, 'merchant_profile_test')
|
25
|
+
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
test: true
|
29
|
+
}
|
30
|
+
|
31
|
+
response = blockchyp.merchant_profile(request)
|
32
|
+
|
33
|
+
assert_not_nil(response)
|
34
|
+
# response assertions
|
35
|
+
assert(response[:success])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -14,33 +14,33 @@ module BlockChyp
|
|
14
14
|
config = load_test_config
|
15
15
|
|
16
16
|
blockchyp = BlockChyp.new(
|
17
|
-
config[
|
18
|
-
config[
|
19
|
-
config[
|
17
|
+
config[:apiKey],
|
18
|
+
config[:bearerToken],
|
19
|
+
config[:signingKey]
|
20
20
|
)
|
21
|
-
blockchyp.gateway_host = config[
|
22
|
-
blockchyp.test_gateway_host = config[
|
21
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
22
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'new_transaction_display_test')
|
25
25
|
|
26
26
|
# Set request parameters
|
27
27
|
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
test: true,
|
29
|
+
terminalName: 'Test Terminal',
|
30
|
+
transaction: {
|
31
|
+
subtotal: '35.00',
|
32
|
+
tax: '5.00',
|
33
|
+
total: '70.00',
|
34
|
+
items: [
|
35
35
|
{
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
description: 'Leki Trekking Poles',
|
37
|
+
price: '35.00',
|
38
|
+
quantity: 2,
|
39
|
+
extended: '70.00',
|
40
|
+
discounts: [
|
41
41
|
{
|
42
|
-
|
43
|
-
|
42
|
+
description: 'memberDiscount',
|
43
|
+
amount: '10.00'
|
44
44
|
}
|
45
45
|
]
|
46
46
|
}
|
@@ -52,7 +52,7 @@ module BlockChyp
|
|
52
52
|
|
53
53
|
assert_not_nil(response)
|
54
54
|
# response assertions
|
55
|
-
assert(response[
|
55
|
+
assert(response[:success])
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
data/test/pan_charge_test.rb
CHANGED
@@ -14,40 +14,40 @@ module BlockChyp
|
|
14
14
|
config = load_test_config
|
15
15
|
|
16
16
|
blockchyp = BlockChyp.new(
|
17
|
-
config[
|
18
|
-
config[
|
19
|
-
config[
|
17
|
+
config[:apiKey],
|
18
|
+
config[:bearerToken],
|
19
|
+
config[:signingKey]
|
20
20
|
)
|
21
|
-
blockchyp.gateway_host = config[
|
22
|
-
blockchyp.test_gateway_host = config[
|
21
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
22
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'pan_charge_test')
|
25
25
|
|
26
26
|
# Set request parameters
|
27
27
|
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
pan: '4111111111111111',
|
29
|
+
amount: '25.55',
|
30
|
+
test: true,
|
31
|
+
transactionRef: uuid
|
32
32
|
}
|
33
33
|
|
34
34
|
response = blockchyp.charge(request)
|
35
35
|
|
36
36
|
assert_not_nil(response)
|
37
37
|
# response assertions
|
38
|
-
assert(response[
|
39
|
-
assert(response[
|
40
|
-
assert(response[
|
41
|
-
assert_equal(response[
|
42
|
-
assert(!response[
|
43
|
-
assert(!response[
|
44
|
-
assert(!response[
|
45
|
-
assert_equal('approved', response[
|
46
|
-
assert(!response[
|
47
|
-
assert(!response[
|
48
|
-
assert(!response[
|
49
|
-
assert_equal('25.55', response[
|
50
|
-
assert_equal('KEYED', response[
|
38
|
+
assert(response[:success])
|
39
|
+
assert(response[:approved])
|
40
|
+
assert(response[:test])
|
41
|
+
assert_equal(response[:authCode].length, 6)
|
42
|
+
assert(!response[:transactionId].empty?)
|
43
|
+
assert(!response[:timestamp].empty?)
|
44
|
+
assert(!response[:tickBlock].empty?)
|
45
|
+
assert_equal('approved', response[:responseDescription])
|
46
|
+
assert(!response[:paymentType].empty?)
|
47
|
+
assert(!response[:maskedPan].empty?)
|
48
|
+
assert(!response[:entryMethod].empty?)
|
49
|
+
assert_equal('25.55', response[:authorizedAmount])
|
50
|
+
assert_equal('KEYED', response[:entryMethod])
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
data/test/pan_enroll_test.rb
CHANGED
@@ -14,38 +14,38 @@ module BlockChyp
|
|
14
14
|
config = load_test_config
|
15
15
|
|
16
16
|
blockchyp = BlockChyp.new(
|
17
|
-
config[
|
18
|
-
config[
|
19
|
-
config[
|
17
|
+
config[:apiKey],
|
18
|
+
config[:bearerToken],
|
19
|
+
config[:signingKey]
|
20
20
|
)
|
21
|
-
blockchyp.gateway_host = config[
|
22
|
-
blockchyp.test_gateway_host = config[
|
21
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
22
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'pan_enroll_test')
|
25
25
|
|
26
26
|
# Set request parameters
|
27
27
|
request = {
|
28
|
-
|
29
|
-
|
28
|
+
pan: '4111111111111111',
|
29
|
+
test: true
|
30
30
|
}
|
31
31
|
|
32
32
|
response = blockchyp.enroll(request)
|
33
33
|
|
34
34
|
assert_not_nil(response)
|
35
35
|
# response assertions
|
36
|
-
assert(response[
|
37
|
-
assert(response[
|
38
|
-
assert(response[
|
39
|
-
assert_equal(response[
|
40
|
-
assert(!response[
|
41
|
-
assert(!response[
|
42
|
-
assert(!response[
|
43
|
-
assert_equal('approved', response[
|
44
|
-
assert(!response[
|
45
|
-
assert(!response[
|
46
|
-
assert(!response[
|
47
|
-
assert_equal('KEYED', response[
|
48
|
-
assert(!response[
|
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('KEYED', response[:entryMethod])
|
48
|
+
assert(!response[:token].empty?)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/test/pan_preauth_test.rb
CHANGED
@@ -14,39 +14,39 @@ module BlockChyp
|
|
14
14
|
config = load_test_config
|
15
15
|
|
16
16
|
blockchyp = BlockChyp.new(
|
17
|
-
config[
|
18
|
-
config[
|
19
|
-
config[
|
17
|
+
config[:apiKey],
|
18
|
+
config[:bearerToken],
|
19
|
+
config[:signingKey]
|
20
20
|
)
|
21
|
-
blockchyp.gateway_host = config[
|
22
|
-
blockchyp.test_gateway_host = config[
|
21
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
22
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'pan_preauth_test')
|
25
25
|
|
26
26
|
# Set request parameters
|
27
27
|
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
pan: '4111111111111111',
|
29
|
+
amount: '25.55',
|
30
|
+
test: true
|
31
31
|
}
|
32
32
|
|
33
33
|
response = blockchyp.preauth(request)
|
34
34
|
|
35
35
|
assert_not_nil(response)
|
36
36
|
# response assertions
|
37
|
-
assert(response[
|
38
|
-
assert(response[
|
39
|
-
assert(response[
|
40
|
-
assert_equal(response[
|
41
|
-
assert(!response[
|
42
|
-
assert(!response[
|
43
|
-
assert(!response[
|
44
|
-
assert_equal('approved', response[
|
45
|
-
assert(!response[
|
46
|
-
assert(!response[
|
47
|
-
assert(!response[
|
48
|
-
assert_equal('25.55', response[
|
49
|
-
assert_equal('KEYED', response[
|
37
|
+
assert(response[:success])
|
38
|
+
assert(response[:approved])
|
39
|
+
assert(response[:test])
|
40
|
+
assert_equal(response[:authCode].length, 6)
|
41
|
+
assert(!response[:transactionId].empty?)
|
42
|
+
assert(!response[:timestamp].empty?)
|
43
|
+
assert(!response[:tickBlock].empty?)
|
44
|
+
assert_equal('approved', response[:responseDescription])
|
45
|
+
assert(!response[:paymentType].empty?)
|
46
|
+
assert(!response[:maskedPan].empty?)
|
47
|
+
assert(!response[:entryMethod].empty?)
|
48
|
+
assert_equal('25.55', response[:authorizedAmount])
|
49
|
+
assert_equal('KEYED', response[:entryMethod])
|
50
50
|
end
|
51
51
|
end
|
52
52
|
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 PartialRefundTest < TestCase
|
13
|
+
def test_partial_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, 'partial_refund_test')
|
25
|
+
|
26
|
+
# Set request parameters
|
27
|
+
setup_request = {
|
28
|
+
pan: '4111111111111111',
|
29
|
+
amount: '25.55',
|
30
|
+
test: true,
|
31
|
+
transactionRef: uuid
|
32
|
+
}
|
33
|
+
|
34
|
+
response = blockchyp.charge(setup_request)
|
35
|
+
|
36
|
+
# Set request parameters
|
37
|
+
request = {
|
38
|
+
transactionId: response[:transactionId],
|
39
|
+
amount: '5.00',
|
40
|
+
test: true
|
41
|
+
}
|
42
|
+
|
43
|
+
response = blockchyp.refund(request)
|
44
|
+
|
45
|
+
assert_not_nil(response)
|
46
|
+
# response assertions
|
47
|
+
assert(response[:success])
|
48
|
+
assert(response[:approved])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -14,23 +14,23 @@ module BlockChyp
|
|
14
14
|
config = load_test_config
|
15
15
|
|
16
16
|
blockchyp = BlockChyp.new(
|
17
|
-
config[
|
18
|
-
config[
|
19
|
-
config[
|
17
|
+
config[:apiKey],
|
18
|
+
config[:bearerToken],
|
19
|
+
config[:signingKey]
|
20
20
|
)
|
21
|
-
blockchyp.gateway_host = config[
|
22
|
-
blockchyp.test_gateway_host = config[
|
21
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
22
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'search_customer_test')
|
25
25
|
|
26
26
|
# Set request parameters
|
27
27
|
setup_request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
customer: {
|
29
|
+
firstName: 'Test',
|
30
|
+
lastName: 'Customer',
|
31
|
+
companyName: 'Test Company',
|
32
|
+
emailAddress: 'support@blockchyp.com',
|
33
|
+
smsNumber: '(123) 123-1234'
|
34
34
|
}
|
35
35
|
}
|
36
36
|
|
@@ -38,14 +38,14 @@ module BlockChyp
|
|
38
38
|
|
39
39
|
# Set request parameters
|
40
40
|
request = {
|
41
|
-
|
41
|
+
query: '123123'
|
42
42
|
}
|
43
43
|
|
44
44
|
response = blockchyp.customer_search(request)
|
45
45
|
|
46
46
|
assert_not_nil(response)
|
47
47
|
# response assertions
|
48
|
-
assert(response[
|
48
|
+
assert(response[:success])
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -14,40 +14,40 @@ module BlockChyp
|
|
14
14
|
config = load_test_config
|
15
15
|
|
16
16
|
blockchyp = BlockChyp.new(
|
17
|
-
config[
|
18
|
-
config[
|
19
|
-
config[
|
17
|
+
config[:apiKey],
|
18
|
+
config[:bearerToken],
|
19
|
+
config[:signingKey]
|
20
20
|
)
|
21
|
-
blockchyp.gateway_host = config[
|
22
|
-
blockchyp.test_gateway_host = config[
|
21
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
22
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'send_payment_link_test')
|
25
25
|
|
26
26
|
# Set request parameters
|
27
27
|
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
amount: '199.99',
|
29
|
+
description: 'Widget',
|
30
|
+
subject: 'Widget invoice',
|
31
|
+
transaction: {
|
32
|
+
subtotal: '195.00',
|
33
|
+
tax: '4.99',
|
34
|
+
total: '199.99',
|
35
|
+
items: [
|
36
36
|
{
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
description: 'Widget',
|
38
|
+
price: '195.00',
|
39
|
+
quantity: 1
|
40
40
|
}
|
41
41
|
]
|
42
42
|
},
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
autoSend: true,
|
44
|
+
customer: {
|
45
|
+
customerRef: 'Customer reference string',
|
46
|
+
firstName: 'FirstName',
|
47
|
+
lastName: 'LastName',
|
48
|
+
companyName: 'Company Name',
|
49
|
+
emailAddress: 'support@blockchyp.com',
|
50
|
+
smsNumber: '(123) 123-1231'
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
@@ -55,8 +55,8 @@ module BlockChyp
|
|
55
55
|
|
56
56
|
assert_not_nil(response)
|
57
57
|
# response assertions
|
58
|
-
assert(response[
|
59
|
-
assert(!response[
|
58
|
+
assert(response[:success])
|
59
|
+
assert(!response[:url].empty?)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|