activemerchant 1.60.0 → 1.61.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +64 -0
  3. data/lib/active_merchant/billing/gateways/authorize_net.rb +1 -1
  4. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +12 -1
  5. data/lib/active_merchant/billing/gateways/blue_pay.rb +1 -1
  6. data/lib/active_merchant/billing/gateways/blue_snap.rb +1 -1
  7. data/lib/active_merchant/billing/gateways/braintree_blue.rb +8 -0
  8. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -0
  9. data/lib/active_merchant/billing/gateways/citrus_pay.rb +24 -0
  10. data/lib/active_merchant/billing/gateways/clearhaus.rb +12 -4
  11. data/lib/active_merchant/billing/gateways/conekta.rb +6 -1
  12. data/lib/active_merchant/billing/gateways/credorax.rb +234 -0
  13. data/lib/active_merchant/billing/gateways/cyber_source.rb +39 -52
  14. data/lib/active_merchant/billing/gateways/element.rb +13 -2
  15. data/lib/active_merchant/billing/gateways/fat_zebra.rb +12 -3
  16. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +5 -0
  17. data/lib/active_merchant/billing/gateways/global_collect.rb +3 -1
  18. data/lib/active_merchant/billing/gateways/jetpay.rb +11 -3
  19. data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -0
  20. data/lib/active_merchant/billing/gateways/litle.rb +28 -12
  21. data/lib/active_merchant/billing/gateways/mastercard.rb +261 -0
  22. data/lib/active_merchant/billing/gateways/migs.rb +23 -1
  23. data/lib/active_merchant/billing/gateways/monei.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/moneris.rb +13 -0
  25. data/lib/active_merchant/billing/gateways/netbanx.rb +245 -0
  26. data/lib/active_merchant/billing/gateways/nmi.rb +5 -0
  27. data/lib/active_merchant/billing/gateways/openpay.rb +7 -0
  28. data/lib/active_merchant/billing/gateways/opp.rb +362 -0
  29. data/lib/active_merchant/billing/gateways/orbital.rb +13 -0
  30. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
  31. data/lib/active_merchant/billing/gateways/payflow.rb +6 -0
  32. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/paymill.rb +10 -0
  34. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/payu_latam.rb +386 -0
  36. data/lib/active_merchant/billing/gateways/pin.rb +1 -3
  37. data/lib/active_merchant/billing/gateways/redsys.rb +2 -0
  38. data/lib/active_merchant/billing/gateways/sage.rb +22 -0
  39. data/lib/active_merchant/billing/gateways/sage_pay.rb +12 -0
  40. data/lib/active_merchant/billing/gateways/securion_pay.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/stripe.rb +29 -8
  42. data/lib/active_merchant/billing/gateways/telr.rb +275 -0
  43. data/lib/active_merchant/billing/gateways/tns.rb +12 -230
  44. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +1 -1
  45. data/lib/active_merchant/billing/gateways/vanco.rb +12 -8
  46. data/lib/active_merchant/billing/gateways/worldpay.rb +18 -0
  47. data/lib/active_merchant/country.rb +6 -2
  48. data/lib/active_merchant/version.rb +1 -1
  49. metadata +11 -3
@@ -1,17 +1,8 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
- # See the remote and mocked unit test files for example usage. Pay special
4
- # attention to the contents of the options hash.
5
- #
6
3
  # Initial setup instructions can be found in
7
4
  # http://cybersource.com/support_center/implementation/downloads/soap_api/SOAP_toolkits.pdf
8
5
  #
9
- # Debugging
10
- # If you experience an issue with this gateway be sure to examine the
11
- # transaction information from a general transaction search inside the
12
- # CyberSource Business Center for the full error messages including field
13
- # names.
14
- #
15
6
  # Important Notes
16
7
  # * For checks you can purchase and store.
17
8
  # * AVS and CVV only work against the production server. You will always
@@ -35,14 +26,15 @@ module ActiveMerchant #:nodoc:
35
26
 
36
27
  XSD_VERSION = "1.121"
37
28
 
38
- # visa, master, american_express, discover
39
29
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
40
30
  self.supported_countries = %w(US BR CA CN DK FI FR DE JP MX NO SE GB SG)
31
+
41
32
  self.default_currency = 'USD'
33
+ self.currencies_without_fractions = %w(JPY)
34
+
42
35
  self.homepage_url = 'http://www.cybersource.com'
43
36
  self.display_name = 'CyberSource'
