@@ -25,6 +25,11 @@ def setup
25
25
billing_address : address ,
26
26
description : 'Store Purchase'
27
27
}
28
+
29
+ @billing_options = {
30
+ billing_id : 'billing1234' ,
31
+ amount : 15000
32
+ }
28
33
end
29
34
30
35
def test_successful_purchase
@@ -126,44 +131,44 @@ def test_failed_void
126
131
end
127
132
128
133
def test_successful_unstore
129
- @gateway . store ( @credit_card , { billing_id : 'test1234' , amount : 15000 } ) rescue nil
134
+ @gateway . store ( @credit_card , @billing_options ) rescue nil
130
135
131
- assert response = @gateway . unstore ( 'test1234 ' )
136
+ assert response = @gateway . unstore ( 'billing1234 ' )
132
137
assert_success response
133
138
134
139
assert_equal 'Successful' , response . message
135
140
end
136
141
137
142
def test_repeat_unstore
138
- @gateway . unstore ( 'test1234 ' ) rescue nil # Ensure it is already missing
143
+ @gateway . unstore ( 'billing1234 ' ) rescue nil # Ensure it is already missing
139
144
140
- response = @gateway . unstore ( 'test1234 ' )
145
+ response = @gateway . unstore ( 'billing1234 ' )
141
146
142
147
assert_success response
143
148
end
144
149
145
150
def test_successful_store
146
- @gateway . unstore ( 'test1234 ' ) rescue nil
151
+ @gateway . unstore ( 'billing1234 ' ) rescue nil
147
152
148
- assert response = @gateway . store ( @credit_card , { billing_id : 'test1234' , amount : 15000 } )
153
+ assert response = @gateway . store ( @credit_card , @billing_options )
149
154
assert_success response
150
155
151
156
assert_equal 'Successful' , response . message
152
157
end
153
158
154
159
def test_failed_store
155
- @gateway . store ( @credit_card , { billing_id : 'test1234' , amount : 15000 } ) rescue nil # Ensure it already exists
160
+ @gateway . store ( @credit_card , @billing_options ) rescue nil # Ensure it already exists
156
161
157
- assert response = @gateway . store ( @credit_card , { billing_id : 'test1234' , amount : 15000 } )
162
+ assert response = @gateway . store ( @credit_card , @billing_options )
158
163
assert_failure response
159
164
160
165
assert_equal 'Duplicate Client ID Found' , response . message
161
166
end
162
167
163
168
def test_successful_triggered_payment
164
- @gateway . store ( @credit_card , { billing_id : 'test1234' , amount : 15000 } ) rescue nil # Ensure it already exists
169
+ @gateway . store ( @credit_card , @billing_options ) rescue nil # Ensure it already exists
165
170
166
- assert response = @gateway . purchase ( 12300 , 'test1234 ' , @options )
171
+ assert response = @gateway . purchase ( 12300 , 'billing1234 ' , @options )
167
172
assert_success response
168
173
assert_equal response . params [ 'amount' ] , '12300'
169
174
assert_equal response . params [ 'ponum' ] , 'order123'
@@ -172,9 +177,9 @@ def test_successful_triggered_payment
172
177
end
173
178
174
179
def test_failure_triggered_payment
175
- @gateway . unstore ( 'test1234 ' ) rescue nil # Ensure its no longer there
180
+ @gateway . unstore ( 'billing1234 ' ) rescue nil # Ensure its no longer there
176
181
177
- assert response = @gateway . purchase ( 12300 , 'test1234 ' , @options )
182
+ assert response = @gateway . purchase ( 12300 , 'billing1234 ' , @options )
178
183
assert_failure response
179
184
180
185
assert_equal 'Payment not found' , response . message
0 commit comments