activemerchant 1.44.1 → 1.45.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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +1 -3
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG +48 -0
  5. data/CONTRIBUTORS +12 -0
  6. data/README.md +15 -5
  7. data/lib/active_merchant/billing.rb +2 -0
  8. data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
  9. data/lib/active_merchant/billing/gateway.rb +36 -4
  10. data/lib/active_merchant/billing/gateways/adyen.rb +6 -2
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +332 -255
  12. data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
  13. data/lib/active_merchant/billing/gateways/bogus.rb +9 -9
  14. data/lib/active_merchant/billing/gateways/borgun.rb +0 -1
  15. data/lib/active_merchant/billing/gateways/braintree_blue.rb +8 -0
  16. data/lib/active_merchant/billing/gateways/cashnet.rb +17 -10
  17. data/lib/active_merchant/billing/gateways/checkout.rb +213 -0
  18. data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
  19. data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/elavon.rb +3 -3
  21. data/lib/active_merchant/billing/gateways/eway_rapid.rb +114 -13
  22. data/lib/active_merchant/billing/gateways/finansbank.rb +1 -1
  23. data/lib/active_merchant/billing/gateways/global_transport.rb +183 -0
  24. data/lib/active_merchant/billing/gateways/hps.rb +27 -20
  25. data/lib/active_merchant/billing/gateways/iats_payments.rb +68 -35
  26. data/lib/active_merchant/billing/gateways/litle.rb +36 -1
  27. data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
  28. data/lib/active_merchant/billing/gateways/merchant_ware.rb +8 -4
  29. data/lib/active_merchant/billing/gateways/mercury.rb +17 -10
  30. data/lib/active_merchant/billing/gateways/moneris.rb +11 -6
  31. data/lib/active_merchant/billing/gateways/moneris_us.rb +126 -33
  32. data/lib/active_merchant/billing/gateways/money_movers.rb +0 -1
  33. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -1
  34. data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
  35. data/lib/active_merchant/billing/gateways/nmi.rb +241 -5
  36. data/lib/active_merchant/billing/gateways/openpay.rb +1 -0
  37. data/lib/active_merchant/billing/gateways/optimal_payment.rb +6 -1
  38. data/lib/active_merchant/billing/gateways/orbital.rb +6 -4
  39. data/lib/active_merchant/billing/gateways/pay_junction.rb +9 -5
  40. data/lib/active_merchant/billing/gateways/payex.rb +19 -9
  41. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -2
  42. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  43. data/lib/active_merchant/billing/gateways/payscout.rb +0 -2
  44. data/lib/active_merchant/billing/gateways/pin.rb +1 -1
  45. data/lib/active_merchant/billing/gateways/psigate.rb +1 -2
  46. data/lib/active_merchant/billing/gateways/redsys.rb +37 -40
  47. data/lib/active_merchant/billing/gateways/secure_pay.rb +181 -9
  48. data/lib/active_merchant/billing/gateways/stripe.rb +106 -31
  49. data/lib/active_merchant/billing/gateways/tns.rb +227 -0
  50. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +38 -10
  51. data/lib/active_merchant/billing/gateways/webpay.rb +14 -0
  52. data/lib/active_merchant/billing/payment_token.rb +21 -0
  53. data/lib/active_merchant/billing/response.rb +2 -1
  54. data/lib/active_merchant/country.rb +6 -1
  55. data/lib/active_merchant/version.rb +1 -1
  56. metadata +8 -3
  57. metadata.gz.sig +0 -0
  58. data/lib/active_merchant/billing/gateways/samurai.rb +0 -130
@@ -57,6 +57,13 @@ module ActiveMerchant #:nodoc:
57
57
  end
58
58
  end
59
59
 
60
+ def verify(card_or_token, options={})
61
+ commit('CreditAccountVerify') do |xml|
62
+ add_customer_data(xml, card_or_token, options)
63
+ add_payment(xml, card_or_token, options)
64
+ end
65
+ end
66
+
60
67
  def void(transaction_id, options={})
61
68
  commit('CreditVoid') do |xml|
62
69
  add_reference(xml, transaction_id)
