activemerchant 1.2.1 → 1.3.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 +310 -294
- data/CONTRIBUTERS +13 -0
- data/README +55 -31
- data/Rakefile +21 -13
- data/lib/active_merchant.rb +7 -0
- data/lib/active_merchant/billing/avs_result.rb +95 -0
- data/lib/active_merchant/billing/base.rb +8 -3
- data/lib/active_merchant/billing/check.rb +61 -0
- data/lib/active_merchant/billing/credit_card.rb +104 -80
- data/lib/active_merchant/billing/credit_card_formatting.rb +11 -8
- data/lib/active_merchant/billing/credit_card_methods.rb +76 -32
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/expiry_date.rb +28 -0
- data/lib/active_merchant/billing/gateway.rb +47 -111
- data/lib/active_merchant/billing/gateways/authorize_net.rb +508 -121
- data/lib/active_merchant/billing/gateways/bogus.rb +26 -32
- data/lib/active_merchant/billing/gateways/brain_tree.rb +82 -70
- data/lib/active_merchant/billing/gateways/card_stream.rb +43 -15
- data/lib/active_merchant/billing/gateways/cyber_source.rb +9 -29
- data/lib/active_merchant/billing/gateways/data_cash.rb +18 -38
- data/lib/active_merchant/billing/gateways/efsnet.rb +23 -50
- data/lib/active_merchant/billing/gateways/eway.rb +8 -19
- data/lib/active_merchant/billing/gateways/exact.rb +17 -25
- data/lib/active_merchant/billing/gateways/linkpoint.rb +18 -25
- data/lib/active_merchant/billing/gateways/moneris.rb +9 -39
- data/lib/active_merchant/billing/gateways/net_registry.rb +113 -182
- data/lib/active_merchant/billing/gateways/netbilling.rb +168 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +52 -73
- data/lib/active_merchant/billing/gateways/pay_secure.rb +120 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +13 -14
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +55 -37
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -4
- data/lib/active_merchant/billing/gateways/payment_express.rb +11 -30
- data/lib/active_merchant/billing/gateways/paypal.rb +3 -14
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +36 -16
- data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -2
- data/lib/active_merchant/billing/gateways/plugnpay.rb +7 -15
- data/lib/active_merchant/billing/gateways/protx.rb +24 -25
- data/lib/active_merchant/billing/gateways/psigate.rb +34 -71
- data/lib/active_merchant/billing/gateways/psl_card.rb +24 -19
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -24
- data/lib/active_merchant/billing/gateways/realex.rb +7 -19
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +113 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +437 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +5 -14
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +100 -39
- data/lib/active_merchant/billing/gateways/usa_epay.rb +60 -55
- data/lib/active_merchant/billing/gateways/verifi.rb +32 -39
- data/lib/active_merchant/billing/gateways/viaklix.rb +31 -37
- data/lib/active_merchant/billing/integrations.rb +2 -0
- data/lib/active_merchant/billing/integrations/bogus.rb +5 -0
- data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/chronopay.rb +5 -0
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/gestpay.rb +5 -0
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/hi_trust.rb +26 -0
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +57 -0
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +5 -0
- data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/paypal.rb +5 -0
- data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/return.rb +35 -0
- data/lib/active_merchant/billing/integrations/two_checkout.rb +5 -0
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
- data/lib/active_merchant/billing/response.rb +12 -8
- data/lib/active_merchant/lib/posts_data.rb +39 -7
- data/lib/active_merchant/lib/requires_parameters.rb +2 -3
- data/lib/active_merchant/lib/utils.rb +18 -0
- data/lib/active_merchant/lib/validateable.rb +3 -3
- data/lib/support/gateway_support.rb +22 -9
- data/script/destroy +14 -0
- data/script/generate +7 -7
- data/test/fixtures.yml +25 -3
- data/test/remote/gateways/remote_authorize_net_test.rb +145 -0
- data/test/remote/gateways/remote_brain_tree_test.rb +118 -0
- data/test/{remote_tests → remote/gateways}/remote_card_stream_test.rb +56 -68
- data/test/{remote_tests → remote/gateways}/remote_cyber_source_test.rb +21 -32
- data/test/{remote_tests → remote/gateways}/remote_data_cash_test.rb +2 -2
- data/test/{remote_tests → remote/gateways}/remote_efsnet_test.rb +22 -34
- data/test/{remote_tests → remote/gateways}/remote_eway_test.rb +18 -15
- data/test/{remote_tests → remote/gateways}/remote_exact_test.rb +20 -19
- data/test/{remote_tests → remote/gateways}/remote_linkpoint_test.rb +31 -63
- data/test/remote/gateways/remote_moneris_test.rb +82 -0
- data/test/{remote_tests → remote/gateways}/remote_net_registry_test.rb +19 -54
- data/test/remote/gateways/remote_netbilling_test.rb +70 -0
- data/test/{remote_tests → remote/gateways}/remote_pay_junction_test.rb +41 -60
- data/test/remote/gateways/remote_pay_secure_test.rb +39 -0
- data/test/{remote_tests → remote/gateways}/remote_payflow_express_test.rb +2 -2
- data/test/{remote_tests → remote/gateways}/remote_payflow_test.rb +34 -38
- data/test/{remote_tests → remote/gateways}/remote_payflow_uk_test.rb +13 -12
- data/test/{remote_tests → remote/gateways}/remote_payment_express_test.rb +26 -36
- data/test/{remote_tests → remote/gateways}/remote_paypal_express_test.rb +3 -3
- data/test/{remote_tests → remote/gateways}/remote_paypal_test.rb +25 -21
- data/test/{remote_tests → remote/gateways}/remote_plugnpay_test.rb +18 -16
- data/test/{remote_tests → remote/gateways}/remote_protx_test.rb +33 -33
- data/test/remote/gateways/remote_psigate_test.rb +50 -0
- data/test/{remote_tests → remote/gateways}/remote_psl_card_test.rb +27 -26
- data/test/{remote_tests → remote/gateways}/remote_quickpay_test.rb +48 -48
- data/test/{remote_tests → remote/gateways}/remote_realex_test.rb +30 -33
- data/test/remote/gateways/remote_secure_pay_tech_test.rb +37 -0
- data/test/remote/gateways/remote_secure_pay_test.rb +28 -0
- data/test/remote/gateways/remote_skipjack_test.rb +105 -0
- data/test/{remote_tests → remote/gateways}/remote_trans_first_test.rb +7 -10
- data/test/remote/gateways/remote_trust_commerce_test.rb +152 -0
- data/test/{remote_tests → remote/gateways}/remote_usa_epay_test.rb +11 -22
- data/test/{remote_tests → remote/gateways}/remote_verifi_test.rb +27 -27
- data/test/{remote_tests → remote/gateways}/remote_viaklix_test.rb +8 -18
- data/test/{remote_tests → remote/integrations}/remote_gestpay_integration_test.rb +1 -1
- data/test/{remote_tests → remote/integrations}/remote_paypal_integration_test.rb +1 -1
- data/test/test_helper.rb +102 -61
- data/test/unit/avs_result_test.rb +59 -0
- data/test/unit/base_test.rb +33 -39
- data/test/unit/check_test.rb +76 -0
- data/test/unit/credit_card_formatting_test.rb +10 -15
- data/test/unit/credit_card_methods_test.rb +132 -17
- data/test/unit/credit_card_test.rb +157 -228
- data/test/unit/cvv_result_test.rb +33 -0
- data/test/unit/expiry_date_test.rb +21 -0
- data/test/unit/gateways/authorize_net_test.rb +180 -40
- data/test/unit/gateways/bogus_test.rb +2 -3
- data/test/unit/gateways/brain_tree_test.rb +63 -29
- data/test/unit/gateways/card_stream_test.rb +59 -6
- data/test/unit/gateways/cyber_source_test.rb +59 -40
- data/test/unit/gateways/data_cash_test.rb +82 -1
- data/test/unit/gateways/efsnet_test.rb +97 -44
- data/test/unit/gateways/eway_test.rb +55 -42
- data/test/unit/gateways/exact_test.rb +93 -55
- data/test/unit/gateways/gateway_test.rb +7 -0
- data/test/unit/gateways/linkpoint_test.rb +60 -58
- data/test/unit/gateways/moneris_test.rb +67 -76
- data/test/unit/gateways/net_registry_test.rb +351 -419
- data/test/unit/gateways/netbilling_test.rb +54 -0
- data/test/unit/gateways/pay_junction_test.rb +108 -46
- data/test/unit/gateways/pay_secure_test.rb +71 -0
- data/test/unit/gateways/payflow_express_test.rb +0 -8
- data/test/unit/gateways/payflow_test.rb +136 -65
- data/test/unit/gateways/payflow_uk_test.rb +0 -38
- data/test/unit/gateways/payment_express_test.rb +31 -51
- data/test/unit/gateways/paypal_express_test.rb +8 -2
- data/test/unit/gateways/paypal_test.rb +213 -54
- data/test/unit/gateways/plugnpay_test.rb +39 -32
- data/test/unit/gateways/protx_test.rb +45 -33
- data/test/unit/gateways/psigate_test.rb +146 -87
- data/test/unit/gateways/psl_card_test.rb +37 -24
- data/test/unit/gateways/quickpay_test.rb +33 -46
- data/test/unit/gateways/realex_test.rb +32 -31
- data/test/unit/gateways/secure_pay_tech_test.rb +44 -0
- data/test/unit/gateways/secure_pay_test.rb +35 -26
- data/test/unit/gateways/skip_jack_test.rb +125 -0
- data/test/unit/gateways/trans_first_test.rb +24 -37
- data/test/unit/gateways/trust_commerce_test.rb +47 -26
- data/test/unit/gateways/usa_epay_test.rb +52 -41
- data/test/unit/gateways/verifi_test.rb +41 -35
- data/test/unit/gateways/viaklix_test.rb +38 -32
- data/test/unit/generators/test_gateway_generator.rb +46 -0
- data/test/unit/generators/test_generator_helper.rb +20 -0
- data/test/unit/generators/test_integration_generator.rb +53 -0
- data/test/unit/integrations/action_view_helper_test.rb +7 -14
- data/test/unit/integrations/bogus_module_test.rb +4 -0
- data/test/unit/integrations/chronopay_module_test.rb +4 -0
- data/test/unit/integrations/gestpay_module_test.rb +4 -0
- data/test/unit/integrations/helpers/hi_trust_helper_test.rb +16 -0
- data/test/unit/integrations/hi_trust_module_test.rb +13 -0
- data/test/unit/integrations/nochex_module_test.rb +4 -0
- data/test/unit/integrations/notifications/hi_trust_notification_test.rb +38 -0
- data/test/unit/integrations/paypal_module_test.rb +4 -0
- data/test/unit/integrations/returns/chronopay_return_test.rb +11 -0
- data/test/unit/integrations/returns/gestpay_return_test.rb +10 -0
- data/test/unit/integrations/returns/hi_trust_return_test.rb +24 -0
- data/test/unit/integrations/returns/nochex_return_test.rb +10 -0
- data/test/unit/integrations/returns/paypal_return_test.rb +10 -0
- data/test/unit/integrations/returns/return_test.rb +11 -0
- data/test/unit/integrations/returns/two_checkout_return_test.rb +24 -0
- data/test/unit/integrations/two_checkout_module_test.rb +4 -0
- data/test/unit/posts_data_test.rb +86 -0
- data/test/unit/response_test.rb +15 -1
- data/test/unit/utils_test.rb +7 -0
- data/test/unit/validateable_test.rb +10 -6
- metadata +180 -142
- metadata.gz.sig +0 -0
- data/lib/active_merchant/billing/gateways/paypal/api_cert_chain.crt +0 -35
- data/script/generator/base.rb +0 -45
- data/script/generator/generator.rb +0 -24
- data/script/generator/generators/gateway/gateway_generator.rb +0 -14
- data/script/generator/generators/gateway/templates/gateway.rb +0 -73
- data/script/generator/generators/gateway/templates/gateway_test.rb +0 -41
- data/script/generator/generators/gateway/templates/remote_gateway_test.rb +0 -56
- data/script/generator/generators/integration/integration_generator.rb +0 -25
- data/script/generator/generators/integration/templates/helper.rb +0 -34
- data/script/generator/generators/integration/templates/helper_test.rb +0 -54
- data/script/generator/generators/integration/templates/integration.rb +0 -18
- data/script/generator/generators/integration/templates/module_test.rb +0 -9
- data/script/generator/generators/integration/templates/notification.rb +0 -100
- data/script/generator/generators/integration/templates/notification_test.rb +0 -41
- data/script/generator/manifest.rb +0 -20
- data/test/remote_tests/remote_authorize_net_test.rb +0 -113
- data/test/remote_tests/remote_brain_tree_test.rb +0 -78
- data/test/remote_tests/remote_moneris_test.rb +0 -110
- data/test/remote_tests/remote_psigate_test.rb +0 -87
- data/test/remote_tests/remote_secure_pay_test.rb +0 -36
- data/test/remote_tests/remote_trust_commerce_test.rb +0 -136
|
@@ -123,8 +123,7 @@ module ActiveMerchant #:nodoc:
|
|
|
123
123
|
xml.tag! 'n2:cpp-header-border-color', options[:header_border_color] unless options[:header_border_color].blank?
|
|
124
124
|
xml.tag! 'n2:cpp-payflow-color', options[:background_color] unless options[:background_color].blank?
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
# localeCode - String
|
|
126
|
+
xml.tag! 'n2:LocaleCode', options[:locale] unless options[:locale].blank?
|
|
128
127
|
end
|
|
129
128
|
end
|
|
130
129
|
end
|
|
@@ -93,10 +93,6 @@ module ActiveMerchant
|
|
|
93
93
|
SUCCESS_CODES = [ 'pending', 'success' ]
|
|
94
94
|
FAILURE_CODES = [ 'badcard', 'fraud' ]
|
|
95
95
|
|
|
96
|
-
# URL
|
|
97
|
-
attr_reader :response
|
|
98
|
-
attr_reader :options
|
|
99
|
-
|
|
100
96
|
self.default_currency = 'USD'
|
|
101
97
|
self.supported_countries = ['US']
|
|
102
98
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
|
@@ -174,20 +170,16 @@ module ActiveMerchant
|
|
|
174
170
|
|
|
175
171
|
private
|
|
176
172
|
def commit(action, post)
|
|
177
|
-
|
|
178
|
-
return result
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
data = ssl_post(URL, post_data(action, post))
|
|
182
|
-
|
|
183
|
-
@response = parse(data)
|
|
173
|
+
response = parse( ssl_post(URL, post_data(action, post)) )
|
|
184
174
|
|
|
185
|
-
success = SUCCESS_CODES.include?(
|
|
186
|
-
message = success ? 'Success' : message_from(
|
|
175
|
+
success = SUCCESS_CODES.include?(response[:finalstatus])
|
|
176
|
+
message = success ? 'Success' : message_from(response)
|
|
187
177
|
|
|
188
|
-
Response.new(success, message,
|
|
178
|
+
Response.new(success, message, response,
|
|
189
179
|
:test => test?,
|
|
190
|
-
:authorization =>
|
|
180
|
+
:authorization => response[:orderid],
|
|
181
|
+
:avs_result => { :code => response[:avs_code] },
|
|
182
|
+
:cvv_result => response[:cvvresp]
|
|
191
183
|
)
|
|
192
184
|
end
|
|
193
185
|
|
|
@@ -32,12 +32,13 @@ module ActiveMerchant #:nodoc:
|
|
|
32
32
|
|
|
33
33
|
ELECTRON = /^(424519|42496[23]|450875|48440[6-8]|4844[1-5][1-5]|4917[3-5][0-9]|491880)\d{10}(\d{3})?$/
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
AVS_CVV_CODE = {
|
|
36
|
+
"NOTPROVIDED" => nil,
|
|
37
|
+
"NOTCHECKED" => 'X',
|
|
38
|
+
"MATCHED" => 'Y',
|
|
39
|
+
"NOTMATCHED" => 'N'
|
|
40
|
+
}
|
|
41
|
+
|
|
41
42
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :solo, :maestro, :diners_club]
|
|
42
43
|
self.supported_countries = ['GB']
|
|
43
44
|
self.default_currency = 'GBP'
|
|
@@ -212,29 +213,27 @@ module ActiveMerchant #:nodoc:
|
|
|
212
213
|
end
|
|
213
214
|
|
|
214
215
|
def commit(action, parameters)
|
|
215
|
-
|
|
216
|
-
return result
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
data = ssl_post(build_endpoint_url(action), post_data(action, parameters), POST_HEADERS)
|
|
220
|
-
|
|
221
|
-
@response = parse(data)
|
|
216
|
+
response = parse( ssl_post(url_for(action), post_data(action, parameters)) )
|
|
222
217
|
|
|
223
|
-
|
|
224
|
-
message = message_from(@response)
|
|
225
|
-
|
|
226
|
-
authorization = [ parameters[:VendorTxCode],
|
|
227
|
-
@response["VPSTxId"],
|
|
228
|
-
@response["TxAuthNo"],
|
|
229
|
-
@response["SecurityKey"] ].compact.join(";")
|
|
230
|
-
|
|
231
|
-
Response.new(success, message, @response,
|
|
218
|
+
Response.new(response["Status"] == APPROVED, message_from(response), response,
|
|
232
219
|
:test => test?,
|
|
233
|
-
:authorization =>
|
|
220
|
+
:authorization => authorization_from(response, parameters),
|
|
221
|
+
:avs_result => {
|
|
222
|
+
:street_match => AVS_CVV_CODE[ response["AddressResult"] ],
|
|
223
|
+
:postal_match => AVS_CVV_CODE[ response["PostCodeResult"] ],
|
|
224
|
+
},
|
|
225
|
+
:cvv_result => AVS_CVV_CODE[ response["CV2Result"] ]
|
|
234
226
|
)
|
|
235
227
|
end
|
|
236
228
|
|
|
237
|
-
def
|
|
229
|
+
def authorization_from(response, params)
|
|
230
|
+
[ params[:VendorTxCode],
|
|
231
|
+
response["VPSTxId"],
|
|
232
|
+
response["TxAuthNo"],
|
|
233
|
+
response["SecurityKey"] ].compact.join(";")
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def url_for(action)
|
|
238
237
|
simulate ? build_simulator_url(action) : build_url(action)
|
|
239
238
|
end
|
|
240
239
|
|
|
@@ -248,7 +247,7 @@ module ActiveMerchant #:nodoc:
|
|
|
248
247
|
"#{SIMULATOR_URL}/#{endpoint}"
|
|
249
248
|
end
|
|
250
249
|
|
|
251
|
-
def message_from(
|
|
250
|
+
def message_from(response)
|
|
252
251
|
if response["Status"] == APPROVED
|
|
253
252
|
return 'Success'
|
|
254
253
|
else
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#
|
|
10
10
|
# twenty = 2000
|
|
11
11
|
# gateway = PsigateGateway.new(
|
|
12
|
-
# :
|
|
12
|
+
# :login => 'teststore',
|
|
13
13
|
# :password => 'psigate1234'
|
|
14
14
|
# )
|
|
15
15
|
#
|
|
@@ -20,16 +20,18 @@
|
|
|
20
20
|
# :first_name => 'Longbob',
|
|
21
21
|
# :last_name => 'Longsen'
|
|
22
22
|
# )
|
|
23
|
-
# response = @gateway.authorize(twenty, creditcard,
|
|
23
|
+
# response = @gateway.authorize(twenty, creditcard,
|
|
24
|
+
# :order_id => 1234,
|
|
24
25
|
# :billing_address => {
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
26
|
+
# :address1 => '123 fairweather Lane',
|
|
27
|
+
# :address2 => 'Apt B',
|
|
28
|
+
# :city => 'New York',
|
|
29
|
+
# :state => 'NY',
|
|
30
|
+
# :country => 'U.S.A.',
|
|
31
|
+
# :zip => '10010'
|
|
32
|
+
# },
|
|
31
33
|
# :email => 'jack@yahoo.com'
|
|
32
|
-
#
|
|
34
|
+
# )
|
|
33
35
|
|
|
34
36
|
require 'rexml/document'
|
|
35
37
|
|
|
@@ -37,12 +39,6 @@ module ActiveMerchant #:nodoc:
|
|
|
37
39
|
module Billing #:nodoc:
|
|
38
40
|
|
|
39
41
|
class PsigateGateway < Gateway
|
|
40
|
-
|
|
41
|
-
# URL
|
|
42
|
-
attr_reader :url
|
|
43
|
-
attr_reader :response
|
|
44
|
-
attr_reader :options
|
|
45
|
-
|
|
46
42
|
TEST_URL = 'https://dev.psigate.com:7989/Messenger/XMLMessenger'
|
|
47
43
|
LIVE_URL = 'https://secure.psigate.com:7934/Messenger/XMLMessenger'
|
|
48
44
|
|
|
@@ -50,18 +46,13 @@ module ActiveMerchant #:nodoc:
|
|
|
50
46
|
self.supported_countries = ['CA']
|
|
51
47
|
self.homepage_url = 'http://www.psigate.com/'
|
|
52
48
|
self.display_name = 'Psigate'
|
|
53
|
-
|
|
49
|
+
|
|
50
|
+
SUCCESS_MESSAGE = 'Success'
|
|
51
|
+
FAILURE_MESSAGE = 'The transaction was declined'
|
|
54
52
|
|
|
55
53
|
def initialize(options = {})
|
|
56
54
|
requires!(options, :login, :password)
|
|
57
|
-
|
|
58
|
-
options[:store_id] ||= options[:login]
|
|
59
|
-
|
|
60
|
-
# these are the defaults for the psigate test server
|
|
61
|
-
@options = {
|
|
62
|
-
:store_id => "teststore",
|
|
63
|
-
:password => "testpass",
|
|
64
|
-
}.update(options)
|
|
55
|
+
@options = options
|
|
65
56
|
super
|
|
66
57
|
end
|
|
67
58
|
|
|
@@ -95,49 +86,21 @@ module ActiveMerchant #:nodoc:
|
|
|
95
86
|
private
|
|
96
87
|
|
|
97
88
|
def commit(money, creditcard, options = {})
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Response.new(success, message, @response, :test => test?, :authorization => response[:orderid])
|
|
89
|
+
response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, post_data(money, creditcard, options)))
|
|
90
|
+
|
|
91
|
+
Response.new(successful?(response), message_from(response), response,
|
|
92
|
+
:test => test?,
|
|
93
|
+
:authorization => response[:orderid],
|
|
94
|
+
:avs_result => { :code => response[:avsresult] },
|
|
95
|
+
:cvv_result => response[:cardidresult]
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def successful?(response)
|
|
100
|
+
response[:approved] == "APPROVED"
|
|
111
101
|
end
|
|
112
102
|
|
|
113
|
-
# Parse psigate response xml into a convinient hash
|
|
114
103
|
def parse(xml)
|
|
115
|
-
# <?xml version="1.0" encoding="UTF-8"?>
|
|
116
|
-
# <Result>
|
|
117
|
-
# <TransTime>Tue Jun 27 22:19:58 EDT 2006</TransTime>
|
|
118
|
-
# <OrderID>1004</OrderID>
|
|
119
|
-
# <TransactionType>POSTAUTH</TransactionType>
|
|
120
|
-
# <Approved>APPROVED</Approved>
|
|
121
|
-
# <ReturnCode>Y:123456:0abcdef:M:X:NNN</ReturnCode>
|
|
122
|
-
# <ErrMsg></ErrMsg>
|
|
123
|
-
# <TaxTotal>0.00</TaxTotal>
|
|
124
|
-
# <ShipTotal>0.00</ShipTotal>
|
|
125
|
-
# <SubTotal>20.00</SubTotal>
|
|
126
|
-
# <FullTotal>20.00</FullTotal>
|
|
127
|
-
# <PaymentType>CC</PaymentType>
|
|
128
|
-
# <CardNumber>......1111</CardNumber>
|
|
129
|
-
# <TransRefNumber>1bd6f76ad1a25804</TransRefNumber>
|
|
130
|
-
# <CardIDResult>M</CardIDResult>
|
|
131
|
-
# <AVSResult>X</AVSResult>
|
|
132
|
-
# <CardAuthNumber>123456</CardAuthNumber>
|
|
133
|
-
# <CardRefNumber>0abcdef</CardRefNumber>
|
|
134
|
-
# <CardType>VISA</CardType>
|
|
135
|
-
# <IPResult>NNN</IPResult>
|
|
136
|
-
# <IPCountry>UN</IPCountry>
|
|
137
|
-
# <IPRegion>UNKNOWN</IPRegion>
|
|
138
|
-
# <IPCity>UNKNOWN</IPCity>
|
|
139
|
-
# </Result>
|
|
140
|
-
|
|
141
104
|
response = {:message => "Global Error Receipt", :complete => false}
|
|
142
105
|
|
|
143
106
|
xml = REXML::Document.new(xml)
|
|
@@ -150,12 +113,12 @@ module ActiveMerchant #:nodoc:
|
|
|
150
113
|
response
|
|
151
114
|
end
|
|
152
115
|
|
|
153
|
-
def post_data(
|
|
116
|
+
def post_data(money, creditcard, options)
|
|
154
117
|
xml = REXML::Document.new
|
|
155
118
|
xml << REXML::XMLDecl.new
|
|
156
119
|
root = xml.add_element("Order")
|
|
157
120
|
|
|
158
|
-
for key, value in parameters
|
|
121
|
+
for key, value in parameters(money, creditcard, options)
|
|
159
122
|
root.add_element(key.to_s).text = value if value
|
|
160
123
|
end
|
|
161
124
|
|
|
@@ -167,7 +130,7 @@ module ActiveMerchant #:nodoc:
|
|
|
167
130
|
def parameters(money, creditcard, options = {})
|
|
168
131
|
params = {
|
|
169
132
|
# General order paramters
|
|
170
|
-
:StoreID => @options[:
|
|
133
|
+
:StoreID => @options[:login],
|
|
171
134
|
:Passphrase => @options[:password],
|
|
172
135
|
:TestResult => options[:test_result],
|
|
173
136
|
:OrderID => options[:order_id],
|
|
@@ -213,7 +176,7 @@ module ActiveMerchant #:nodoc:
|
|
|
213
176
|
params[:Bcompany] = address[:company] unless address[:company].blank?
|
|
214
177
|
end
|
|
215
178
|
|
|
216
|
-
if address = options[:shipping_address]
|
|
179
|
+
if address = options[:shipping_address]
|
|
217
180
|
params[:Sname] = address[:name] || creditcard.name
|
|
218
181
|
params[:Saddress1] = address[:address1] unless address[:address1].blank?
|
|
219
182
|
params[:Saddress2] = address[:address2] unless address[:address2].blank?
|
|
@@ -227,11 +190,11 @@ module ActiveMerchant #:nodoc:
|
|
|
227
190
|
return params
|
|
228
191
|
end
|
|
229
192
|
|
|
230
|
-
def
|
|
193
|
+
def message_from(response)
|
|
231
194
|
if response[:approved] == "APPROVED"
|
|
232
|
-
return
|
|
195
|
+
return SUCCESS_MESSAGE
|
|
233
196
|
else
|
|
234
|
-
return
|
|
197
|
+
return FAILURE_MESSAGE if response[:errmsg].blank?
|
|
235
198
|
return response[:errmsg].gsub(/[^\w]/, ' ').split.join(" ").capitalize
|
|
236
199
|
end
|
|
237
200
|
end
|
|
@@ -14,8 +14,6 @@ module ActiveMerchant
|
|
|
14
14
|
# directly to the gateway then the appropriate cardholder present or not present message
|
|
15
15
|
# type should be used rather than the ‘E’ equivalent.
|
|
16
16
|
# -The CV2 / AVS policies are set up with the account settings when signing up for an account
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
17
|
class PslCardGateway < Gateway
|
|
20
18
|
self.money_format = :cents
|
|
21
19
|
self.default_currency = 'GBP'
|
|
@@ -37,10 +35,6 @@ module ActiveMerchant
|
|
|
37
35
|
# the test account when testing...
|
|
38
36
|
URL = 'https://pslcard3.paymentsolutionsltd.com/secure/transact.asp?'
|
|
39
37
|
|
|
40
|
-
attr_reader :url
|
|
41
|
-
attr_reader :response
|
|
42
|
-
attr_reader :options
|
|
43
|
-
|
|
44
38
|
# eCommerce sale transaction, details keyed by merchant or cardholder
|
|
45
39
|
MESSAGE_TYPE = 'ESALE_KEYED'
|
|
46
40
|
|
|
@@ -70,6 +64,24 @@ module ActiveMerchant
|
|
|
70
64
|
#taken.
|
|
71
65
|
NOMINAL_AMOUNT = 101
|
|
72
66
|
|
|
67
|
+
AVS_CODE = {
|
|
68
|
+
"ALL MATCH" => 'Y',
|
|
69
|
+
"SECURITY CODE MATCH ONLY" => 'N',
|
|
70
|
+
"ADDRESS MATCH ONLY" => 'Y',
|
|
71
|
+
"NO DATA MATCHES" => 'N',
|
|
72
|
+
"DATA NOT CHECKED" => 'R',
|
|
73
|
+
"SECURITY CHECKS NOT SUPPORTED" => 'X'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
CVV_CODE = {
|
|
77
|
+
"ALL MATCH" => 'M',
|
|
78
|
+
"SECURITY CODE MATCH ONLY" => 'M',
|
|
79
|
+
"ADDRESS MATCH ONLY" => 'N',
|
|
80
|
+
"NO DATA MATCHES" => 'N',
|
|
81
|
+
"DATA NOT CHECKED" => 'P',
|
|
82
|
+
"SECURITY CHECKS NOT SUPPORTED" => 'X'
|
|
83
|
+
}
|
|
84
|
+
|
|
73
85
|
# Create a new PslCardGateway
|
|
74
86
|
#
|
|
75
87
|
# The gateway requires that a valid :login be passed in the options hash
|
|
@@ -251,20 +263,13 @@ module ActiveMerchant
|
|
|
251
263
|
# - ActiveMerchant::Billing::Response object
|
|
252
264
|
#
|
|
253
265
|
def commit(request)
|
|
254
|
-
|
|
255
|
-
return result
|
|
256
|
-
end
|
|
257
|
-
|
|
258
|
-
result = ssl_post(URL, post_data(request))
|
|
259
|
-
|
|
260
|
-
@response = parse(result)
|
|
261
|
-
|
|
262
|
-
success = @response[:ResponseCode] == APPROVED
|
|
263
|
-
message = @response[:Message]
|
|
266
|
+
response = parse( ssl_post(URL, post_data(request)) )
|
|
264
267
|
|
|
265
|
-
Response.new(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
+
Response.new(response[:ResponseCode] == APPROVED, response[:Message], response,
|
|
269
|
+
:test => test?,
|
|
270
|
+
:authorization => response[:CrossReference],
|
|
271
|
+
:cvv_result => CVV_CODE[response[:AVSCV2Check]],
|
|
272
|
+
:avs_result => { :code => AVS_CODE[response[:AVSCV2Check]] }
|
|
268
273
|
)
|
|
269
274
|
end
|
|
270
275
|
|
|
@@ -5,11 +5,7 @@ module ActiveMerchant #:nodoc:
|
|
|
5
5
|
module Billing #:nodoc:
|
|
6
6
|
class QuickpayGateway < Gateway
|
|
7
7
|
URL = 'https://secure.quickpay.dk/transaction.php'
|
|
8
|
-
|
|
9
|
-
attr_reader :url
|
|
10
|
-
attr_reader :response
|
|
11
|
-
attr_reader :options
|
|
12
|
-
|
|
8
|
+
|
|
13
9
|
self.default_currency = 'DKK'
|
|
14
10
|
self.money_format = :cents
|
|
15
11
|
self.supported_cardtypes = [ :dankort, :forbrugsforeningen, :visa, :master, :american_express, :diners_club, :jcb, :maestro ]
|
|
@@ -18,7 +14,7 @@ module ActiveMerchant #:nodoc:
|
|
|
18
14
|
self.display_name = 'Quickpay'
|
|
19
15
|
|
|
20
16
|
TRANSACTIONS = {
|
|
21
|
-
:authorization
|
|
17
|
+
:authorization => '1100',
|
|
22
18
|
:capture => '1220',
|
|
23
19
|
:void => '1420',
|
|
24
20
|
:credit => 'credit'
|
|
@@ -63,10 +59,6 @@ module ActiveMerchant #:nodoc:
|
|
|
63
59
|
end
|
|
64
60
|
|
|
65
61
|
def purchase(money, creditcard, options = {})
|
|
66
|
-
if result = test_result_from_cc_number(creditcard.number)
|
|
67
|
-
return result
|
|
68
|
-
end
|
|
69
|
-
|
|
70
62
|
auth = authorize(money, creditcard, options)
|
|
71
63
|
auth.success? ? capture(money, auth.authorization) : auth
|
|
72
64
|
end
|
|
@@ -120,23 +112,17 @@ module ActiveMerchant #:nodoc:
|
|
|
120
112
|
end
|
|
121
113
|
|
|
122
114
|
def commit(action, params)
|
|
115
|
+
response = parse(ssl_post(URL, post_data(action, params)))
|
|
123
116
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
data = ssl_post URL, post_data(action, params)
|
|
129
|
-
|
|
130
|
-
@response = parse(data)
|
|
131
|
-
|
|
132
|
-
success = @response[:qpstat] == APPROVED
|
|
133
|
-
message = message_from(@response)
|
|
134
|
-
|
|
135
|
-
Response.new(success, message, @response,
|
|
136
|
-
:test => test?,
|
|
137
|
-
:authorization => @response[:transaction]
|
|
117
|
+
Response.new(successful?(response), message_from(response), response,
|
|
118
|
+
:test => test?,
|
|
119
|
+
:authorization => response[:transaction]
|
|
138
120
|
)
|
|
139
121
|
end
|
|
122
|
+
|
|
123
|
+
def successful?(response)
|
|
124
|
+
response[:qpstat] == APPROVED
|
|
125
|
+
end
|
|
140
126
|
|
|
141
127
|
def parse(data)
|
|
142
128
|
response = {}
|
|
@@ -42,10 +42,6 @@ module ActiveMerchant
|
|
|
42
42
|
BANK_ERROR = REALEX_ERROR = "Gateway is in maintenance. Please try again later."
|
|
43
43
|
ERROR = CLIENT_DEACTIVATED = "Gateway Error"
|
|
44
44
|
|
|
45
|
-
attr_reader :url
|
|
46
|
-
attr_reader :response
|
|
47
|
-
attr_reader :options
|
|
48
|
-
|
|
49
45
|
def initialize(options = {})
|
|
50
46
|
requires!(options, :login, :password)
|
|
51
47
|
@options = options
|
|
@@ -60,21 +56,13 @@ module ActiveMerchant
|
|
|
60
56
|
end
|
|
61
57
|
|
|
62
58
|
private
|
|
63
|
-
def commit(request)
|
|
64
|
-
|
|
65
|
-
return result
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
data = ssl_post(URL, request)
|
|
69
|
-
|
|
70
|
-
@response = parse(data)
|
|
59
|
+
def commit(request)
|
|
60
|
+
response = parse(ssl_post(URL, request))
|
|
71
61
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
:test => test,
|
|
77
|
-
:authorization => @response[:authcode]
|
|
62
|
+
Response.new(response[:result] == "00", message_from(response), response,
|
|
63
|
+
:test => response[:message] =~ /\[ test system \]/,
|
|
64
|
+
:authorization => response[:authcode],
|
|
65
|
+
:cvv_result => response[:cvnresult]
|
|
78
66
|
)
|
|
79
67
|
end
|
|
80
68
|
|
|
@@ -137,7 +125,7 @@ module ActiveMerchant
|
|
|
137
125
|
end
|
|
138
126
|
|
|
139
127
|
billing_address = options[:billing_address] || options[:address] || {}
|
|
140
|
-
shipping_address = options[:shipping_address] ||
|
|
128
|
+
shipping_address = options[:shipping_address] || {}
|
|
141
129
|
|
|
142
130
|
xml.tag! 'tssinfo' do
|
|
143
131
|
xml.tag! 'address', 'type' => 'billing' do
|