44
37
 
45
- # map credit card to the CyberSource expected representation
46
38
  @@credit_card_codes = {
47
39
  :visa => '001',
48
40
  :master => '002',
@@ -50,7 +42,6 @@ module ActiveMerchant #:nodoc:
50
42
  :discover => '004'
51
43
  }
52
44
 
53
- # map response codes to something humans can read
54
45
  @@response_codes = {
55
46
  :r100 => "Successful transaction",
56
47
  :r101 => "Request is missing one or more required fields" ,
@@ -116,38 +107,28 @@ module ActiveMerchant #:nodoc:
116
107
  super
117
108
  end
118
109
 
119
- # Request an authorization for an amount from CyberSource
120
- #
121
- # You must supply an :order_id in the options hash
122
110
  def authorize(money, creditcard_or_reference, options = {})
123
111
  setup_address_hash(options)
124
- commit(build_auth_request(money, creditcard_or_reference, options), options )
112
+ commit(build_auth_request(money, creditcard_or_reference, options), :authorize, money, options )
125
113
  end
126
114
 
127
- def auth_reversal(money, identification, options = {})
128
- commit(build_auth_reversal_request(money, identification, options), options)
129
- end
130
-
131
- # Capture an authorization that has previously been requested
132
115
  def capture(money, authorization, options = {})
133
116
  setup_address_hash(options)
134
- commit(build_capture_request(money, authorization, options), options)
117
+ commit(build_capture_request(money, authorization, options), :capture, money, options)
135
118
  end
136
119
 
137
- # Purchase is an auth followed by a capture
138
- # You must supply an order_id in the options hash
139
120
  # options[:pinless_debit_card] => true # attempts to process as pinless debit card
140
121
  def purchase(money, payment_method_or_reference, options = {})
141
122
  setup_address_hash(options)
142
- commit(build_purchase_request(money, payment_method_or_reference, options), options)
123
+ commit(build_purchase_request(money, payment_method_or_reference, options), :purchase, money, options)
143
124
  end
144
125
 
145
126
  def void(identification, options = {})
146
- commit(build_void_request(identification, options), options)
127
+ commit(build_void_request(identification, options), :void, nil, options)
147
128
  end
148
129
 
149
130
  def refund(money, identification, options = {})
150
- commit(build_refund_request(money, identification, options), options)
131
+ commit(build_refund_request(money, identification, options), :refund, money, options)
151
132
  end
152
133
 
153
134
  def verify(payment, options = {})
@@ -159,7 +140,7 @@ module ActiveMerchant #:nodoc:
159
140
 
160
141
  # Adds credit to a subscription (stand alone credit).
161
142
  def credit(money, reference, options = {})
162
- commit(build_credit_request(money, reference, options), options)
143
+ commit(build_credit_request(money, reference, options), :credit, money, options)
163
144
  end
164
145
 
165
146
  # Stores a customer subscription/profile with type "on-demand".
@@ -167,26 +148,26 @@ module ActiveMerchant #:nodoc:
167
148
  # options[:setup_fee] => money
168
149
  def store(payment_method, options = {})
169
150
  setup_address_hash(options)
170
- commit(build_create_subscription_request(payment_method, options), options)
151
+ commit(build_create_subscription_request(payment_method, options), :store, nil, options)
171
152
  end
172
153
 
173
154
  # Updates a customer subscription/profile
174
155
  def update(reference, creditcard, options = {})
175
156
  requires!(options, :order_id)
176
157
  setup_address_hash(options)
177
- commit(build_update_subscription_request(reference, creditcard, options), options)
158
+ commit(build_update_subscription_request(reference, creditcard, options), :update, nil, options)
178
159
  end
179
160
 
180
161
  # Removes a customer subscription/profile
181
162
  def unstore(reference, options = {})
182
163
  requires!(options, :order_id)
183
- commit(build_delete_subscription_request(reference, options), options)
164
+ commit(build_delete_subscription_request(reference, options), :unstore, nil, options)
184
165
  end
185
166
 
186
167
  # Retrieves a customer subscription/profile
187
168
  def retrieve(reference, options = {})
188
169
  requires!(options, :order_id)
189
- commit(build_retrieve_subscription_request(reference, options), options)
170
+ commit(build_retrieve_subscription_request(reference, options), :retrieve, nil, options)
190
171
  end
191
172
 
192
173
  # CyberSource requires that you provide line item information for tax
@@ -218,13 +199,13 @@ module ActiveMerchant #:nodoc:
218
199
  def calculate_tax(creditcard, options)
219
200
  requires!(options, :line_items)
220
201
  setup_address_hash(options)
221
- commit(build_tax_calculation_request(creditcard, options), options)
202
+ commit(build_tax_calculation_request(creditcard, options), :calculate_tax, nil, options)
222
203
  end
223
204
 
224
205
  # Determines if a card can be used for Pinless Debit Card transactions
225
206
  def validate_pinless_debit_card(creditcard, options = {})
226
207
  requires!(options, :order_id)
227
- commit(build_validate_pinless_debit_request(creditcard,options), options)
208
+ commit(build_validate_pinless_debit_request(creditcard,options), :validate_pinless_debit_card, nil, options)
228
209
  end
229
210
 
230
211
  def supports_scrubbing?
@@ -245,6 +226,11 @@ module ActiveMerchant #:nodoc:
245
226
  true
246
227
  end
247
228
 
229
+ def verify_credentials
230
+ response = void("0")
231
+ response.params["reasonCode"] == "102"
232
+ end
233
+
248
234
  private
249
235
 
250
236
  # Create all address hash key value pairs so that we still function if we
@@ -308,20 +294,16 @@ module ActiveMerchant #:nodoc:
308
294
  end
309
295
 
310
296
  def build_void_request(identification, options)
311
- order_id, request_id, request_token = identification.split(";")
297
+ order_id, request_id, request_token, action, money, currency = identification.split(";")
312
298
  options[:order_id] = order_id
313
299
 
314
300
  xml = Builder::XmlMarkup.new :indent => 2
315
- add_void_service(xml, request_id, request_token)
316
- xml.target!
317
- end
318
-
319
- def build_auth_reversal_request(money, identification, options)
320
- order_id, request_id, request_token = identification.split(";")
321
- options[:order_id] = order_id
322
- xml = Builder::XmlMarkup.new :indent => 2
323
- add_purchase_data(xml, money, true, options)
324
- add_auth_reversal_service(xml, request_id, request_token)
301
+ if action == "capture"
302
+ add_void_service(xml, request_id, request_token)
303
+ else
304
+ add_purchase_data(xml, money, true, options.merge(:currency => currency || default_currency))
305
+ add_auth_reversal_service(xml, request_id, request_token)
306
+ end
325
307
  xml.target!
326
308
  end
327
309
 
@@ -429,7 +411,7 @@ module ActiveMerchant #:nodoc:
429
411
  def add_line_item_data(xml, options)
430
412
  options[:line_items].each_with_index do |value, index|
431
413
  xml.tag! 'item', {'id' => index} do
432
- xml.tag! 'unitPrice', amount(value[:declared_value])
414
+ xml.tag! 'unitPrice', localized_amount(value[:declared_value].to_i, options[:currency] || default_currency)
433
415
  xml.tag! 'quantity', value[:quantity]
434
416
  xml.tag! 'productCode', value[:code] || 'shipping_only'
435
417
  xml.tag! 'productName', value[:description]
@@ -449,7 +431,7 @@ module ActiveMerchant #:nodoc:
449
431
  def add_purchase_data(xml, money = 0, include_grand_total = false, options={})
450
432
  xml.tag! 'purchaseTotals' do
451
433
  xml.tag! 'currency', options[:currency] || currency(money)
452
- xml.tag!('grandTotalAmount', amount(money)) if include_grand_total
434
+ xml.tag!('grandTotalAmount', localized_amount(money.to_i, options[:currency] || default_currency)) if include_grand_total
453
435
  end
454
436
  end
455
437
 
@@ -462,7 +444,7 @@ module ActiveMerchant #:nodoc:
462
444
  xml.tag! 'city', address[:city]
463
445
  xml.tag! 'state', address[:state]
464
446
  xml.tag! 'postalCode', address[:zip]
465
- xml.tag! 'country', address[:country]
447
+ xml.tag! 'country', lookup_country_code(address[:country]) unless address[:country].blank?
466
448
  xml.tag! 'company', address[:company] unless address[:company].blank?
467
449
  xml.tag! 'companyTaxID', address[:companyTaxID] unless address[:company_tax_id].blank?
468
450
  xml.tag! 'phoneNumber', address[:phone] unless address[:phone].blank?
@@ -492,7 +474,7 @@ module ActiveMerchant #:nodoc:
492
474
 
493
475
  def add_mdd_fields(xml, options)
494
476
  xml.tag! 'merchantDefinedData' do
495
- (1..20).each do |each|
477
+ (1..100).each do |each|
496
478
  key = "mdd_field_#{each}".to_sym
497
479
  xml.tag!("field#{each}", options[key]) if options[key]
498
480
  end
@@ -625,7 +607,7 @@ module ActiveMerchant #:nodoc:
625
607
  end
626
608
 
627
609
  xml.tag! 'status', options[:subscription][:status] if options[:subscription][:status]
628
- xml.tag! 'amount', amount(options[:subscription][:amount]) if options[:subscription][:amount]
610
+ xml.tag! 'amount', localized_amount(options[:subscription][:amount].to_i, options[:currency] || default_currency) if options[:subscription][:amount]
629
611
  xml.tag! 'numberOfPayments', options[:subscription][:occurrences] if options[:subscription][:occurrences]
630
612
  xml.tag! 'automaticRenew', options[:subscription][:automatic_renew] if options[:subscription][:automatic_renew]
631
613
  xml.tag! 'frequency', options[:subscription][:frequency] if options[:subscription][:frequency]
@@ -669,6 +651,11 @@ module ActiveMerchant #:nodoc:
669
651
  xml.tag!'pinlessDebitValidateService', {'run' => 'true'}
670
652
  end
671
653
 
654
+ def lookup_country_code(country_field)
655
+ country_code = Country.find(country_field) rescue nil
656
+ country_code.code(:alpha2)
657
+ end
658
+
672
659
  # Where we actually build the full SOAP request using builder
673
660
  def build_request(body, options)
674
661
  xml = Builder::XmlMarkup.new :indent => 2
@@ -694,7 +681,7 @@ module ActiveMerchant #:nodoc:
694
681
 
695
682
  # Contact CyberSource, make the SOAP request, and parse the reply into a
696
683
  # Response object
697
- def commit(request, options)
684
+ def commit(request, action, amount, options)
698
685
  begin
699
686
  response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(request, options)))