@@ -74,24 +81,20 @@ module ActiveMerchant #:nodoc:
74
81
  end
75
82
 
76
83
  def add_customer_data(xml, credit_card, options)
77
- return unless credit_card.respond_to?(:number)
78
-
79
- first_name = credit_card.first_name
80
- last_name = credit_card.last_name
81
-
82
- if(first_name || last_name)
83
- xml.hps :CardHolderData do
84
- xml.hps :CardHolderFirstName, first_name if first_name
85
- xml.hps :CardHolderLastName, last_name if last_name
86
- xml.hps :CardHolderEmail, options[:email] if options[:email]
87
- xml.hps :CardHolderPhone, options[:phone] if options[:phone]
88
-
89
- if(billing_address = (options[:billing_address] || options[:address]))
90
- xml.hps :CardHolderAddr, billing_address[:address1] if billing_address[:address1]
91
- xml.hps :CardHolderCity, billing_address[:city] if billing_address[:city]
92
- xml.hps :CardHolderState, billing_address[:state] if billing_address[:state]
93
- xml.hps :CardHolderZip, billing_address[:zip] if billing_address[:zip]
94
- end
84
+ xml.hps :CardHolderData do
85
+ if credit_card.respond_to?(:number)
86
+ xml.hps :CardHolderFirstName, credit_card.first_name if credit_card.first_name
87
+ xml.hps :CardHolderLastName, credit_card.last_name if credit_card.last_name
88
+ end
89
+
90
+ xml.hps :CardHolderEmail, options[:email] if options[:email]
91
+ xml.hps :CardHolderPhone, options[:phone] if options[:phone]
92
+
93
+ if(billing_address = (options[:billing_address] || options[:address]))
94
+ xml.hps :CardHolderAddr, billing_address[:address1] if billing_address[:address1]
95
+ xml.hps :CardHolderCity, billing_address[:city] if billing_address[:city]
96
+ xml.hps :CardHolderState, billing_address[:state] if billing_address[:state]
97
+ xml.hps :CardHolderZip, billing_address[:zip] if billing_address[:zip]
95
98
  end
96
99
  end
97
100
  end
@@ -230,7 +233,7 @@ module ActiveMerchant #:nodoc:
230
233
  def successful?(response)
231
234
  (
232
235
  (response["GatewayRspCode"] == "0") &&
233
- ((response["RspCode"] || "00") == "00")
236
+ ((response["RspCode"] || "00") == "00" || response["RspCode"] == "85")
234
237
  )
235
238
  end
236
239
 
@@ -238,7 +241,7 @@ module ActiveMerchant #:nodoc:
238
241
  if(response["Fault"])
239
242
  response["Fault"]
240
243
  elsif(response["GatewayRspCode"] == "0")
241
- if(response["RspCode"] != "00")
244
+ if(response["RspCode"] != "00" && response["RspCode"] != "85")
242
245
  issuer_message(response["RspCode"])
243
246
  else
244
247
  response['GatewayRspMsg']
@@ -252,6 +255,10 @@ module ActiveMerchant #:nodoc:
252
255
  response['GatewayTxnId']
253
256
  end
254
257
 
