smulube-activemerchant 1.5.1.4 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +9 -0
- data/CONTRIBUTORS +5 -1
- data/gem-public_cert.pem +18 -18
- data/lib/active_merchant.rb +9 -9
- data/lib/active_merchant/billing/gateways/braintree.rb +11 -11
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +210 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +17 -0
- data/lib/active_merchant/billing/gateways/payflow_nvp_uk.rb +10 -5
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +1 -1
- data/lib/active_merchant/common.rb +14 -0
- data/lib/active_merchant/{lib → common}/connection.rb +2 -5
- data/lib/active_merchant/{lib → common}/country.rb +1 -1
- data/lib/active_merchant/common/error.rb +26 -0
- data/lib/active_merchant/common/post_data.rb +24 -0
- data/lib/active_merchant/{lib → common}/posts_data.rb +0 -0
- data/lib/active_merchant/{lib → common}/requires_parameters.rb +0 -0
- data/lib/active_merchant/{lib → common}/utils.rb +0 -0
- data/lib/active_merchant/{lib → common}/validateable.rb +0 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant/version.rb.orig +7 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/support/outbound_hosts.rb +25 -0
- metadata +175 -493
- metadata.gz.sig +0 -0
- data/.gitignore +0 -7
- data/Rakefile +0 -85
- data/generators/gateway/USAGE +0 -5
- data/generators/gateway/gateway_generator.rb +0 -61
- data/generators/gateway/templates/gateway.rb +0 -77
- data/generators/gateway/templates/gateway_test.rb +0 -49
- data/generators/gateway/templates/remote_gateway_test.rb +0 -57
- data/generators/integration/USAGE +0 -5
- data/generators/integration/integration_generator.rb +0 -68
- data/generators/integration/templates/helper.rb +0 -34
- data/generators/integration/templates/helper_test.rb +0 -54
- data/generators/integration/templates/integration.rb +0 -18
- data/generators/integration/templates/module_test.rb +0 -9
- data/generators/integration/templates/notification.rb +0 -100
- data/generators/integration/templates/notification_test.rb +0 -41
- data/init.rb +0 -3
- data/lib/active_merchant/lib/error.rb +0 -4
- data/lib/active_merchant/lib/post_data.rb +0 -22
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/test/fixtures.yml +0 -360
- data/test/remote/gateways/remote_authorize_net_cim_test.rb +0 -460
- data/test/remote/gateways/remote_authorize_net_test.rb +0 -145
- data/test/remote/gateways/remote_beanstream_interac_test.rb +0 -53
- data/test/remote/gateways/remote_beanstream_test.rb +0 -150
- data/test/remote/gateways/remote_braintree_test.rb +0 -147
- data/test/remote/gateways/remote_card_stream_test.rb +0 -148
- data/test/remote/gateways/remote_cyber_source_test.rb +0 -146
- data/test/remote/gateways/remote_data_cash_test.rb +0 -356
- data/test/remote/gateways/remote_efsnet_test.rb +0 -81
- data/test/remote/gateways/remote_elavon_test.rb +0 -66
- data/test/remote/gateways/remote_eway_test.rb +0 -74
- data/test/remote/gateways/remote_exact_test.rb +0 -60
- data/test/remote/gateways/remote_first_pay_test.rb +0 -87
- data/test/remote/gateways/remote_garanti_test.rb +0 -58
- data/test/remote/gateways/remote_instapay_test.rb +0 -61
- data/test/remote/gateways/remote_jetpay_test.rb +0 -103
- data/test/remote/gateways/remote_linkpoint_test.rb +0 -121
- data/test/remote/gateways/remote_merchant_e_solutions_test.rb +0 -173
- data/test/remote/gateways/remote_merchant_ware_test.rb +0 -113
- data/test/remote/gateways/remote_modern_payments_cim_test.rb +0 -58
- data/test/remote/gateways/remote_modern_payments_test.rb +0 -57
- data/test/remote/gateways/remote_moneris_test.rb +0 -82
- data/test/remote/gateways/remote_net_registry_test.rb +0 -85
- data/test/remote/gateways/remote_netbilling_test.rb +0 -70
- data/test/remote/gateways/remote_ogone_test.rb +0 -115
- data/test/remote/gateways/remote_pay_junction_test.rb +0 -143
- data/test/remote/gateways/remote_pay_secure_test.rb +0 -39
- data/test/remote/gateways/remote_payflow_express_test.rb +0 -50
- data/test/remote/gateways/remote_payflow_nvp_uk_test.rb +0 -57
- data/test/remote/gateways/remote_payflow_test.rb +0 -237
- data/test/remote/gateways/remote_payflow_uk_test.rb +0 -173
- data/test/remote/gateways/remote_payment_express_test.rb +0 -136
- data/test/remote/gateways/remote_paypal_express_test.rb +0 -49
- data/test/remote/gateways/remote_paypal_test.rb +0 -191
- data/test/remote/gateways/remote_plugnpay_test.rb +0 -72
- data/test/remote/gateways/remote_psigate_test.rb +0 -50
- data/test/remote/gateways/remote_psl_card_test.rb +0 -123
- data/test/remote/gateways/remote_quickpay_test.rb +0 -190
- data/test/remote/gateways/remote_realex_test.rb +0 -224
- data/test/remote/gateways/remote_sage_bankcard_test.rb +0 -109
- data/test/remote/gateways/remote_sage_pay_test.rb +0 -219
- data/test/remote/gateways/remote_sage_test.rb +0 -87
- data/test/remote/gateways/remote_sage_virtual_check_test.rb +0 -62
- data/test/remote/gateways/remote_sallie_mae_test.rb +0 -51
- data/test/remote/gateways/remote_secure_pay_au_test.rb +0 -40
- data/test/remote/gateways/remote_secure_pay_tech_test.rb +0 -37
- data/test/remote/gateways/remote_secure_pay_test.rb +0 -28
- data/test/remote/gateways/remote_skipjack_test.rb +0 -105
- data/test/remote/gateways/remote_trans_first_test.rb +0 -34
- data/test/remote/gateways/remote_transax_test.rb +0 -112
- data/test/remote/gateways/remote_trust_commerce_test.rb +0 -152
- data/test/remote/gateways/remote_usa_epay_test.rb +0 -46
- data/test/remote/gateways/remote_verifi_test.rb +0 -107
- data/test/remote/gateways/remote_viaklix_test.rb +0 -43
- data/test/remote/gateways/remote_wirecard_test.rb +0 -111
- data/test/remote/integrations/remote_gestpay_integration_test.rb +0 -37
- data/test/remote/integrations/remote_paypal_integration_test.rb +0 -26
- data/test/test_helper.rb +0 -184
- data/test/unit/avs_result_test.rb +0 -59
- data/test/unit/base_test.rb +0 -54
- data/test/unit/check_test.rb +0 -88
- data/test/unit/connection_test.rb +0 -137
- data/test/unit/country_code_test.rb +0 -33
- data/test/unit/country_test.rb +0 -64
- data/test/unit/credit_card_formatting_test.rb +0 -19
- data/test/unit/credit_card_methods_test.rb +0 -192
- data/test/unit/credit_card_test.rb +0 -318
- data/test/unit/cvv_result_test.rb +0 -33
- data/test/unit/expiry_date_test.rb +0 -32
- data/test/unit/gateways/authorize_net_cim_test.rb +0 -676
- data/test/unit/gateways/authorize_net_test.rb +0 -290
- data/test/unit/gateways/beanstream_interac_test.rb +0 -51
- data/test/unit/gateways/beanstream_test.rb +0 -144
- data/test/unit/gateways/bogus_test.rb +0 -58
- data/test/unit/gateways/braintree_test.rb +0 -118
- data/test/unit/gateways/card_stream_test.rb +0 -90
- data/test/unit/gateways/cyber_source_test.rb +0 -188
- data/test/unit/gateways/data_cash_test.rb +0 -133
- data/test/unit/gateways/efsnet_test.rb +0 -123
- data/test/unit/gateways/elavon_test.rb +0 -139
- data/test/unit/gateways/eway_test.rb +0 -118
- data/test/unit/gateways/exact_test.rb +0 -156
- data/test/unit/gateways/first_pay_test.rb +0 -125
- data/test/unit/gateways/garanti_test.rb +0 -86
- data/test/unit/gateways/gateway_test.rb +0 -48
- data/test/unit/gateways/instapay_test.rb +0 -102
- data/test/unit/gateways/jetpay_test.rb +0 -185
- data/test/unit/gateways/linkpoint_test.rb +0 -197
- data/test/unit/gateways/merchant_e_solutions_test.rb +0 -169
- data/test/unit/gateways/merchant_ware_test.rb +0 -188
- data/test/unit/gateways/modern_payments_cim_test.rb +0 -162
- data/test/unit/gateways/moneris_test.rb +0 -158
- data/test/unit/gateways/net_registry_test.rb +0 -416
- data/test/unit/gateways/netbilling_test.rb +0 -54
- data/test/unit/gateways/ogone_test.rb +0 -319
- data/test/unit/gateways/pay_junction_test.rb +0 -123
- data/test/unit/gateways/pay_secure_test.rb +0 -71
- data/test/unit/gateways/payflow_express_test.rb +0 -173
- data/test/unit/gateways/payflow_express_uk_test.rb +0 -86
- data/test/unit/gateways/payflow_nvp_uk_test.rb +0 -205
- data/test/unit/gateways/payflow_test.rb +0 -305
- data/test/unit/gateways/payflow_uk_test.rb +0 -30
- data/test/unit/gateways/payment_express_test.rb +0 -195
- data/test/unit/gateways/paypal_express_test.rb +0 -389
- data/test/unit/gateways/paypal_test.rb +0 -569
- data/test/unit/gateways/plugnpay_test.rb +0 -86
- data/test/unit/gateways/psigate_test.rb +0 -169
- data/test/unit/gateways/psl_card_test.rb +0 -64
- data/test/unit/gateways/quickpay_test.rb +0 -112
- data/test/unit/gateways/realex_test.rb +0 -151
- data/test/unit/gateways/sage_bankcard_test.rb +0 -196
- data/test/unit/gateways/sage_pay_test.rb +0 -139
- data/test/unit/gateways/sage_virtual_check_test.rb +0 -71
- data/test/unit/gateways/sallie_mae_test.rb +0 -53
- data/test/unit/gateways/secure_pay_au_test.rb +0 -207
- data/test/unit/gateways/secure_pay_tech_test.rb +0 -44
- data/test/unit/gateways/secure_pay_test.rb +0 -101
- data/test/unit/gateways/skip_jack_test.rb +0 -228
- data/test/unit/gateways/trans_first_test.rb +0 -112
- data/test/unit/gateways/trust_commerce_test.rb +0 -90
- data/test/unit/gateways/usa_epay_test.rb +0 -128
- data/test/unit/gateways/verifi_test.rb +0 -96
- data/test/unit/gateways/viaklix_test.rb +0 -78
- data/test/unit/gateways/wirecard_test.rb +0 -250
- data/test/unit/generators/test_gateway_generator.rb +0 -46
- data/test/unit/generators/test_generator_helper.rb +0 -20
- data/test/unit/generators/test_integration_generator.rb +0 -53
- data/test/unit/integrations/action_view_helper_test.rb +0 -50
- data/test/unit/integrations/bogus_module_test.rb +0 -20
- data/test/unit/integrations/chronopay_module_test.rb +0 -13
- data/test/unit/integrations/gestpay_module_test.rb +0 -14
- data/test/unit/integrations/helpers/bogus_helper_test.rb +0 -28
- data/test/unit/integrations/helpers/chronopay_helper_test.rb +0 -110
- data/test/unit/integrations/helpers/gestpay_helper_test.rb +0 -100
- data/test/unit/integrations/helpers/hi_trust_helper_test.rb +0 -16
- data/test/unit/integrations/helpers/nochex_helper_test.rb +0 -53
- data/test/unit/integrations/helpers/paypal_helper_test.rb +0 -171
- data/test/unit/integrations/helpers/quickpay_helper_test.rb +0 -40
- data/test/unit/integrations/helpers/two_checkout_helper_test.rb +0 -92
- data/test/unit/integrations/hi_trust_module_test.rb +0 -13
- data/test/unit/integrations/nochex_module_test.rb +0 -13
- data/test/unit/integrations/notifications/chronopay_notification_test.rb +0 -66
- data/test/unit/integrations/notifications/gestpay_notification_test.rb +0 -60
- data/test/unit/integrations/notifications/hi_trust_notification_test.rb +0 -59
- data/test/unit/integrations/notifications/nochex_notification_test.rb +0 -51
- data/test/unit/integrations/notifications/notification_test.rb +0 -54
- data/test/unit/integrations/notifications/paypal_notification_test.rb +0 -85
- data/test/unit/integrations/notifications/quickpay_notification_test.rb +0 -69
- data/test/unit/integrations/notifications/two_checkout_notification_test.rb +0 -55
- data/test/unit/integrations/paypal_module_test.rb +0 -28
- data/test/unit/integrations/quickpay_module_test.rb +0 -9
- data/test/unit/integrations/returns/chronopay_return_test.rb +0 -11
- data/test/unit/integrations/returns/gestpay_return_test.rb +0 -10
- data/test/unit/integrations/returns/hi_trust_return_test.rb +0 -24
- data/test/unit/integrations/returns/nochex_return_test.rb +0 -10
- data/test/unit/integrations/returns/paypal_return_test.rb +0 -10
- data/test/unit/integrations/returns/return_test.rb +0 -11
- data/test/unit/integrations/returns/two_checkout_return_test.rb +0 -24
- data/test/unit/integrations/two_checkout_module_test.rb +0 -13
- data/test/unit/post_data_test.rb +0 -55
- data/test/unit/posts_data_test.rb +0 -48
- data/test/unit/response_test.rb +0 -28
- data/test/unit/utils_test.rb +0 -7
- data/test/unit/validateable_test.rb +0 -60
@@ -1,188 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class MerchantWareTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@gateway = MerchantWareGateway.new(
|
6
|
-
:login => 'login',
|
7
|
-
:password => 'password',
|
8
|
-
:name => 'name'
|
9
|
-
)
|
10
|
-
|
11
|
-
@credit_card = credit_card
|
12
|
-
@amount = 100
|
13
|
-
|
14
|
-
@options = {
|
15
|
-
:order_id => '1',
|
16
|
-
:billing_address => address
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_successful_authorization
|
21
|
-
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
22
|
-
|
23
|
-
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
24
|
-
assert_instance_of Response, response
|
25
|
-
assert_success response
|
26
|
-
|
27
|
-
assert_equal '4706382;1', response.authorization
|
28
|
-
assert_equal "APPROVED", response.message
|
29
|
-
assert response.test?
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_soap_fault_during_authorization
|
33
|
-
response_500 = stub(:code => "500", :message => "Internal Server Error", :body => fault_authorization_response)
|
34
|
-
@gateway.expects(:ssl_post).raises(ActiveMerchant::ResponseError.new(response_500))
|
35
|
-
|
36
|
-
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
37
|
-
assert_instance_of Response, response
|
38
|
-
assert_failure response
|
39
|
-
assert response.test?
|
40
|
-
|
41
|
-
assert_nil response.authorization
|
42
|
-
assert_equal "Server was unable to process request. ---> strPAN should be at least 13 to at most 19 characters in size. Parameter name: strPAN", response.message
|
43
|
-
assert_equal response_500.code, response.params["http_code"]
|
44
|
-
assert_equal response_500.message, response.params["http_message"]
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_failed_authorization
|
48
|
-
@gateway.expects(:ssl_post).returns(failed_authorization_response)
|
49
|
-
|
50
|
-
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
51
|
-
assert_instance_of Response, response
|
52
|
-
assert_failure response
|
53
|
-
assert response.test?
|
54
|
-
|
55
|
-
assert_nil response.authorization
|
56
|
-
assert_equal "transaction type not supported by version", response.message
|
57
|
-
assert_equal "FAILED", response.params["status"]
|
58
|
-
assert_equal "1014", response.params["failure_code"]
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_failed_void
|
62
|
-
@gateway.expects(:ssl_post).returns(failed_void_response)
|
63
|
-
|
64
|
-
assert response = @gateway.void("1")
|
65
|
-
assert_instance_of Response, response
|
66
|
-
assert_failure response
|
67
|
-
assert response.test?
|
68
|
-
|
69
|
-
assert_nil response.authorization
|
70
|
-
assert_equal "decline", response.message
|
71
|
-
assert_equal "DECLINED", response.params["status"]
|
72
|
-
assert_equal "1012", response.params["failure_code"]
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_avs_result
|
76
|
-
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
77
|
-
|
78
|
-
response = @gateway.authorize(@amount, @credit_card, @options)
|
79
|
-
assert_equal 'N', response.avs_result['code']
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_cvv_result
|
83
|
-
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
84
|
-
|
85
|
-
response = @gateway.authorize(@amount, @credit_card, @options)
|
86
|
-
assert_equal 'M', response.cvv_result['code']
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def successful_authorization_response
|
92
|
-
<<-XML
|
93
|
-
<?xml version="1.0" encoding="utf-8"?>
|
94
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
95
|
-
<soap:Body>
|
96
|
-
<IssueKeyedPreAuthResponse xmlns="http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail">
|
97
|
-
<IssueKeyedPreAuthResult>
|
98
|
-
<ReferenceID>4706382</ReferenceID>
|
99
|
-
<OrderNumber>1</OrderNumber>
|
100
|
-
<TXDate>7/3/2009 2:05:04 AM</TXDate>
|
101
|
-
<ApprovalStatus>APPROVED</ApprovalStatus>
|
102
|
-
<AuthCode>VI0100</AuthCode>
|
103
|
-
<CardHolder>Longbob Longsen</CardHolder>
|
104
|
-
<Amount>1.00</Amount>
|
105
|
-
<Type>5</Type>
|
106
|
-
<CardNumber>************4242</CardNumber>
|
107
|
-
<CardType>0</CardType>
|
108
|
-
<AVSResponse>N</AVSResponse>
|
109
|
-
<CVResponse>M</CVResponse>
|
110
|
-
<POSEntryType>1</POSEntryType>
|
111
|
-
</IssueKeyedPreAuthResult>
|
112
|
-
</IssueKeyedPreAuthResponse>
|
113
|
-
</soap:Body>
|
114
|
-
</soap:Envelope>
|
115
|
-
XML
|
116
|
-
end
|
117
|
-
|
118
|
-
def fault_authorization_response
|
119
|
-
<<-XML
|
120
|
-
<?xml version="1.0" encoding="utf-8"?>
|
121
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
122
|
-
<soap:Body>
|
123
|
-
<soap:Fault>
|
124
|
-
<faultcode>soap:Server</faultcode>
|
125
|
-
<faultstring>Server was unable to process request. ---> strPAN should be at least 13 to at most 19 characters in size.
|
126
|
-
Parameter name: strPAN</faultstring>
|
127
|
-
<detail/>
|
128
|
-
</soap:Fault>
|
129
|
-
</soap:Body>
|
130
|
-
</soap:Envelope>
|
131
|
-
XML
|
132
|
-
end
|
133
|
-
|
134
|
-
def failed_authorization_response
|
135
|
-
<<-XML
|
136
|
-
<?xml version="1.0" encoding="utf-8"?>
|
137
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
138
|
-
<soap:Body>
|
139
|
-
<IssueKeyedPreAuthResponse xmlns="http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail">
|
140
|
-
<IssueKeyedPreAuthResult>
|
141
|
-
<ReferenceID/>
|
142
|
-
<OrderNumber>1</OrderNumber>
|
143
|
-
<TXDate>7/3/2009 3:04:33 AM</TXDate>
|
144
|
-
<ApprovalStatus>FAILED;1014;transaction type not supported by version</ApprovalStatus>
|
145
|
-
<AuthCode/>
|
146
|
-
<CardHolder>Longbob Longsen</CardHolder>
|
147
|
-
<Amount>1.00</Amount>
|
148
|
-
<Type>5</Type>
|
149
|
-
<CardNumber>*********0123</CardNumber>
|
150
|
-
<CardType>0</CardType>
|
151
|
-
<AVSResponse/>
|
152
|
-
<CVResponse/>
|
153
|
-
<POSEntryType>1</POSEntryType>
|
154
|
-
</IssueKeyedPreAuthResult>
|
155
|
-
</IssueKeyedPreAuthResponse>
|
156
|
-
</soap:Body>
|
157
|
-
</soap:Envelope>
|
158
|
-
XML
|
159
|
-
end
|
160
|
-
|
161
|
-
def failed_void_response
|
162
|
-
<<-XML
|
163
|
-
<?xml version="1.0" encoding="utf-8"?>
|
164
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
165
|
-
<soap:Body>
|
166
|
-
<IssueVoidResponse xmlns="http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail">
|
167
|
-
<IssueVoidResult>
|
168
|
-
<ReferenceID>4707277</ReferenceID>
|
169
|
-
<OrderNumber/>
|
170
|
-
<TXDate>7/3/2009 3:28:38 AM</TXDate>
|
171
|
-
<ApprovalStatus>DECLINED;1012;decline</ApprovalStatus>
|
172
|
-
<AuthCode/>
|
173
|
-
<CardHolder/>
|
174
|
-
<Amount/>
|
175
|
-
<Type>3</Type>
|
176
|
-
<CardNumber/>
|
177
|
-
<CardType>0</CardType>
|
178
|
-
<AVSResponse/>
|
179
|
-
<CVResponse/>
|
180
|
-
<POSEntryType>0</POSEntryType>
|
181
|
-
</IssueVoidResult>
|
182
|
-
</IssueVoidResponse>
|
183
|
-
</soap:Body>
|
184
|
-
</soap:Envelope>
|
185
|
-
XML
|
186
|
-
end
|
187
|
-
|
188
|
-
end
|
@@ -1,162 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ModernPaymentsCimTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
Base.mode = :test
|
6
|
-
|
7
|
-
@gateway = ModernPaymentsCimGateway.new(
|
8
|
-
:login => 'login',
|
9
|
-
:password => 'password'
|
10
|
-
)
|
11
|
-
|
12
|
-
@credit_card = credit_card
|
13
|
-
@amount = 100
|
14
|
-
|
15
|
-
@options = {
|
16
|
-
:order_id => '1',
|
17
|
-
:billing_address => address,
|
18
|
-
:description => 'Store Purchase'
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_create_customer
|
23
|
-
@gateway.expects(:ssl_post).returns(successful_create_customer_response)
|
24
|
-
|
25
|
-
assert response = @gateway.create_customer(@options)
|
26
|
-
assert_instance_of Response, response
|
27
|
-
assert response.test?
|
28
|
-
assert_success response
|
29
|
-
assert_equal "6677348", response.params["create_customer_result"]
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_modify_customer_credit_card
|
33
|
-
@gateway.expects(:ssl_post).returns(successful_modify_customer_credit_card_response)
|
34
|
-
|
35
|
-
assert response = @gateway.modify_customer_credit_card("10001", @credit_card)
|
36
|
-
assert_instance_of Response, response
|
37
|
-
assert response.test?
|
38
|
-
assert_success response
|
39
|
-
assert_equal "6677757", response.params["modify_customer_credit_card_result"]
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_successful_credit_card_authorization
|
43
|
-
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
44
|
-
|
45
|
-
assert response = @gateway.authorize_credit_card_payment("10001", @amount)
|
46
|
-
assert_instance_of Response, response
|
47
|
-
assert response.test?
|
48
|
-
|
49
|
-
assert_success response
|
50
|
-
assert_equal "18713505", response.params["trans_id"]
|
51
|
-
assert_equal "RESPONSECODE=A\nAUTHCODE=020411\nDECLINEREASON=\nAVSDATA=Z\nTRANSID=C00 17093294", response.params["auth_string"]
|
52
|
-
assert_equal "Approved", response.params["message_text"]
|
53
|
-
assert_equal "true", response.params["approved"]
|
54
|
-
assert_equal "Z", response.params["avs_code"]
|
55
|
-
assert_equal "020411", response.params["auth_code"]
|
56
|
-
assert_equal "C00 17093294", response.params["trans_code"]
|
57
|
-
assert_equal "18713505", response.authorization
|
58
|
-
assert_equal ModernPaymentsCimGateway::SUCCESS_MESSAGE, response.message
|
59
|
-
assert_equal 'Z', response.avs_result['code']
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_unsuccessful_credit_card_authorization
|
63
|
-
@gateway.expects(:ssl_post).returns(unsuccessful_credit_card_authorization_response)
|
64
|
-
|
65
|
-
assert response = @gateway.authorize_credit_card_payment("10001", @amount)
|
66
|
-
assert_instance_of Response, response
|
67
|
-
assert response.test?
|
68
|
-
assert_failure response
|
69
|
-
assert_equal "999", response.authorization
|
70
|
-
assert_match /RESPONSECODE=D/, response.params["message_text"]
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_soap_fault_response
|
74
|
-
@gateway.expects(:ssl_post).returns(soap_fault_response)
|
75
|
-
|
76
|
-
assert response = @gateway.create_customer(@options)
|
77
|
-
assert_instance_of Response, response
|
78
|
-
assert response.test?
|
79
|
-
assert_failure response
|
80
|
-
assert_equal "soap:Client", response.params["faultcode"]
|
81
|
-
end
|
82
|
-
|
83
|
-
private
|
84
|
-
|
85
|
-
def successful_create_customer_response
|
86
|
-
<<-XML
|
87
|
-
<?xml version="1.0" encoding="utf-8"?>
|
88
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
89
|
-
<soap:Body>
|
90
|
-
<CreateCustomerResponse xmlns="http://secure.modpay.com:81/ws/">
|
91
|
-
<CreateCustomerResult>6677348</CreateCustomerResult>
|
92
|
-
</CreateCustomerResponse>
|
93
|
-
</soap:Body>
|
94
|
-
</soap:Envelope>
|
95
|
-
XML
|
96
|
-
end
|
97
|
-
|
98
|
-
def successful_modify_customer_credit_card_response
|
99
|
-
<<-XML
|
100
|
-
<?xml version="1.0" encoding="utf-8"?>
|
101
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
102
|
-
<soap:Body>
|
103
|
-
<ModifyCustomerCreditCardResponse xmlns="http://secure.modpay.com:81/ws/">
|
104
|
-
<ModifyCustomerCreditCardResult>6677757</ModifyCustomerCreditCardResult>
|
105
|
-
</ModifyCustomerCreditCardResponse>
|
106
|
-
</soap:Body>
|
107
|
-
</soap:Envelope>
|
108
|
-
XML
|
109
|
-
end
|
110
|
-
|
111
|
-
def unsuccessful_credit_card_authorization_response
|
112
|
-
<<-XML
|
113
|
-
<?xml version="1.0" encoding="utf-8"?>
|
114
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
115
|
-
<soap:Body>
|
116
|
-
<AuthorizeCreditCardPaymentResponse xmlns="https://secure.modpay.com/netservices/test/">
|
117
|
-
<AuthorizeCreditCardPaymentResult>
|
118
|
-
<transId>999</transId>
|
119
|
-
<authCode/>
|
120
|
-
<avsCode/>
|
121
|
-
<transCode/>
|
122
|
-
<authString>RESPONSECODE=D,AUTHCODE=,DECLINEREASON.1.TAG=,DECLINEREASON.1.ERRORCLASS=card declined,DECLINEREASON.1.PARAM1=05:DECLINE,DECLINEREASON.1.PARAM2=The authorization is declined,DECLINEREASON.1.MESSAGE=Card was declined: The authorization is declined,AVSDATA</authString>
|
123
|
-
<messageText>RESPONSECODE=D,AUTHCODE=,DECLINEREASON.1.TAG=,DECLINEREASON.1.ERRORCLASS=card declined,DECLINEREASON.1.PARAM1=05:DECLINE,DECLINEREASON.1.PARAM2=The authorization is declined,DECLINEREASON.1.MESSAGE=Card was declined: The authorization is declined,AVSDATA</messageText>
|
124
|
-
<approved>false</approved>
|
125
|
-
</AuthorizeCreditCardPaymentResult>
|
126
|
-
</AuthorizeCreditCardPaymentResponse>
|
127
|
-
</soap:Body>
|
128
|
-
</soap:Envelope>
|
129
|
-
XML
|
130
|
-
end
|
131
|
-
|
132
|
-
def soap_fault_response
|
133
|
-
<<-XML
|
134
|
-
<?xml version="1.0" encoding="utf-8"?>
|
135
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
136
|
-
<soap:Body>
|
137
|
-
<soap:Fault>
|
138
|
-
<faultcode>soap:Client</faultcode>
|
139
|
-
<faultstring>System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: h heheheh http://secure.modpay.com:81/ws/CreateCustomer.
|
140
|
-
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
|
141
|
-
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
|
142
|
-
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
|
143
|
-
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)</faultstring>
|
144
|
-
<detail/>
|
145
|
-
</soap:Fault>
|
146
|
-
</soap:Body>
|
147
|
-
</soap:Envelope>
|
148
|
-
XML
|
149
|
-
end
|
150
|
-
|
151
|
-
def successful_authorization_response
|
152
|
-
<<-XML
|
153
|
-
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AuthorizeCreditCardPaymentResponse xmlns="https://secure.modpay.com/ws/"><AuthorizeCreditCardPaymentResult><transId>18713505</transId><authCode>020411</authCode><avsCode>Z</avsCode><transCode>C00 17093294
|
154
|
-
</transCode><authString>RESPONSECODE=A
|
155
|
-
AUTHCODE=020411
|
156
|
-
DECLINEREASON=
|
157
|
-
AVSDATA=Z
|
158
|
-
TRANSID=C00 17093294
|
159
|
-
</authString><messageText>Approved</messageText><approved>true</approved></AuthorizeCreditCardPaymentResult></AuthorizeCreditCardPaymentResponse></soap:Body></soap:Envelope>
|
160
|
-
XML
|
161
|
-
end
|
162
|
-
end
|
@@ -1,158 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class MonerisTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
Base.mode = :test
|
6
|
-
|
7
|
-
@gateway = MonerisGateway.new(
|
8
|
-
:login => 'store1',
|
9
|
-
:password => 'yesguy'
|
10
|
-
)
|
11
|
-
|
12
|
-
@amount = 100
|
13
|
-
@credit_card = credit_card('4242424242424242')
|
14
|
-
@options = { :order_id => '1', :billing_address => address }
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_successful_purchase
|
18
|
-
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
19
|
-
|
20
|
-
assert response = @gateway.authorize(100, @credit_card, @options)
|
21
|
-
assert_success response
|
22
|
-
assert_equal '58-0_3;1026.1', response.authorization
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_failed_purchase
|
26
|
-
@gateway.expects(:ssl_post).returns(failed_purchase_response)
|
27
|
-
|
28
|
-
assert response = @gateway.authorize(100, @credit_card, @options)
|
29
|
-
assert_failure response
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_amount_style
|
33
|
-
assert_equal '10.34', @gateway.send(:amount, 1034)
|
34
|
-
|
35
|
-
assert_raise(ArgumentError) do
|
36
|
-
@gateway.send(:amount, '10.34')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_purchase_is_valid_xml
|
41
|
-
|
42
|
-
params = {
|
43
|
-
:order_id => "order1",
|
44
|
-
:amount => "1.01",
|
45
|
-
:pan => "4242424242424242",
|
46
|
-
:expdate => "0303",
|
47
|
-
:crypt_type => 7,
|
48
|
-
}
|
49
|
-
|
50
|
-
assert data = @gateway.send(:post_data, 'preauth', params)
|
51
|
-
assert REXML::Document.new(data)
|
52
|
-
assert_equal xml_capture_fixture.size, data.size
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_purchase_is_valid_xml
|
56
|
-
|
57
|
-
params = {
|
58
|
-
:order_id => "order1",
|
59
|
-
:amount => "1.01",
|
60
|
-
:pan => "4242424242424242",
|
61
|
-
:expdate => "0303",
|
62
|
-
:crypt_type => 7,
|
63
|
-
}
|
64
|
-
|
65
|
-
assert data = @gateway.send(:post_data, 'purchase', params)
|
66
|
-
assert REXML::Document.new(data)
|
67
|
-
assert_equal xml_purchase_fixture.size, data.size
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_capture_is_valid_xml
|
71
|
-
|
72
|
-
params = {
|
73
|
-
:order_id => "order1",
|
74
|
-
:amount => "1.01",
|
75
|
-
:pan => "4242424242424242",
|
76
|
-
:expdate => "0303",
|
77
|
-
:crypt_type => 7,
|
78
|
-
}
|
79
|
-
|
80
|
-
assert data = @gateway.send(:post_data, 'preauth', params)
|
81
|
-
assert REXML::Document.new(data)
|
82
|
-
assert_equal xml_capture_fixture.size, data.size
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_supported_countries
|
86
|
-
assert_equal ['CA'], MonerisGateway.supported_countries
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_supported_card_types
|
90
|
-
assert_equal [:visa, :master, :american_express], MonerisGateway.supported_cardtypes
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_should_raise_error_if_transaction_param_empty_on_credit_request
|
94
|
-
[nil, '', '1234'].each do |invalid_transaction_param|
|
95
|
-
assert_raise(ArgumentError) { @gateway.void(invalid_transaction_param) }
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
private
|
100
|
-
def successful_purchase_response
|
101
|
-
<<-RESPONSE
|
102
|
-
<?xml version="1.0"?>
|
103
|
-
<response>
|
104
|
-
<receipt>
|
105
|
-
<ReceiptId>1026.1</ReceiptId>
|
106
|
-
<ReferenceNum>661221050010170010</ReferenceNum>
|
107
|
-
<ResponseCode>027</ResponseCode>
|
108
|
-
<ISO>01</ISO>
|
109
|
-
<AuthCode>013511</AuthCode>
|
110
|
-
<TransTime>18:41:13</TransTime>
|
111
|
-
<TransDate>2008-01-05</TransDate>
|
112
|
-
<TransType>00</TransType>
|
113
|
-
<Complete>true</Complete>
|
114
|
-
<Message>APPROVED * =</Message>
|
115
|
-
<TransAmount>1.00</TransAmount>
|
116
|
-
<CardType>V</CardType>
|
117
|
-
<TransID>58-0_3</TransID>
|
118
|
-
<TimedOut>false</TimedOut>
|
119
|
-
</receipt>
|
120
|
-
</response>
|
121
|
-
|
122
|
-
RESPONSE
|
123
|
-
end
|
124
|
-
|
125
|
-
def failed_purchase_response
|
126
|
-
<<-RESPONSE
|
127
|
-
<?xml version="1.0"?>
|
128
|
-
<response>
|
129
|
-
<receipt>
|
130
|
-
<ReceiptId>1026.1</ReceiptId>
|
131
|
-
<ReferenceNum>661221050010170010</ReferenceNum>
|
132
|
-
<ResponseCode>481</ResponseCode>
|
133
|
-
<ISO>01</ISO>
|
134
|
-
<AuthCode>013511</AuthCode>
|
135
|
-
<TransTime>18:41:13</TransTime>
|
136
|
-
<TransDate>2008-01-05</TransDate>
|
137
|
-
<TransType>00</TransType>
|
138
|
-
<Complete>true</Complete>
|
139
|
-
<Message>DECLINED * =</Message>
|
140
|
-
<TransAmount>1.00</TransAmount>
|
141
|
-
<CardType>V</CardType>
|
142
|
-
<TransID>97-2-0</TransID>
|
143
|
-
<TimedOut>false</TimedOut>
|
144
|
-
</receipt>
|
145
|
-
</response>
|
146
|
-
|
147
|
-
RESPONSE
|
148
|
-
end
|
149
|
-
|
150
|
-
def xml_purchase_fixture
|
151
|
-
'<request><store_id>store1</store_id><api_token>yesguy</api_token><purchase><amount>1.01</amount><pan>4242424242424242</pan><expdate>0303</expdate><crypt_type>7</crypt_type><order_id>order1</order_id></purchase></request>'
|
152
|
-
end
|
153
|
-
|
154
|
-
def xml_capture_fixture
|
155
|
-
'<request><store_id>store1</store_id><api_token>yesguy</api_token><preauth><amount>1.01</amount><pan>4242424242424242</pan><expdate>0303</expdate><crypt_type>7</crypt_type><order_id>order1</order_id></preauth></request>'
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|