700
687
  rescue ResponseError => e
@@ -703,7 +690,7 @@ module ActiveMerchant #:nodoc:
703
690
 
704
691
  success = response[:decision] == "ACCEPT"
705
692
  message = @@response_codes[('r' + response[:reasonCode]).to_sym] rescue response[:message]
706
- authorization = success ? [ options[:order_id], response[:requestID], response[:requestToken] ].compact.join(";") : nil
693
+ authorization = success ? [ options[:order_id], response[:requestID], response[:requestToken], action, amount, options[:currency]].compact.join(";") : nil
707
694
 
708
695
  Response.new(success, message, response,
709
696
  :test => test?,
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
  xml.send(action, xmlns: "https://transaction.elementexpress.com") do
30
30
  add_credentials(xml)
31
31
  add_payment_method(xml, payment)
32
- add_transaction(xml, money)
32
+ add_transaction(xml, money, options)
33
33
  add_terminal(xml, options)
34
34
  add_address(xml, options)
35
35
  end
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
43
43
  xml.CreditCardAuthorization(xmlns: "https://transaction.elementexpress.com") do
44
44
  add_credentials(xml)
45
45
  add_payment_method(xml, payment)
46
- add_transaction(xml, money)
46
+ add_transaction(xml, money, options)
47
47
  add_terminal(xml, options)
48
48
  add_address(xml, options)
49
49
  end
@@ -226,6 +226,17 @@ module ActiveMerchant #:nodoc:
226
226
  xml.BillingPhone address[:phone_number] if address[:phone_number]
227
227
  end
228
228
  end
229
+ if shipping_address = options[:shipping_address]
230
+ xml.address do
231
+ xml.ShippingAddress1 shipping_address[:address1] if shipping_address[:address1]
232
+ xml.ShippingAddress2 shipping_address[:address2] if shipping_address[:address2]
233
+ xml.ShippingCity shipping_address[:city] if shipping_address[:city]
234
+ xml.ShippingState shipping_address[:state] if shipping_address[:state]
235
+ xml.ShippingZipcode shipping_address[:zip] if shipping_address[:zip]
236
+ xml.ShippingEmail shipping_address[:email] if shipping_address[:email]
237
+ xml.ShippingPhone shipping_address[:phone_number] if shipping_address[:phone_number]
238
+ end
239
+ end
229
240
  end
230
241
 
231
242
  def parse(xml)
@@ -3,7 +3,7 @@ require 'json'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class FatZebraGateway < Gateway
6
- self.live_url = "https://gateway.fatzebra.com.au/v1.0"
6
+ self.live_url = "https://gateway.fatzebra.com.au/v1.0"
7
7
  self.test_url = "https://gateway.sandbox.fatzebra.com.au/v1.0"
8
8
 
9
9
  self.supported_countries = ['AU']
@@ -121,12 +121,21 @@ module ActiveMerchant #:nodoc:
121
121
 
122
122
  def add_extra_options(post, options)
123
123
  extra = {}
124
- extra[:name] = options[:merchant] if options[:merchant]
125
- extra[:location] = options[:merchant_location] if options[:merchant_location]
126
124
  extra[:ecm] = "32" if options[:recurring]
125
+ extra[:cavv] = options[:cavv] if options[:cavv]
126
+ extra[:xid] = options[:cavv] if options[:xid]
127
+ extra[:sli] = options[:sli] if options[:sli]
128
+ add_descriptor(extra, options)
127
129
  post[:extra] = extra if extra.any?
128
130
  end
129
131
 
132
+ def add_descriptor(extra, options)
133
+ descriptor = {}
134
+ descriptor[:name] = options[:merchant] if options[:merchant]
135
+ descriptor[:location] = options[:merchant_location] if options[:merchant_location]
136
+ extra[:descriptor] = descriptor if descriptor.any?
137
+ end
138
+
130
139
  def add_order_id(post, options)
131
140
  post[:reference] = options[:order_id] || SecureRandom.hex(15)
132
141
  end
@@ -129,6 +129,11 @@ module ActiveMerchant #:nodoc:
129
129
  commit(:store, build_store_request(credit_card, options), credit_card)
130
130
  end
131
131
 
132
+ def verify_credentials
133
+ response = void("0")
134
+ response.message != "Unauthorized Request. Bad or missing credentials."
135
+ end
136
+
132
137
  def supports_scrubbing?
133
138
  true
134
139
  end
@@ -80,7 +80,9 @@ module ActiveMerchant #:nodoc:
80
80
  "visa" => "1",
81
81
  "american_express" => "2",
82
82
  "master" => "3",
83
- "discover" => "128"
83
+ "discover" => "128",
84
+ "jcb" => "125",
85
+ "diners_club" => "132"
84
86
  }