258
+ def test?
259
+ (@options[:secret_api_key] && @options[:secret_api_key].include?('_cert_'))
260
+ end
261
+
255
262
  ISSUER_MESSAGES = {
256
263
  "13" => "Must be greater than or equal 0.",
257
264
  "14" => "The card number is incorrect.",
@@ -3,8 +3,8 @@ module ActiveMerchant #:nodoc:
3
3
  class IatsPaymentsGateway < Gateway
4
4
  class_attribute :live_na_url, :live_uk_url
5
5
 
6
- self.live_na_url = 'https://www.iatspayments.com/NetGate/ProcessLink.asmx'
7
- self.live_uk_url = 'https://www.uk.iatspayments.com/NetGate/ProcessLink.asmx'
6
+ self.live_na_url = 'https://www.iatspayments.com/NetGate'
7
+ self.live_uk_url = 'https://www.uk.iatspayments.com/NetGate'
8
8
 
9
9
  self.supported_countries = %w(AU BR CA CH DE DK ES FI FR GR HK IE IT NL NO PT SE SG TR GB US)
10
10
  self.default_currency = 'USD'
@@ -13,6 +13,13 @@ module ActiveMerchant #:nodoc:
13
13
  self.homepage_url = 'http://home.iatspayments.com/'
14
14
  self.display_name = 'iATS Payments'
15
15
 
16
+ ACTIONS = {
17
+ purchase: "ProcessCreditCardV1",
18
+ refund: "ProcessCreditCardRefundWithTransactionIdV1",
19
+ store: "CreateCreditCardCustomerCodeV1",
20
+ unstore: "DeleteCustomerCodeV1"
21
+ }
22
+
16
23
  def initialize(options={})
17
24
  if(options[:login])
18
25
  ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'agent_code' and will be removed in a future version.")
@@ -30,41 +37,44 @@ module ActiveMerchant #:nodoc:
30
37
  add_invoice(post, money, options)
31
38
  add_payment(post, payment)
32
39
  add_address(post, options)
33
- add_customer_data(post, options)
40
+ add_ip(post, options)
41
+ add_description(post, options)
34
42
 
35
- commit('ProcessCreditCardV1', post)
43
+ commit(:purchase, post)
36
44
  end
37
45
 
38
- def authorize(money, payment, options={})
46
+ def refund(money, authorization, options={})
39
47
  post = {}
40
- add_invoice(post, money, options)
41
- add_payment(post, payment)
42
- add_address(post, options)
43
- add_customer_data(post, options)
44
-
45
- commit('authonly', post)
46
- end
48
+ post[:transaction_id] = authorization
49
+ add_invoice(post, -money, options)
50
+ add_ip(post, options)
51
+ add_description(post, options)
47
52
 
48
- def capture(money, authorization, options={})
49
- commit('capture', post)
53
+ commit(:refund, post)
50
54
  end
51
55
 
52
- def refund(money, authorization, options={})
56
+ def store(credit_card, options = {})
53
57
  post = {}
54
- post[:transaction_id] = authorization
55
- add_customer_data(post, options)
56
- add_invoice(post, -money, options)
58
+ add_payment(post, credit_card)
59
+ add_address(post, options)
60
+ add_ip(post, options)
61
+ add_description(post, options)
62
+ add_store_defaults(post)
57
63
 
58
- commit('ProcessCreditCardRefundWithTransactionIdV1', post)
64
+ commit(:store, post)
59
65
  end
60
66
 
61
- def void(authorization, options={})
62
- commit('void', post)
67
+ def unstore(authorization, options = {})
68
+ post = {}
69
+ post[:customer_code] = authorization
70
+ add_ip(post, options)
71
+
72
+ commit(:unstore, post)
63
73
  end
64
74
 
65
75
  private
66
76
 
67
- def add_customer_data(post, options)
77
+ def add_ip(post, options)
68
78
  post[:customer_ip_address] = options[:ip] if options.has_key?(:ip)
69
79
  end
70
80
 
@@ -81,6 +91,9 @@ module ActiveMerchant #:nodoc:
81
91
  def add_invoice(post, money, options)
82
92
  post[:invoice_num] = options[:order_id] if options[:order_id]
83
93
  post[:total] = amount(money)
94
+ end
95
+
96
+ def add_description(post, options)
84
97
  post[:comment] = options[:description] if options[:description]
85
98
  end
86
99
 
@@ -93,6 +106,13 @@ module ActiveMerchant #:nodoc:
93
106
  post[:mop] = creditcard_brand(payment.brand)
94
107
  end
95
108
 
109
+ def add_store_defaults(post)
110
+ post[:recurring] = false
111
+ post[:begin_date] = Time.now.xmlschema
112
+ post[:end_date] = Time.now.xmlschema
113
+ post[:amount] = 0
114
+ end
115
+
96
116
  def expdate(creditcard)
97
117
  year = sprintf("%.4i", creditcard.year)
98
118
  month = sprintf("%.2i", creditcard.month)
@@ -120,14 +140,23 @@ module ActiveMerchant #:nodoc:
120
140
  success_from(response),
121
141
  message_from(response),
122
142
  response,
123
- authorization: authorization_from(response),
143
+ authorization: authorization_from(action, response),
124
144
  test: test?
125
145
  )
