cardconnect 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +11 -0
- data/.rubocop.yml +10 -0
- data/.travis.yml +7 -0
- data/README.md +2 -0
- data/Rakefile +70 -42
- data/cardconnect.gemspec +8 -8
- data/lib/cardconnect.rb +1 -4
- data/lib/cardconnect/configuration.rb +0 -1
- data/lib/cardconnect/connection.rb +12 -16
- data/lib/cardconnect/error.rb +1 -1
- data/lib/cardconnect/services/authorization/authorization.rb +1 -3
- data/lib/cardconnect/services/authorization/authorization_request.rb +6 -5
- data/lib/cardconnect/services/authorization/authorization_response.rb +7 -7
- data/lib/cardconnect/services/capture/capture.rb +0 -2
- data/lib/cardconnect/services/capture/capture_request.rb +4 -5
- data/lib/cardconnect/services/capture/capture_response.rb +3 -4
- data/lib/cardconnect/services/deposit/deposit.rb +1 -3
- data/lib/cardconnect/services/deposit/deposit_request.rb +8 -11
- data/lib/cardconnect/services/deposit/deposit_response.rb +4 -5
- data/lib/cardconnect/services/inquire/inquire.rb +0 -2
- data/lib/cardconnect/services/inquire/inquire_request.rb +3 -4
- data/lib/cardconnect/services/inquire/inquire_response.rb +3 -4
- data/lib/cardconnect/services/refund/refund.rb +1 -2
- data/lib/cardconnect/services/refund/refund_request.rb +5 -6
- data/lib/cardconnect/services/refund/refund_response.rb +7 -7
- data/lib/cardconnect/services/service_endpoint.rb +10 -14
- data/lib/cardconnect/services/settlement_status/settlement_status.rb +0 -2
- data/lib/cardconnect/services/settlement_status/settlement_status_request.rb +8 -11
- data/lib/cardconnect/services/settlement_status/settlement_status_response.rb +4 -5
- data/lib/cardconnect/services/void/void.rb +1 -2
- data/lib/cardconnect/services/void/void_request.rb +5 -6
- data/lib/cardconnect/services/void/void_response.rb +8 -7
- data/lib/cardconnect/utils.rb +0 -2
- data/lib/cardconnect/version.rb +1 -1
- data/test/api_request_stubs.rb +56 -52
- data/test/api_response_stubs.rb +87 -92
- data/test/cardconnect/configuration_test.rb +0 -1
- data/test/cardconnect/connection_test.rb +1 -1
- data/test/cardconnect/services/authorization/authorization_request_test.rb +44 -27
- data/test/cardconnect/services/authorization/authorization_response_test.rb +24 -18
- data/test/cardconnect/services/authorization/authorization_test.rb +1 -4
- data/test/cardconnect/services/capture/capture_request_test.rb +8 -8
- data/test/cardconnect/services/capture/capture_response_test.rb +7 -7
- data/test/cardconnect/services/capture/capture_test.rb +1 -3
- data/test/cardconnect/services/deposit/deposit_request_test.rb +9 -9
- data/test/cardconnect/services/deposit/deposit_response_test.rb +17 -15
- data/test/cardconnect/services/deposit/deposit_test.rb +4 -4
- data/test/cardconnect/services/inquire/inquire_request_test.rb +3 -3
- data/test/cardconnect/services/inquire/inquire_response_test.rb +12 -12
- data/test/cardconnect/services/inquire/inquire_test.rb +5 -5
- data/test/cardconnect/services/refund/refund_request_test.rb +3 -3
- data/test/cardconnect/services/refund/refund_response_test.rb +15 -13
- data/test/cardconnect/services/refund/refund_test.rb +1 -2
- data/test/cardconnect/services/settlement_status/settlement_status_request_test.rb +12 -11
- data/test/cardconnect/services/settlement_status/settlement_status_response_test.rb +9 -8
- data/test/cardconnect/services/settlement_status/settlement_status_test.rb +4 -4
- data/test/cardconnect/services/void/void_request_test.rb +3 -3
- data/test/cardconnect/services/void/void_response_test.rb +16 -14
- data/test/cardconnect/services/void/void_test.rb +1 -2
- data/test/cardconnect_test.rb +0 -1
- data/test/test_helper.rb +15 -13
- metadata +6 -3
@@ -16,7 +16,7 @@ describe CardConnect::Connection do
|
|
16
16
|
|
17
17
|
it 'must have a URL that matches the configured endpoint' do
|
18
18
|
@connection.url_prefix.host.must_equal URI.parse(CardConnect.configuration.endpoint).host
|
19
|
-
@connection.url_prefix.scheme.must_equal
|
19
|
+
@connection.url_prefix.scheme.must_equal 'https'
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'Faraday handlers' do
|
@@ -11,102 +11,118 @@ describe CardConnect::Service::AuthorizationRequest do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have merchant id' do
|
14
|
-
@request.merchid.must_equal
|
14
|
+
@request.merchid.must_equal '000000927996'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have account' do
|
18
|
-
@request.account.must_equal
|
18
|
+
@request.account.must_equal '4111111111111111'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have expiry' do
|
22
|
-
@request.expiry.must_equal
|
22
|
+
@request.expiry.must_equal '1212'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have amount' do
|
26
|
-
@request.amount.must_equal
|
26
|
+
@request.amount.must_equal '0'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have currency' do
|
30
|
-
@request.currency.must_equal
|
30
|
+
@request.currency.must_equal 'USD'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should have account type' do
|
34
|
-
@request.accttype.must_equal
|
34
|
+
@request.accttype.must_equal 'VISA'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have name' do
|
38
|
-
@request.name.must_equal
|
38
|
+
@request.name.must_equal 'TOM JONES'
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should have address' do
|
42
|
-
@request.address.must_equal
|
42
|
+
@request.address.must_equal '123 MAIN STREET'
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should have city' do
|
46
|
-
@request.city.must_equal
|
46
|
+
@request.city.must_equal 'anytown'
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should have country' do
|
50
|
-
@request.country.must_equal
|
50
|
+
@request.country.must_equal 'US'
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should have phone' do
|
54
|
-
@request.phone.must_equal
|
54
|
+
@request.phone.must_equal '3334445555'
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should have postal' do
|
58
|
-
@request.postal.must_equal
|
58
|
+
@request.postal.must_equal '55555'
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should have email' do
|
62
|
-
@request.email.must_equal
|
62
|
+
@request.email.must_equal 'tom@jones.com'
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'should have ecomind' do
|
66
|
-
@request.ecomind.must_equal
|
66
|
+
@request.ecomind.must_equal 'E'
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should have cvv2' do
|
70
|
-
@request.cvv2.must_equal
|
70
|
+
@request.cvv2.must_equal '123'
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'should have order id' do
|
74
|
-
@request.orderid.must_equal
|
74
|
+
@request.orderid.must_equal 'AB-11-9876'
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'should have track' do
|
78
|
-
@request.track.must_equal
|
78
|
+
@request.track.must_equal 'Y'
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'should have bankaba' do
|
82
|
-
@request.bankaba.must_equal
|
82
|
+
@request.bankaba.must_equal '1010101'
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should have tokenize' do
|
86
|
-
@request.tokenize.must_equal
|
86
|
+
@request.tokenize.must_equal 'Y'
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'should have termid' do
|
90
|
-
@request.termid.must_equal
|
90
|
+
@request.termid.must_equal '12345'
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'should have capture' do
|
94
|
-
@request.capture.must_equal
|
94
|
+
@request.capture.must_equal 'Y'
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'should have ssnl4 field' do
|
98
|
-
@request.ssnl4.must_equal
|
98
|
+
@request.ssnl4.must_equal '1234'
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'should have license field' do
|
102
|
-
@request.license.must_equal
|
102
|
+
@request.license.must_equal 'CO:1231231234'
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'should have profile field' do
|
106
|
-
@request.profile.must_equal
|
106
|
+
@request.profile.must_equal 'Y'
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
it 'should have ponumber field' do
|
110
|
+
@request.ponumber.must_equal '1234'
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should have authcode field' do
|
114
|
+
@request.authcode.must_equal '123456'
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should have invoiceid field' do
|
118
|
+
@request.invoiceid.must_equal '000000000001'
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should have taxamnt field' do
|
122
|
+
@request.taxamnt.must_equal '0'
|
123
|
+
end
|
124
|
+
|
125
|
+
describe 'userfields' do
|
110
126
|
it 'should be an array of name-value pairs' do
|
111
127
|
@request.userfields.must_be_kind_of Array
|
112
128
|
@request.userfields.first.must_be_kind_of Hash
|
@@ -127,8 +143,9 @@ describe CardConnect::Service::AuthorizationRequest do
|
|
127
143
|
|
128
144
|
describe '#errors' do
|
129
145
|
CardConnect::Service::AuthorizationRequest::REQUIRED_FIELDS.each do |field|
|
130
|
-
|
131
|
-
|
146
|
+
field_name = field.to_s.capitalize
|
147
|
+
it "should have an error message if #{field_name} is missing" do
|
148
|
+
CardConnect::Service::AuthorizationRequest.new.errors.must_include "#{field_name} is missing"
|
132
149
|
end
|
133
150
|
end
|
134
151
|
end
|
@@ -11,55 +11,59 @@ describe CardConnect::Service::AuthorizationResponse do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have the merchant id' do
|
14
|
-
@response.merchid.must_equal
|
14
|
+
@response.merchid.must_equal '020594000000'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have the status' do
|
18
|
-
@response.respstat.must_equal
|
18
|
+
@response.respstat.must_equal 'A'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have the Retrieval Reference Number' do
|
22
|
-
@response.retref.must_equal
|
22
|
+
@response.retref.must_equal '343005123105'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have the Account Number' do
|
26
|
-
@response.account.must_equal
|
26
|
+
@response.account.must_equal '41XXXXXXXXXX1111'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have the Token' do
|
30
|
-
@response.token.must_equal
|
30
|
+
@response.token.must_equal '9419786452781111'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should have the Amount' do
|
34
|
-
@response.amount.must_equal
|
34
|
+
@response.amount.must_equal '111'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have the Response Code' do
|
38
|
-
@response.respcode.must_equal
|
38
|
+
@response.respcode.must_equal '00'
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should have the Response text' do
|
42
|
-
@response.resptext.must_equal
|
42
|
+
@response.resptext.must_equal 'Approved'
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should have the Response Processor' do
|
46
|
-
@response.respproc.must_equal
|
46
|
+
@response.respproc.must_equal 'FNOR'
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should have the AVS response code' do
|
50
|
-
@response.avsresp.must_equal
|
50
|
+
@response.avsresp.must_equal '9'
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should have the CVV response code' do
|
54
|
-
@response.cvvresp.must_equal
|
54
|
+
@response.cvvresp.must_equal 'M'
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should have the Authorization code' do
|
58
|
-
@response.authcode.must_equal
|
58
|
+
@response.authcode.must_equal '046221'
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should have the Commercial Card Flag' do
|
62
|
-
@response.commcard.must_equal
|
62
|
+
@response.commcard.must_equal 'N'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should have the profile id' do
|
66
|
+
@response.profileid.must_equal '12345678'
|
63
67
|
end
|
64
68
|
end
|
65
69
|
|
@@ -69,7 +73,8 @@ describe CardConnect::Service::AuthorizationResponse do
|
|
69
73
|
end
|
70
74
|
|
71
75
|
it 'should be false when there are errors' do
|
72
|
-
|
76
|
+
auth_response = valid_auth_response.merge!('respstat' => 'B', 'resptext' => 'this is an error')
|
77
|
+
response = CardConnect::Service::AuthorizationResponse.new(auth_response)
|
73
78
|
response.success?.must_equal false
|
74
79
|
end
|
75
80
|
end
|
@@ -80,14 +85,15 @@ describe CardConnect::Service::AuthorizationResponse do
|
|
80
85
|
end
|
81
86
|
|
82
87
|
it 'should be an array of error messages when there are errors' do
|
83
|
-
|
84
|
-
response
|
88
|
+
auth_response = valid_auth_response.merge!('respstat' => 'B', 'resptext' => 'this is an error')
|
89
|
+
response = CardConnect::Service::AuthorizationResponse.new(auth_response)
|
90
|
+
response.errors.must_equal ['this is an error']
|
85
91
|
end
|
86
92
|
end
|
87
93
|
|
88
|
-
describe
|
94
|
+
describe '#body' do
|
89
95
|
it 'should generate hash with all the right values' do
|
90
96
|
@response.body.must_equal symbolize_keys(valid_auth_response)
|
91
97
|
end
|
92
98
|
end
|
93
|
-
end
|
99
|
+
end
|
@@ -26,15 +26,13 @@ describe CardConnect::Service::Authorization do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'uses the default merchant id if it is not passed in' do
|
29
|
-
@service.build_request(@valid_params.reject!{|k,
|
29
|
+
@service.build_request(@valid_params.reject! { |k, _| k == 'merchid' })
|
30
30
|
@service.request.merchid.must_equal 'merchant123'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'creates an Authorization request object with the right params' do
|
34
34
|
@service.build_request(@valid_params)
|
35
|
-
|
36
35
|
@service.request.must_be_kind_of CardConnect::Service::AuthorizationRequest
|
37
|
-
|
38
36
|
@service.request.merchid.must_equal '000000927996'
|
39
37
|
@service.request.account.must_equal '4111111111111111'
|
40
38
|
@service.request.expiry.must_equal '1212'
|
@@ -55,5 +53,4 @@ describe CardConnect::Service::Authorization do
|
|
55
53
|
@service.response.must_be_kind_of CardConnect::Service::AuthorizationResponse
|
56
54
|
end
|
57
55
|
end
|
58
|
-
|
59
56
|
end
|
@@ -11,31 +11,31 @@ describe CardConnect::Service::CaptureRequest do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have merchant id' do
|
14
|
-
@request.merchid.must_equal
|
14
|
+
@request.merchid.must_equal '000000927996'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have retrieval reference number' do
|
18
|
-
@request.retref.must_equal
|
18
|
+
@request.retref.must_equal '288002073633'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have authorization code' do
|
22
|
-
@request.authcode.must_equal
|
22
|
+
@request.authcode.must_equal '046221'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have amount' do
|
26
|
-
@request.amount.must_equal
|
26
|
+
@request.amount.must_equal '596.00'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have invoice id' do
|
30
|
-
@request.invoiceid.must_equal
|
30
|
+
@request.invoiceid.must_equal '7890'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should have PO number' do
|
34
|
-
@request.ponumber.must_equal
|
34
|
+
@request.ponumber.must_equal 'PO-0736332'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have tax amount' do
|
38
|
-
@request.taxamnt.must_equal
|
38
|
+
@request.taxamnt.must_equal '40.00'
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -57,7 +57,7 @@ describe CardConnect::Service::CaptureRequest do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
describe
|
60
|
+
describe '#payload' do
|
61
61
|
it 'should generate hash with all the right values' do
|
62
62
|
@request.payload.must_equal symbolize_keys(valid_capture_request)
|
63
63
|
end
|
@@ -11,29 +11,29 @@ describe CardConnect::Service::CaptureResponse do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have merchant id' do
|
14
|
-
@response.merchid.must_equal
|
14
|
+
@response.merchid.must_equal '000000927996'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have account' do
|
18
|
-
@response.account.must_equal
|
18
|
+
@response.account.must_equal '41XXXXXXXXXX4113'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have amount' do
|
22
|
-
@response.amount.must_equal
|
22
|
+
@response.amount.must_equal '596.00'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have retrieval reference number' do
|
26
|
-
@response.retref.must_equal
|
26
|
+
@response.retref.must_equal '288002073633'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have settlement status' do
|
30
|
-
@response.setlstat.must_equal
|
30
|
+
@response.setlstat.must_equal 'Pending'
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe
|
34
|
+
describe '#body' do
|
35
35
|
it 'should generate hash with all the right values' do
|
36
36
|
@response.body.must_equal symbolize_keys(valid_capture_response)
|
37
37
|
end
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
@@ -35,10 +35,8 @@ describe CardConnect::Service::Capture do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'uses default merchant ID if merchid is not passed in' do
|
38
|
-
@service.build_request(@valid_params.reject!{|k,
|
39
|
-
|
38
|
+
@service.build_request(@valid_params.reject! { |k, _| k == 'merchid' })
|
40
39
|
@service.request.must_be_kind_of CardConnect::Service::CaptureRequest
|
41
|
-
|
42
40
|
@service.request.merchid.must_equal 'merchant123'
|
43
41
|
end
|
44
42
|
end
|
@@ -11,11 +11,11 @@ describe CardConnect::Service::DepositRequest do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have merchant id' do
|
14
|
-
@request.merchid.must_equal
|
14
|
+
@request.merchid.must_equal '000000927996'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have date' do
|
18
|
-
@request.date.must_equal
|
18
|
+
@request.date.must_equal '0110'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -38,26 +38,26 @@ describe CardConnect::Service::DepositRequest do
|
|
38
38
|
|
39
39
|
describe '#validate_date_format' do
|
40
40
|
it 'should have an error when date is less than 4 characters long' do
|
41
|
-
request = CardConnect::Service::DepositRequest.new(
|
41
|
+
request = CardConnect::Service::DepositRequest.new(date: '123')
|
42
42
|
request.valid?.must_equal false
|
43
|
-
request.errors.must_include
|
43
|
+
request.errors.must_include 'Date format is invalid. Please use MMDD format'
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'should have an error when date is more than 4 characters long' do
|
47
|
-
request = CardConnect::Service::DepositRequest.new(
|
47
|
+
request = CardConnect::Service::DepositRequest.new(date: '12345')
|
48
48
|
request.valid?.must_equal false
|
49
|
-
request.errors.must_include
|
49
|
+
request.errors.must_include 'Date format is invalid. Please use MMDD format'
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'should have an error when date is not parseable in MMDD format' do
|
53
|
-
request = CardConnect::Service::DepositRequest.new(
|
53
|
+
request = CardConnect::Service::DepositRequest.new(date: '0000')
|
54
54
|
request.valid?.must_equal false
|
55
|
-
request.errors.must_include
|
55
|
+
request.errors.must_include 'Date format is invalid. Please use MMDD format'
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
describe
|
60
|
+
describe '#payload' do
|
61
61
|
it 'should generate the correct path params' do
|
62
62
|
@request.payload.must_equal "?merchid=#{@request.merchid}&date=#{@request.date}&"
|
63
63
|
end
|
@@ -14,62 +14,64 @@ describe CardConnect::Service::DepositResponse do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should have the merchant id' do
|
17
|
-
@response.merchid.must_equal
|
17
|
+
@response.merchid.must_equal '000000927996'
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should have the respproc' do
|
21
|
-
@response.respproc.must_equal
|
21
|
+
@response.respproc.must_equal 'FNOR'
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should have the accttype' do
|
25
|
-
@response.accttype.must_equal
|
25
|
+
@response.accttype.must_equal 'VI'
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should have the action' do
|
29
|
-
@response.action.must_equal
|
29
|
+
@response.action.must_equal 'DEB'
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should have the actdate' do
|
33
|
-
@response.actdate.must_equal
|
33
|
+
@response.actdate.must_equal '20121008'
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should have the postdate' do
|
37
|
-
@response.postdate.must_equal
|
37
|
+
@response.postdate.must_equal '20121009'
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'should have the currency' do
|
41
|
-
@response.currency.must_equal
|
41
|
+
@response.currency.must_equal 'USD'
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should have the amount' do
|
45
|
-
@response.amount.must_equal
|
45
|
+
@response.amount.must_equal '11.00'
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should have the feeamnt' do
|
49
|
-
@response.feeamnt.must_equal
|
49
|
+
@response.feeamnt.must_equal '0.55'
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'should have the cbakamnt' do
|
53
|
-
@response.cbakamnt.must_equal
|
53
|
+
@response.cbakamnt.must_equal '0.00'
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'should have the resptext' do
|
57
|
-
@response.resptext.must_equal
|
57
|
+
@response.resptext.must_equal 'Successful or something'
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'should have the transactions' do
|
61
|
-
@response.txns.must_equal [{merchbatch: 92821429, retref:
|
61
|
+
@response.txns.must_equal [{ merchbatch: 92821429, retref: '282005142924', hostbatch: '1429',
|
62
|
+
feeamnt: '0.00', action: 'DEB', depamnt: '11.00' }]
|
62
63
|
end
|
63
64
|
|
64
65
|
describe '#body' do
|
65
66
|
it 'should have all the right fields in the body' do
|
66
|
-
@response.body.keys.must_equal [:depositid, :merchid, :respproc, :accttype, :action, :actdate,
|
67
|
+
@response.body.keys.must_equal [:depositid, :merchid, :respproc, :accttype, :action, :actdate,
|
68
|
+
:postdate, :currency, :amount, :feeamnt, :cbakamnt, :resptext, :txns]
|
67
69
|
end
|
68
70
|
|
69
71
|
it 'should generate hash with all the right values' do
|
70
72
|
valid_payload = symbolize_keys(valid_deposit_response.first)
|
71
|
-
valid_payload[:txns] = valid_payload[:txns].map{|txn| symbolize_keys(txn)}
|
73
|
+
valid_payload[:txns] = valid_payload[:txns].map { |txn| symbolize_keys(txn) }
|
72
74
|
@response.body.must_equal valid_payload
|
73
75
|
end
|
74
76
|
end
|
75
|
-
end
|
77
|
+
end
|