blockchyp 1.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Makefile +78 -0
- data/README.md +4023 -0
- data/Rakefile +39 -0
- data/lib/blockchyp/version.rb +5 -0
- data/lib/blockchyp.rb +478 -0
- data/lib/blockchyp_client.rb +416 -0
- data/lib/crypto_utils.rb +25 -0
- data/test/activate_terminal_test.rb +45 -0
- data/test/add_test_merchant_test.rb +56 -0
- data/test/batch_history_test.rb +54 -0
- data/test/boolean_prompt_test.rb +49 -0
- data/test/cancel_payment_link_test.rb +72 -0
- data/test/capture_signature_test.rb +46 -0
- data/test/deactivate_terminal_test.rb +42 -0
- data/test/delete_branding_asset_test.rb +50 -0
- data/test/delete_customer_test.rb +55 -0
- data/test/delete_media_asset_test.rb +53 -0
- data/test/delete_queued_transaction_test.rb +56 -0
- data/test/delete_slide_show_test.rb +50 -0
- data/test/delete_survey_question_test.rb +51 -0
- data/test/delete_test_merchant_test.rb +59 -0
- data/test/delete_token_test.rb +55 -0
- data/test/empty_branding_asset_test.rb +44 -0
- data/test/empty_slide_show_test.rb +45 -0
- data/test/gateway_timeout_test.rb +49 -0
- data/test/get_customer_test.rb +55 -0
- data/test/get_merchants_test.rb +52 -0
- data/test/heartbeat_test.rb +27 -0
- data/test/invite_merchant_user_test.rb +45 -0
- data/test/link_token_test.rb +56 -0
- data/test/list_queued_transactions_test.rb +55 -0
- data/test/list_terminals_test.rb +42 -0
- data/test/media_asset_test.rb +57 -0
- data/test/media_test.rb +42 -0
- data/test/media_upload_test.rb +52 -0
- data/test/merchant_platforms_test.rb +59 -0
- data/test/merchant_profile_test.rb +43 -0
- data/test/merchant_users_test.rb +42 -0
- data/test/new_transaction_display_test.rb +64 -0
- data/test/pan_charge_test.rb +61 -0
- data/test/pan_enroll_test.rb +62 -0
- data/test/pan_preauth_test.rb +60 -0
- data/test/partial_refund_test.rb +58 -0
- data/test/payment_link_status_test.rb +72 -0
- data/test/resend_payment_link_test.rb +49 -0
- data/test/search_customer_test.rb +55 -0
- data/test/send_payment_link_test.rb +67 -0
- data/test/simple_batch_close_test.rb +54 -0
- data/test/simple_capture_test.rb +55 -0
- data/test/simple_gift_activate_test.rb +48 -0
- data/test/simple_locate_test.rb +44 -0
- data/test/simple_message_test.rb +46 -0
- data/test/simple_ping_test.rb +45 -0
- data/test/simple_refund_test.rb +57 -0
- data/test/simple_reversal_test.rb +56 -0
- data/test/simple_void_test.rb +56 -0
- data/test/slide_show_test.rb +51 -0
- data/test/slide_shows_test.rb +49 -0
- data/test/survey_question_test.rb +48 -0
- data/test/survey_questions_test.rb +50 -0
- data/test/survey_results_test.rb +48 -0
- data/test/tc_delete_template_test.rb +51 -0
- data/test/tc_entry_test.rb +56 -0
- data/test/tc_log_test.rb +42 -0
- data/test/tc_template_test.rb +53 -0
- data/test/tc_template_update_test.rb +48 -0
- data/test/tc_templates_test.rb +42 -0
- data/test/terminal_branding_test.rb +42 -0
- data/test/terminal_charge_test.rb +57 -0
- data/test/terminal_clear_test.rb +45 -0
- data/test/terminal_ebt_balance_test.rb +47 -0
- data/test/terminal_ebt_charge_test.rb +59 -0
- data/test/terminal_enroll_test.rb +56 -0
- data/test/terminal_gift_card_balance_test.rb +46 -0
- data/test/terminal_keyed_charge_test.rb +58 -0
- data/test/terminal_manual_ebt_charge_test.rb +60 -0
- data/test/terminal_preauth_test.rb +57 -0
- data/test/terminal_queued_transaction_test.rb +51 -0
- data/test/terminal_status_test.rb +45 -0
- data/test/terminal_timeout_test.rb +46 -0
- data/test/terms_and_conditions_test.rb +50 -0
- data/test/test_helper.rb +64 -0
- data/test/testdata/aviato.png +0 -0
- data/test/text_prompt_test.rb +47 -0
- data/test/token_metadata_test.rb +55 -0
- data/test/transaction_history_test.rb +54 -0
- data/test/unlink_token_test.rb +56 -0
- data/test/update_branding_asset_test.rb +62 -0
- data/test/update_customer_test.rb +49 -0
- data/test/update_merchant_platforms_test.rb +61 -0
- data/test/update_merchant_test.rb +60 -0
- data/test/update_slide_show_test.rb +60 -0
- data/test/update_survey_question_test.rb +47 -0
- data/test/update_transaction_display_test.rb +64 -0
- data/test/upload_status_test.rb +53 -0
- metadata +138 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TerminalManualEBTChargeTest < TestCase
|
13
|
+
def test_terminal_manual_ebt_charge
|
14
|
+
|
15
|
+
puts "Running test_terminal_manual_ebt_charge..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
test_delay(blockchyp, 'terminal_manual_ebt_charge_test', config[:defaultTerminalName])
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# Set request parameters
|
34
|
+
request = {
|
35
|
+
terminalName: config[:defaultTerminalName],
|
36
|
+
amount: '27.00',
|
37
|
+
test: true,
|
38
|
+
cardType: CardType::EBT,
|
39
|
+
manualEntry: true
|
40
|
+
}
|
41
|
+
|
42
|
+
response = blockchyp.charge(request)
|
43
|
+
assert_not_nil(response)
|
44
|
+
# response assertions
|
45
|
+
assert(response[:success])
|
46
|
+
assert(response[:approved])
|
47
|
+
assert(response[:test])
|
48
|
+
assert_equal(response[:authCode].length, 6)
|
49
|
+
assert(!response[:transactionId].empty?)
|
50
|
+
assert(!response[:timestamp].empty?)
|
51
|
+
assert(!response[:tickBlock].empty?)
|
52
|
+
assert_equal('approved', response[:responseDescription])
|
53
|
+
assert(!response[:paymentType].empty?)
|
54
|
+
assert(!response[:maskedPan].empty?)
|
55
|
+
assert(!response[:entryMethod].empty?)
|
56
|
+
assert_equal('27.00', response[:authorizedAmount])
|
57
|
+
assert_equal('73.00', response[:remainingBalance])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TerminalPreauthTest < TestCase
|
13
|
+
def test_terminal_preauth
|
14
|
+
|
15
|
+
puts "Running test_terminal_preauth..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
test_delay(blockchyp, 'terminal_preauth_test', config[:defaultTerminalName])
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# Set request parameters
|
34
|
+
request = {
|
35
|
+
terminalName: config[:defaultTerminalName],
|
36
|
+
amount: '15.15',
|
37
|
+
test: true
|
38
|
+
}
|
39
|
+
|
40
|
+
response = blockchyp.preauth(request)
|
41
|
+
assert_not_nil(response)
|
42
|
+
# response assertions
|
43
|
+
assert(response[:success])
|
44
|
+
assert(response[:approved])
|
45
|
+
assert(response[:test])
|
46
|
+
assert_equal(response[:authCode].length, 6)
|
47
|
+
assert(!response[:transactionId].empty?)
|
48
|
+
assert(!response[:timestamp].empty?)
|
49
|
+
assert(!response[:tickBlock].empty?)
|
50
|
+
assert_equal('approved', response[:responseDescription])
|
51
|
+
assert(!response[:paymentType].empty?)
|
52
|
+
assert(!response[:maskedPan].empty?)
|
53
|
+
assert(!response[:entryMethod].empty?)
|
54
|
+
assert_equal('15.15', response[:authorizedAmount])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TerminalQueuedTransactionTest < TestCase
|
13
|
+
def test_terminal_queued_transaction
|
14
|
+
|
15
|
+
puts "Running test_terminal_queued_transaction..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
test_delay(blockchyp, 'terminal_queued_transaction_test', config[:defaultTerminalName])
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# Set request parameters
|
34
|
+
request = {
|
35
|
+
terminalName: config[:defaultTerminalName],
|
36
|
+
transactionRef: uuid,
|
37
|
+
description: '1060 West Addison',
|
38
|
+
amount: '25.15',
|
39
|
+
test: true,
|
40
|
+
queue: true
|
41
|
+
}
|
42
|
+
|
43
|
+
response = blockchyp.charge(request)
|
44
|
+
assert_not_nil(response)
|
45
|
+
# response assertions
|
46
|
+
assert(response[:success])
|
47
|
+
assert(!response[:approved])
|
48
|
+
assert_equal('Queued', response[:responseDescription])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TerminalStatusTest < TestCase
|
13
|
+
def test_terminal_status
|
14
|
+
|
15
|
+
puts "Running test_terminal_status..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
test_delay(blockchyp, 'terminal_status_test', config[:defaultTerminalName])
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# Set request parameters
|
34
|
+
request = {
|
35
|
+
terminalName: config[:defaultTerminalName]
|
36
|
+
}
|
37
|
+
|
38
|
+
response = blockchyp.terminal_status(request)
|
39
|
+
assert_not_nil(response)
|
40
|
+
# response assertions
|
41
|
+
assert(response[:success])
|
42
|
+
assert(response[:idle])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TerminalTimeoutTest < TestCase
|
13
|
+
def test_terminal_timeout
|
14
|
+
|
15
|
+
puts "Running test_terminal_timeout..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
test_delay(blockchyp, 'terminal_timeout_test', config[:defaultTerminalName])
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# Set request parameters
|
34
|
+
request = {
|
35
|
+
timeout: 1,
|
36
|
+
terminalName: config[:defaultTerminalName],
|
37
|
+
amount: '25.15',
|
38
|
+
test: true
|
39
|
+
}
|
40
|
+
|
41
|
+
assert_raise Net::ReadTimeout do
|
42
|
+
blockchyp.charge(request)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TermsAndConditionsTest < TestCase
|
13
|
+
def test_terms_and_conditions
|
14
|
+
|
15
|
+
puts "Running test_terms_and_conditions..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
test_delay(blockchyp, 'terms_and_conditions_test', config[:defaultTerminalName])
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# Set request parameters
|
34
|
+
request = {
|
35
|
+
test: true,
|
36
|
+
terminalName: config[:defaultTerminalName],
|
37
|
+
tcName: 'HIPPA Disclosure',
|
38
|
+
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.',
|
39
|
+
sigFormat: SignatureFormat::PNG,
|
40
|
+
sigWidth: 200,
|
41
|
+
sigRequired: true
|
42
|
+
}
|
43
|
+
|
44
|
+
response = blockchyp.terms_and_conditions(request)
|
45
|
+
assert_not_nil(response)
|
46
|
+
# response assertions
|
47
|
+
assert(response[:success])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,64 @@
|
|
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
|
+
raise 'file not found: ' + file_name unless File.file?(file_name)
|
28
|
+
|
29
|
+
config_file = File.open(file_name)
|
30
|
+
content = config_file.read
|
31
|
+
|
32
|
+
JSON.parse(content, symbolize_names: true)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_delay(client, test_name, terminal_name)
|
36
|
+
test_delay = ENV['BC_TEST_DELAY']
|
37
|
+
|
38
|
+
if test_delay
|
39
|
+
test_delay_int = Integer(test_delay)
|
40
|
+
if test_delay_int.positive?
|
41
|
+
request = {
|
42
|
+
test: true,
|
43
|
+
terminalName: terminal_name,
|
44
|
+
message: "Running #{test_name} in #{test_delay} seconds.."
|
45
|
+
}
|
46
|
+
response = client.message(request)
|
47
|
+
|
48
|
+
assert_not_nil(response)
|
49
|
+
# response assertions
|
50
|
+
assert(response[:success])
|
51
|
+
sleep test_delay_int
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def uuid
|
57
|
+
SecureRandom.uuid
|
58
|
+
end
|
59
|
+
|
60
|
+
def windows?
|
61
|
+
!(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM).nil?
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
Binary file
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TextPromptTest < TestCase
|
13
|
+
def test_text_prompt
|
14
|
+
|
15
|
+
puts "Running test_text_prompt..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
test_delay(blockchyp, 'text_prompt_test', config[:defaultTerminalName])
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# Set request parameters
|
34
|
+
request = {
|
35
|
+
test: true,
|
36
|
+
terminalName: config[:defaultTerminalName],
|
37
|
+
promptType: PromptType::EMAIL
|
38
|
+
}
|
39
|
+
|
40
|
+
response = blockchyp.text_prompt(request)
|
41
|
+
assert_not_nil(response)
|
42
|
+
# response assertions
|
43
|
+
assert(response[:success])
|
44
|
+
assert(!response[:response].empty?)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TokenMetadataTest < TestCase
|
13
|
+
def test_token_metadata
|
14
|
+
|
15
|
+
puts "Running test_token_metadata..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
# Set request parameters
|
33
|
+
setup_request = {
|
34
|
+
pan: '4111111111111111',
|
35
|
+
test: true,
|
36
|
+
customer: {
|
37
|
+
customerRef: 'TESTCUSTOMER',
|
38
|
+
firstName: 'Test',
|
39
|
+
lastName: 'Customer'
|
40
|
+
}
|
41
|
+
}
|
42
|
+
response = blockchyp.enroll(setup_request)
|
43
|
+
|
44
|
+
# Set request parameters
|
45
|
+
request = {
|
46
|
+
token: response[:token]
|
47
|
+
}
|
48
|
+
|
49
|
+
response = blockchyp.token_metadata(request)
|
50
|
+
assert_not_nil(response)
|
51
|
+
# response assertions
|
52
|
+
assert(response[:success])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class TransactionHistoryTest < TestCase
|
13
|
+
def test_transaction_history
|
14
|
+
|
15
|
+
puts "Running test_transaction_history..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
# Set request parameters
|
33
|
+
setup_request = {
|
34
|
+
pan: '4111111111111111',
|
35
|
+
expMonth: '12',
|
36
|
+
expYear: '2025',
|
37
|
+
amount: '25.55',
|
38
|
+
test: true,
|
39
|
+
transactionRef: uuid
|
40
|
+
}
|
41
|
+
response = blockchyp.charge(setup_request)
|
42
|
+
|
43
|
+
# Set request parameters
|
44
|
+
request = {
|
45
|
+
maxResults: 10
|
46
|
+
}
|
47
|
+
|
48
|
+
response = blockchyp.transaction_history(request)
|
49
|
+
assert_not_nil(response)
|
50
|
+
# response assertions
|
51
|
+
assert(response[:success])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class UnlinkTokenTest < TestCase
|
13
|
+
def test_unlink_token
|
14
|
+
|
15
|
+
puts "Running test_unlink_token..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
# Set request parameters
|
33
|
+
setup_request = {
|
34
|
+
pan: '4111111111111111',
|
35
|
+
test: true,
|
36
|
+
customer: {
|
37
|
+
customerRef: 'TESTCUSTOMER',
|
38
|
+
firstName: 'Test',
|
39
|
+
lastName: 'Customer'
|
40
|
+
}
|
41
|
+
}
|
42
|
+
response = blockchyp.enroll(setup_request)
|
43
|
+
|
44
|
+
# Set request parameters
|
45
|
+
request = {
|
46
|
+
token: response[:token],
|
47
|
+
customerId: response[:customer][:id]
|
48
|
+
}
|
49
|
+
|
50
|
+
response = blockchyp.unlink_token(request)
|
51
|
+
assert_not_nil(response)
|
52
|
+
# response assertions
|
53
|
+
assert(response[:success])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2023 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 by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class UpdateBrandingAssetTest < TestCase
|
13
|
+
def test_update_branding_asset
|
14
|
+
|
15
|
+
puts "Running test_update_branding_asset..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
# Set request parameters
|
33
|
+
setup_request = {
|
34
|
+
fileName: 'aviato.png',
|
35
|
+
fileSize: 18843,
|
36
|
+
uploadId: uuid
|
37
|
+
}
|
38
|
+
file = File.open("test/testdata/aviato.png")
|
39
|
+
content = file.read
|
40
|
+
response = blockchyp.upload_media(setup_request, content)
|
41
|
+
|
42
|
+
# Set request parameters
|
43
|
+
request = {
|
44
|
+
mediaId: response[:id],
|
45
|
+
padded: true,
|
46
|
+
ordinal: 10,
|
47
|
+
startDate: '01/06/2021',
|
48
|
+
startTime: '14:00',
|
49
|
+
endDate: '11/05/2024',
|
50
|
+
endTime: '16:00',
|
51
|
+
notes: 'Test Branding Asset',
|
52
|
+
preview: false,
|
53
|
+
enabled: true
|
54
|
+
}
|
55
|
+
|
56
|
+
response = blockchyp.update_branding_asset(request)
|
57
|
+
assert_not_nil(response)
|
58
|
+
# response assertions
|
59
|
+
assert(response[:success])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|