126
146
  end
127
147
 
148
+ def endpoints
149
+ {
150
+ purchase: "ProcessLink.asmx",
151
+ refund: "ProcessLink.asmx",
152
+ store: "CustomerLink.asmx",
153
+ unstore: "CustomerLink.asmx"
154
+ }
155
+ end
156
+
128
157
  def url(action)
129
158
  base_url = @options[:region] == 'uk' ? live_uk_url : live_na_url
130
- "#{base_url}?op=#{action}"
159
+ "#{base_url}/#{endpoints[action]}?op=#{ACTIONS[action]}"
131
160
  end
132
161
 
133
162
  def parse(body)
@@ -149,13 +178,11 @@ module ActiveMerchant #:nodoc:
149
178
  def hashify_xml!(xml, response)
150
179
  xml = REXML::Document.new(xml)
151
180
 
152
- # Purchase, refund
153
181
  xml.elements.each("//IATSRESPONSE/*") do |node|
154
182
  recursively_parse_element(node, response)
155
183
  end
156
184
  end
157
185
 
158
- # Flatten nested XML structures
159
186
  def recursively_parse_element(node, response)
160
187
  if(node.has_elements?)
161
188
  node.elements.each { |n| recursively_parse_element(n, response) }
@@ -182,22 +209,28 @@ module ActiveMerchant #:nodoc:
182
209
  end
183
210
  end
184
211
 
185
- def authorization_from(response)
186
- response[:transaction_id]
212
+ def authorization_from(action, response)
213
+ if [:store, :unstore].include?(action)
214
+ response[:customercode]
215
+ else
216
+ response[:transaction_id]
217
+ end
187
218
  end
188
219
 
189
- ENVELOPE_NAMESPACES = {
190
- "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
191
- "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
192
- "xmlns:soap12" => "http://www.w3.org/2003/05/soap-envelope"
193
- }
220
+ def envelope_namespaces
221
+ {
222
+ "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
223
+ "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
224
+ "xmlns:soap12" => "http://www.w3.org/2003/05/soap-envelope"
225
+ }
226
+ end
194
227
 
195
228
  def post_data(action, parameters = {})
196
229
  xml = Builder::XmlMarkup.new
197
230
  xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
198
- xml.tag! 'soap12:Envelope', ENVELOPE_NAMESPACES do
231
+ xml.tag! 'soap12:Envelope', envelope_namespaces do
199
232
  xml.tag! 'soap12:Body' do
200
- xml.tag! action, { "xmlns" => "https://www.iatspayments.com/NetGate/" } do
233
+ xml.tag! ACTIONS[action], { "xmlns" => "https://www.iatspayments.com/NetGate/" } do
201
234
  xml.tag!('agentCode', @options[:agent_code])
202
235
  xml.tag!('password', @options[:password])
203
236
  parameters.each do |name, value|
@@ -53,6 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
 
54
54
  request = build_xml_request do |doc|
55
55
  add_authentication(doc)
56
+ add_descriptor(doc, options)
56
57
  doc.capture_(transaction_attributes(options)) do
57
58
  doc.litleTxnId(transaction_id)
58
59
  doc.amount(money) if money
@@ -72,6 +73,7 @@ module ActiveMerchant #:nodoc:
72
73
 
73
74
  request = build_xml_request do |doc|
74
75
  add_authentication(doc)
76
+ add_descriptor(doc, options)
75
77
  doc.credit(transaction_attributes(options)) do
76
78
  doc.litleTxnId(transaction_id)
77
79
  doc.amount(money) if money
@@ -155,10 +157,21 @@ module ActiveMerchant #:nodoc:
155
157
  def add_auth_purchase_params(doc, money, payment_method, options)
156
158
  doc.orderId(truncated(options[:order_id]))
157
159
  doc.amount(money)
158
- doc.orderSource('ecommerce')
160
+ add_order_source(doc, payment_method)
159
161
  add_billing_address(doc, payment_method, options)
160
162
  add_shipping_address(doc, payment_method, options)
161
163
  add_payment_method(doc, payment_method)
