hps 2.3.2 → 2.4.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.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/Gemfile.lock +59 -0
- data/LICENSE.md +264 -264
- data/PRIVACY.txt +65 -65
- data/README.md +213 -213
- data/Rakefile +15 -15
- data/examples/sinatra-verify-only/Gemfile +4 -4
- data/examples/sinatra-verify-only/app.rb +32 -32
- data/examples/sinatra-verify-only/views/index.erb +478 -478
- data/examples/sinatra-verify-only/views/result.erb +39 -39
- data/hps.gemspec +28 -27
- data/lib/hps/configuration.rb +17 -17
- data/lib/hps/entities/hps_account_verify.rb +8 -8
- data/lib/hps/entities/hps_address.rb +6 -6
- data/lib/hps/entities/hps_authorization.rb +12 -12
- data/lib/hps/entities/hps_batch.rb +6 -6
- data/lib/hps/entities/hps_cardholder.rb +6 -6
- data/lib/hps/entities/hps_charge.rb +8 -8
- data/lib/hps/entities/hps_charge_exceptions.rb +6 -6
- data/lib/hps/entities/hps_check.rb +18 -18
- data/lib/hps/entities/hps_check_holder.rb +10 -10
- data/lib/hps/entities/hps_check_response.rb +45 -45
- data/lib/hps/entities/hps_check_response_details.rb +9 -9
- data/lib/hps/entities/hps_credit_card.rb +34 -34
- data/lib/hps/entities/hps_direct_market_data.rb +5 -5
- data/lib/hps/entities/hps_encryption_data.rb +6 -6
- data/lib/hps/entities/hps_gift_card.rb +133 -133
- data/lib/hps/entities/hps_manage_tokens.rb +8 -8
- data/lib/hps/entities/hps_refund.rb +8 -8
- data/lib/hps/entities/hps_report_transaction_details.rb +10 -10
- data/lib/hps/entities/hps_report_transaction_summary.rb +6 -6
- data/lib/hps/entities/hps_reversal.rb +10 -10
- data/lib/hps/entities/hps_token_data.rb +10 -10
- data/lib/hps/entities/hps_track_data.rb +5 -5
- data/lib/hps/entities/hps_transaction.rb +161 -161
- data/lib/hps/entities/hps_transaction_details.rb +6 -6
- data/lib/hps/entities/hps_transaction_header.rb +8 -8
- data/lib/hps/entities/hps_transaction_type.rb +16 -16
- data/lib/hps/entities/hps_void.rb +8 -8
- data/lib/hps/infrastructure/api_connection_exception.rb +11 -11
- data/lib/hps/infrastructure/authentication_exception.rb +11 -11
- data/lib/hps/infrastructure/card_exception.rb +15 -15
- data/lib/hps/infrastructure/exceptions.json +547 -547
- data/lib/hps/infrastructure/hps_account_type.rb +11 -11
- data/lib/hps/infrastructure/hps_check_exception.rb +13 -13
- data/lib/hps/infrastructure/hps_check_type.rb +11 -11
- data/lib/hps/infrastructure/hps_data_entry_mode.rb +11 -11
- data/lib/hps/infrastructure/hps_exception.rb +25 -25
- data/lib/hps/infrastructure/hps_exception_mapper.rb +145 -145
- data/lib/hps/infrastructure/hps_gateway_response_validation.rb +20 -20
- data/lib/hps/infrastructure/hps_input_validation.rb +13 -13
- data/lib/hps/infrastructure/hps_sdk_codes.rb +48 -48
- data/lib/hps/infrastructure/hps_sec_code.rb +27 -27
- data/lib/hps/infrastructure/hps_track_data_method.rb +6 -6
- data/lib/hps/infrastructure/invalid_request_exception.rb +15 -15
- data/lib/hps/services/hps_batch_service.rb +29 -29
- data/lib/hps/services/hps_charge_service.rb +773 -773
- data/lib/hps/services/hps_check_service.rb +110 -110
- data/lib/hps/services/hps_gift_card_service.rb +301 -301
- data/lib/hps/services/hps_service.rb +141 -136
- data/lib/hps/version.rb +3 -3
- data/lib/hps.rb +63 -63
- data/tests/amex_tests.rb +292 -292
- data/tests/cert_tests.rb +80 -80
- data/tests/certification/card_present_spec.rb +320 -320
- data/tests/certification/gift_card_certification_test.rb +106 -106
- data/tests/certification/gift_card_certification_tests.rb +107 -107
- data/tests/check_tests.rb +50 -50
- data/tests/discover_tests.rb +386 -386
- data/tests/exception_mapper_tests.rb +311 -311
- data/tests/general_tests.rb +140 -140
- data/tests/giftcard_tests.rb +212 -212
- data/tests/hps_token_service.rb +56 -56
- data/tests/mastercard_tests.rb +387 -387
- data/tests/secret_key.rb +11 -11
- data/tests/test_check.rb +77 -77
- data/tests/test_data.rb +138 -138
- data/tests/test_helper.rb +179 -179
- data/tests/token_tests.rb +512 -512
- data/tests/visa_tests.rb +445 -445
- metadata +31 -11
@@ -1,107 +1,107 @@
|
|
1
|
-
require File.join( File.dirname(File.dirname(__FILE__)), "test_helper" )
|
2
|
-
|
3
|
-
describe "Gift card certification tests" do
|
4
|
-
let(:service) do
|
5
|
-
Hps::TestHelper.valid_multi_use_config
|
6
|
-
Hps::HpsGiftCardService.new
|
7
|
-
end
|
8
|
-
|
9
|
-
# Test #96
|
10
|
-
it "testActivateSVA1" do
|
11
|
-
activation = service.activate( sva1, 6.00 )
|
12
|
-
expect( activation.response_code ).to eql("0")
|
13
|
-
end
|
14
|
-
|
15
|
-
# Test #97
|
16
|
-
it "testActivateSVA2" do
|
17
|
-
activation = service.activate( sva2, 7.00 )
|
18
|
-
expect( activation.response_code ).to eql("0")
|
19
|
-
end
|
20
|
-
|
21
|
-
# Test #98
|
22
|
-
it "testAddValueSVA1" do
|
23
|
-
add_value = service.add_value( sva1, 8.00 )
|
24
|
-
expect( add_value.response_code ).to eql("0")
|
25
|
-
end
|
26
|
-
|
27
|
-
# Test #99
|
28
|
-
it "testAddValueSVA2" do
|
29
|
-
add_value = service.add_value( sva2, 9.00 )
|
30
|
-
expect( add_value.response_code ).to eql("0")
|
31
|
-
end
|
32
|
-
|
33
|
-
# Test #100
|
34
|
-
it "testBalanceSVA1" do
|
35
|
-
balance = service.balance( sva1 )
|
36
|
-
expect( balance.response_code ).to eql("0")
|
37
|
-
expect( balance.balance_amount.to_i ).to eql(10)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Test #101
|
41
|
-
it "testBalanceSVA2" do
|
42
|
-
balance = service.balance( sva2 )
|
43
|
-
expect( balance.response_code ).to eql("0")
|
44
|
-
expect( balance.balance_amount.to_i ).to eql(10)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Test #102
|
48
|
-
it "testReplaceSVA1" do
|
49
|
-
replace = service.replace(sva1, sva2)
|
50
|
-
expect( replace.response_code ).to eql("0")
|
51
|
-
end
|
52
|
-
|
53
|
-
# Test #103
|
54
|
-
it "testReplaceSVA2" do
|
55
|
-
replace = service.replace(sva2, sva1)
|
56
|
-
expect( replace.response_code ).to eql("0")
|
57
|
-
end
|
58
|
-
|
59
|
-
# Test #104
|
60
|
-
it "testSaleSVA1" do
|
61
|
-
sale = service.sale(sva1, 1.00)
|
62
|
-
expect( sale.response_code ).to eql("0")
|
63
|
-
end
|
64
|
-
|
65
|
-
# Test #105
|
66
|
-
it "testSaleSVA2" do
|
67
|
-
sale = service.sale(sva2, 2.00)
|
68
|
-
expect( sale.response_code ).to eql("0")
|
69
|
-
end
|
70
|
-
|
71
|
-
# Test #106 & Test #108
|
72
|
-
it "testSaleAndVoidSVA1" do
|
73
|
-
sale = service.sale(sva1, 3.00)
|
74
|
-
expect( sale.response_code ).to eql("0")
|
75
|
-
void = service.void(sale.transaction_id)
|
76
|
-
expect( void.response_code ).to eql("0")
|
77
|
-
end
|
78
|
-
|
79
|
-
# Test #107 & Test # 109
|
80
|
-
it "testSaleAndReversalSVA2" do
|
81
|
-
sale = service.sale(sva2, 4.00)
|
82
|
-
expect( sale.response_code ).to eql("0")
|
83
|
-
reverse = service.reverse(sale.transaction_id, 4.00)
|
84
|
-
expect( reverse.response_code ).to eql("0")
|
85
|
-
end
|
86
|
-
|
87
|
-
# Test #110
|
88
|
-
it "testDeactivateSVA1" do
|
89
|
-
deactivate = service.deactivate(sva1)
|
90
|
-
expect( deactivate.response_code ).to eql("0")
|
91
|
-
end
|
92
|
-
|
93
|
-
# Test #111
|
94
|
-
it "testDeactivateSVA1" do
|
95
|
-
deactivate = service.deactivate(sva2)
|
96
|
-
expect( deactivate.response_code ).to eql("0")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# Helper methods
|
101
|
-
def sva1
|
102
|
-
Hps::HpsGiftCard.new(5022440000000000098)
|
103
|
-
end
|
104
|
-
|
105
|
-
def sva2
|
106
|
-
Hps::HpsGiftCard.new(5022440000000000007)
|
1
|
+
require File.join( File.dirname(File.dirname(__FILE__)), "test_helper" )
|
2
|
+
|
3
|
+
describe "Gift card certification tests" do
|
4
|
+
let(:service) do
|
5
|
+
Hps::TestHelper.valid_multi_use_config
|
6
|
+
Hps::HpsGiftCardService.new
|
7
|
+
end
|
8
|
+
|
9
|
+
# Test #96
|
10
|
+
it "testActivateSVA1" do
|
11
|
+
activation = service.activate( sva1, 6.00 )
|
12
|
+
expect( activation.response_code ).to eql("0")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Test #97
|
16
|
+
it "testActivateSVA2" do
|
17
|
+
activation = service.activate( sva2, 7.00 )
|
18
|
+
expect( activation.response_code ).to eql("0")
|
19
|
+
end
|
20
|
+
|
21
|
+
# Test #98
|
22
|
+
it "testAddValueSVA1" do
|
23
|
+
add_value = service.add_value( sva1, 8.00 )
|
24
|
+
expect( add_value.response_code ).to eql("0")
|
25
|
+
end
|
26
|
+
|
27
|
+
# Test #99
|
28
|
+
it "testAddValueSVA2" do
|
29
|
+
add_value = service.add_value( sva2, 9.00 )
|
30
|
+
expect( add_value.response_code ).to eql("0")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Test #100
|
34
|
+
it "testBalanceSVA1" do
|
35
|
+
balance = service.balance( sva1 )
|
36
|
+
expect( balance.response_code ).to eql("0")
|
37
|
+
expect( balance.balance_amount.to_i ).to eql(10)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Test #101
|
41
|
+
it "testBalanceSVA2" do
|
42
|
+
balance = service.balance( sva2 )
|
43
|
+
expect( balance.response_code ).to eql("0")
|
44
|
+
expect( balance.balance_amount.to_i ).to eql(10)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Test #102
|
48
|
+
it "testReplaceSVA1" do
|
49
|
+
replace = service.replace(sva1, sva2)
|
50
|
+
expect( replace.response_code ).to eql("0")
|
51
|
+
end
|
52
|
+
|
53
|
+
# Test #103
|
54
|
+
it "testReplaceSVA2" do
|
55
|
+
replace = service.replace(sva2, sva1)
|
56
|
+
expect( replace.response_code ).to eql("0")
|
57
|
+
end
|
58
|
+
|
59
|
+
# Test #104
|
60
|
+
it "testSaleSVA1" do
|
61
|
+
sale = service.sale(sva1, 1.00)
|
62
|
+
expect( sale.response_code ).to eql("0")
|
63
|
+
end
|
64
|
+
|
65
|
+
# Test #105
|
66
|
+
it "testSaleSVA2" do
|
67
|
+
sale = service.sale(sva2, 2.00)
|
68
|
+
expect( sale.response_code ).to eql("0")
|
69
|
+
end
|
70
|
+
|
71
|
+
# Test #106 & Test #108
|
72
|
+
it "testSaleAndVoidSVA1" do
|
73
|
+
sale = service.sale(sva1, 3.00)
|
74
|
+
expect( sale.response_code ).to eql("0")
|
75
|
+
void = service.void(sale.transaction_id)
|
76
|
+
expect( void.response_code ).to eql("0")
|
77
|
+
end
|
78
|
+
|
79
|
+
# Test #107 & Test # 109
|
80
|
+
it "testSaleAndReversalSVA2" do
|
81
|
+
sale = service.sale(sva2, 4.00)
|
82
|
+
expect( sale.response_code ).to eql("0")
|
83
|
+
reverse = service.reverse(sale.transaction_id, 4.00)
|
84
|
+
expect( reverse.response_code ).to eql("0")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Test #110
|
88
|
+
it "testDeactivateSVA1" do
|
89
|
+
deactivate = service.deactivate(sva1)
|
90
|
+
expect( deactivate.response_code ).to eql("0")
|
91
|
+
end
|
92
|
+
|
93
|
+
# Test #111
|
94
|
+
it "testDeactivateSVA1" do
|
95
|
+
deactivate = service.deactivate(sva2)
|
96
|
+
expect( deactivate.response_code ).to eql("0")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Helper methods
|
101
|
+
def sva1
|
102
|
+
Hps::HpsGiftCard.new(5022440000000000098)
|
103
|
+
end
|
104
|
+
|
105
|
+
def sva2
|
106
|
+
Hps::HpsGiftCard.new(5022440000000000007)
|
107
107
|
end
|
@@ -1,107 +1,107 @@
|
|
1
|
-
require File.join( File.dirname(File.dirname(__FILE__)), "test_helper" )
|
2
|
-
|
3
|
-
describe "Gift card certification tests" do
|
4
|
-
let(:service) do
|
5
|
-
Hps::TestHelper.valid_multi_use_config
|
6
|
-
Hps::HpsGiftCardService.new
|
7
|
-
end
|
8
|
-
|
9
|
-
# Test #96
|
10
|
-
it "testActivateSVA1" do
|
11
|
-
activation = service.activate( sva1, 6.00 )
|
12
|
-
expect( activation.response_code ).to eql("0")
|
13
|
-
end
|
14
|
-
|
15
|
-
# Test #97
|
16
|
-
it "testActivateSVA2" do
|
17
|
-
activation = service.activate( sva2, 7.00 )
|
18
|
-
expect( activation.response_code ).to eql("0")
|
19
|
-
end
|
20
|
-
|
21
|
-
# Test #98
|
22
|
-
it "testAddValueSVA1" do
|
23
|
-
add_value = service.add_value( sva1, 8.00 )
|
24
|
-
expect( add_value.response_code ).to eql("0")
|
25
|
-
end
|
26
|
-
|
27
|
-
# Test #99
|
28
|
-
it "testAddValueSVA2" do
|
29
|
-
add_value = service.add_value( sva2, 9.00 )
|
30
|
-
expect( add_value.response_code ).to eql("0")
|
31
|
-
end
|
32
|
-
|
33
|
-
# Test #100
|
34
|
-
it "testBalanceSVA1" do
|
35
|
-
balance = service.balance( sva1 )
|
36
|
-
expect( balance.response_code ).to eql("0")
|
37
|
-
expect( balance.balance_amount.to_i ).to eql(10)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Test #101
|
41
|
-
it "testBalanceSVA2" do
|
42
|
-
balance = service.balance( sva2 )
|
43
|
-
expect( balance.response_code ).to eql("0")
|
44
|
-
expect( balance.balance_amount.to_i ).to eql(10)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Test #102
|
48
|
-
it "testReplaceSVA1" do
|
49
|
-
replace = service.replace(sva1, sva2)
|
50
|
-
expect( replace.response_code ).to eql("0")
|
51
|
-
end
|
52
|
-
|
53
|
-
# Test #103
|
54
|
-
it "testReplaceSVA2" do
|
55
|
-
replace = service.replace(sva2, sva1)
|
56
|
-
expect( replace.response_code ).to eql("0")
|
57
|
-
end
|
58
|
-
|
59
|
-
# Test #104
|
60
|
-
it "testSaleSVA1" do
|
61
|
-
sale = service.sale(sva1, 1.00)
|
62
|
-
expect( sale.response_code ).to eql("0")
|
63
|
-
end
|
64
|
-
|
65
|
-
# Test #105
|
66
|
-
it "testSaleSVA2" do
|
67
|
-
sale = service.sale(sva2, 2.00)
|
68
|
-
expect( sale.response_code ).to eql("0")
|
69
|
-
end
|
70
|
-
|
71
|
-
# Test #106 & Test #108
|
72
|
-
it "testSaleAndVoidSVA1" do
|
73
|
-
sale = service.sale(sva1, 3.00)
|
74
|
-
expect( sale.response_code ).to eql("0")
|
75
|
-
void = service.void(sale.transaction_id)
|
76
|
-
expect( void.response_code ).to eql("0")
|
77
|
-
end
|
78
|
-
|
79
|
-
# Test #107 & Test # 109
|
80
|
-
it "testSaleAndReversalSVA2" do
|
81
|
-
sale = service.sale(sva2, 4.00)
|
82
|
-
expect( sale.response_code ).to eql("0")
|
83
|
-
reverse = service.reverse(sale.transaction_id, 4.00)
|
84
|
-
expect( reverse.response_code ).to eql("0")
|
85
|
-
end
|
86
|
-
|
87
|
-
# Test #110
|
88
|
-
it "testDeactivateSVA1" do
|
89
|
-
deactivate = service.deactivate(sva1)
|
90
|
-
expect( deactivate.response_code ).to eql("0")
|
91
|
-
end
|
92
|
-
|
93
|
-
# Test #111
|
94
|
-
it "testDeactivateSVA1" do
|
95
|
-
deactivate = service.deactivate(sva2)
|
96
|
-
expect( deactivate.response_code ).to eql("0")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# Helper methods
|
101
|
-
def sva1
|
102
|
-
Hps::HpsGiftCard.new(5022440000000000098)
|
103
|
-
end
|
104
|
-
|
105
|
-
def sva2
|
106
|
-
Hps::HpsGiftCard.new(5022440000000000007)
|
107
|
-
end
|
1
|
+
require File.join( File.dirname(File.dirname(__FILE__)), "test_helper" )
|
2
|
+
|
3
|
+
describe "Gift card certification tests" do
|
4
|
+
let(:service) do
|
5
|
+
Hps::TestHelper.valid_multi_use_config
|
6
|
+
Hps::HpsGiftCardService.new
|
7
|
+
end
|
8
|
+
|
9
|
+
# Test #96
|
10
|
+
it "testActivateSVA1" do
|
11
|
+
activation = service.activate( sva1, 6.00 )
|
12
|
+
expect( activation.response_code ).to eql("0")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Test #97
|
16
|
+
it "testActivateSVA2" do
|
17
|
+
activation = service.activate( sva2, 7.00 )
|
18
|
+
expect( activation.response_code ).to eql("0")
|
19
|
+
end
|
20
|
+
|
21
|
+
# Test #98
|
22
|
+
it "testAddValueSVA1" do
|
23
|
+
add_value = service.add_value( sva1, 8.00 )
|
24
|
+
expect( add_value.response_code ).to eql("0")
|
25
|
+
end
|
26
|
+
|
27
|
+
# Test #99
|
28
|
+
it "testAddValueSVA2" do
|
29
|
+
add_value = service.add_value( sva2, 9.00 )
|
30
|
+
expect( add_value.response_code ).to eql("0")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Test #100
|
34
|
+
it "testBalanceSVA1" do
|
35
|
+
balance = service.balance( sva1 )
|
36
|
+
expect( balance.response_code ).to eql("0")
|
37
|
+
expect( balance.balance_amount.to_i ).to eql(10)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Test #101
|
41
|
+
it "testBalanceSVA2" do
|
42
|
+
balance = service.balance( sva2 )
|
43
|
+
expect( balance.response_code ).to eql("0")
|
44
|
+
expect( balance.balance_amount.to_i ).to eql(10)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Test #102
|
48
|
+
it "testReplaceSVA1" do
|
49
|
+
replace = service.replace(sva1, sva2)
|
50
|
+
expect( replace.response_code ).to eql("0")
|
51
|
+
end
|
52
|
+
|
53
|
+
# Test #103
|
54
|
+
it "testReplaceSVA2" do
|
55
|
+
replace = service.replace(sva2, sva1)
|
56
|
+
expect( replace.response_code ).to eql("0")
|
57
|
+
end
|
58
|
+
|
59
|
+
# Test #104
|
60
|
+
it "testSaleSVA1" do
|
61
|
+
sale = service.sale(sva1, 1.00)
|
62
|
+
expect( sale.response_code ).to eql("0")
|
63
|
+
end
|
64
|
+
|
65
|
+
# Test #105
|
66
|
+
it "testSaleSVA2" do
|
67
|
+
sale = service.sale(sva2, 2.00)
|
68
|
+
expect( sale.response_code ).to eql("0")
|
69
|
+
end
|
70
|
+
|
71
|
+
# Test #106 & Test #108
|
72
|
+
it "testSaleAndVoidSVA1" do
|
73
|
+
sale = service.sale(sva1, 3.00)
|
74
|
+
expect( sale.response_code ).to eql("0")
|
75
|
+
void = service.void(sale.transaction_id)
|
76
|
+
expect( void.response_code ).to eql("0")
|
77
|
+
end
|
78
|
+
|
79
|
+
# Test #107 & Test # 109
|
80
|
+
it "testSaleAndReversalSVA2" do
|
81
|
+
sale = service.sale(sva2, 4.00)
|
82
|
+
expect( sale.response_code ).to eql("0")
|
83
|
+
reverse = service.reverse(sale.transaction_id, 4.00)
|
84
|
+
expect( reverse.response_code ).to eql("0")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Test #110
|
88
|
+
it "testDeactivateSVA1" do
|
89
|
+
deactivate = service.deactivate(sva1)
|
90
|
+
expect( deactivate.response_code ).to eql("0")
|
91
|
+
end
|
92
|
+
|
93
|
+
# Test #111
|
94
|
+
it "testDeactivateSVA1" do
|
95
|
+
deactivate = service.deactivate(sva2)
|
96
|
+
expect( deactivate.response_code ).to eql("0")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Helper methods
|
101
|
+
def sva1
|
102
|
+
Hps::HpsGiftCard.new(5022440000000000098)
|
103
|
+
end
|
104
|
+
|
105
|
+
def sva2
|
106
|
+
Hps::HpsGiftCard.new(5022440000000000007)
|
107
|
+
end
|
data/tests/check_tests.rb
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
require File.join( File.dirname(__FILE__), "test_helper.rb" )
|
2
|
-
|
3
|
-
describe "Check Tests" do
|
4
|
-
before(:each) do
|
5
|
-
Hps::TestHelper.configure_hps_module_secret_key_with_spaces
|
6
|
-
@service = Hps::HpsCheckService.new()
|
7
|
-
end
|
8
|
-
|
9
|
-
it "check should decline" do
|
10
|
-
expect {
|
11
|
-
@service.sale(Hps::TestCheck::decline, 5.00)
|
12
|
-
}.to raise_error(Hps::HpsCheckException) { |error|
|
13
|
-
expect(error.code).to eql("1")
|
14
|
-
}
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should throw check exception" do
|
18
|
-
expect {
|
19
|
-
@service.sale(Hps::TestCheck::invalid_check_holder, 5.00)
|
20
|
-
}.to raise_error(Hps::HpsCheckException) { |error|
|
21
|
-
expect(error.code).to eql("1")
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
it "check should sale" do
|
26
|
-
result = @service.sale(Hps::TestCheck::approve, 5.00)
|
27
|
-
expect(result).not_to eql(nil)
|
28
|
-
expect(result.response_code).to eql("0")
|
29
|
-
expect(result.response_text).to eql("Transaction Approved")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "check should void" do
|
33
|
-
sale_result = @service.sale(Hps::TestCheck::approve, 5.00)
|
34
|
-
result = @service.void(sale_result.transaction_id)
|
35
|
-
expect(result).not_to eql(nil)
|
36
|
-
expect(result.response_code).to eql("0")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "sale and void with client_txn_id" do
|
40
|
-
client_txn_id = 10244205
|
41
|
-
sale_result = @service.sale(Hps::TestCheck::approve, 5.00, client_txn_id)
|
42
|
-
expect(sale_result).not_to eql(nil)
|
43
|
-
expect(sale_result.response_code).to eql("0")
|
44
|
-
expect(sale_result.response_text).to eql("Transaction Approved")
|
45
|
-
|
46
|
-
void_result = @service.void(nil, client_txn_id)
|
47
|
-
expect(void_result).not_to eql(nil)
|
48
|
-
expect(void_result.response_code).to eql("0")
|
49
|
-
end
|
50
|
-
end
|
1
|
+
require File.join( File.dirname(__FILE__), "test_helper.rb" )
|
2
|
+
|
3
|
+
describe "Check Tests" do
|
4
|
+
before(:each) do
|
5
|
+
Hps::TestHelper.configure_hps_module_secret_key_with_spaces
|
6
|
+
@service = Hps::HpsCheckService.new()
|
7
|
+
end
|
8
|
+
|
9
|
+
it "check should decline" do
|
10
|
+
expect {
|
11
|
+
@service.sale(Hps::TestCheck::decline, 5.00)
|
12
|
+
}.to raise_error(Hps::HpsCheckException) { |error|
|
13
|
+
expect(error.code).to eql("1")
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should throw check exception" do
|
18
|
+
expect {
|
19
|
+
@service.sale(Hps::TestCheck::invalid_check_holder, 5.00)
|
20
|
+
}.to raise_error(Hps::HpsCheckException) { |error|
|
21
|
+
expect(error.code).to eql("1")
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
it "check should sale" do
|
26
|
+
result = @service.sale(Hps::TestCheck::approve, 5.00)
|
27
|
+
expect(result).not_to eql(nil)
|
28
|
+
expect(result.response_code).to eql("0")
|
29
|
+
expect(result.response_text).to eql("Transaction Approved")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "check should void" do
|
33
|
+
sale_result = @service.sale(Hps::TestCheck::approve, 5.00)
|
34
|
+
result = @service.void(sale_result.transaction_id)
|
35
|
+
expect(result).not_to eql(nil)
|
36
|
+
expect(result.response_code).to eql("0")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "sale and void with client_txn_id" do
|
40
|
+
client_txn_id = 10244205
|
41
|
+
sale_result = @service.sale(Hps::TestCheck::approve, 5.00, client_txn_id)
|
42
|
+
expect(sale_result).not_to eql(nil)
|
43
|
+
expect(sale_result.response_code).to eql("0")
|
44
|
+
expect(sale_result.response_text).to eql("Transaction Approved")
|
45
|
+
|
46
|
+
void_result = @service.void(nil, client_txn_id)
|
47
|
+
expect(void_result).not_to eql(nil)
|
48
|
+
expect(void_result.response_code).to eql("0")
|
49
|
+
end
|
50
|
+
end
|