85
87
 
86
88
  def add_order(post, money, options)
@@ -1,11 +1,14 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class JetpayGateway < Gateway
4
+ class_attribute :live_us_url, :live_ca_url
5
+
4
6
  self.test_url = 'https://test1.jetpay.com/jetpay'
5
- self.live_url = 'https://gateway17.jetpay.com/jetpay'
7
+ self.live_us_url = 'https://gateway17.jetpay.com/jetpay'
8
+ self.live_ca_url = 'https://gateway17.jetpay.com/canada-bb'
6
9
 
7
10
  # The countries the gateway supports merchants from as 2 digit ISO country codes
8
- self.supported_countries = ['US']
11
+ self.supported_countries = ['US', 'CA']
9
12
 
10
13
  # The card types supported by the payment gateway
11
14
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
@@ -277,7 +280,7 @@ module ActiveMerchant #:nodoc:
277
280
  end
278
281
 
279
282
  def commit(money, request)
280
- response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
283
+ response = parse(ssl_post(url, request))
281
284
 
282
285
  success = success?(response)
283
286
  Response.new(success,
@@ -290,6 +293,11 @@ module ActiveMerchant #:nodoc:
290
293
  )
291
294
  end
292
295
 
296
+ def url
297
+ live_url = @options[:region] == 'CA' ? live_ca_url : live_us_url
298
+ test? ? test_url : live_url
299
+ end
300
+
293
301
  def parse(body)