164
+ add_pos(doc, payment_method)
165
+ add_descriptor(doc, options)
166
+ end
167
+
168
+ def add_descriptor(doc, options)
169
+ if options[:descriptor_name] || options[:descriptor_phone]
170
+ doc.customBilling do
171
+ doc.phone(options[:descriptor_phone]) if options[:descriptor_phone]
172
+ doc.descriptor(options[:descriptor_name]) if options[:descriptor_name]
173
+ end
174
+ end
162
175
  end
163
176
 
164
177
  def add_payment_method(doc, payment_method)
@@ -166,6 +179,10 @@ module ActiveMerchant #:nodoc:
166
179
  doc.token do
167
180
  doc.litleToken(payment_method)
168
181
  end
182
+ elsif payment_method.respond_to?(:track_data) && payment_method.track_data.present?
183
+ doc.card do
184
+ doc.track(payment_method.track_data)
185
+ end
169
186
  else
170
187
  doc.card do
171
188
  doc.type_(CARD_TYPE[payment_method.brand])
@@ -208,6 +225,24 @@ module ActiveMerchant #:nodoc:
208
225
  doc.phone(address[:phone]) unless address[:phone].blank?
209
226
  end
210
227
 
228
+ def add_order_source(doc, payment_method)
229
+ if payment_method.respond_to?(:track_data) && payment_method.track_data.present?
230
+ doc.orderSource('retail')
231
+ else
232
+ doc.orderSource('ecommerce')
233
+ end
234
+ end
235
+
236
+ def add_pos(doc, payment_method)
237
+ return unless payment_method.respond_to?(:track_data) && payment_method.track_data.present?
238
+
239
+ doc.pos do
240
+ doc.capability('magstripe')
241
+ doc.entryMode('completeread')
242
+ doc.cardholderId('signature')
243
+ end
244
+ end
245
+
211
246
  def exp_date(payment_method)
212
247
  "#{format(payment_method.month, :two_digits)}#{format(payment_method.year, :two_digits)}"
213
248
  end
@@ -8,7 +8,6 @@ module ActiveMerchant #:nodoc:
8
8
  def configure_ssl(http)
9
9
  super(http)
10
10
  http.use_ssl = true
11
- http.ssl_version = :SSLv3
12
11
  end
13
12
  end
14
13
 
@@ -223,10 +223,14 @@ module ActiveMerchant #:nodoc:
223
223
  end
224
224
 
225
225
  def add_credit_card(xml, credit_card)
226
- xml.tag! "strPAN", credit_card.number
227
- xml.tag! "strExpDate", expdate(credit_card)
228
- xml.tag! "strCardHolder", credit_card.name
229
- xml.tag! "strCVCode", credit_card.verification_value if credit_card.verification_value?
226
+ if credit_card.respond_to?(:track_data) && credit_card.track_data.present?
227
+ xml.tag! "trackData", credit_card.track_data
228
+ else
229
+ xml.tag! "strPAN", credit_card.number
230
+ xml.tag! "strExpDate", expdate(credit_card)
231
+ xml.tag! "strCardHolder", credit_card.name
232
+ xml.tag! "strCVCode", credit_card.verification_value if credit_card.verification_value?
233
+ end
230
234
  end
231
235
 
232
236
  def split_reference(reference)
@@ -22,6 +22,12 @@ module ActiveMerchant #:nodoc:
22
22
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
23
23
  self.default_currency = 'USD'
24
24
 
25
+ STANDARD_ERROR_CODE_MAPPING = {
26
+ '100204' => STANDARD_ERROR_CODE[:invalid_number],
27
+ '100205' => STANDARD_ERROR_CODE[:invalid_expiry_date],
28
+ '000000' => STANDARD_ERROR_CODE[:card_declined]
29
+ }
30
+
25
31
  def initialize(options = {})
26
32
  requires!(options, :login, :password)
27
33
  @use_tokenization = (!options.has_key?(:tokenization) || options[:tokenization])
@@ -99,7 +105,7 @@ module ActiveMerchant #:nodoc:
99
105
  add_customer_data(xml, options)
100
106
  add_amount(xml, money, options)
101
107
  add_credit_card(xml, credit_card, action)
