activemerchant 1.28.0 → 1.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data.tar.gz.sig +3 -3
  2. data/CHANGELOG +36 -0
  3. data/CONTRIBUTORS +8 -0
  4. data/README.md +5 -0
  5. data/lib/active_merchant/billing/gateway.rb +2 -1
  6. data/lib/active_merchant/billing/gateways.rb +6 -7
  7. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  8. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
  9. data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
  10. data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
  11. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
  12. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
  13. data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
  14. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
  15. data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
  16. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
  17. data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
  18. data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
  19. data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
  20. data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
  21. data/lib/active_merchant/billing/gateways/epay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/eway.rb +88 -93
  23. data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
  24. data/lib/active_merchant/billing/gateways/exact.rb +45 -54
  25. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
  26. data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
  27. data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
  28. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  29. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
  30. data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
  31. data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
  32. data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
  33. data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
  34. data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
  35. data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
  36. data/lib/active_merchant/billing/gateways/litle.rb +1 -5
  37. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
  38. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
  39. data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
  40. data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
  41. data/lib/active_merchant/billing/gateways/migs.rb +5 -3
  42. data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
  43. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
  44. data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
  45. data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
  46. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
  47. data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
  48. data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
  49. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  50. data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
  51. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
  52. data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
  53. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  54. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
  55. data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
  56. data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
  57. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
  58. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
  59. data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
  60. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
  61. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
  62. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
  63. data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
  64. data/lib/active_merchant/billing/gateways/payway.rb +2 -9
  65. data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
  67. data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
  68. data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
  69. data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
  70. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
  71. data/lib/active_merchant/billing/gateways/realex.rb +6 -16
  72. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  73. data/lib/active_merchant/billing/gateways/sage.rb +15 -16
  74. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
  75. data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
  76. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  77. data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
  78. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  79. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
  80. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
  81. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
  82. data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
  83. data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
  84. data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
  85. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
  86. data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
  87. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
  88. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
  89. data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
  90. data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
  91. data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
  92. data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
  93. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
  94. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
  95. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  96. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  97. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  98. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  99. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
  100. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  101. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  102. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  103. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +17 -1
  104. data/lib/active_merchant/billing/integrations/notification.rb +4 -0
  105. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
  106. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
  107. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  108. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  109. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  110. data/lib/active_merchant/billing/integrations/paypal/notification.rb +64 -0
  111. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +10 -7
  112. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +12 -0
  113. data/lib/active_merchant/billing/response.rb +19 -4
  114. data/lib/active_merchant/version.rb +1 -1
  115. metadata +45 -27
  116. metadata.gz.sig +0 -0
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  module Billing #:nodoc:
6
6
  # ==== USA ePay Advanced SOAP Interface
7
7
  #
8
- # This class encapuslates USA ePay's Advanced SOAP Interface. The Advanced Soap Interface allows
8
+ # This class encapuslates USA ePay's Advanced SOAP Interface. The Advanced Soap Interface allows
9
9
  # standard transactions, storing customer information, and recurring billing. Storing sensitive
10
10
  # information on USA ePay's servers can help with PCI DSS compliance, since customer and card data
11
11
  # do not need to be stored locally.
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  #
64
64
  class UsaEpayAdvancedGateway < Gateway
65
65
  API_VERSION = "1.4"
66
-
66
+
67
67
  TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' #:nodoc:
68
68
  LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' #:nodoc:
69
69
 
@@ -71,7 +71,7 @@ module ActiveMerchant #:nodoc:
71
71
  self.live_url = LIVE_URL_BASE
72
72
 
73
73
  FAILURE_MESSAGE = "Default Failure" #:nodoc:
74
-
74
+
75
75
  self.supported_countries = ['US']
76
76
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
77
77
  self.homepage_url = 'http://www.usaepay.com/'
@@ -154,7 +154,7 @@ module ActiveMerchant #:nodoc:
154
154
  :currency => [:string, 'Currency'],
155
155
  :non_tax => [:boolean, 'NonTax'],
156
156
  } #:nodoc:
157
-
157
+
158
158
  TRANSACTION_DETAIL_MONEY_OPTIONS = {
159
159
  :amount => [:double, 'Amount'],
160
160
  :tax => [:double, 'Tax'],
@@ -235,15 +235,14 @@ module ActiveMerchant #:nodoc:
235
235
  # * <tt>:soap_response</tt> -- set to +true+ to add :soap_response to the params hash containing the entire soap xml message
236
236
  #
237
237
  def initialize(options = {})
238
- requires! options, :login, :password
239
- @options = options
238
+ requires!(options, :login, :password)
240
239
 
241
- if @options[:software_id]
242
- self.live_url = "#{LIVE_URL_BASE}#{@options[:software_id].to_s}"
243
- self.test_url = "#{TEST_URL_BASE}#{@options[:software_id].to_s}"
240
+ if options[:software_id]
241
+ self.live_url = "#{LIVE_URL_BASE}#{options[:software_id].to_s}"
242
+ self.test_url = "#{TEST_URL_BASE}#{options[:software_id].to_s}"
244
243
  else
245
- self.live_url = @options[:live_url].to_s
246
- self.test_url = @options[:test_url].to_s if @options[:test_url]
244
+ self.live_url = options[:live_url].to_s
245
+ self.test_url = options[:test_url].to_s if options[:test_url]
247
246
  end
248
247
 
249
248
  super
@@ -251,7 +250,7 @@ module ActiveMerchant #:nodoc:
251
250
 
252
251
  # Standard Gateway Methods ======================================
253
252
 
254
- # Make a purchase with a credit card. (Authorize and
253
+ # Make a purchase with a credit card. (Authorize and
255
254
  # capture for settlement.)
256
255
  #
257
256
  # Note: See run_transaction for additional options.
@@ -302,7 +301,7 @@ module ActiveMerchant #:nodoc:
302
301
  # * <tt>:data</tt> -- base64 data about customer
303
302
  # * <tt>:url</tt> -- customer website
304
303
  # * <tt>:billing_address</tt> -- usual options
305
- # * <tt>:payment_methods</tt> -- array of payment method hashes.
304
+ # * <tt>:payment_methods</tt> -- array of payment method hashes.
306
305
  # * <tt>:method</tt> -- credit_card or check
307
306
  # * <tt>:name</tt> -- optional name/label for the method
308
307
  # * <tt>:sort</tt> -- optional integer value specifying the backup sort order, 0 is default
@@ -531,7 +530,7 @@ module ActiveMerchant #:nodoc:
531
530
  # Run a transaction.
532
531
  #
533
532
  # Note: run_sale, run_auth_only, run_credit, run_check_sale, run_check_credit
534
- # methods are also available. Each takes the same options as
533
+ # methods are also available. Each takes the same options as
535
534
  # run_transaction, but the :command option is not required.
536
535
  #
537
536
  # Recurring Note: If recurring options are included USA ePay will create a
@@ -589,7 +588,7 @@ module ActiveMerchant #:nodoc:
589
588
  end
590
589
 
591
590
  TRANSACTION_METHODS = [
592
- :run_sale, :run_auth_only, :run_credit,
591
+ :run_sale, :run_auth_only, :run_credit,
593
592
  :run_check_sale, :run_check_credit
594
593
  ] #:nodoc:
595
594
 
@@ -639,7 +638,7 @@ module ActiveMerchant #:nodoc:
639
638
  request = build_request(__method__, options)
640
639
  commit(__method__, request)
641
640
  end
642
-
641
+
643
642
  # Void a transaction.
644
643
  #
645
644
  # Note: Can only be voided before being settled.
@@ -656,7 +655,7 @@ module ActiveMerchant #:nodoc:
656
655
  request = build_request(__method__, options)
657
656
  commit(__method__, request)
658
657
  end
659
-
658
+
660
659
  # Refund transaction.
661
660
  #
662
661
  # Note: Required after a transaction has been settled. Refunds
@@ -675,7 +674,7 @@ module ActiveMerchant #:nodoc:
675
674
  request = build_request(__method__, options)
676
675
  commit(__method__, request)
677
676
  end
678
-
677
+
679
678
  # Override transaction flagged for mananager approval.
680
679
  #
681
680
  # Note: Checks only!
@@ -812,7 +811,7 @@ module ActiveMerchant #:nodoc:
812
811
  end
813
812
 
814
813
  # Check status of a transaction (custom).
815
- #
814
+ #
816
815
  # ==== Required
817
816
  # * <tt>:reference_number</tt>
818
817
  # * <tt>:fields</tt> -- string array of fields to retrieve
@@ -937,7 +936,7 @@ module ActiveMerchant #:nodoc:
937
936
  end
938
937
 
939
938
  # Builders ======================================================
940
-
939
+
941
940
  private
942
941
 
943
942
  # Build soap header, etc.
@@ -1062,7 +1061,7 @@ module ActiveMerchant #:nodoc:
1062
1061
  end
1063
1062
 
1064
1063
  # Transactions ==================================================
1065
-
1064
+
1066
1065
  def build_run_transaction(soap, options)
1067
1066
  soap.tag! 'ns1:runTransaction' do |soap|
1068
1067
  build_token soap, options
@@ -1213,7 +1212,7 @@ module ActiveMerchant #:nodoc:
1213
1212
  def build_customer_payments(soap, options)
1214
1213
  if options[:payment_methods]
1215
1214
  length = options[:payment_methods].length
1216
- soap.PaymentMethods 'SOAP-ENC:arrayType' => "ns1:PaymentMethod[#{length}]",
1215
+ soap.PaymentMethods 'SOAP-ENC:arrayType' => "ns1:PaymentMethod[#{length}]",
1217
1216
  'xsi:type' =>"ns1:PaymentMethodArray" do |soap|
1218
1217
  build_customer_payment_methods soap, options
1219
1218
  end
@@ -1239,7 +1238,7 @@ module ActiveMerchant #:nodoc:
1239
1238
  case
1240
1239
  when payment_method[:method].kind_of?(ActiveMerchant::Billing::CreditCard)
1241
1240
  build_tag soap, :string, 'CardNumber', payment_method[:method].number
1242
- build_tag soap, :string, 'CardExpiration',
1241
+ build_tag soap, :string, 'CardExpiration',
1243
1242
  "#{"%02d" % payment_method[:method].month}#{payment_method[:method].year}"
1244
1243
  if options[:billing_address]
1245
1244
  build_tag soap, :string, 'AvsStreet', options[:billing_address][:address1]
@@ -1319,7 +1318,7 @@ module ActiveMerchant #:nodoc:
1319
1318
  def build_credit_card_data(soap, options)
1320
1319
  soap.CreditCardData 'xsi:type' => "ns1:CreditCardData" do |soap|
1321
1320
  build_tag soap, :string, 'CardNumber', options[:payment_method].number
1322
- build_tag soap, :string, 'CardExpiration',
1321
+ build_tag soap, :string, 'CardExpiration',
1323
1322
  "#{"%02d" % options[:payment_method].month}#{options[:payment_method].year}"
1324
1323
  if options[:billing_address]
1325
1324
  build_tag soap, :string, 'AvsStreet', options[:billing_address][:address1]
@@ -1397,7 +1396,7 @@ module ActiveMerchant #:nodoc:
1397
1396
 
1398
1397
  def build_line_items(soap, options) # TODO
1399
1398
  end
1400
-
1399
+
1401
1400
  def build_custom_fields(soap, options) # TODO
1402
1401
  end
1403
1402
 
@@ -1444,7 +1443,7 @@ module ActiveMerchant #:nodoc:
1444
1443
  fault = (!response) || (response.length < 1) || response.has_key?('faultcode')
1445
1444
  return [response, success, response['faultstring'], authorization, avs, cvv] if fault
1446
1445
 
1447
- if response.respond_to?(:[]) && p = response["#{action}_return"]
1446
+ if response.respond_to?(:[]) && p = response["#{action}_return"]
1448
1447
  if p.respond_to?(:key?) && p.key?('result_code')
1449
1448
  success = p['result_code'] == 'A' ? true : false
1450
1449
  authorization = p['ref_num']
@@ -1481,8 +1480,8 @@ module ActiveMerchant #:nodoc:
1481
1480
  response[key] = [response[key], value]
1482
1481
  end
1483
1482
  else
1484
- response[key] = parse_element(e)
1485
- end
1483
+ response[key] = parse_element(e)
1484
+ end
1486
1485
  end
1487
1486
  else
1488
1487
  response = node.text
@@ -19,7 +19,6 @@ module ActiveMerchant #:nodoc:
19
19
 
20
20
  def initialize(options = {})
21
21
  requires!(options, :login)
22
- @options = options
23
22
  super
24
23
  end
25
24
 
@@ -66,10 +65,6 @@ module ActiveMerchant #:nodoc:
66
65
  commit(:void, post)
67
66
  end
68
67
 
69
- def test?
70
- @options[:test] || super
71
- end
72
-
73
68
  private
74
69
 
75
70
  def add_amount(post, money)
@@ -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