activemerchant 1.4.2 → 1.5.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 +78 -0
- data/{CONTRIBUTERS → CONTRIBUTORS} +44 -0
- data/{README → README.rdoc} +4 -1
- data/Rakefile +7 -13
- data/lib/active_merchant.rb +11 -21
- data/lib/active_merchant/billing/avs_result.rb +13 -10
- data/lib/active_merchant/billing/base.rb +2 -2
- data/lib/active_merchant/billing/check.rb +1 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
- data/lib/active_merchant/billing/expiry_date.rb +10 -4
- data/lib/active_merchant/billing/gateway.rb +7 -6
- data/lib/active_merchant/billing/gateways.rb +18 -3
- data/lib/active_merchant/billing/gateways/authorize_net.rb +20 -12
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +40 -6
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb.orig +736 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +6 -211
- data/lib/active_merchant/billing/gateways/data_cash.rb +5 -7
- data/lib/active_merchant/billing/gateways/elavon.rb +134 -0
- data/lib/active_merchant/billing/gateways/eway.rb +7 -2
- data/lib/active_merchant/billing/gateways/first_pay.rb +172 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +164 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +270 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +65 -12
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +154 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +283 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +12 -6
- data/lib/active_merchant/billing/gateways/ogone.rb +279 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +20 -32
- data/lib/active_merchant/billing/gateways/paypal.rb +22 -9
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +4 -6
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +7 -1
- data/lib/active_merchant/billing/gateways/{protx.rb → sage_pay.rb} +60 -35
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +144 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/skip_jack.rb +23 -10
- data/lib/active_merchant/billing/gateways/smart_ps.rb +265 -0
- data/lib/active_merchant/billing/gateways/transax.rb +25 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +38 -14
- data/lib/active_merchant/billing/gateways/wirecard.rb +15 -2
- data/lib/active_merchant/billing/integrations.rb +18 -11
- data/lib/active_merchant/billing/integrations/bogus.rb +4 -3
- data/lib/active_merchant/billing/integrations/chronopay.rb +4 -3
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +3 -1
- data/lib/active_merchant/billing/integrations/gestpay.rb +4 -5
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +3 -1
- data/lib/active_merchant/billing/integrations/hi_trust.rb +4 -3
- data/lib/active_merchant/billing/integrations/nochex.rb +4 -3
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +1 -1
- data/lib/active_merchant/billing/integrations/paypal.rb +3 -4
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +9 -8
- data/lib/active_merchant/billing/integrations/quickpay.rb +2 -3
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +1 -1
- data/lib/active_merchant/billing/integrations/two_checkout.rb +3 -3
- data/lib/active_merchant/lib/connection.rb +170 -0
- data/lib/active_merchant/lib/country.rb +4 -1
- data/lib/active_merchant/lib/posts_data.rb +22 -84
- data/test/fixtures.yml +39 -1
- data/test/remote/gateways/remote_authorize_net_cim_test.rb +2 -1
- data/test/remote/gateways/remote_authorize_net_test.rb +1 -1
- data/test/remote/gateways/remote_beanstream_interac_test.rb +1 -1
- data/test/remote/gateways/remote_beanstream_test.rb +1 -1
- data/test/remote/gateways/remote_braintree_test.rb +2 -9
- data/test/remote/gateways/remote_card_stream_test.rb +1 -1
- data/test/remote/gateways/remote_cyber_source_test.rb +1 -1
- data/test/remote/gateways/remote_data_cash_test.rb +1 -2
- data/test/remote/gateways/remote_efsnet_test.rb +1 -1
- data/test/remote/gateways/remote_elavon_test.rb +66 -0
- data/test/remote/gateways/remote_eway_test.rb +1 -1
- data/test/remote/gateways/remote_exact_test.rb +1 -1
- data/test/remote/gateways/remote_first_pay_test.rb +87 -0
- data/test/remote/gateways/remote_instapay_test.rb +61 -0
- data/test/remote/gateways/remote_jetpay_test.rb +103 -0
- data/test/remote/gateways/remote_linkpoint_test.rb +11 -2
- data/test/remote/gateways/remote_merchant_e_solutions_test.rb +173 -0
- data/test/remote/gateways/remote_merchant_ware_test.rb +113 -0
- data/test/remote/gateways/remote_modern_payments_cim_test.rb +1 -1
- data/test/remote/gateways/remote_modern_payments_test.rb +23 -9
- data/test/remote/gateways/remote_moneris_test.rb +1 -1
- data/test/remote/gateways/remote_net_registry_test.rb +1 -1
- data/test/remote/gateways/remote_netbilling_test.rb +1 -1
- data/test/remote/gateways/remote_ogone_test.rb +115 -0
- data/test/remote/gateways/remote_pay_junction_test.rb +1 -1
- data/test/remote/gateways/remote_pay_secure_test.rb +1 -1
- data/test/remote/gateways/remote_payflow_express_test.rb +1 -1
- data/test/remote/gateways/remote_payflow_test.rb +1 -1
- data/test/remote/gateways/remote_payflow_uk_test.rb +1 -1
- data/test/remote/gateways/remote_payment_express_test.rb +17 -7
- data/test/remote/gateways/remote_paypal_express_test.rb +1 -1
- data/test/remote/gateways/remote_paypal_test.rb +26 -2
- data/test/remote/gateways/remote_plugnpay_test.rb +1 -1
- data/test/remote/gateways/remote_psigate_test.rb +1 -1
- data/test/remote/gateways/remote_psl_card_test.rb +1 -3
- data/test/remote/gateways/remote_quickpay_test.rb +1 -1
- data/test/remote/gateways/remote_realex_test.rb +1 -1
- data/test/remote/gateways/remote_sage_bankcard_test.rb +1 -1
- data/test/remote/gateways/remote_sage_pay_test.rb +219 -0
- data/test/remote/gateways/remote_sage_test.rb +1 -1
- data/test/remote/gateways/remote_sage_virtual_check_test.rb +1 -1
- data/test/remote/gateways/remote_sallie_mae_test.rb +51 -0
- data/test/remote/gateways/remote_secure_pay_au_test.rb +1 -1
- data/test/remote/gateways/remote_secure_pay_tech_test.rb +1 -1
- data/test/remote/gateways/remote_secure_pay_test.rb +2 -2
- data/test/remote/gateways/remote_skipjack_test.rb +1 -1
- data/test/remote/gateways/remote_trans_first_test.rb +1 -1
- data/test/remote/gateways/remote_transax_test.rb +112 -0
- data/test/remote/gateways/remote_trust_commerce_test.rb +1 -1
- data/test/remote/gateways/remote_usa_epay_test.rb +1 -1
- data/test/remote/gateways/remote_verifi_test.rb +1 -1
- data/test/remote/gateways/remote_viaklix_test.rb +1 -1
- data/test/remote/gateways/remote_wirecard_test.rb +34 -0
- data/test/remote/integrations/remote_gestpay_integration_test.rb +1 -1
- data/test/remote/integrations/remote_paypal_integration_test.rb +1 -1
- data/test/test_helper.rb +81 -89
- data/test/unit/avs_result_test.rb +1 -1
- data/test/unit/base_test.rb +1 -2
- data/test/unit/check_test.rb +1 -1
- data/test/unit/connection_test.rb +129 -0
- data/test/unit/country_code_test.rb +1 -1
- data/test/unit/country_test.rb +1 -1
- data/test/unit/credit_card_formatting_test.rb +1 -1
- data/test/unit/credit_card_methods_test.rb +10 -1
- data/test/unit/credit_card_test.rb +1 -1
- data/test/unit/cvv_result_test.rb +1 -1
- data/test/unit/expiry_date_test.rb +13 -2
- data/test/unit/gateways/authorize_net_cim_test.rb +39 -1
- data/test/unit/gateways/authorize_net_test.rb +1 -1
- data/test/unit/gateways/beanstream_interac_test.rb +1 -1
- data/test/unit/gateways/beanstream_test.rb +1 -1
- data/test/unit/gateways/bogus_test.rb +1 -1
- data/test/unit/gateways/braintree_test.rb +16 -14
- data/test/unit/gateways/card_stream_test.rb +1 -1
- data/test/unit/gateways/cyber_source_test.rb +1 -1
- data/test/unit/gateways/data_cash_test.rb +2 -1
- data/test/unit/gateways/efsnet_test.rb +1 -1
- data/test/unit/gateways/elavon_test.rb +139 -0
- data/test/unit/gateways/eway_test.rb +1 -1
- data/test/unit/gateways/exact_test.rb +1 -1
- data/test/unit/gateways/first_pay_test.rb +125 -0
- data/test/unit/gateways/gateway_test.rb +1 -1
- data/test/unit/gateways/instapay_test.rb +102 -0
- data/test/unit/gateways/jetpay_test.rb +185 -0
- data/test/unit/gateways/linkpoint_test.rb +37 -7
- data/test/unit/gateways/merchant_e_solutions_test.rb +169 -0
- data/test/unit/gateways/merchant_ware_test.rb +188 -0
- data/test/unit/gateways/modern_payments_cim_test.rb +25 -34
- data/test/unit/gateways/moneris_test.rb +1 -1
- data/test/unit/gateways/net_registry_test.rb +1 -1
- data/test/unit/gateways/netbilling_test.rb +1 -1
- data/test/unit/gateways/ogone_test.rb +319 -0
- data/test/unit/gateways/pay_junction_test.rb +1 -1
- data/test/unit/gateways/pay_secure_test.rb +1 -1
- data/test/unit/gateways/payflow_express_test.rb +2 -2
- data/test/unit/gateways/payflow_express_uk_test.rb +73 -1
- data/test/unit/gateways/payflow_test.rb +1 -1
- data/test/unit/gateways/payflow_uk_test.rb +1 -1
- data/test/unit/gateways/payment_express_test.rb +3 -3
- data/test/unit/gateways/paypal_express_test.rb +1 -1
- data/test/unit/gateways/paypal_test.rb +50 -1
- data/test/unit/gateways/plugnpay_test.rb +1 -1
- data/test/unit/gateways/psigate_test.rb +1 -1
- data/test/unit/gateways/psl_card_test.rb +1 -1
- data/test/unit/gateways/quickpay_test.rb +1 -1
- data/test/unit/gateways/realex_test.rb +1 -1
- data/test/unit/gateways/sage_bankcard_test.rb +36 -2
- data/test/unit/gateways/{protx_test.rb → sage_pay_test.rb} +49 -32
- data/test/unit/gateways/sage_virtual_check_test.rb +1 -1
- data/test/unit/gateways/sallie_mae_test.rb +53 -0
- data/test/unit/gateways/secure_pay_au_test.rb +1 -1
- data/test/unit/gateways/secure_pay_tech_test.rb +1 -1
- data/test/unit/gateways/secure_pay_test.rb +24 -10
- data/test/unit/gateways/skip_jack_test.rb +81 -1
- data/test/unit/gateways/trans_first_test.rb +1 -1
- data/test/unit/gateways/trust_commerce_test.rb +1 -1
- data/test/unit/gateways/usa_epay_test.rb +1 -1
- data/test/unit/gateways/verifi_test.rb +1 -1
- data/test/unit/gateways/viaklix_test.rb +1 -1
- data/test/unit/gateways/wirecard_test.rb +19 -1
- data/test/unit/generators/test_generator_helper.rb +1 -1
- data/test/unit/integrations/action_view_helper_test.rb +1 -1
- data/test/unit/integrations/bogus_module_test.rb +1 -1
- data/test/unit/integrations/chronopay_module_test.rb +1 -1
- data/test/unit/integrations/gestpay_module_test.rb +1 -1
- data/test/unit/integrations/helpers/bogus_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/chronopay_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/gestpay_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/hi_trust_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/nochex_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/paypal_helper_test.rb +11 -2
- data/test/unit/integrations/helpers/quickpay_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/two_checkout_helper_test.rb +1 -1
- data/test/unit/integrations/hi_trust_module_test.rb +1 -1
- data/test/unit/integrations/nochex_module_test.rb +1 -1
- data/test/unit/integrations/notifications/chronopay_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/gestpay_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/hi_trust_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/nochex_notification_test.rb +2 -2
- data/test/unit/integrations/notifications/notification_test.rb +1 -1
- data/test/unit/integrations/notifications/paypal_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/quickpay_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/two_checkout_notification_test.rb +1 -1
- data/test/unit/integrations/paypal_module_test.rb +1 -1
- data/test/unit/integrations/quickpay_module_test.rb +1 -1
- data/test/unit/integrations/returns/chronopay_return_test.rb +1 -1
- data/test/unit/integrations/returns/gestpay_return_test.rb +1 -1
- data/test/unit/integrations/returns/hi_trust_return_test.rb +1 -1
- data/test/unit/integrations/returns/nochex_return_test.rb +1 -1
- data/test/unit/integrations/returns/paypal_return_test.rb +1 -1
- data/test/unit/integrations/returns/return_test.rb +1 -1
- data/test/unit/integrations/returns/two_checkout_return_test.rb +1 -1
- data/test/unit/integrations/two_checkout_module_test.rb +1 -1
- data/test/unit/post_data_test.rb +1 -1
- data/test/unit/posts_data_test.rb +14 -66
- data/test/unit/response_test.rb +1 -1
- data/test/unit/utils_test.rb +1 -1
- data/test/unit/validateable_test.rb +1 -1
- metadata +41 -45
- metadata.gz.sig +0 -0
- data/test/extra/binding_of_caller.rb +0 -80
- data/test/extra/breakpoint.rb +0 -547
- data/test/remote/gateways/remote_protx_test.rb +0 -184
@@ -0,0 +1,265 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'check.rb')
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class SmartPs < Gateway #:nodoc:
|
6
|
+
|
7
|
+
##
|
8
|
+
# This is the base gateway for processors who use the smartPS processing system
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
requires!(options, :login, :password)
|
12
|
+
@options = options
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
# Pass :store => true in the options to store the
|
17
|
+
# payment info at the gateway and get a generated
|
18
|
+
# customer_vault_id in the response.
|
19
|
+
# Pass :store => some_number_or_string to specify the
|
20
|
+
# customer_vault_id the gateway should use (make sure it's
|
21
|
+
# unique).
|
22
|
+
def authorize(money, creditcard, options = {})
|
23
|
+
post = {}
|
24
|
+
add_invoice(post, options)
|
25
|
+
add_payment_source(post, creditcard,options)
|
26
|
+
add_address(post, options[:billing_address] || options[:address])
|
27
|
+
add_address(post, options[:shipping_address], "shipping")
|
28
|
+
add_customer_data(post, options)
|
29
|
+
add_currency(post, money, options)
|
30
|
+
add_processor(post, options)
|
31
|
+
commit('auth', money, post)
|
32
|
+
end
|
33
|
+
|
34
|
+
def purchase(money, payment_source, options = {})
|
35
|
+
post = {}
|
36
|
+
add_invoice(post, options)
|
37
|
+
add_payment_source(post, payment_source, options)
|
38
|
+
add_address(post, options[:billing_address] || options[:address])
|
39
|
+
add_address(post, options[:shipping_address], "shipping")
|
40
|
+
add_customer_data(post, options)
|
41
|
+
add_currency(post, money, options)
|
42
|
+
add_processor(post, options)
|
43
|
+
commit('sale', money, post)
|
44
|
+
end
|
45
|
+
|
46
|
+
def capture(money, authorization, options = {})
|
47
|
+
post ={}
|
48
|
+
post[:transactionid] = authorization
|
49
|
+
commit('capture', money, post)
|
50
|
+
end
|
51
|
+
|
52
|
+
def void(authorization, options = {})
|
53
|
+
post ={}
|
54
|
+
post[:transactionid] = authorization
|
55
|
+
commit('void', nil, post)
|
56
|
+
end
|
57
|
+
|
58
|
+
def credit(money, payment_source, options = {})
|
59
|
+
post = {}
|
60
|
+
add_invoice(post, options)
|
61
|
+
add_payment_source(post, payment_source, options)
|
62
|
+
add_address(post, options[:billing_address] || options[:address])
|
63
|
+
add_customer_data(post, options)
|
64
|
+
add_sku(post,options)
|
65
|
+
add_currency(post, money, options)
|
66
|
+
add_processor(post, options)
|
67
|
+
commit('credit', money, post)
|
68
|
+
end
|
69
|
+
|
70
|
+
def refund(auth, options = {})
|
71
|
+
post = {}
|
72
|
+
add_transaction(post, auth)
|
73
|
+
commit('refund', options.delete(:amount), post)
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
# Update the values (such as CC expiration) stored at
|
78
|
+
# the gateway. The CC number must be supplied in the
|
79
|
+
# CreditCard object.
|
80
|
+
def update(vault_id, creditcard, options = {})
|
81
|
+
post = {}
|
82
|
+
post[:customer_vault] = "update_customer"
|
83
|
+
add_customer_vault_id(post, vault_id)
|
84
|
+
add_creditcard(post, creditcard, options)
|
85
|
+
add_address(post, options[:billing_address] || options[:address])
|
86
|
+
add_customer_data(post, options)
|
87
|
+
|
88
|
+
commit(nil, nil, post)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Amend an existing transaction
|
92
|
+
def amend(auth, options = {})
|
93
|
+
post = {}
|
94
|
+
add_invoice(post, options)
|
95
|
+
add_transaction(post, auth)
|
96
|
+
commit('update', nil, post)
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
def delete(vault_id)
|
101
|
+
post = {}
|
102
|
+
post[:customer_vault] = "delete_customer"
|
103
|
+
add_customer_vault_id(post, vault_id)
|
104
|
+
commit(nil, nil, post)
|
105
|
+
end
|
106
|
+
|
107
|
+
# To match the other stored-value gateways, like TrustCommerce,
|
108
|
+
# store and unstore need to be defined
|
109
|
+
def store(payment_source, options = {})
|
110
|
+
post = {}
|
111
|
+
billing_id = options.delete(:billing_id).to_s || true
|
112
|
+
add_payment_source(post, payment_source, :store => billing_id)
|
113
|
+
add_address(post, options[:billing_address] || options[:address])
|
114
|
+
add_customer_data(post, options)
|
115
|
+
commit(nil, nil, post)
|
116
|
+
end
|
117
|
+
|
118
|
+
alias_method :unstore, :delete
|
119
|
+
|
120
|
+
private
|
121
|
+
def add_customer_data(post, options)
|
122
|
+
if options.has_key? :email
|
123
|
+
post[:email] = options[:email]
|
124
|
+
end
|
125
|
+
|
126
|
+
if options.has_key? :ip
|
127
|
+
post[:ipaddress] = options[:ip]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def add_address(post, address,prefix="")
|
132
|
+
prefix +="_" unless prefix.blank?
|
133
|
+
unless address.blank? or address.values.blank?
|
134
|
+
post[prefix+"address1"] = address[:address1].to_s
|
135
|
+
post[prefix+"address2"] = address[:address2].to_s unless address[:address2].blank?
|
136
|
+
post[prefix+"company"] = address[:company].to_s
|
137
|
+
post[prefix+"phone"] = address[:phone].to_s
|
138
|
+
post[prefix+"zip"] = address[:zip].to_s
|
139
|
+
post[prefix+"city"] = address[:city].to_s
|
140
|
+
post[prefix+"country"] = address[:country].to_s
|
141
|
+
post[prefix+"state"] = address[:state].blank? ? 'n/a' : address[:state]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def add_currency(post, money, options)
|
146
|
+
post[:currency] = options[:currency] || currency(money)
|
147
|
+
end
|
148
|
+
|
149
|
+
def add_processor(post, options)
|
150
|
+
post[:processor] = options[:processor] unless options[:processor].nil?
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_invoice(post, options)
|
154
|
+
post[:orderid] = options[:order_id].to_s.gsub(/[^\w.]/, '')
|
155
|
+
end
|
156
|
+
|
157
|
+
def add_payment_source(params, source, options={})
|
158
|
+
case determine_funding_source(source)
|
159
|
+
when :vault then add_customer_vault_id(params, source)
|
160
|
+
when :credit_card then add_creditcard(params, source, options)
|
161
|
+
when :check then add_check(params, source, options)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def add_customer_vault_id(params, vault_id)
|
166
|
+
params[:customer_vault_id] = vault_id
|
167
|
+
end
|
168
|
+
|
169
|
+
def add_creditcard(post, creditcard, options)
|
170
|
+
if options[:store]
|
171
|
+
post[:customer_vault] = "add_customer"
|
172
|
+
post[:customer_vault_id] = options[:store] unless options[:store] == true
|
173
|
+
end
|
174
|
+
post[:ccnumber] = creditcard.number
|
175
|
+
post[:cvv] = creditcard.verification_value if creditcard.verification_value?
|
176
|
+
post[:ccexp] = expdate(creditcard)
|
177
|
+
post[:firstname] = creditcard.first_name
|
178
|
+
post[:lastname] = creditcard.last_name
|
179
|
+
end
|
180
|
+
|
181
|
+
def add_check(post, check, options)
|
182
|
+
if options[:store]
|
183
|
+
post[:customer_vault] = "add_customer"
|
184
|
+
post[:customer_vault_id] = options[:store] unless options[:store] == true
|
185
|
+
end
|
186
|
+
|
187
|
+
post[:payment] = 'check' # Set transaction to ACH
|
188
|
+
post[:checkname] = check.name # The name on the customer's Checking Account
|
189
|
+
post[:checkaba] = check.routing_number # The customer's bank routing number
|
190
|
+
post[:checkaccount] = check.account_number # The customer's account number
|
191
|
+
post[:account_holder_type] = check.account_holder_type # The customer's type of ACH account
|
192
|
+
post[:account_type] = check.account_type # The customer's type of ACH account
|
193
|
+
end
|
194
|
+
|
195
|
+
def add_sku(post,options)
|
196
|
+
post["product_sku_#"] = options[:sku] || options["product_sku_#"]
|
197
|
+
end
|
198
|
+
|
199
|
+
def add_transaction(post, auth)
|
200
|
+
post[:transactionid] = auth
|
201
|
+
end
|
202
|
+
|
203
|
+
def parse(body)
|
204
|
+
results = {}
|
205
|
+
body.split(/&/).each do |pair|
|
206
|
+
key,val = pair.split(/=/)
|
207
|
+
results[key] = val
|
208
|
+
end
|
209
|
+
|
210
|
+
results
|
211
|
+
end
|
212
|
+
|
213
|
+
def commit(action, money, parameters)
|
214
|
+
parameters[:amount] = amount(money) if money
|
215
|
+
response = parse( ssl_post(api_url, post_data(action,parameters)) )
|
216
|
+
Response.new(response["response"] == "1", message_from(response), response,
|
217
|
+
:authorization => response["transactionid"],
|
218
|
+
:test => test?,
|
219
|
+
:cvv_result => response["cvvresponse"],
|
220
|
+
:avs_result => { :code => response["avsresponse"] }
|
221
|
+
)
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
def expdate(creditcard)
|
226
|
+
year = sprintf("%.04i", creditcard.year.to_i)
|
227
|
+
month = sprintf("%.02i", creditcard.month.to_i)
|
228
|
+
|
229
|
+
"#{month}#{year[-2..-1]}"
|
230
|
+
end
|
231
|
+
|
232
|
+
|
233
|
+
def message_from(response)
|
234
|
+
case response["responsetext"]
|
235
|
+
when "SUCCESS", "Approved", nil # This is dubious, but responses from UPDATE are nil.
|
236
|
+
"This transaction has been approved"
|
237
|
+
when "DECLINE"
|
238
|
+
"This transaction has been declined"
|
239
|
+
else
|
240
|
+
response["responsetext"]
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def post_data(action, parameters = {})
|
245
|
+
post = {}
|
246
|
+
post[:username] = @options[:login]
|
247
|
+
post[:password] = @options[:password]
|
248
|
+
post[:type] = action if action
|
249
|
+
|
250
|
+
request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
|
251
|
+
request
|
252
|
+
end
|
253
|
+
|
254
|
+
def determine_funding_source(source)
|
255
|
+
case
|
256
|
+
when source.is_a?(String) then :vault
|
257
|
+
when CreditCard.card_companies.keys.include?(card_brand(source)) then :credit_card
|
258
|
+
when card_brand(source) == 'check' then :check
|
259
|
+
else raise ArgumentError, "Unsupported funding source provided"
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__),'smart_ps.rb')
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class TransaxGateway < SmartPs
|
6
|
+
def api_url
|
7
|
+
'https://secure.nelixtransax.net/api/transact.php'
|
8
|
+
end
|
9
|
+
|
10
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
11
|
+
self.supported_countries = ['US']
|
12
|
+
|
13
|
+
# The card types supported by the payment gateway
|
14
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
15
|
+
|
16
|
+
# The homepage URL of the gateway
|
17
|
+
self.homepage_url = 'https://www.nelixtransax.com/'
|
18
|
+
|
19
|
+
# The name of the gateway
|
20
|
+
self.display_name = 'NELiX TransaX'
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -1,8 +1,16 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class ViaklixGateway < Gateway
|
4
|
-
|
5
|
-
|
4
|
+
class_inheritable_accessor :test_url, :live_url, :delimiter, :actions
|
5
|
+
|
6
|
+
self.test_url = 'https://demo.viaklix.com/process.asp'
|
7
|
+
self.live_url = 'https://www.viaklix.com/process.asp'
|
8
|
+
self.delimiter = "\r\n"
|
9
|
+
|
10
|
+
self.actions = {
|
11
|
+
:purchase => 'SALE',
|
12
|
+
:credit => 'CREDIT'
|
13
|
+
}
|
6
14
|
|
7
15
|
APPROVED = '0'
|
8
16
|
|
@@ -35,7 +43,7 @@ module ActiveMerchant #:nodoc:
|
|
35
43
|
add_creditcard(form, creditcard)
|
36
44
|
add_address(form, options)
|
37
45
|
add_customer_data(form, options)
|
38
|
-
commit(
|
46
|
+
commit(:purchase, money, form)
|
39
47
|
end
|
40
48
|
|
41
49
|
# Make a credit to a card (Void can only be done from the virtual terminal)
|
@@ -50,13 +58,13 @@ module ActiveMerchant #:nodoc:
|
|
50
58
|
add_creditcard(form, creditcard)
|
51
59
|
add_address(form, options)
|
52
60
|
add_customer_data(form, options)
|
53
|
-
commit(
|
61
|
+
commit(:credit, money, form)
|
54
62
|
end
|
55
63
|
|
56
64
|
private
|
57
65
|
def add_customer_data(form, options)
|
58
66
|
form[:email] = options[:email].to_s.slice(0, 100) unless options[:email].blank?
|
59
|
-
form[:customer_code] = options[:customer].to_s.slice(0,
|
67
|
+
form[:customer_code] = options[:customer].to_s.slice(0, 10) unless options[:customer].blank?
|
60
68
|
end
|
61
69
|
|
62
70
|
def add_invoice(form,options)
|
@@ -104,20 +112,24 @@ module ActiveMerchant #:nodoc:
|
|
104
112
|
form[:exp_date] = expdate(creditcard)
|
105
113
|
|
106
114
|
if creditcard.verification_value?
|
107
|
-
form
|
108
|
-
form[:cvv2] = 'present'
|
115
|
+
add_verification_value(form, creditcard)
|
109
116
|
end
|
110
117
|
|
111
118
|
form[:first_name] = creditcard.first_name.to_s.slice(0, 20)
|
112
119
|
form[:last_name] = creditcard.last_name.to_s.slice(0, 30)
|
113
120
|
end
|
114
121
|
|
122
|
+
def add_verification_value(form, creditcard)
|
123
|
+
form[:cvv2cvc2] = creditcard.verification_value
|
124
|
+
form[:cvv2] = 'present'
|
125
|
+
end
|
126
|
+
|
115
127
|
def preamble
|
116
128
|
result = {
|
117
129
|
'merchant_id' => @options[:login],
|
118
130
|
'pin' => @options[:password],
|
119
131
|
'show_form' => 'false',
|
120
|
-
'test_mode' =>
|
132
|
+
'test_mode' => test? ? 'TRUE' : 'FALSE',
|
121
133
|
'result_format' => 'ASCII',
|
122
134
|
}
|
123
135
|
|
@@ -125,20 +137,32 @@ module ActiveMerchant #:nodoc:
|
|
125
137
|
result
|
126
138
|
end
|
127
139
|
|
140
|
+
def test?
|
141
|
+
@options[:test] || super
|
142
|
+
end
|
143
|
+
|
128
144
|
def commit(action, money, parameters)
|
129
145
|
parameters[:amount] = amount(money)
|
130
|
-
parameters[:transaction_type] = action
|
146
|
+
parameters[:transaction_type] = self.actions[action]
|
131
147
|
|
132
|
-
response = parse( ssl_post(test? ?
|
148
|
+
response = parse( ssl_post(test? ? self.test_url : self.live_url, post_data(parameters)) )
|
133
149
|
|
134
|
-
Response.new(response['result'] == APPROVED, response
|
150
|
+
Response.new(response['result'] == APPROVED, message_from(response), response,
|
135
151
|
:test => @options[:test] || test?,
|
136
|
-
:authorization => response
|
152
|
+
:authorization => authorization_from(response),
|
137
153
|
:avs_result => { :code => response['avs_response'] },
|
138
154
|
:cvv_result => response['cvv2_response']
|
139
155
|
)
|
140
156
|
end
|
141
157
|
|
158
|
+
def authorization_from(response)
|
159
|
+
response['txn_id']
|
160
|
+
end
|
161
|
+
|
162
|
+
def message_from(response)
|
163
|
+
response['result_message']
|
164
|
+
end
|
165
|
+
|
142
166
|
def post_data(parameters)
|
143
167
|
result = preamble
|
144
168
|
result.merge!(parameters)
|
@@ -154,9 +178,9 @@ module ActiveMerchant #:nodoc:
|
|
154
178
|
# Parse the response message
|
155
179
|
def parse(msg)
|
156
180
|
resp = {}
|
157
|
-
msg.split(
|
181
|
+
msg.split(self.delimiter).collect{|li|
|
158
182
|
key, value = li.split("=")
|
159
|
-
resp[key.gsub(/^ssl_/, '')] = value.to_s.strip
|
183
|
+
resp[key.strip.gsub(/^ssl_/, '')] = value.to_s.strip
|
160
184
|
}
|
161
185
|
resp
|
162
186
|
end
|
@@ -20,6 +20,15 @@ module ActiveMerchant #:nodoc:
|
|
20
20
|
|
21
21
|
RETURN_CODES = %w[ ACK NOK ]
|
22
22
|
|
23
|
+
# Wirecard only allows phone numbers with a format like this: +xxx(yyy)zzz-zzzz-ppp, where:
|
24
|
+
# xxx = Country code
|
25
|
+
# yyy = Area or city code
|
26
|
+
# zzz-zzzz = Local number
|
27
|
+
# ppp = PBX extension
|
28
|
+
# For example, a typical U.S. or Canadian number would be "+1(202)555-1234-739" indicating PBX extension 739 at phone
|
29
|
+
# number 5551234 within area code 202 (country code 1).
|
30
|
+
VALID_PHONE_FORMAT = /\+\d{1,3}(\(?\d{3}\)?)?\d{3}-\d{4}-\d{3}/
|
31
|
+
|
23
32
|
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
24
33
|
# TODO: Check supported countries
|
25
34
|
self.supported_countries = ['DE']
|
@@ -202,9 +211,13 @@ module ActiveMerchant #:nodoc:
|
|
202
211
|
xml.tag! 'Address2', address[:address2] if address[:address2]
|
203
212
|
xml.tag! 'City', address[:city]
|
204
213
|
xml.tag! 'ZipCode', address[:zip]
|
205
|
-
|
214
|
+
|
215
|
+
if address[:state] =~ /[A-Za-z]{2}/ && address[:country] =~ /^(us|ca)$/i
|
216
|
+
xml.tag! 'State', address[:state].upcase
|
217
|
+
end
|
218
|
+
|
206
219
|
xml.tag! 'Country', address[:country]
|
207
|
-
|
220
|
+
xml.tag! 'Phone', address[:phone] if address[:phone] =~ VALID_PHONE_FORMAT
|
208
221
|
xml.tag! 'Email', address[:email]
|
209
222
|
end
|
210
223
|
end
|
@@ -1,14 +1,3 @@
|
|
1
|
-
require 'active_merchant/billing/integrations/notification'
|
2
|
-
require 'active_merchant/billing/integrations/helper'
|
3
|
-
require 'active_merchant/billing/integrations/return'
|
4
|
-
require 'active_merchant/billing/integrations/bogus'
|
5
|
-
require 'active_merchant/billing/integrations/chronopay'
|
6
|
-
require 'active_merchant/billing/integrations/paypal'
|
7
|
-
require 'active_merchant/billing/integrations/nochex'
|
8
|
-
require 'active_merchant/billing/integrations/gestpay'
|
9
|
-
require 'active_merchant/billing/integrations/two_checkout'
|
10
|
-
require 'active_merchant/billing/integrations/hi_trust'
|
11
|
-
require 'active_merchant/billing/integrations/quickpay'
|
12
1
|
|
13
2
|
# make the bogus gateway be classified correctly by the inflector
|
14
3
|
if defined?(ActiveSupport::Inflector)
|
@@ -20,3 +9,21 @@ else
|
|
20
9
|
inflect.uncountable 'bogus'
|
21
10
|
end
|
22
11
|
end
|
12
|
+
|
13
|
+
module ActiveMerchant
|
14
|
+
module Billing
|
15
|
+
module Integrations
|
16
|
+
|
17
|
+
Dir[File.dirname(__FILE__) + '/integrations/*.rb'].each do |f|
|
18
|
+
|
19
|
+
# Get camelized class name
|
20
|
+
filename = File.basename(f, '.rb')
|
21
|
+
# Camelize the string to get the class name
|
22
|
+
gateway_class = filename.camelize.to_sym
|
23
|
+
|
24
|
+
# Register for autoloading
|
25
|
+
autoload gateway_class, f
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|