294
302
  return {} if body.blank?
295
303
 
@@ -143,6 +143,8 @@ module ActiveMerchant #:nodoc:
143
143
  :pem => LinkpointGateway.pem_file
144
144
  }.update(options)
145
145
 
146
+ @options[:pem].strip!
147
+
146
148
  raise ArgumentError, "You need to pass in your pem file using the :pem parameter or set it globally using ActiveMerchant::Billing::LinkpointGateway.pem_file = File.read( File.dirname(__FILE__) + '/../mycert.pem' ) or similar" if @options[:pem].blank?
147
149
  end
148
150
 
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
  end
35
35
  end
36
36
 
37
- commit(:sale, request)
37
+ commit(:sale, request, money)
38
38
  end
39
39
 
40
40
  def authorize(money, payment_method, options={})
@@ -45,11 +45,11 @@ module ActiveMerchant #:nodoc:
45
45
  end
46
46
  end
47
47
 
48
- commit(:authorization, request)
48
+ commit(:authorization, request, money)
49
49
  end
50
50
 
51
51
  def capture(money, authorization, options={})
52
- transaction_id, _ = split_authorization(authorization)
52
+ transaction_id, _, _ = split_authorization(authorization)
53
53
 
54
54
  request = build_xml_request do |doc|
55
55
  add_authentication(doc)
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
60
60
  end