102
- add_address(xml, options)
108
+ add_address(xml, options) unless credit_card.track_data.present?
103
109
  end
104
110
  end
105
111
  xml = xml.target!
@@ -109,7 +115,7 @@ module ActiveMerchant #:nodoc:
109
115
  xml = Builder::XmlMarkup.new
110
116
 
111
117
  invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = split_authorization(authorization)
112
- ref_no = invoice_no if options[:reversal]
118
+ ref_no = "1" if options[:reversal] #filler value for preauth voids -- not used by mercury but will reject if missing or not numeric
113
119
 
114
120
  xml.tag! "TStream" do
115
121
  xml.tag! "Transaction" do
@@ -152,10 +158,6 @@ module ActiveMerchant #:nodoc:
152
158
  end
153
159
 
154
160
  def add_invoice(xml, invoice_no, ref_no, options)
155
- if /^\d+$/ !~ invoice_no.to_s
156
- raise ArgumentError.new("order_id '#{invoice_no}' is not numeric as required by Mercury")
157
- end
158
-
159
161
  xml.tag! 'InvoiceNo', invoice_no
160
162
  xml.tag! 'RefNo', (ref_no || invoice_no)
161
163
  xml.tag! 'OperatorID', options[:merchant] if options[:merchant]
@@ -199,12 +201,16 @@ module ActiveMerchant #:nodoc:
199
201
 
200
202
  def add_credit_card(xml, credit_card, action)
201
203
  xml.tag! 'Account' do
202
- xml.tag! 'AcctNo', credit_card.number
203
- xml.tag! 'ExpDate', expdate(credit_card)
204
+ if credit_card.track_data.present?
205
+ xml.tag! 'Track1', credit_card.track_data
206
+ else
207
+ xml.tag! 'AcctNo', credit_card.number
208
+ xml.tag! 'ExpDate', expdate(credit_card)
209
+ end
204
210
  end
205
211
  xml.tag! 'CardType', CARD_CODES[credit_card.brand] if credit_card.brand
206
212
 
207
- include_cvv = !%w(Return PreAuthCapture).include?(action)
213
+ include_cvv = !%w(Return PreAuthCapture).include?(action) && !credit_card.track_data.present?
208
214
  xml.tag! 'CVVData', credit_card.verification_value if(include_cvv && credit_card.verification_value)
209
215
  end
210
216
 
@@ -281,7 +287,8 @@ module ActiveMerchant #:nodoc:
281
287
  :test => test?,
282
288
  :authorization => authorization_from(response),
283
289
  :avs_result => { :code => response[:avs_result] },
284
- :cvv_result => response[:cvv_result])
290
+ :cvv_result => response[:cvv_result],
291
+ :error_code => success ? nil : STANDARD_ERROR_CODE_MAPPING[response[:dsix_return_code]])
285
292
  end
286
293
 
287
294
  def message_from(response)
@@ -154,10 +154,15 @@ module ActiveMerchant #:nodoc:
154
154
  post[:data_key] = source
155
155
  post[:cust_id] = options[:customer]
156
156
  else
157
- post[:pan] = source.number
158
- post[:expdate] = expdate(source)
159
- post[:cvd_value] = source.verification_value if source.verification_value?
160
- post[:cust_id] = options[:customer] || source.name
157
+ if source.respond_to?(:track_data) && source.track_data.present?
158
+ post[:pos_code] = '00'
159
+ post[:track2] = source.track_data
160
+ else
161
+ post[:pan] = source.number
162
+ post[:expdate] = expdate(source)
163
+ post[:cvd_value] = source.verification_value if source.verification_value?
164
+ end
165
+ post[:cust_id] = options[:customer] || source.name
161
166
  end
162
167
  end
163
168
 
@@ -279,8 +284,8 @@ module ActiveMerchant #:nodoc:
279
284
 
280
285
  def actions
281
286
  {
282
- "purchase" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
283
- "preauth" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
287
+ "purchase" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code],
288
+ "preauth" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code],
284
289
  "command" => [:order_id],
285
290
  "refund" => [:order_id, :amount, :txn_number, :crypt_type],
286
291
  "indrefund" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],