blockchyp 2.3.5 → 2.6.0

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +155 -117
  3. data/lib/blockchyp.rb +6 -1
  4. data/lib/blockchyp/version.rb +1 -1
  5. data/lib/blockchyp_client.rb +50 -60
  6. data/test/batch_history_test.rb +11 -11
  7. data/test/boolean_prompt_test.rb +12 -12
  8. data/test/capture_signature_test.rb +9 -9
  9. data/test/gateway_timeout_test.rb +10 -10
  10. data/test/get_customer_test.rb +13 -13
  11. data/test/heartbeat_test.rb +10 -10
  12. data/test/merchant_profile_test.rb +38 -0
  13. data/test/new_transaction_display_test.rb +20 -20
  14. data/test/pan_charge_test.rb +22 -22
  15. data/test/pan_enroll_test.rb +20 -20
  16. data/test/pan_preauth_test.rb +21 -21
  17. data/test/partial_refund_test.rb +51 -0
  18. data/test/search_customer_test.rb +13 -13
  19. data/test/send_payment_link_test.rb +26 -26
  20. data/test/simple_batch_close_test.rb +11 -13
  21. data/test/simple_capture_test.rb +12 -12
  22. data/test/simple_gift_activate_test.rb +11 -11
  23. data/test/simple_message_test.rb +9 -9
  24. data/test/simple_ping_test.rb +8 -8
  25. data/test/simple_refund_test.rb +13 -13
  26. data/test/simple_reversal_test.rb +13 -13
  27. data/test/simple_void_test.rb +13 -13
  28. data/test/terminal_charge_test.rb +20 -20
  29. data/test/terminal_clear_test.rb +8 -8
  30. data/test/terminal_ebt_balance_test.rb +10 -10
  31. data/test/terminal_ebt_charge_test.rb +22 -22
  32. data/test/terminal_enroll_test.rb +19 -19
  33. data/test/terminal_gift_card_balance_test.rb +9 -9
  34. data/test/terminal_keyed_charge_test.rb +21 -21
  35. data/test/terminal_manual_ebt_charge_test.rb +23 -23
  36. data/test/terminal_preauth_test.rb +20 -20
  37. data/test/terminal_status_test.rb +8 -8
  38. data/test/terminal_timeout_test.rb +9 -9
  39. data/test/terms_and_conditions_test.rb +13 -13
  40. data/test/test_helper.rb +7 -6
  41. data/test/text_prompt_test.rb +10 -10
  42. data/test/transaction_history_test.rb +11 -11
  43. data/test/update_customer_test.rb +12 -12
  44. data/test/update_transaction_display_test.rb +20 -20
  45. metadata +4 -2
@@ -8,20 +8,20 @@ module BlockChyp
8
8
  config = load_test_config
9
9
 
10
10
  blockchyp = BlockChyp.new(
11
- config['apiKey'],
12
- config['bearerToken'],
13
- config['signingKey']
11
+ config[:apiKey],
12
+ config[:bearerToken],
13
+ config[:signingKey]
14
14
  )
15
- blockchyp.gateway_host = config['gatewayHost']
16
- blockchyp.test_gateway_host = config['testGatewayHost']
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['success'])
21
- assert(!response['timestamp'].empty?)
22
- assert(!response['clockchain'].empty?)
23
- assert(!response['latestTick'].empty?)
24
- assert(!response['merchantPk'].empty?)
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['apiKey'],
18
- config['bearerToken'],
19
- config['signingKey']
17
+ config[:apiKey],
18
+ config[:bearerToken],
19
+ config[:signingKey]
20
20
  )
21
- blockchyp.gateway_host = config['gatewayHost']
22
- blockchyp.test_gateway_host = config['testGatewayHost']
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
- "test": true,
29
- "terminalName": 'Test Terminal',
30
- "transaction": {
31
- "subtotal": '35.00',
32
- "tax": '5.00',
33
- "total": '70.00',
34
- "items": [
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
- "description": 'Leki Trekking Poles',
37
- "price": '35.00',
38
- "quantity": 2,
39
- "extended": '70.00',
40
- "discounts": [
36
+ description: 'Leki Trekking Poles',
37
+ price: '35.00',
38
+ quantity: 2,
39
+ extended: '70.00',
40
+ discounts: [
41
41
  {
42
- "description": 'memberDiscount',
43
- "amount": '10.00'
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['success'])
55
+ assert(response[:success])
56
56
  end
57
57
  end
58
58
  end
@@ -14,40 +14,40 @@ module BlockChyp
14
14
  config = load_test_config
15
15
 
16
16
  blockchyp = BlockChyp.new(
17
- config['apiKey'],
18
- config['bearerToken'],
19
- config['signingKey']
17
+ config[:apiKey],
18
+ config[:bearerToken],
19
+ config[:signingKey]
20
20
  )
21
- blockchyp.gateway_host = config['gatewayHost']
22
- blockchyp.test_gateway_host = config['testGatewayHost']
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
- "pan": '4111111111111111',
29
- "amount": '25.55',
30
- "test": true,
31
- "transactionRef": uuid
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['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'])
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
@@ -14,38 +14,38 @@ module BlockChyp
14
14
  config = load_test_config
15
15
 
16
16
  blockchyp = BlockChyp.new(
17
- config['apiKey'],
18
- config['bearerToken'],
19
- config['signingKey']
17
+ config[:apiKey],
18
+ config[:bearerToken],
19
+ config[:signingKey]
20
20
  )
21
- blockchyp.gateway_host = config['gatewayHost']
22
- blockchyp.test_gateway_host = config['testGatewayHost']
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
- "pan": '4111111111111111',
29
- "test": true
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['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?)
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
@@ -14,39 +14,39 @@ module BlockChyp
14
14
  config = load_test_config
15
15
 
16
16
  blockchyp = BlockChyp.new(
17
- config['apiKey'],
18
- config['bearerToken'],
19
- config['signingKey']
17
+ config[:apiKey],
18
+ config[:bearerToken],
19
+ config[:signingKey]
20
20
  )
21
- blockchyp.gateway_host = config['gatewayHost']
22
- blockchyp.test_gateway_host = config['testGatewayHost']
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
- "pan": '4111111111111111',
29
- "amount": '25.55',
30
- "test": true
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['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'])
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['apiKey'],
18
- config['bearerToken'],
19
- config['signingKey']
17
+ config[:apiKey],
18
+ config[:bearerToken],
19
+ config[:signingKey]
20
20
  )
21
- blockchyp.gateway_host = config['gatewayHost']
22
- blockchyp.test_gateway_host = config['testGatewayHost']
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
- "customer": {
29
- "firstName": 'Test',
30
- "lastName": 'Customer',
31
- "companyName": 'Test Company',
32
- "emailAddress": 'support@blockchyp.com',
33
- "smsNumber": '(123) 123-1234'
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
- "query": '123123'
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['success'])
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['apiKey'],
18
- config['bearerToken'],
19
- config['signingKey']
17
+ config[:apiKey],
18
+ config[:bearerToken],
19
+ config[:signingKey]
20
20
  )
21
- blockchyp.gateway_host = config['gatewayHost']
22
- blockchyp.test_gateway_host = config['testGatewayHost']
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
- "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": [
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
- "description": 'Widget',
38
- "price": '195.00',
39
- "quantity": 1
37
+ description: 'Widget',
38
+ price: '195.00',
39
+ quantity: 1
40
40
  }
41
41
  ]
42
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'
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['success'])
59
- assert(!response['url'].empty?)
58
+ assert(response[:success])
59
+ assert(!response[:url].empty?)
60
60
  end
61
61
  end
62
62
  end