61
61
  end
62
62
 
63
- commit(:capture, request)
63
+ commit(:capture, request, money)
64
64
  end
65
65
 
66
66
  def credit(money, authorization, options = {})
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
69
69
  end
70
70
 
71
71
  def refund(money, authorization, options={})
72
- transaction_id, _ = split_authorization(authorization)
72
+ transaction_id, _, _ = split_authorization(authorization)
73
73
 
74
74
  request = build_xml_request do |doc|
75
75
  add_authentication(doc)
@@ -91,12 +91,13 @@ module ActiveMerchant #:nodoc:
91
91
  end
92
92
 
93
93
  def void(authorization, options={})
94
- transaction_id, kind = split_authorization(authorization)
94
+ transaction_id, kind, money = split_authorization(authorization)
95
95
 
96
96
  request = build_xml_request do |doc|
97
97
  add_authentication(doc)
98
98
  doc.send(void_type(kind), transaction_attributes(options)) do
99
99
  doc.litleTxnId(transaction_id)
100
+ doc.amount(money) if void_type(kind) == :authReversal
100
101
  end
101
102
  end
102
103
 
@@ -120,6 +121,21 @@ module ActiveMerchant #:nodoc:
120
121
  commit(:registerToken, request)
121
122
  end
122
123
 
124
+ def supports_scrubbing?
125
+ true
126
+ end
127
+
128
+ def scrub(transcript)
129
+ transcript.
130
+ gsub(%r((<user>).+(</user>)), '\1[FILTERED]\2').
131
+ gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
132
+ gsub(%r((<number>).+(</number>)), '\1[FILTERED]\2').
133
+ gsub(%r((<cardValidationNum>).+(</cardValidationNum>)), '\1[FILTERED]\2').
134
+ gsub(%r((<accountNumber>).+(</accountNumber>)), '\1[FILTERED]\2').
135
+ gsub(%r((<paypageRegistrationId>).+(</paypageRegistrationId>)), '\1[FILTERED]\2').
136
+ gsub(%r((<authenticationValue>).+(</authenticationValue>)), '\1[FILTERED]\2')
137
+ end
138
+
123
139
  private
124
140
  CARD_TYPE = {
125
141
  'visa' => 'VI',
@@ -290,11 +306,11 @@ module ActiveMerchant #:nodoc:
290
306
  parsed
291
307
  end
292
308
 
293
- def commit(kind, request)
309
+ def commit(kind, request, money=nil)
294
310
  parsed = parse(kind, ssl_post(url, request, headers))
295
311
 
296
312
  options = {
297
- authorization: authorization_from(kind, parsed),
313
+ authorization: authorization_from(kind, parsed, money),
298
314
  test: test?,
299
315
  :avs_result => { :code => AVS_RESPONSE_CODE[parsed[:fraudResult_avsResult]] },
300
316
  :cvv_result => parsed[:fraudResult_cardValidationResult]
@@ -308,13 +324,13 @@ module ActiveMerchant #:nodoc:
308
324
  %w(000 801 802).include?(parsed[:response])
309
325
  end
310
326
 
311
- def authorization_from(kind, parsed)
312
- (kind == :registerToken) ? parsed[:litleToken] : "#{parsed[:litleTxnId]};#{kind}"
327
+ def authorization_from(kind, parsed, money)
328
+ (kind == :registerToken) ? parsed[:litleToken] : "#{parsed[:litleTxnId]};#{kind};#{money}"
313
329
  end
314
330
 
315
331
  def split_authorization(authorization)
316
- transaction_id, kind = authorization.to_s.split(';')
317
- [transaction_id, kind]
332
+ transaction_id, kind, money = authorization.to_s.split(';')
333
+ [transaction_id, kind, money]
318
334
  end
319
335
 
320
336
  def transaction_attributes(options)