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,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class TermsAndConditionsTest < TestCase
|
7
|
+
def test_terms_and_conditions
|
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, 'TermsAndConditionsTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['test'] = true
|
22
|
+
request['terminalName'] = 'Test Terminal'
|
23
|
+
request['tcName'] = 'HIPPA Disclosure'
|
24
|
+
request['tcContent'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ullamcorper id urna quis pulvinar. Pellentesque vestibulum justo ac nulla consectetur tristique. Suspendisse arcu arcu, viverra vel luctus non, dapibus vitae augue. Aenean ac volutpat purus. Curabitur in lacus nisi. Nam vel sagittis eros. Curabitur faucibus ut nisl in pulvinar. Nunc egestas, orci ut porttitor tempus, ante mauris pellentesque ex, nec feugiat purus arcu ac metus. Cras sodales ornare lobortis. Aenean lacinia ultricies purus quis pharetra. Cras vestibulum nulla et magna eleifend eleifend. Nunc nibh dolor, malesuada ut suscipit vitae, bibendum quis dolor. Phasellus ultricies ex vitae dolor malesuada, vel dignissim neque accumsan.'
|
25
|
+
request['sigFormat'] = SignatureFormat::PNG
|
26
|
+
request['sigWidth'] = 200
|
27
|
+
request['sigRequired'] = true
|
28
|
+
response = blockchyp.termsAndConditions(request)
|
29
|
+
|
30
|
+
assert_not_nil(response)
|
31
|
+
# response assertions
|
32
|
+
assert(response['success'])
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'etc'
|
4
|
+
require 'json'
|
5
|
+
require 'securerandom'
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
require ::File.expand_path('../lib/blockchyp', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TestCase < Test::Unit::TestCase
|
13
|
+
def load_test_config
|
14
|
+
config_home = ''
|
15
|
+
if windows?
|
16
|
+
config_home = ENV['userprofile']
|
17
|
+
else
|
18
|
+
config_home = ENV['XDG_CONFIG_HOME']
|
19
|
+
if config_home.nil?
|
20
|
+
config_home = ENV['HOME']
|
21
|
+
end
|
22
|
+
config_home = File.join(config_home, '.config')
|
23
|
+
end
|
24
|
+
|
25
|
+
file_name = File.join(config_home, 'blockchyp', 'sdk-itest-config.json')
|
26
|
+
|
27
|
+
puts 'load config: ' + file_name
|
28
|
+
|
29
|
+
raise 'file not found: ' + file_name unless File.file?(file_name)
|
30
|
+
|
31
|
+
config_file = File.open(file_name)
|
32
|
+
content = config_file.read
|
33
|
+
|
34
|
+
JSON.parse(content)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_delay(client, test_name)
|
38
|
+
test_delay = ENV['BC_TEST_DELAY']
|
39
|
+
|
40
|
+
if test_delay
|
41
|
+
test_delay_int = Integer(test_delay)
|
42
|
+
if test_delay_int.positive
|
43
|
+
request = {}
|
44
|
+
request['test'] = true
|
45
|
+
request['terminalName'] = 'Test Terminal'
|
46
|
+
request['message'] = "Running #{test_name} in #{test_delay} seconds.."
|
47
|
+
response = client.message(request)
|
48
|
+
|
49
|
+
assert_not_nil(response)
|
50
|
+
# response assertions
|
51
|
+
assert(response['success'])
|
52
|
+
sleep test_delay_int
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def uuid
|
58
|
+
SecureRandom.uuid
|
59
|
+
end
|
60
|
+
|
61
|
+
def windows?
|
62
|
+
!(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM).nil?
|
63
|
+
end
|
64
|
+
end
|
65
|
+
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 TextPromptTest < TestCase
|
7
|
+
def test_text_prompt
|
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, 'TextPromptTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['test'] = true
|
22
|
+
request['terminalName'] = 'Test Terminal'
|
23
|
+
request['promptType'] = PromptType::EMAIL
|
24
|
+
response = blockchyp.textPrompt(request)
|
25
|
+
|
26
|
+
assert_not_nil(response)
|
27
|
+
# response assertions
|
28
|
+
assert(response['success'])
|
29
|
+
assert(!response['response'].empty?)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path('test_helper', __dir__)
|
4
|
+
|
5
|
+
module BlockChyp
|
6
|
+
class UpdateTransactionDisplayTest < TestCase
|
7
|
+
def test_update_transaction_display
|
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, 'UpdateTransactionDisplayTest')
|
19
|
+
# setup request object
|
20
|
+
request = {}
|
21
|
+
request['test'] = true
|
22
|
+
request['terminalName'] = 'Test Terminal'
|
23
|
+
request['transaction'] = new_transaction_display_transaction
|
24
|
+
response = blockchyp.updateTransactionDisplay(request)
|
25
|
+
|
26
|
+
assert_not_nil(response)
|
27
|
+
# response assertions
|
28
|
+
assert(response['success'])
|
29
|
+
end
|
30
|
+
|
31
|
+
def new_transaction_display_transaction
|
32
|
+
val = {}
|
33
|
+
val['subtotal'] = '35.00'
|
34
|
+
val['tax'] = '5.00'
|
35
|
+
val['total'] = '70.00'
|
36
|
+
val['items'] = new_transaction_display_items
|
37
|
+
val
|
38
|
+
end
|
39
|
+
|
40
|
+
def new_transaction_display_items
|
41
|
+
val = []
|
42
|
+
val.push(new_transaction_display_item_2)
|
43
|
+
val
|
44
|
+
end
|
45
|
+
|
46
|
+
def new_transaction_display_item_2
|
47
|
+
val = {}
|
48
|
+
val['description'] = 'Leki Trekking Poles'
|
49
|
+
val['price'] = '35.00'
|
50
|
+
val['quantity'] = 2
|
51
|
+
val['extended'] = '70.00'
|
52
|
+
val['discounts'] = new_transaction_display_discounts
|
53
|
+
val
|
54
|
+
end
|
55
|
+
|
56
|
+
def new_transaction_display_discounts
|
57
|
+
val = []
|
58
|
+
val.push(new_transaction_display_discount_2)
|
59
|
+
val
|
60
|
+
end
|
61
|
+
|
62
|
+
def new_transaction_display_discount_2
|
63
|
+
val = {}
|
64
|
+
val['description'] = 'memberDiscount'
|
65
|
+
val['amount'] = '10.00'
|
66
|
+
val
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blockchyp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0.pre.alpha7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- BlockChyp
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- Makefile
|
20
|
+
- README.md
|
21
|
+
- Rakefile
|
22
|
+
- lib/blockchyp.rb
|
23
|
+
- lib/blockchyp/version.rb
|
24
|
+
- lib/blockchyp_client.rb
|
25
|
+
- lib/crypto_utils.rb
|
26
|
+
- test/boolean_prompt_test.rb
|
27
|
+
- test/heartbeat_test.rb
|
28
|
+
- test/new_transaction_display_test.rb
|
29
|
+
- test/pan_charge_test.rb
|
30
|
+
- test/pan_enroll_test.rb
|
31
|
+
- test/pan_preauth_test.rb
|
32
|
+
- test/simple_batch_close_test.rb
|
33
|
+
- test/simple_capture_test.rb
|
34
|
+
- test/simple_gift_activate_test.rb
|
35
|
+
- test/simple_message_test.rb
|
36
|
+
- test/simple_ping_test.rb
|
37
|
+
- test/simple_refund_test.rb
|
38
|
+
- test/simple_reversal_test.rb
|
39
|
+
- test/simple_void_test.rb
|
40
|
+
- test/terminal_charge_test.rb
|
41
|
+
- test/terminal_clear_test.rb
|
42
|
+
- test/terminal_ebt_balance_test.rb
|
43
|
+
- test/terminal_ebt_charge_test.rb
|
44
|
+
- test/terminal_enroll_test.rb
|
45
|
+
- test/terminal_gift_card_balance_test.rb
|
46
|
+
- test/terminal_keyed_charge_test.rb
|
47
|
+
- test/terminal_manual_ebt_charge_test.rb
|
48
|
+
- test/terminal_preauth_test.rb
|
49
|
+
- test/terms_and_conditions_test.rb
|
50
|
+
- test/test_helper.rb
|
51
|
+
- test/text_prompt_test.rb
|
52
|
+
- test/update_transaction_display_test.rb
|
53
|
+
homepage: https://github.com/blockchyp/blockchyp-ruby
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata:
|
57
|
+
github_repo: ssh://github.com/blockchyp/blockchyp-ruby.git
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.3.0
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 1.3.1
|
72
|
+
requirements: []
|
73
|
+
rubygems_version: 3.0.3
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: BlockChyp Ruby SDK
|
77
|
+
test_files: []
|