activemerchant 1.28.0 → 1.29.1
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/CHANGELOG +41 -0
- data/CONTRIBUTORS +12 -0
- data/README.md +6 -0
- data/lib/active_merchant/billing/gateway.rb +2 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
- data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
- data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
- data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
- data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
- data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
- data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
- data/lib/active_merchant/billing/gateways/epay.rb +0 -1
- data/lib/active_merchant/billing/gateways/eway.rb +88 -93
- data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +300 -0
- data/lib/active_merchant/billing/gateways/exact.rb +45 -54
- data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
- data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
- data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
- data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
- data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
- data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
- data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
- data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
- data/lib/active_merchant/billing/gateways/litle.rb +1 -5
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
- data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
- data/lib/active_merchant/billing/gateways/migs.rb +5 -3
- data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
- data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
- data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
- data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
- data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
- data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
- data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
- data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
- data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
- data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
- data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
- data/lib/active_merchant/billing/gateways/payway.rb +2 -9
- data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
- data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
- data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
- data/lib/active_merchant/billing/gateways/realex.rb +6 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
- data/lib/active_merchant/billing/gateways/sage.rb +15 -16
- data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
- data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
- data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
- data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
- data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
- data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
- data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
- data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
- data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
- data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
- data/lib/active_merchant/billing/gateways.rb +6 -7
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
- data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
- data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +17 -1
- data/lib/active_merchant/billing/integrations/notification.rb +4 -0
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +64 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +10 -7
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +12 -0
- data/lib/active_merchant/billing/response.rb +17 -4
- data/lib/active_merchant/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +46 -27
- metadata.gz.sig +0 -0
|
@@ -2,53 +2,53 @@ require 'rexml/document'
|
|
|
2
2
|
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
|
4
4
|
module Billing #:nodoc:
|
|
5
|
-
class VerifiGateway < Gateway
|
|
5
|
+
class VerifiGateway < Gateway
|
|
6
6
|
class VerifiPostData < PostData
|
|
7
7
|
# Fields that will be sent even if they are blank
|
|
8
8
|
self.required_fields = [ :amount, :type, :ccnumber, :ccexp, :firstname, :lastname,
|
|
9
|
-
:company, :address1, :address2, :city, :state, :zip, :country, :phone ]
|
|
9
|
+
:company, :address1, :address2, :city, :state, :zip, :country, :phone ]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
self.live_url = self.test_url = 'https://secure.verifi.com/gw/api/transact.php'
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
RESPONSE_CODE_MESSAGES = {
|
|
15
|
-
"100" => "Transaction was Approved",
|
|
16
|
-
"200" => "Transaction was Declined by Processor",
|
|
17
|
-
"201" => "Do Not Honor",
|
|
18
|
-
"202" => "Insufficient Funds",
|
|
19
|
-
"203" => "Over Limit",
|
|
20
|
-
"204" => "Transaction not allowed",
|
|
21
|
-
"220" => "Incorrect payment Data",
|
|
22
|
-
"221" => "No Such Card Issuer",
|
|
23
|
-
"222" => "No Card Number on file with Issuer",
|
|
24
|
-
"223" => "Expired Card",
|
|
25
|
-
"224" => "Invalid Expiration Date",
|
|
26
|
-
"225" => "Invalid Card Security Code",
|
|
27
|
-
"240" => "Call Issuer for Further Information",
|
|
28
|
-
"250" => "Pick Up Card",
|
|
29
|
-
"251" => "Lost Card",
|
|
30
|
-
"252" => "Stolen Card",
|
|
31
|
-
"253" => "Fraudulent Card",
|
|
32
|
-
"260" => "Declined With further Instructions Available (see response text)",
|
|
33
|
-
"261" => "Declined - Stop All Recurring Payments",
|
|
34
|
-
"262" => "Declined - Stop this Recurring Program",
|
|
35
|
-
"263" => "Declined - Update Cardholder Data Available",
|
|
36
|
-
"264" => "Declined - Retry in a few days",
|
|
37
|
-
"300" => "Transaction was Rejected by Gateway",
|
|
38
|
-
"400" => "Transaction Error Returned by Processor",
|
|
39
|
-
"410" => "Invalid Merchant Configuration",
|
|
40
|
-
"411" => "Merchant Account is Inactive",
|
|
41
|
-
"420" => "Communication Error",
|
|
42
|
-
"421" => "Communication Error with Issuer",
|
|
43
|
-
"430" => "Duplicate Transaction at Processor",
|
|
44
|
-
"440" => "Processor Format Error",
|
|
45
|
-
"441" => "Invalid Transaction Information",
|
|
46
|
-
"460" => "Processor Feature Not Available",
|
|
15
|
+
"100" => "Transaction was Approved",
|
|
16
|
+
"200" => "Transaction was Declined by Processor",
|
|
17
|
+
"201" => "Do Not Honor",
|
|
18
|
+
"202" => "Insufficient Funds",
|
|
19
|
+
"203" => "Over Limit",
|
|
20
|
+
"204" => "Transaction not allowed",
|
|
21
|
+
"220" => "Incorrect payment Data",
|
|
22
|
+
"221" => "No Such Card Issuer",
|
|
23
|
+
"222" => "No Card Number on file with Issuer",
|
|
24
|
+
"223" => "Expired Card",
|
|
25
|
+
"224" => "Invalid Expiration Date",
|
|
26
|
+
"225" => "Invalid Card Security Code",
|
|
27
|
+
"240" => "Call Issuer for Further Information",
|
|
28
|
+
"250" => "Pick Up Card",
|
|
29
|
+
"251" => "Lost Card",
|
|
30
|
+
"252" => "Stolen Card",
|
|
31
|
+
"253" => "Fraudulent Card",
|
|
32
|
+
"260" => "Declined With further Instructions Available (see response text)",
|
|
33
|
+
"261" => "Declined - Stop All Recurring Payments",
|
|
34
|
+
"262" => "Declined - Stop this Recurring Program",
|
|
35
|
+
"263" => "Declined - Update Cardholder Data Available",
|
|
36
|
+
"264" => "Declined - Retry in a few days",
|
|
37
|
+
"300" => "Transaction was Rejected by Gateway",
|
|
38
|
+
"400" => "Transaction Error Returned by Processor",
|
|
39
|
+
"410" => "Invalid Merchant Configuration",
|
|
40
|
+
"411" => "Merchant Account is Inactive",
|
|
41
|
+
"420" => "Communication Error",
|
|
42
|
+
"421" => "Communication Error with Issuer",
|
|
43
|
+
"430" => "Duplicate Transaction at Processor",
|
|
44
|
+
"440" => "Processor Format Error",
|
|
45
|
+
"441" => "Invalid Transaction Information",
|
|
46
|
+
"460" => "Processor Feature Not Available",
|
|
47
47
|
"461" => "Unsupported Card Type"
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
SUCCESS = 1
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
TRANSACTIONS = {
|
|
53
53
|
:authorization => 'auth',
|
|
54
54
|
:purchase => 'sale',
|
|
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
|
|
|
57
57
|
:credit => 'credit',
|
|
58
58
|
:refund => 'refund'
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
self.supported_countries = ['US']
|
|
62
62
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
|
63
63
|
self.homepage_url = 'http://www.verifi.com/'
|
|
@@ -65,7 +65,6 @@ module ActiveMerchant #:nodoc:
|
|
|
65
65
|
|
|
66
66
|
def initialize(options = {})
|
|
67
67
|
requires!(options, :login, :password)
|
|
68
|
-
@options = options
|
|
69
68
|
super
|
|
70
69
|
end
|
|
71
70
|
|
|
@@ -76,15 +75,15 @@ module ActiveMerchant #:nodoc:
|
|
|
76
75
|
def authorize(money, credit_card, options = {})
|
|
77
76
|
sale_authorization_or_credit_template(:authorization, money, credit_card, options)
|
|
78
77
|
end
|
|
79
|
-
|
|
78
|
+
|
|
80
79
|
def capture(money, authorization, options = {})
|
|
81
80
|
capture_void_or_refund_template(:capture, money, authorization, options)
|
|
82
81
|
end
|
|
83
|
-
|
|
82
|
+
|
|
84
83
|
def void(authorization, options = {})
|
|
85
84
|
capture_void_or_refund_template(:void, 0, authorization, options)
|
|
86
85
|
end
|
|
87
|
-
|
|
86
|
+
|
|
88
87
|
def credit(money, credit_card_or_authorization, options = {})
|
|
89
88
|
if credit_card_or_authorization.is_a?(String)
|
|
90
89
|
deprecated CREDIT_DEPRECATION_MESSAGE
|
|
@@ -98,8 +97,8 @@ module ActiveMerchant #:nodoc:
|
|
|
98
97
|
capture_void_or_refund_template(:refund, money, reference, options)
|
|
99
98
|
end
|
|
100
99
|
|
|
101
|
-
private
|
|
102
|
-
|
|
100
|
+
private
|
|
101
|
+
|
|
103
102
|
def sale_authorization_or_credit_template(trx_type, money, credit_card, options = {})
|
|
104
103
|
post = VerifiPostData.new
|
|
105
104
|
add_security_key_data(post, options, money)
|
|
@@ -108,24 +107,24 @@ module ActiveMerchant #:nodoc:
|
|
|
108
107
|
add_customer_data(post, options)
|
|
109
108
|
add_invoice_data(post, options)
|
|
110
109
|
add_optional_data(post, options)
|
|
111
|
-
commit(trx_type, money, post)
|
|
110
|
+
commit(trx_type, money, post)
|
|
112
111
|
end
|
|
113
112
|
|
|
114
113
|
def capture_void_or_refund_template(trx_type, money, authorization, options)
|
|
115
114
|
post = VerifiPostData.new
|
|
116
115
|
post[:transactionid] = authorization
|
|
117
|
-
|
|
116
|
+
|
|
118
117
|
commit(trx_type, money, post)
|
|
119
118
|
end
|
|
120
|
-
|
|
119
|
+
|
|
121
120
|
def add_credit_card(post, credit_card)
|
|
122
121
|
post[:ccnumber] = credit_card.number
|
|
123
122
|
post[:ccexp] = expdate(credit_card)
|
|
124
123
|
post[:firstname] = credit_card.first_name
|
|
125
|
-
post[:lastname] = credit_card.last_name
|
|
124
|
+
post[:lastname] = credit_card.last_name
|
|
126
125
|
post[:cvv] = credit_card.verification_value
|
|
127
|
-
end
|
|
128
|
-
|
|
126
|
+
end
|
|
127
|
+
|
|
129
128
|
def expdate(credit_card)
|
|
130
129
|
year = sprintf("%.4i", credit_card.year)
|
|
131
130
|
month = sprintf("%.2i", credit_card.month)
|
|
@@ -138,33 +137,33 @@ module ActiveMerchant #:nodoc:
|
|
|
138
137
|
post[:company] = billing_address[:company]
|
|
139
138
|
post[:address1] = billing_address[:address1]
|
|
140
139
|
post[:address2] = billing_address[:address2]
|
|
141
|
-
post[:city] = billing_address[:city]
|
|
140
|
+
post[:city] = billing_address[:city]
|
|
142
141
|
post[:state] = billing_address[:state]
|
|
143
|
-
post[:zip] = billing_address[:zip]
|
|
142
|
+
post[:zip] = billing_address[:zip]
|
|
144
143
|
post[:country] = billing_address[:country]
|
|
145
144
|
post[:phone] = billing_address[:phone]
|
|
146
|
-
post[:fax] = billing_address[:fax]
|
|
145
|
+
post[:fax] = billing_address[:fax]
|
|
147
146
|
end
|
|
148
|
-
|
|
147
|
+
|
|
149
148
|
if shipping_address = options[:shipping_address]
|
|
150
149
|
post[:shipping_firstname] = shipping_address[:first_name]
|
|
151
|
-
post[:shipping_lastname] = shipping_address[:last_name]
|
|
152
|
-
post[:shipping_company] = shipping_address[:company]
|
|
153
|
-
post[:shipping_address1] = shipping_address[:address1]
|
|
154
|
-
post[:shipping_address2] = shipping_address[:address2]
|
|
155
|
-
post[:shipping_city] = shipping_address[:city]
|
|
156
|
-
post[:shipping_state] = shipping_address[:state]
|
|
157
|
-
post[:shipping_zip] = shipping_address[:zip]
|
|
158
|
-
post[:shipping_country] = shipping_address[:country]
|
|
159
|
-
post[:shipping_email] = shipping_address[:email]
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
|
|
150
|
+
post[:shipping_lastname] = shipping_address[:last_name]
|
|
151
|
+
post[:shipping_company] = shipping_address[:company]
|
|
152
|
+
post[:shipping_address1] = shipping_address[:address1]
|
|
153
|
+
post[:shipping_address2] = shipping_address[:address2]
|
|
154
|
+
post[:shipping_city] = shipping_address[:city]
|
|
155
|
+
post[:shipping_state] = shipping_address[:state]
|
|
156
|
+
post[:shipping_zip] = shipping_address[:zip]
|
|
157
|
+
post[:shipping_country] = shipping_address[:country]
|
|
158
|
+
post[:shipping_email] = shipping_address[:email]
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
163
162
|
def add_customer_data(post, options)
|
|
164
163
|
post[:email] = options[:email]
|
|
165
164
|
post[:ipaddress] = options[:ip]
|
|
166
165
|
end
|
|
167
|
-
|
|
166
|
+
|
|
168
167
|
def add_invoice_data(post, options)
|
|
169
168
|
post[:orderid] = options[:order_id]
|
|
170
169
|
post[:ponumber] = options[:invoice]
|
|
@@ -172,18 +171,18 @@ module ActiveMerchant #:nodoc:
|
|
|
172
171
|
post[:tax] = options[:tax]
|
|
173
172
|
post[:shipping] = options[:shipping]
|
|
174
173
|
end
|
|
175
|
-
|
|
174
|
+
|
|
176
175
|
def add_optional_data(post, options)
|
|
177
|
-
post[:billing_method] = options[:billing_method]
|
|
178
|
-
post[:website] = options[:website]
|
|
179
|
-
post[:descriptor] = options[:descriptor]
|
|
180
|
-
post[:descriptor_phone] = options[:descriptor_phone]
|
|
181
|
-
post[:cardholder_auth] = options[:cardholder_auth]
|
|
182
|
-
post[:cavv] = options[:cavv]
|
|
183
|
-
post[:xid] = options[:xid]
|
|
176
|
+
post[:billing_method] = options[:billing_method]
|
|
177
|
+
post[:website] = options[:website]
|
|
178
|
+
post[:descriptor] = options[:descriptor]
|
|
179
|
+
post[:descriptor_phone] = options[:descriptor_phone]
|
|
180
|
+
post[:cardholder_auth] = options[:cardholder_auth]
|
|
181
|
+
post[:cavv] = options[:cavv]
|
|
182
|
+
post[:xid] = options[:xid]
|
|
184
183
|
post[:customer_receipt] = options[:customer_receipt]
|
|
185
184
|
end
|
|
186
|
-
|
|
185
|
+
|
|
187
186
|
def add_security_key_data(post, options, money)
|
|
188
187
|
# MD5(username|password|orderid|amount|time)
|
|
189
188
|
now = Time.now.to_i.to_s
|
|
@@ -195,13 +194,13 @@ module ActiveMerchant #:nodoc:
|
|
|
195
194
|
md5 << now
|
|
196
195
|
post[:key] = md5.hexdigest
|
|
197
196
|
post[:time] = now
|
|
198
|
-
end
|
|
199
|
-
|
|
197
|
+
end
|
|
198
|
+
|
|
200
199
|
def commit(trx_type, money, post)
|
|
201
200
|
post[:amount] = amount(money)
|
|
202
|
-
|
|
201
|
+
|
|
203
202
|
response = parse( ssl_post(self.live_url, post_data(trx_type, post)) )
|
|
204
|
-
|
|
203
|
+
|
|
205
204
|
Response.new(response[:response].to_i == SUCCESS, message_from(response), response,
|
|
206
205
|
:test => test?,
|
|
207
206
|
:authorization => response[:transactionid],
|
|
@@ -209,25 +208,25 @@ module ActiveMerchant #:nodoc:
|
|
|
209
208
|
:cvv_result => response[:cvvresponse]
|
|
210
209
|
)
|
|
211
210
|
end
|
|
212
|
-
|
|
211
|
+
|
|
213
212
|
def message_from(response)
|
|
214
213
|
response[:response_code_message] ? response[:response_code_message] : ""
|
|
215
214
|
end
|
|
216
|
-
|
|
215
|
+
|
|
217
216
|
def parse(body)
|
|
218
217
|
results = {}
|
|
219
218
|
CGI.parse(body).each { |key, value| results[key.intern] = value[0] }
|
|
220
219
|
results[:response_code_message] = RESPONSE_CODE_MESSAGES[results[:response_code]] if results[:response_code]
|
|
221
220
|
results
|
|
222
|
-
end
|
|
223
|
-
|
|
221
|
+
end
|
|
222
|
+
|
|
224
223
|
def post_data(trx_type, post)
|
|
225
|
-
post[:username] = @options[:login]
|
|
224
|
+
post[:username] = @options[:login]
|
|
226
225
|
post[:password] = @options[:password]
|
|
227
226
|
post[:type] = TRANSACTIONS[trx_type]
|
|
228
|
-
|
|
227
|
+
|
|
229
228
|
post.to_s
|
|
230
229
|
end
|
|
231
|
-
end
|
|
230
|
+
end
|
|
232
231
|
end
|
|
233
232
|
end
|
|
@@ -6,24 +6,24 @@ module ActiveMerchant #:nodoc:
|
|
|
6
6
|
self.test_url = 'https://demo.viaklix.com/process.asp'
|
|
7
7
|
self.live_url = 'https://www.viaklix.com/process.asp'
|
|
8
8
|
self.delimiter = "\r\n"
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
self.actions = {
|
|
11
11
|
:purchase => 'SALE',
|
|
12
12
|
:credit => 'CREDIT'
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
APPROVED = '0'
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
|
18
18
|
self.supported_countries = ['US']
|
|
19
19
|
self.display_name = 'ViaKLIX'
|
|
20
20
|
self.homepage_url = 'http://viaklix.com'
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
# Initialize the Gateway
|
|
23
23
|
#
|
|
24
24
|
# The gateway requires that a valid login and password be passed
|
|
25
25
|
# in the +options+ hash.
|
|
26
|
-
#
|
|
26
|
+
#
|
|
27
27
|
# ==== Options
|
|
28
28
|
#
|
|
29
29
|
# * <tt>:login</tt> -- Merchant ID
|
|
@@ -32,55 +32,54 @@ module ActiveMerchant #:nodoc:
|
|
|
32
32
|
# * <tt>:test => +true+ or +false+</tt> -- Force test transactions
|
|
33
33
|
def initialize(options = {})
|
|
34
34
|
requires!(options, :login, :password)
|
|
35
|
-
@options = options
|
|
36
35
|
super
|
|
37
36
|
end
|
|
38
|
-
|
|
39
|
-
# Make a purchase
|
|
37
|
+
|
|
38
|
+
# Make a purchase
|
|
40
39
|
def purchase(money, creditcard, options = {})
|
|
41
40
|
form = {}
|
|
42
41
|
add_invoice(form, options)
|
|
43
|
-
add_creditcard(form, creditcard)
|
|
44
|
-
add_address(form, options)
|
|
42
|
+
add_creditcard(form, creditcard)
|
|
43
|
+
add_address(form, options)
|
|
45
44
|
add_customer_data(form, options)
|
|
46
45
|
add_test_mode(form, options)
|
|
47
46
|
commit(:purchase, money, form)
|
|
48
47
|
end
|
|
49
|
-
|
|
48
|
+
|
|
50
49
|
# Make a credit to a card (Void can only be done from the virtual terminal)
|
|
51
50
|
# Viaklix does not support credits by reference. You must pass in the credit card
|
|
52
51
|
def credit(money, creditcard, options = {})
|
|
53
52
|
if creditcard.is_a?(String)
|
|
54
53
|
raise ArgumentError, "Reference credits are not supported. Please supply the original credit card"
|
|
55
54
|
end
|
|
56
|
-
|
|
55
|
+
|
|
57
56
|
form = {}
|
|
58
57
|
add_invoice(form, options)
|
|
59
|
-
add_creditcard(form, creditcard)
|
|
60
|
-
add_address(form, options)
|
|
58
|
+
add_creditcard(form, creditcard)
|
|
59
|
+
add_address(form, options)
|
|
61
60
|
add_customer_data(form, options)
|
|
62
61
|
add_test_mode(form, options)
|
|
63
62
|
commit(:credit, money, form)
|
|
64
63
|
end
|
|
65
|
-
|
|
64
|
+
|
|
66
65
|
private
|
|
67
66
|
def add_test_mode(form, options)
|
|
68
67
|
form[:test_mode] = 'TRUE' if options[:test_mode]
|
|
69
68
|
end
|
|
70
|
-
|
|
69
|
+
|
|
71
70
|
def add_customer_data(form, options)
|
|
72
71
|
form[:email] = options[:email].to_s.slice(0, 100) unless options[:email].blank?
|
|
73
72
|
form[:customer_code] = options[:customer].to_s.slice(0, 10) unless options[:customer].blank?
|
|
74
73
|
end
|
|
75
|
-
|
|
74
|
+
|
|
76
75
|
def add_invoice(form,options)
|
|
77
76
|
form[:invoice_number] = (options[:order_id] || options[:invoice]).to_s.slice(0, 10)
|
|
78
77
|
form[:description] = options[:description].to_s.slice(0, 255)
|
|
79
78
|
end
|
|
80
|
-
|
|
79
|
+
|
|
81
80
|
def add_address(form,options)
|
|
82
|
-
billing_address = options[:billing_address] || options[:address]
|
|
83
|
-
|
|
81
|
+
billing_address = options[:billing_address] || options[:address]
|
|
82
|
+
|
|
84
83
|
if billing_address
|
|
85
84
|
form[:avs_address] = billing_address[:address1].to_s.slice(0, 30)
|
|
86
85
|
form[:address2] = billing_address[:address2].to_s.slice(0, 30)
|
|
@@ -91,7 +90,7 @@ module ActiveMerchant #:nodoc:
|
|
|
91
90
|
form[:phone] = billing_address[:phone].to_s.slice(0, 20)
|
|
92
91
|
form[:country] = billing_address[:country].to_s.slice(0, 50)
|
|
93
92
|
end
|
|
94
|
-
|
|
93
|
+
|
|
95
94
|
if shipping_address = options[:shipping_address]
|
|
96
95
|
first_name, last_name = parse_first_and_last_name(shipping_address[:name])
|
|
97
96
|
form[:ship_to_first_name] = first_name.to_s.slice(0, 20)
|
|
@@ -104,82 +103,78 @@ module ActiveMerchant #:nodoc:
|
|
|
104
103
|
form[:ship_to_zip] = shipping_address[:zip].to_s.slice(0, 10)
|
|
105
104
|
end
|
|
106
105
|
end
|
|
107
|
-
|
|
106
|
+
|
|
108
107
|
def parse_first_and_last_name(value)
|
|
109
108
|
name = value.to_s.split(' ')
|
|
110
|
-
|
|
109
|
+
|
|
111
110
|
last_name = name.pop || ''
|
|
112
111
|
first_name = name.join(' ')
|
|
113
|
-
[ first_name, last_name ]
|
|
112
|
+
[ first_name, last_name ]
|
|
114
113
|
end
|
|
115
|
-
|
|
114
|
+
|
|
116
115
|
def add_creditcard(form, creditcard)
|
|
117
116
|
form[:card_number] = creditcard.number
|
|
118
117
|
form[:exp_date] = expdate(creditcard)
|
|
119
|
-
|
|
118
|
+
|
|
120
119
|
if creditcard.verification_value?
|
|
121
120
|
add_verification_value(form, creditcard)
|
|
122
121
|
end
|
|
123
|
-
|
|
122
|
+
|
|
124
123
|
form[:first_name] = creditcard.first_name.to_s.slice(0, 20)
|
|
125
124
|
form[:last_name] = creditcard.last_name.to_s.slice(0, 30)
|
|
126
125
|
end
|
|
127
|
-
|
|
126
|
+
|
|
128
127
|
def add_verification_value(form, creditcard)
|
|
129
|
-
form[:cvv2cvc2] = creditcard.verification_value
|
|
128
|
+
form[:cvv2cvc2] = creditcard.verification_value
|
|
130
129
|
form[:cvv2] = 'present'
|
|
131
130
|
end
|
|
132
|
-
|
|
131
|
+
|
|
133
132
|
def preamble
|
|
134
133
|
result = {
|
|
135
134
|
'merchant_id' => @options[:login],
|
|
136
135
|
'pin' => @options[:password],
|
|
137
136
|
'show_form' => 'false',
|
|
138
|
-
'result_format' => 'ASCII'
|
|
137
|
+
'result_format' => 'ASCII'
|
|
139
138
|
}
|
|
140
|
-
|
|
139
|
+
|
|
141
140
|
result['user_id'] = @options[:user] unless @options[:user].blank?
|
|
142
141
|
result
|
|
143
142
|
end
|
|
144
|
-
|
|
145
|
-
def test?
|
|
146
|
-
@options[:test] || super
|
|
147
|
-
end
|
|
148
|
-
|
|
143
|
+
|
|
149
144
|
def commit(action, money, parameters)
|
|
150
145
|
parameters[:amount] = amount(money)
|
|
151
146
|
parameters[:transaction_type] = self.actions[action]
|
|
152
|
-
|
|
147
|
+
|
|
153
148
|
response = parse( ssl_post(test? ? self.test_url : self.live_url, post_data(parameters)) )
|
|
154
149
|
|
|
155
|
-
Response.new(response['result'] == APPROVED, message_from(response), response,
|
|
156
|
-
:test => @options[:test] || test?,
|
|
150
|
+
Response.new(response['result'] == APPROVED, message_from(response), response,
|
|
151
|
+
:test => @options[:test] || test?,
|
|
157
152
|
:authorization => authorization_from(response),
|
|
158
153
|
:avs_result => { :code => response['avs_response'] },
|
|
159
154
|
:cvv_result => response['cvv2_response']
|
|
160
155
|
)
|
|
161
156
|
end
|
|
162
|
-
|
|
157
|
+
|
|
163
158
|
def authorization_from(response)
|
|
164
159
|
response['txn_id']
|
|
165
160
|
end
|
|
166
|
-
|
|
161
|
+
|
|
167
162
|
def message_from(response)
|
|
168
163
|
response['result_message']
|
|
169
164
|
end
|
|
170
|
-
|
|
165
|
+
|
|
171
166
|
def post_data(parameters)
|
|
172
167
|
result = preamble
|
|
173
|
-
result.merge!(parameters)
|
|
168
|
+
result.merge!(parameters)
|
|
174
169
|
result.collect { |key, value| "ssl_#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
|
175
170
|
end
|
|
176
|
-
|
|
171
|
+
|
|
177
172
|
def expdate(creditcard)
|
|
178
173
|
year = sprintf("%.4i", creditcard.year)
|
|
179
174
|
month = sprintf("%.2i", creditcard.month)
|
|
180
175
|
"#{month}#{year[2..3]}"
|
|
181
176
|
end
|
|
182
|
-
|
|
177
|
+
|
|
183
178
|
# Parse the response message
|
|
184
179
|
def parse(msg)
|
|
185
180
|
resp = {}
|
|
@@ -191,4 +186,4 @@ module ActiveMerchant #:nodoc:
|
|
|
191
186
|
end
|
|
192
187
|
end
|
|
193
188
|
end
|
|
194
|
-
end
|
|
189
|
+
end
|