activemerchant 1.3.2 → 1.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.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +58 -0
- data/CONTRIBUTERS +25 -0
- data/MIT-LICENSE +3 -3
- data/README +16 -10
- data/Rakefile +4 -3
- data/lib/active_merchant.rb +7 -1
- data/lib/active_merchant/billing/check.rb +16 -9
- data/lib/active_merchant/billing/gateway.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +702 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +102 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +233 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +10 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +26 -2
- data/lib/active_merchant/billing/gateways/data_cash.rb +255 -59
- data/lib/active_merchant/billing/gateways/modern_payments.rb +36 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +214 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_express.rb +3 -11
- data/lib/active_merchant/billing/gateways/payment_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +39 -21
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +3 -12
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +20 -0
- data/lib/active_merchant/billing/gateways/protx.rb +25 -25
- data/lib/active_merchant/billing/gateways/sage.rb +145 -0
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +88 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +110 -0
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +97 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +3 -1
- data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -1
- data/lib/active_merchant/billing/gateways/wirecard.rb +304 -0
- data/lib/active_merchant/billing/integrations.rb +8 -2
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +18 -4
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +4 -2
- data/lib/active_merchant/billing/integrations/notification.rb +10 -1
- data/lib/active_merchant/lib/posts_data.rb +12 -3
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/test/extra/binding_of_caller.rb +0 -0
- data/test/extra/breakpoint.rb +0 -0
- data/test/fixtures.yml +24 -0
- data/test/remote/gateways/remote_authorize_net_cim_test.rb +459 -0
- data/test/remote/gateways/remote_beanstream_interac_test.rb +53 -0
- data/test/remote/gateways/remote_beanstream_test.rb +150 -0
- data/test/remote/gateways/remote_braintree_test.rb +22 -0
- data/test/remote/gateways/remote_cyber_source_test.rb +28 -3
- data/test/remote/gateways/remote_data_cash_test.rb +250 -48
- data/test/remote/gateways/remote_modern_payments_cim_test.rb +58 -0
- data/test/remote/gateways/remote_modern_payments_test.rb +43 -0
- data/test/remote/gateways/remote_sage_bankcard_test.rb +109 -0
- data/test/remote/gateways/remote_sage_test.rb +87 -0
- data/test/remote/gateways/remote_sage_virtual_check_test.rb +62 -0
- data/test/remote/gateways/remote_wirecard_test.rb +76 -0
- data/test/remote/integrations/remote_paypal_integration_test.rb +15 -3
- data/test/test_helper.rb +31 -13
- data/test/unit/check_test.rb +14 -2
- data/test/unit/credit_card_methods_test.rb +18 -0
- data/test/unit/gateways/authorize_net_cim_test.rb +641 -0
- data/test/unit/gateways/beanstream_interac_test.rb +51 -0
- data/test/unit/gateways/beanstream_test.rb +108 -0
- data/test/unit/gateways/braintree_test.rb +2 -5
- data/test/unit/gateways/cyber_source_test.rb +18 -0
- data/test/unit/gateways/data_cash_test.rb +32 -4
- data/test/unit/gateways/gateway_test.rb +8 -1
- data/test/unit/gateways/modern_payments_cim_test.rb +171 -0
- data/test/unit/gateways/net_registry_test.rb +6 -0
- data/test/unit/gateways/payflow_express_test.rb +18 -2
- data/test/unit/gateways/paypal_express_test.rb +154 -0
- data/test/unit/gateways/paypal_test.rb +140 -0
- data/test/unit/gateways/sage_bankcard_test.rb +162 -0
- data/test/unit/gateways/sage_virtual_check_test.rb +71 -0
- data/test/unit/gateways/secure_pay_au_test.rb +58 -1
- data/test/unit/gateways/skip_jack_test.rb +8 -0
- data/test/unit/gateways/verifi_test.rb +0 -1
- data/test/unit/gateways/wirecard_test.rb +232 -0
- data/test/unit/integrations/action_view_helper_test.rb +3 -0
- data/test/unit/integrations/notifications/hi_trust_notification_test.rb +23 -2
- data/test/unit/integrations/notifications/notification_test.rb +13 -0
- data/test/unit/posts_data_test.rb +20 -6
- metadata +40 -5
- metadata.gz.sig +0 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
|
3
|
+
class SageVirtualCheckTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@gateway = SageVirtualCheckGateway.new(
|
6
|
+
:login => 'login',
|
7
|
+
:password => 'password'
|
8
|
+
)
|
9
|
+
|
10
|
+
@check = check
|
11
|
+
|
12
|
+
@options = {
|
13
|
+
:order_id => generate_unique_id,
|
14
|
+
:billing_address => address,
|
15
|
+
:shipping_address => address,
|
16
|
+
:email => 'longbob@example.com',
|
17
|
+
:drivers_license_state => 'CA',
|
18
|
+
:drivers_license_number => '12345689',
|
19
|
+
:date_of_birth => Date.new(1978, 8, 11),
|
20
|
+
:ssn => '078051120'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_successful_purchase
|
25
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
26
|
+
|
27
|
+
assert response = @gateway.purchase(@amount, @check, @options)
|
28
|
+
assert_instance_of Response, response
|
29
|
+
assert_success response
|
30
|
+
|
31
|
+
assert_equal "ACCEPTED", response.message
|
32
|
+
assert_equal "C5O8NUdNt0;virtual_check", response.authorization
|
33
|
+
|
34
|
+
assert_equal "A", response.params["success"]
|
35
|
+
assert_equal "", response.params["code"]
|
36
|
+
assert_equal "ACCEPTED", response.params["message"]
|
37
|
+
assert_equal "00", response.params["risk"]
|
38
|
+
assert_equal "C5O8NUdNt0", response.params["reference"]
|
39
|
+
assert_equal "89be635e663b05eca587", response.params["order_number"]
|
40
|
+
assert_equal "0", response.params["authentication_indicator"]
|
41
|
+
assert_equal "NONE", response.params["authentication_disclosure"]
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_declined_purchase
|
45
|
+
@gateway.expects(:ssl_post).returns(declined_purchase_response)
|
46
|
+
|
47
|
+
assert response = @gateway.purchase(@amount, @check, @options)
|
48
|
+
assert_failure response
|
49
|
+
assert response.test?
|
50
|
+
assert_equal "INVALID C_RTE", response.message
|
51
|
+
assert_equal "C5O8NR6Nr0;virtual_check", response.authorization
|
52
|
+
|
53
|
+
assert_equal "X", response.params["success"]
|
54
|
+
assert_equal "900016", response.params["code"]
|
55
|
+
assert_equal "INVALID C_RTE", response.params["message"]
|
56
|
+
assert_equal "00", response.params["risk"]
|
57
|
+
assert_equal "C5O8NR6Nr0", response.params["reference"]
|
58
|
+
assert_equal "d98cf50f7a2430fe04ad", response.params["order_number"]
|
59
|
+
assert_equal "0", response.params["authentication_indicator"]
|
60
|
+
assert_equal nil, response.params["authentication_disclosure"]
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
def successful_purchase_response
|
65
|
+
"\002A ACCEPTED 00C5O8NUdNt0\03489be635e663b05eca587\0340\034NONE\034\003"
|
66
|
+
end
|
67
|
+
|
68
|
+
def declined_purchase_response
|
69
|
+
"\002X900016INVALID C_RTE 00C5O8NR6Nr0\034d98cf50f7a2430fe04ad\0340\034\034\003"
|
70
|
+
end
|
71
|
+
end
|
@@ -17,6 +17,17 @@ class SecurePayAuTest < Test::Unit::TestCase
|
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
20
|
+
def test_successful_purchase_with_live_data
|
21
|
+
@gateway.expects(:ssl_post).returns(successful_live_purchase_response)
|
22
|
+
|
23
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
24
|
+
assert_instance_of Response, response
|
25
|
+
assert_success response
|
26
|
+
|
27
|
+
assert_equal '000000', response.authorization
|
28
|
+
assert response.test?
|
29
|
+
end
|
30
|
+
|
20
31
|
def test_successful_purchase
|
21
32
|
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
22
33
|
|
@@ -97,7 +108,6 @@ class SecurePayAuTest < Test::Unit::TestCase
|
|
97
108
|
</TxnList>
|
98
109
|
</Payment>
|
99
110
|
</SecurePayMessage>
|
100
|
-
|
101
111
|
XML
|
102
112
|
end
|
103
113
|
|
@@ -147,4 +157,51 @@ class SecurePayAuTest < Test::Unit::TestCase
|
|
147
157
|
</SecurePayMessage>
|
148
158
|
XML
|
149
159
|
end
|
160
|
+
|
161
|
+
def successful_live_purchase_response
|
162
|
+
<<-XML
|
163
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
164
|
+
<SecurePayMessage>
|
165
|
+
<MessageInfo>
|
166
|
+
<messageID>8af793f9af34bea0cf40f5fb5c630c</messageID>
|
167
|
+
<messageTimestamp>20080802041625665000+660</messageTimestamp>
|
168
|
+
<apiVersion>xml-4.2</apiVersion>
|
169
|
+
</MessageInfo>
|
170
|
+
<RequestType>Payment</RequestType>
|
171
|
+
<MerchantInfo>
|
172
|
+
<merchantID>XYZ0001</merchantID>
|
173
|
+
</MerchantInfo>
|
174
|
+
<Status>
|
175
|
+
<statusCode>000</statusCode>
|
176
|
+
<statusDescription>Normal</statusDescription>
|
177
|
+
</Status>
|
178
|
+
<Payment>
|
179
|
+
<TxnList count="1">
|
180
|
+
<Txn ID="1">
|
181
|
+
<txnType>0</txnType>
|
182
|
+
<txnSource>23</txnSource>
|
183
|
+
<amount>211700</amount>
|
184
|
+
<currency>AUD</currency>
|
185
|
+
<purchaseOrderNo>#1047.5</purchaseOrderNo>
|
186
|
+
<approved>Yes</approved>
|
187
|
+
<responseCode>77</responseCode>
|
188
|
+
<responseText>Approved</responseText>
|
189
|
+
<thinlinkResponseCode>100</thinlinkResponseCode>
|
190
|
+
<thinlinkResponseText>000</thinlinkResponseText>
|
191
|
+
<thinlinkEventStatusCode>000</thinlinkEventStatusCode>
|
192
|
+
<thinlinkEventStatusText>Normal</thinlinkEventStatusText>
|
193
|
+
<settlementDate>20080525</settlementDate>
|
194
|
+
<txnID>000000</txnID>
|
195
|
+
<CreditCardInfo>
|
196
|
+
<pan>424242...242</pan>
|
197
|
+
<expiryDate>07/11</expiryDate>
|
198
|
+
<cardType>6</cardType>
|
199
|
+
<cardDescription>Visa</cardDescription>
|
200
|
+
</CreditCardInfo>
|
201
|
+
</Txn>
|
202
|
+
</TxnList>
|
203
|
+
</Payment>
|
204
|
+
</SecurePayMessage>
|
205
|
+
XML
|
206
|
+
end
|
150
207
|
end
|
@@ -62,6 +62,14 @@ class SkipJackTest < Test::Unit::TestCase
|
|
62
62
|
assert_success response
|
63
63
|
assert_equal "9802853155172.022", response.authorization
|
64
64
|
end
|
65
|
+
|
66
|
+
def test_purchase_failure
|
67
|
+
@gateway.expects(:ssl_post).returns(unsuccessful_authorization_response)
|
68
|
+
|
69
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
70
|
+
assert_instance_of Response, response
|
71
|
+
assert_failure response
|
72
|
+
end
|
65
73
|
|
66
74
|
def test_split_line
|
67
75
|
keys = @gateway.send(:split_line, '"AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode"')
|
@@ -0,0 +1,232 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
|
3
|
+
class WirecardTest < Test::Unit::TestCase
|
4
|
+
TEST_AUTHORIZATION_GUWID = 'C822580121385121429927'
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@gateway = WirecardGateway.new(:login => '', :password => '', :signature => '')
|
8
|
+
@credit_card = credit_card('4200000000000000')
|
9
|
+
@declined_card = credit_card('4000300011112220')
|
10
|
+
@unsupported_card = credit_card('4200000000000000', :type => :maestro)
|
11
|
+
|
12
|
+
@amount = 111
|
13
|
+
|
14
|
+
@options = {
|
15
|
+
:order_id => '1',
|
16
|
+
:billing_address => address,
|
17
|
+
:description => 'Wirecard Purchase',
|
18
|
+
:email => 'soleone@example.com'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_successful_authorization
|
23
|
+
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
24
|
+
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
25
|
+
assert_instance_of Response, response
|
26
|
+
|
27
|
+
assert_success response
|
28
|
+
assert response.test?
|
29
|
+
assert_equal TEST_AUTHORIZATION_GUWID, response.authorization
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_wrong_credit_card_authorization
|
33
|
+
@gateway.expects(:ssl_post).returns(wrong_creditcard_authorization_response)
|
34
|
+
assert response = @gateway.authorize(@amount, @declined_card, @options)
|
35
|
+
assert_instance_of Response, response
|
36
|
+
|
37
|
+
assert_failure response
|
38
|
+
assert response.test?
|
39
|
+
assert_false response.authorization
|
40
|
+
assert response.message[/credit card number not allowed in demo mode/i]
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_successful_authorization_and_capture
|
44
|
+
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
45
|
+
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
46
|
+
assert_success response
|
47
|
+
assert_equal TEST_AUTHORIZATION_GUWID, response.authorization
|
48
|
+
|
49
|
+
@gateway.expects(:ssl_post).returns(successful_capture_response)
|
50
|
+
assert response = @gateway.capture(@amount, response.authorization, @options)
|
51
|
+
assert_success response
|
52
|
+
assert response.test?
|
53
|
+
assert response.message[/this is a demo/i]
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_unauthorized_capture
|
57
|
+
@gateway.expects(:ssl_post).returns(unauthorized_capture_response)
|
58
|
+
assert response = @gateway.capture(@amount, "1234567890123456789012", @options)
|
59
|
+
|
60
|
+
assert_failure response
|
61
|
+
assert response.message["Could not find referenced transaction for GuWID 1234567890123456789012."]
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
# Authorization success
|
67
|
+
def successful_authorization_response
|
68
|
+
<<-XML
|
69
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
70
|
+
<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">
|
71
|
+
<W_RESPONSE>
|
72
|
+
<W_JOB>
|
73
|
+
<JobID>test dummy data</JobID>
|
74
|
+
<FNC_CC_AUTHORIZATION>
|
75
|
+
<FunctionID>Wirecard remote test purchase</FunctionID>
|
76
|
+
<CC_TRANSACTION>
|
77
|
+
<TransactionID>1</TransactionID>
|
78
|
+
<PROCESSING_STATUS>
|
79
|
+
<GuWID>C822580121385121429927</GuWID>
|
80
|
+
<AuthorizationCode>709678</AuthorizationCode>
|
81
|
+
<Info>THIS IS A DEMO TRANSACTION USING CREDIT CARD NUMBER 420000****0000. NO REAL MONEY WILL BE TRANSFERED.</Info>
|
82
|
+
<StatusType>INFO</StatusType>
|
83
|
+
<FunctionResult>ACK</FunctionResult>
|
84
|
+
<TimeStamp>2008-06-19 06:53:33</TimeStamp>
|
85
|
+
</PROCESSING_STATUS>
|
86
|
+
</CC_TRANSACTION>
|
87
|
+
</FNC_CC_AUTHORIZATION>
|
88
|
+
</W_JOB>
|
89
|
+
</W_RESPONSE>
|
90
|
+
</WIRECARD_BXML>
|
91
|
+
XML
|
92
|
+
end
|
93
|
+
|
94
|
+
# Authorization failure
|
95
|
+
# TODO: replace with real xml string here (current way seems to complicated)
|
96
|
+
def wrong_creditcard_authorization_response
|
97
|
+
error = <<-XML
|
98
|
+
<ERROR>
|
99
|
+
<Type>DATA_ERROR</Type>
|
100
|
+
<Number>24997</Number>
|
101
|
+
<Message>Credit card number not allowed in demo mode.</Message>
|
102
|
+
<Advice>Only demo card number '4200000000000000' is allowed for VISA in demo mode.</Advice>
|
103
|
+
</ERROR>
|
104
|
+
XML
|
105
|
+
result_node = '</FunctionResult>'
|
106
|
+
auth = 'AuthorizationCode'
|
107
|
+
successful_authorization_response.gsub('ACK', 'NOK') \
|
108
|
+
.gsub(result_node, result_node + error) \
|
109
|
+
.gsub(/<#{auth}>\w+<\/#{auth}>/, "<#{auth}><\/#{auth}>") \
|
110
|
+
.gsub(/<Info>.+<\/Info>/, '')
|
111
|
+
end
|
112
|
+
|
113
|
+
# Capture success
|
114
|
+
def successful_capture_response
|
115
|
+
<<-XML
|
116
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
117
|
+
<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">
|
118
|
+
<W_RESPONSE>
|
119
|
+
<W_JOB>
|
120
|
+
<JobID>test dummy data</JobID>
|
121
|
+
<FNC_CC_CAPTURE_AUTHORIZATION>
|
122
|
+
<FunctionID>Wirecard remote test purchase</FunctionID>
|
123
|
+
<CC_TRANSACTION>
|
124
|
+
<TransactionID>1</TransactionID>
|
125
|
+
<PROCESSING_STATUS>
|
126
|
+
<GuWID>C833707121385268439116</GuWID>
|
127
|
+
<AuthorizationCode>915025</AuthorizationCode>
|
128
|
+
<Info>THIS IS A DEMO TRANSACTION USING CREDIT CARD NUMBER 420000****0000. NO REAL MONEY WILL BE TRANSFERED.</Info>
|
129
|
+
<StatusType>INFO</StatusType>
|
130
|
+
<FunctionResult>ACK</FunctionResult>
|
131
|
+
<TimeStamp>2008-06-19 07:18:04</TimeStamp>
|
132
|
+
</PROCESSING_STATUS>
|
133
|
+
</CC_TRANSACTION>
|
134
|
+
</FNC_CC_CAPTURE_AUTHORIZATION>
|
135
|
+
</W_JOB>
|
136
|
+
</W_RESPONSE>
|
137
|
+
</WIRECARD_BXML>
|
138
|
+
XML
|
139
|
+
end
|
140
|
+
|
141
|
+
# Capture failure
|
142
|
+
def unauthorized_capture_response
|
143
|
+
<<-XML
|
144
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
145
|
+
<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">
|
146
|
+
<W_RESPONSE>
|
147
|
+
<W_JOB>
|
148
|
+
<JobID>test dummy data</JobID>
|
149
|
+
<FNC_CC_CAPTURE_AUTHORIZATION>
|
150
|
+
<FunctionID>Test dummy FunctionID</FunctionID>
|
151
|
+
<CC_TRANSACTION>
|
152
|
+
<TransactionID>a2783d471ccc98825b8c498f1a62ce8f</TransactionID>
|
153
|
+
<PROCESSING_STATUS>
|
154
|
+
<GuWID>C865683121385576058270</GuWID>
|
155
|
+
<AuthorizationCode></AuthorizationCode>
|
156
|
+
<StatusType>INFO</StatusType>
|
157
|
+
<FunctionResult>NOK</FunctionResult>
|
158
|
+
<ERROR>
|
159
|
+
<Type>DATA_ERROR</Type>
|
160
|
+
<Number>20080</Number>
|
161
|
+
<Message>Could not find referenced transaction for GuWID 1234567890123456789012.</Message>
|
162
|
+
</ERROR>
|
163
|
+
<TimeStamp>2008-06-19 08:09:20</TimeStamp>
|
164
|
+
</PROCESSING_STATUS>
|
165
|
+
</CC_TRANSACTION>
|
166
|
+
</FNC_CC_CAPTURE_AUTHORIZATION>
|
167
|
+
</W_JOB>
|
168
|
+
</W_RESPONSE>
|
169
|
+
</WIRECARD_BXML>
|
170
|
+
XML
|
171
|
+
end
|
172
|
+
|
173
|
+
# Purchase success
|
174
|
+
def successful_purchase_response
|
175
|
+
<<-XML
|
176
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
177
|
+
<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">
|
178
|
+
<W_RESPONSE>
|
179
|
+
<W_JOB>
|
180
|
+
<JobID>test dummy data</JobID>
|
181
|
+
<FNC_CC_PURCHASE>
|
182
|
+
<FunctionID>Wirecard remote test purchase</FunctionID>
|
183
|
+
<CC_TRANSACTION>
|
184
|
+
<TransactionID>1</TransactionID>
|
185
|
+
<PROCESSING_STATUS>
|
186
|
+
<GuWID>C865402121385575982910</GuWID>
|
187
|
+
<AuthorizationCode>531750</AuthorizationCode>
|
188
|
+
<Info>THIS IS A DEMO TRANSACTION USING CREDIT CARD NUMBER 420000****0000. NO REAL MONEY WILL BE TRANSFERED.</Info>
|
189
|
+
<StatusType>INFO</StatusType>
|
190
|
+
<FunctionResult>ACK</FunctionResult>
|
191
|
+
<TimeStamp>2008-06-19 08:09:19</TimeStamp>
|
192
|
+
</PROCESSING_STATUS>
|
193
|
+
</CC_TRANSACTION>
|
194
|
+
</FNC_CC_PURCHASE>
|
195
|
+
</W_JOB>
|
196
|
+
</W_RESPONSE>
|
197
|
+
</WIRECARD_BXML>
|
198
|
+
XML
|
199
|
+
end
|
200
|
+
|
201
|
+
# Purchase failure
|
202
|
+
def wrong_creditcard_purchase_response
|
203
|
+
<<-XML
|
204
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
205
|
+
<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">
|
206
|
+
<W_RESPONSE>
|
207
|
+
<W_JOB>
|
208
|
+
<JobID>test dummy data</JobID>
|
209
|
+
<FNC_CC_PURCHASE>
|
210
|
+
<FunctionID>Wirecard remote test purchase</FunctionID>
|
211
|
+
<CC_TRANSACTION>
|
212
|
+
<TransactionID>1</TransactionID>
|
213
|
+
<PROCESSING_STATUS>
|
214
|
+
<GuWID>C824697121385153203112</GuWID>
|
215
|
+
<AuthorizationCode></AuthorizationCode>
|
216
|
+
<StatusType>INFO</StatusType>
|
217
|
+
<FunctionResult>NOK</FunctionResult>
|
218
|
+
<ERROR>
|
219
|
+
<Type>DATA_ERROR</Type> <Number>24997</Number>
|
220
|
+
<Message>Credit card number not allowed in demo mode.</Message>
|
221
|
+
<Advice>Only demo card number '4200000000000000' is allowed for VISA in demo mode.</Advice>
|
222
|
+
</ERROR>
|
223
|
+
<TimeStamp>2008-06-19 06:58:51</TimeStamp>
|
224
|
+
</PROCESSING_STATUS>
|
225
|
+
</CC_TRANSACTION>
|
226
|
+
</FNC_CC_PURCHASE>
|
227
|
+
</W_JOB>
|
228
|
+
</W_RESPONSE>
|
229
|
+
</WIRECARD_BXML>
|
230
|
+
XML
|
231
|
+
end
|
232
|
+
end
|
@@ -8,6 +8,8 @@ class ActionViewHelperTest < Test::Unit::TestCase
|
|
8
8
|
include ActionView::Helpers::TagHelper
|
9
9
|
include ActionView::Helpers::TextHelper
|
10
10
|
|
11
|
+
attr_accessor :output_buffer
|
12
|
+
|
11
13
|
def setup
|
12
14
|
@controller = Class.new do
|
13
15
|
attr_reader :url_for_options
|
@@ -16,6 +18,7 @@ class ActionViewHelperTest < Test::Unit::TestCase
|
|
16
18
|
end
|
17
19
|
end
|
18
20
|
@controller = @controller.new
|
21
|
+
@output_buffer = ''
|
19
22
|
end
|
20
23
|
|
21
24
|
|
@@ -6,14 +6,18 @@ class HiTrustNotificationTest < Test::Unit::TestCase
|
|
6
6
|
def setup
|
7
7
|
@notification = HiTrust::Notification.new(successful_response)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
ActiveMerchant::Billing::Base.integration_mode = :test
|
12
|
+
end
|
13
|
+
|
10
14
|
def test_accessors
|
11
15
|
assert @notification.complete?
|
12
16
|
assert_equal "Completed", @notification.status
|
13
17
|
assert_equal "012345678901", @notification.transaction_id
|
14
18
|
assert_equal "1000", @notification.item_id
|
15
19
|
assert_equal "101010", @notification.account
|
16
|
-
assert_equal "
|
20
|
+
assert_equal "5.00", @notification.gross
|
17
21
|
assert_equal "USD", @notification.currency
|
18
22
|
assert_equal Time.parse("2007-12-01.12.35.40.123456"), @notification.received_at
|
19
23
|
assert @notification.test?
|
@@ -31,6 +35,23 @@ class HiTrustNotificationTest < Test::Unit::TestCase
|
|
31
35
|
assert @notification.respond_to?(:acknowledge)
|
32
36
|
end
|
33
37
|
|
38
|
+
def test_valid_sender_in_testmode_always_true
|
39
|
+
assert @notification.test?
|
40
|
+
assert @notification.valid_sender?('127.0.0.1')
|
41
|
+
assert @notification.valid_sender?(nil)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_valid_sender
|
45
|
+
ActiveMerchant::Billing::Base.integration_mode = :production
|
46
|
+
assert @notification.valid_sender?('203.75.242.8')
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_invalid_sender
|
50
|
+
ActiveMerchant::Billing::Base.integration_mode = :production
|
51
|
+
assert_false @notification.valid_sender?('127.0.0.1')
|
52
|
+
assert_false @notification.valid_sender?(nil)
|
53
|
+
end
|
54
|
+
|
34
55
|
private
|
35
56
|
def successful_response
|
36
57
|
'retcode=00&ordernumber=1000&orderstatus=02&authCode=123456&eci=VISA3D&authRRN=012345678901&storeid=101010&approveamount=500¤cy=USD&orderdate=2007-12-01.12.35.40.123456'
|