blockchyp 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +236 -244
- data/lib/blockchyp/version.rb +1 -1
- data/test/boolean_prompt_test.rb +8 -8
- data/test/capture_signature_test.rb +6 -6
- data/test/gateway_timeout_test.rb +8 -8
- data/test/get_customer_test.rb +51 -0
- data/test/new_transaction_display_test.rb +24 -44
- data/test/pan_charge_test.rb +7 -7
- data/test/pan_enroll_test.rb +5 -5
- data/test/pan_preauth_test.rb +6 -6
- data/test/search_customer_test.rb +51 -0
- data/test/send_payment_link_test.rb +62 -0
- data/test/simple_batch_close_test.rb +13 -11
- data/test/simple_capture_test.rb +13 -11
- data/test/simple_gift_activate_test.rb +6 -6
- data/test/simple_message_test.rb +6 -6
- data/test/simple_ping_test.rb +5 -5
- data/test/simple_refund_test.rb +14 -12
- data/test/simple_reversal_test.rb +14 -12
- data/test/simple_void_test.rb +14 -12
- data/test/terminal_charge_test.rb +6 -6
- data/test/terminal_clear_test.rb +5 -5
- data/test/terminal_ebt_balance_test.rb +6 -6
- data/test/terminal_ebt_charge_test.rb +7 -7
- data/test/terminal_enroll_test.rb +5 -5
- data/test/terminal_gift_card_balance_test.rb +5 -5
- data/test/terminal_keyed_charge_test.rb +7 -7
- data/test/terminal_manual_ebt_charge_test.rb +8 -8
- data/test/terminal_preauth_test.rb +6 -6
- data/test/terminal_status_test.rb +4 -4
- data/test/terminal_timeout_test.rb +7 -7
- data/test/terms_and_conditions_test.rb +10 -10
- data/test/text_prompt_test.rb +6 -6
- data/test/update_customer_test.rb +44 -0
- data/test/update_transaction_display_test.rb +24 -44
- metadata +6 -2
data/lib/blockchyp/version.rb
CHANGED
data/test/boolean_prompt_test.rb
CHANGED
@@ -23,13 +23,14 @@ module BlockChyp
|
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'boolean_prompt_test')
|
25
25
|
|
26
|
-
#
|
27
|
-
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"test": true,
|
29
|
+
"terminalName": 'Test Terminal',
|
30
|
+
"prompt": 'Would you like to become a member?',
|
31
|
+
"yesCaption": 'Yes',
|
32
|
+
"noCaption": 'No'
|
33
|
+
}
|
33
34
|
|
34
35
|
response = blockchyp.boolean_prompt(request)
|
35
36
|
|
@@ -38,6 +39,5 @@ module BlockChyp
|
|
38
39
|
assert(response['success'])
|
39
40
|
assert(response['response'])
|
40
41
|
end
|
41
|
-
|
42
42
|
end
|
43
43
|
end
|
@@ -23,11 +23,12 @@ module BlockChyp
|
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'capture_signature_test')
|
25
25
|
|
26
|
-
#
|
27
|
-
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"terminalName": 'Test Terminal',
|
29
|
+
"sigFormat": SignatureFormat::PNG,
|
30
|
+
"sigWidth": 200
|
31
|
+
}
|
31
32
|
|
32
33
|
response = blockchyp.capture_signature(request)
|
33
34
|
|
@@ -35,6 +36,5 @@ module BlockChyp
|
|
35
36
|
# response assertions
|
36
37
|
assert(response['success'])
|
37
38
|
end
|
38
|
-
|
39
39
|
end
|
40
40
|
end
|
@@ -23,18 +23,18 @@ module BlockChyp
|
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'gateway_timeout_test')
|
25
25
|
|
26
|
-
#
|
27
|
-
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"timeout": 1,
|
29
|
+
"pan": '5555555555554444',
|
30
|
+
"amount": '25.55',
|
31
|
+
"test": true,
|
32
|
+
"transactionRef": uuid
|
33
|
+
}
|
33
34
|
|
34
35
|
assert_raise Net::ReadTimeout do
|
35
36
|
blockchyp.charge(request)
|
36
37
|
end
|
37
38
|
end
|
38
|
-
|
39
39
|
end
|
40
40
|
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 GetCustomerTest < TestCase
|
13
|
+
def test_get_customer
|
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, 'get_customer_test')
|
25
|
+
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"customer": {
|
29
|
+
"firstName": 'Test',
|
30
|
+
"lastName": 'Customer',
|
31
|
+
"companyName": 'Test Company',
|
32
|
+
"emailAddress": 'support@blockchyp.com',
|
33
|
+
"smsNumber": '(123) 123-1234'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
response = blockchyp.customer(request)
|
38
|
+
|
39
|
+
# Set request parameters
|
40
|
+
request = {
|
41
|
+
"customerId": response['customer']['id']
|
42
|
+
}
|
43
|
+
|
44
|
+
response = blockchyp.customer(request)
|
45
|
+
|
46
|
+
assert_not_nil(response)
|
47
|
+
# response assertions
|
48
|
+
assert(response['success'])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -23,11 +23,30 @@ module BlockChyp
|
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'new_transaction_display_test')
|
25
25
|
|
26
|
-
#
|
27
|
-
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"test": true,
|
29
|
+
"terminalName": 'Test Terminal',
|
30
|
+
"transaction": {
|
31
|
+
"subtotal": '35.00',
|
32
|
+
"tax": '5.00',
|
33
|
+
"total": '70.00',
|
34
|
+
"items": [
|
35
|
+
{
|
36
|
+
"description": 'Leki Trekking Poles',
|
37
|
+
"price": '35.00',
|
38
|
+
"quantity": 2,
|
39
|
+
"extended": '70.00',
|
40
|
+
"discounts": [
|
41
|
+
{
|
42
|
+
"description": 'memberDiscount',
|
43
|
+
"amount": '10.00'
|
44
|
+
}
|
45
|
+
]
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
}
|
31
50
|
|
32
51
|
response = blockchyp.new_transaction_display(request)
|
33
52
|
|
@@ -35,44 +54,5 @@ module BlockChyp
|
|
35
54
|
# response assertions
|
36
55
|
assert(response['success'])
|
37
56
|
end
|
38
|
-
|
39
|
-
def new_transaction_display_transaction
|
40
|
-
val = {}
|
41
|
-
val['subtotal'] = '35.00'
|
42
|
-
val['tax'] = '5.00'
|
43
|
-
val['total'] = '70.00'
|
44
|
-
val['items'] = new_transaction_display_items
|
45
|
-
val
|
46
|
-
end
|
47
|
-
|
48
|
-
def new_transaction_display_items
|
49
|
-
val = []
|
50
|
-
val.push(new_transaction_display_item_2)
|
51
|
-
val
|
52
|
-
end
|
53
|
-
|
54
|
-
def new_transaction_display_item_2
|
55
|
-
val = {}
|
56
|
-
val['description'] = 'Leki Trekking Poles'
|
57
|
-
val['price'] = '35.00'
|
58
|
-
val['quantity'] = 2
|
59
|
-
val['extended'] = '70.00'
|
60
|
-
val['discounts'] = new_transaction_display_discounts
|
61
|
-
val
|
62
|
-
end
|
63
|
-
|
64
|
-
def new_transaction_display_discounts
|
65
|
-
val = []
|
66
|
-
val.push(new_transaction_display_discount_2)
|
67
|
-
val
|
68
|
-
end
|
69
|
-
|
70
|
-
def new_transaction_display_discount_2
|
71
|
-
val = {}
|
72
|
-
val['description'] = 'memberDiscount'
|
73
|
-
val['amount'] = '10.00'
|
74
|
-
val
|
75
|
-
end
|
76
|
-
|
77
57
|
end
|
78
58
|
end
|
data/test/pan_charge_test.rb
CHANGED
@@ -23,12 +23,13 @@ module BlockChyp
|
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'pan_charge_test')
|
25
25
|
|
26
|
-
#
|
27
|
-
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"pan": '4111111111111111',
|
29
|
+
"amount": '25.55',
|
30
|
+
"test": true,
|
31
|
+
"transactionRef": uuid
|
32
|
+
}
|
32
33
|
|
33
34
|
response = blockchyp.charge(request)
|
34
35
|
|
@@ -48,6 +49,5 @@ module BlockChyp
|
|
48
49
|
assert_equal('25.55', response['authorizedAmount'])
|
49
50
|
assert_equal('KEYED', response['entryMethod'])
|
50
51
|
end
|
51
|
-
|
52
52
|
end
|
53
53
|
end
|
data/test/pan_enroll_test.rb
CHANGED
@@ -23,10 +23,11 @@ module BlockChyp
|
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'pan_enroll_test')
|
25
25
|
|
26
|
-
#
|
27
|
-
request = {
|
28
|
-
|
29
|
-
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"pan": '4111111111111111',
|
29
|
+
"test": true
|
30
|
+
}
|
30
31
|
|
31
32
|
response = blockchyp.enroll(request)
|
32
33
|
|
@@ -46,6 +47,5 @@ module BlockChyp
|
|
46
47
|
assert_equal('KEYED', response['entryMethod'])
|
47
48
|
assert(!response['token'].empty?)
|
48
49
|
end
|
49
|
-
|
50
50
|
end
|
51
51
|
end
|
data/test/pan_preauth_test.rb
CHANGED
@@ -23,11 +23,12 @@ module BlockChyp
|
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'pan_preauth_test')
|
25
25
|
|
26
|
-
#
|
27
|
-
request = {
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"pan": '4111111111111111',
|
29
|
+
"amount": '25.55',
|
30
|
+
"test": true
|
31
|
+
}
|
31
32
|
|
32
33
|
response = blockchyp.preauth(request)
|
33
34
|
|
@@ -47,6 +48,5 @@ module BlockChyp
|
|
47
48
|
assert_equal('25.55', response['authorizedAmount'])
|
48
49
|
assert_equal('KEYED', response['entryMethod'])
|
49
50
|
end
|
50
|
-
|
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 SearchCustomerTest < TestCase
|
13
|
+
def test_search_customer
|
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, 'search_customer_test')
|
25
|
+
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"customer": {
|
29
|
+
"firstName": 'Test',
|
30
|
+
"lastName": 'Customer',
|
31
|
+
"companyName": 'Test Company',
|
32
|
+
"emailAddress": 'support@blockchyp.com',
|
33
|
+
"smsNumber": '(123) 123-1234'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
response = blockchyp.customer_search(request)
|
38
|
+
|
39
|
+
# Set request parameters
|
40
|
+
request = {
|
41
|
+
"query": '123123'
|
42
|
+
}
|
43
|
+
|
44
|
+
response = blockchyp.customer_search(request)
|
45
|
+
|
46
|
+
assert_not_nil(response)
|
47
|
+
# response assertions
|
48
|
+
assert(response['success'])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,62 @@
|
|
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 SendPaymentLinkTest < TestCase
|
13
|
+
def test_send_payment_link
|
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, 'send_payment_link_test')
|
25
|
+
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
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
|
+
{
|
37
|
+
"description": 'Widget',
|
38
|
+
"price": '195.00',
|
39
|
+
"quantity": 1
|
40
|
+
}
|
41
|
+
]
|
42
|
+
},
|
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
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
response = blockchyp.send_payment_link(request)
|
55
|
+
|
56
|
+
assert_not_nil(response)
|
57
|
+
# response assertions
|
58
|
+
assert(response['success'])
|
59
|
+
assert(!response['url'].empty?)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -22,18 +22,21 @@ module BlockChyp
|
|
22
22
|
blockchyp.test_gateway_host = config['testGatewayHost']
|
23
23
|
|
24
24
|
test_delay(blockchyp, 'simple_batch_close_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
25
|
|
26
|
+
# Set request parameters
|
27
|
+
request = {
|
28
|
+
"pan": '4111111111111111',
|
29
|
+
"amount": '25.55',
|
30
|
+
"test": true,
|
31
|
+
"transactionRef": uuid
|
32
|
+
}
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
request
|
34
|
+
response = blockchyp.close_batch(request)
|
35
|
+
|
36
|
+
# Set request parameters
|
37
|
+
request = {
|
38
|
+
"test": true
|
39
|
+
}
|
37
40
|
|
38
41
|
response = blockchyp.close_batch(request)
|
39
42
|
|
@@ -43,6 +46,5 @@ module BlockChyp
|
|
43
46
|
assert(!response['capturedTotal'].empty?)
|
44
47
|
assert(!response['openPreauths'].empty?)
|
45
48
|
end
|
46
|
-
|
47
49
|
end
|
48
50
|
end
|