activemerchant 1.26.0 → 1.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGELOG +17 -0
  2. data/CONTRIBUTORS +20 -0
  3. data/README.md +5 -0
  4. data/lib/active_merchant/billing/base.rb +2 -2
  5. data/lib/active_merchant/billing/gateway.rb +6 -0
  6. data/lib/active_merchant/billing/gateways/authorize_net.rb +1 -1
  7. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +0 -3
  8. data/lib/active_merchant/billing/gateways/balanced.rb +462 -0
  9. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +3 -3
  10. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  11. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -2
  12. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/braintree.rb +2 -0
  14. data/lib/active_merchant/billing/gateways/braintree_blue.rb +11 -1
  15. data/lib/active_merchant/billing/gateways/braintree_orange.rb +2 -4
  16. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  17. data/lib/active_merchant/billing/gateways/certo_direct.rb +2 -3
  18. data/lib/active_merchant/billing/gateways/cyber_source.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/data_cash.rb +3 -3
  20. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -3
  21. data/lib/active_merchant/billing/gateways/epay.rb +3 -3
  22. data/lib/active_merchant/billing/gateways/eway.rb +8 -7
  23. data/lib/active_merchant/billing/gateways/eway_managed.rb +3 -3
  24. data/lib/active_merchant/billing/gateways/exact.rb +2 -2
  25. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  26. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -2
  27. data/lib/active_merchant/billing/gateways/first_pay.rb +3 -3
  28. data/lib/active_merchant/billing/gateways/garanti.rb +2 -2
  29. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +3 -1
  30. data/lib/active_merchant/billing/gateways/inspire.rb +2 -2
  31. data/lib/active_merchant/billing/gateways/instapay.rb +2 -2
  32. data/lib/active_merchant/billing/gateways/iridium.rb +4 -5
  33. data/lib/active_merchant/billing/gateways/itransact.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/jetpay.rb +3 -3
  35. data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -6
  36. data/lib/active_merchant/billing/gateways/litle.rb +50 -34
  37. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +3 -3
  38. data/lib/active_merchant/billing/gateways/merchant_ware.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/migs.rb +8 -4
  40. data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -0
  41. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +4 -4
  42. data/lib/active_merchant/billing/gateways/moneris.rb +3 -3
  43. data/lib/active_merchant/billing/gateways/moneris_us.rb +3 -3
  44. data/lib/active_merchant/billing/gateways/nab_transact.rb +8 -6
  45. data/lib/active_merchant/billing/gateways/net_registry.rb +2 -2
  46. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  47. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  48. data/lib/active_merchant/billing/gateways/ogone.rb +10 -5
  49. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -3
  50. data/lib/active_merchant/billing/gateways/orbital.rb +4 -4
  51. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +2 -2
  52. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -2
  53. data/lib/active_merchant/billing/gateways/paybox_direct.rb +7 -5
  54. data/lib/active_merchant/billing/gateways/payflow.rb +39 -37
  55. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +4 -3
  56. data/lib/active_merchant/billing/gateways/payment_express.rb +2 -2
  57. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +98 -85
  58. data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
  59. data/lib/active_merchant/billing/gateways/payway.rb +3 -2
  60. data/lib/active_merchant/billing/gateways/plugnpay.rb +63 -66
  61. data/lib/active_merchant/billing/gateways/psigate.rb +3 -3
  62. data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
  63. data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
  64. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -2
  65. data/lib/active_merchant/billing/gateways/realex.rb +7 -7
  66. data/lib/active_merchant/billing/gateways/sage.rb +2 -0
  67. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +2 -3
  69. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/sage_pay.rb +8 -6
  71. data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
  72. data/lib/active_merchant/billing/gateways/secure_net.rb +4 -4
  73. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +9 -6
  74. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -3
  76. data/lib/active_merchant/billing/gateways/smart_ps.rb +3 -1
  77. data/lib/active_merchant/billing/gateways/stripe.rb +2 -2
  78. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  79. data/lib/active_merchant/billing/gateways/transax.rb +1 -3
  80. data/lib/active_merchant/billing/gateways/trust_commerce.rb +3 -3
  81. data/lib/active_merchant/billing/gateways/usa_epay.rb +2 -0
  82. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +3 -2
  83. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +6 -6
  84. data/lib/active_merchant/billing/gateways/verifi.rb +2 -2
  85. data/lib/active_merchant/billing/gateways/wirecard.rb +4 -4
  86. data/lib/active_merchant/billing/gateways/worldpay.rb +37 -18
  87. data/lib/active_merchant/billing/integrations/action_view_helper.rb +6 -5
  88. data/lib/active_merchant/billing/integrations/first_data.rb +38 -0
  89. data/lib/active_merchant/billing/integrations/first_data/helper.rb +63 -0
  90. data/lib/active_merchant/billing/integrations/first_data/notification.rb +56 -0
  91. data/lib/active_merchant/billing/integrations/helper.rb +4 -0
  92. data/lib/active_merchant/billing/integrations/maksuturva.rb +86 -0
  93. data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +119 -0
  94. data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +48 -0
  95. data/lib/active_merchant/billing/integrations/paxum.rb +44 -0
  96. data/lib/active_merchant/billing/integrations/paxum/common.rb +24 -0
  97. data/lib/active_merchant/billing/integrations/paxum/helper.rb +42 -0
  98. data/lib/active_merchant/billing/integrations/paxum/notification.rb +33 -0
  99. data/lib/active_merchant/billing/integrations/pxpay.rb +31 -0
  100. data/lib/active_merchant/billing/integrations/pxpay/helper.rb +110 -0
  101. data/lib/active_merchant/billing/integrations/pxpay/notification.rb +157 -0
  102. data/lib/active_merchant/billing/integrations/pxpay/return.rb +25 -0
  103. data/lib/active_merchant/billing/integrations/web_pay.rb +45 -0
  104. data/lib/active_merchant/billing/integrations/web_pay/common.rb +50 -0
  105. data/lib/active_merchant/billing/integrations/web_pay/helper.rb +68 -0
  106. data/lib/active_merchant/billing/integrations/web_pay/notification.rb +51 -0
  107. data/lib/active_merchant/version.rb +1 -1
  108. data/lib/support/gateway_support.rb +9 -2
  109. data/lib/support/ssl_verify.rb +93 -0
  110. metadata +45 -71
  111. data.tar.gz.sig +0 -3
  112. metadata.gz.sig +0 -0
@@ -7,6 +7,8 @@ module ActiveMerchant #:nodoc:
7
7
  self.supported_countries = SageBankcardGateway.supported_countries
8
8
  self.supported_cardtypes = SageBankcardGateway.supported_cardtypes
9
9
 
10
+ self.abstract_class = true
11
+
10
12
  # Creates a new SageGateway
11
13
  #
12
14
  # The gateway requires that a valid login and password be passed
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class SageBankcardGateway < Gateway #:nodoc:
6
6
  include SageCore
7
- self.url = 'https://www.sagepayments.net/cgi-bin/eftBankcard.dll?transaction'
7
+ self.live_url = 'https://www.sagepayments.net/cgi-bin/eftBankcard.dll?transaction'
8
8
  self.source = 'bankcard'
9
9
 
10
10
  # Credit cards supported by Sage
@@ -2,7 +2,6 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  module SageCore #:nodoc:
4
4
  def self.included(base)
5
- base.cattr_accessor :url
6
5
  base.cattr_accessor :source
7
6
  base.supported_countries = ['US', 'CA']
8
7
  base.homepage_url = 'http://www.sagepayments.com'
@@ -86,7 +85,7 @@ module ActiveMerchant #:nodoc:
86
85
  end
87
86
 
88
87
  def commit(action, params)
89
- response = parse(ssl_post(url, post_data(action, params)))
88
+ response = parse(ssl_post(self.live_url, post_data(action, params)))
90
89
 
91
90
  Response.new(success?(response), response[:message], response,
92
91
  :test => test?,
@@ -113,4 +112,4 @@ module ActiveMerchant #:nodoc:
113
112
  end
114
113
  end
115
114
  end
116
- end
115
+ end
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class SageVirtualCheckGateway < Gateway #:nodoc:
6
6
  include SageCore
7
- self.url = 'https://www.sagepayments.net/cgi-bin/eftVirtualCheck.dll?transaction'
7
+ self.live_url = 'https://www.sagepayments.net/cgi-bin/eftVirtualCheck.dll?transaction'
8
8
  self.source = 'virtual_check'
9
9
 
10
10
  def purchase(money, credit_card, options = {})
@@ -3,10 +3,12 @@ module ActiveMerchant #:nodoc:
3
3
  class SagePayGateway < Gateway
4
4
  cattr_accessor :simulate
5
5
  self.simulate = false
6
-
7
- TEST_URL = 'https://test.sagepay.com/gateway/service'
8
- LIVE_URL = 'https://live.sagepay.com/gateway/service'
9
- SIMULATOR_URL = 'https://test.sagepay.com/Simulator'
6
+
7
+ class_attribute :simulator_url
8
+
9
+ self.test_url = 'https://test.sagepay.com/gateway/service'
10
+ self.live_url = 'https://live.sagepay.com/gateway/service'
11
+ self.simulator_url = 'https://test.sagepay.com/Simulator'
10
12
 
11
13
  APPROVED = 'OK'
12
14
 
@@ -265,12 +267,12 @@ module ActiveMerchant #:nodoc:
265
267
 
266
268
  def build_url(action)
267
269
  endpoint = [ :purchase, :authorization ].include?(action) ? "vspdirect-register" : TRANSACTIONS[action].downcase
268
- "#{test? ? TEST_URL : LIVE_URL}/#{endpoint}.vsp"
270
+ "#{test? ? self.test_url : self.live_url}/#{endpoint}.vsp"
269
271
  end
270
272
 
271
273
  def build_simulator_url(action)
272
274
  endpoint = [ :purchase, :authorization ].include?(action) ? "VSPDirectGateway.asp" : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
273
- "#{SIMULATOR_URL}/#{endpoint}"
275
+ "#{self.simulator_url}/#{endpoint}"
274
276
  end
275
277
 
276
278
  def message_from(response)
@@ -1,7 +1,7 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class SallieMaeGateway < Gateway
4
- URL = 'https://trans.salliemae.com/cgi-bin/process.cgi'
4
+ self.live_url = self.test_url = 'https://trans.salliemae.com/cgi-bin/process.cgi'
5
5
 
6
6
  # The countries the gateway supports merchants from as 2 digit ISO country codes
7
7
  self.supported_countries = ['US']
@@ -120,7 +120,7 @@ module ActiveMerchant #:nodoc:
120
120
  parameters[:action] = "ns_quicksale_cc"
121
121
  end
122
122
 
123
- response = parse(ssl_post(URL, parameters.to_post_data) || "")
123
+ response = parse(ssl_post(self.live_url, parameters.to_post_data) || "")
124
124
  Response.new(successful?(response), message_from(response), response,
125
125
  :test => test?,
126
126
  :authorization => response["refcode"]
@@ -44,9 +44,9 @@ module ActiveMerchant #:nodoc:
44
44
  self.display_name = 'SecureNet'
45
45
  # self.wiredump_device = STDOUT
46
46
 
47
- # TEST_URL = 'https://certify.securenet.com/api/Gateway.svc'
48
- TEST_URL = 'https://certify.securenet.com/API/gateway.svc/webHttp/ProcessTransaction'
49
- LIVE_URL = 'https://gateway.securenet.com/api/Gateway.svc'
47
+ # self.test_url = 'https://certify.securenet.com/api/Gateway.svc'
48
+ self.test_url = 'https://certify.securenet.com/API/gateway.svc/webHttp/ProcessTransaction'
49
+ self.live_url = 'https://gateway.securenet.com/api/Gateway.svc'
50
50
 
51
51
  APPROVED, DECLINED, ERROR = 1, 2, 3
52
52
 
@@ -85,7 +85,7 @@ module ActiveMerchant #:nodoc:
85
85
  private
86
86
  def commit(request, money)
87
87
  xml = build_request(request, money)
88
- data = ssl_post(TEST_URL, xml, "Content-Type" => "text/xml")
88
+ data = ssl_post(self.test_url, xml, "Content-Type" => "text/xml")
89
89
  response = parse(data)
90
90
 
91
91
  test_mode = test?
@@ -6,10 +6,13 @@ module ActiveMerchant #:nodoc:
6
6
  API_VERSION = 'xml-4.2'
7
7
  PERIODIC_API_VERSION = 'spxml-3.0'
8
8
 
9
- TEST_URL = 'https://www.securepay.com.au/test/payment'
10
- LIVE_URL = 'https://www.securepay.com.au/xmlapi/payment'
11
- TEST_PERIODIC_URL = "https://test.securepay.com.au/xmlapi/periodic"
12
- LIVE_PERIODIC_URL = "https://api.securepay.com.au/xmlapi/periodic"
9
+ class_attribute :test_periodic_url, :live_periodic_url
10
+
11
+ self.test_url = 'https://www.securepay.com.au/test/payment'
12
+ self.live_url = 'https://www.securepay.com.au/xmlapi/payment'
13
+
14
+ self.test_periodic_url = 'https://test.securepay.com.au/xmlapi/periodic'
15
+ self.live_periodic_url = 'https://api.securepay.com.au/xmlapi/periodic'
13
16
 
14
17
  self.supported_countries = ['AU']
15
18
  self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
@@ -169,7 +172,7 @@ module ActiveMerchant #:nodoc:
169
172
  end
170
173
 
171
174
  def commit(action, request)
172
- response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, build_request(action, request)))
175
+ response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request)))
173
176
 
174
177
  Response.new(success?(response), message_from(response), response,
175
178
  :test => test?,
@@ -227,7 +230,7 @@ module ActiveMerchant #:nodoc:
227
230
  def commit_periodic(request)
228
231
  my_request = build_periodic_request(request)
229
232
  #puts my_request
230
- response = parse(ssl_post(test? ? TEST_PERIODIC_URL : LIVE_PERIODIC_URL, my_request))
233
+ response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, my_request))
231
234
 
232
235
  Response.new(success?(response), message_from(response), response,
233
236
  :test => test?,
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  self.required_fields = [ :OrderReference, :CardNumber, :CardExpiry, :CardHolderName, :CardType, :MerchantID, :MerchantKey, :Amount, :Currency ]
6
6
  end
7
7
 
8
- URL = 'https://tx.securepaytech.com/web/HttpPostPurchase'
8
+ self.live_url = self.test_url = 'https://tx.securepaytech.com/web/HttpPostPurchase'
9
9
 
10
10
  PAYMENT_GATEWAY_RESPONSES = {
11
11
  1 => "Transaction OK",
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  end
84
84
 
85
85
  def commit(action, post)
86
- response = parse( ssl_post(URL, post_data(action, post) ) )
86
+ response = parse( ssl_post(self.live_url, post_data(action, post) ) )
87
87
 
88
88
  Response.new(response[:result_code] == 1, message_from(response), response,
89
89
  :test => test?,
@@ -6,8 +6,8 @@ module ActiveMerchant #:nodoc:
6
6
  class SkipJackGateway < Gateway
7
7
  API_VERSION = '?.?'
8
8
 
9
- LIVE_HOST = "https://www.skipjackic.com"
10
- TEST_HOST = "https://developer.skipjackic.com"
9
+ self.live_url = "https://www.skipjackic.com"
10
+ self.test_url = "https://developer.skipjackic.com"
11
11
 
12
12
  BASIC_PATH = "/scripts/evolvcc.dll"
13
13
  ADVANCED_PATH = "/evolvcc/evolvcc.aspx"
@@ -280,7 +280,7 @@ module ActiveMerchant #:nodoc:
280
280
  end
281
281
 
282
282
  def url_for(action)
283
- result = test? ? TEST_HOST : LIVE_HOST
283
+ result = test? ? self.test_url : self.live_url
284
284
  result += advanced? && action == :authorization ? ADVANCED_PATH : BASIC_PATH
285
285
  result += "?#{ACTIONS[action]}"
286
286
  end
@@ -7,6 +7,8 @@ module ActiveMerchant #:nodoc:
7
7
  ##
8
8
  # This is the base gateway for processors who use the smartPS processing system
9
9
 
10
+ self.abstract_class = true
11
+
10
12
  def initialize(options = {})
11
13
  requires!(options, :login, :password)
12
14
  @options = options
@@ -218,7 +220,7 @@ module ActiveMerchant #:nodoc:
218
220
 
219
221
  def commit(action, money, parameters)
220
222
  parameters[:amount] = amount(money) if money
221
- response = parse( ssl_post(api_url, post_data(action,parameters)) )
223
+ response = parse( ssl_post(self.live_url, post_data(action,parameters)) )
222
224
  Response.new(response["response"] == "1", message_from(response), response,
223
225
  :authorization => response["transactionid"],
224
226
  :test => test?,
@@ -3,7 +3,7 @@ require 'json'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class StripeGateway < Gateway
6
- LIVE_URL = 'https://api.stripe.com/v1/'
6
+ self.live_url = 'https://api.stripe.com/v1/'
7
7
 
8
8
  AVS_CODE_TRANSLATOR = {
9
9
  'line1: pass, zip: pass' => 'Y',
@@ -191,7 +191,7 @@ module ActiveMerchant #:nodoc:
191
191
  raw_response = response = nil
192
192
  success = false
193
193
  begin
194
- raw_response = ssl_request(method, LIVE_URL + url, post_data(parameters), headers(meta))
194
+ raw_response = ssl_request(method, self.live_url + url, post_data(parameters), headers(meta))
195
195
  response = parse(raw_response)
196
196
  success = !response.key?("error")
197
197
  rescue ResponseError => e
@@ -1,7 +1,7 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class TransFirstGateway < Gateway
4
- URL = 'https://webservices.primerchants.com/creditcard.asmx/CCSale'
4
+ self.live_url = self.test_url = 'https://webservices.primerchants.com/creditcard.asmx/CCSale'
5
5
 
6
6
  self.supported_countries = ['US']
7
7
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
@@ -90,7 +90,7 @@ module ActiveMerchant #:nodoc:
90
90
  end
91
91
 
92
92
  def commit(params)
93
- response = parse( ssl_post(URL, post_data(params)) )
93
+ response = parse( ssl_post(self.live_url, post_data(params)) )
94
94
 
95
95
  Response.new(response[:status] == "Authorized", message_from(response), response,
96
96
  :test => test?,
@@ -3,9 +3,7 @@ require File.join(File.dirname(__FILE__),'smart_ps.rb')
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class TransaxGateway < SmartPs
6
- def api_url
7
- 'https://secure.nelixtransax.net/api/transact.php'
8
- end
6
+ self.live_url = self.test_url = 'https://secure.nelixtransax.net/api/transact.php'
9
7
 
10
8
  # The countries the gateway supports merchants from as 2 digit ISO country codes
11
9
  self.supported_countries = ['US']
@@ -65,7 +65,7 @@ module ActiveMerchant #:nodoc:
65
65
  # below and the rest of active_merchant's documentation, as well as Trust Commerce's user and developer documentation.
66
66
 
67
67
  class TrustCommerceGateway < Gateway
68
- URL = 'https://vault.trustcommerce.com/trans/'
68
+ self.live_url = self.test_url = 'https://vault.trustcommerce.com/trans/'
69
69
 
70
70
  SUCCESS_TYPES = ["approved", "accepted"]
71
71
 
@@ -380,7 +380,7 @@ module ActiveMerchant #:nodoc:
380
380
  data = if tclink?
381
381
  TCLink.send(parameters)
382
382
  else
383
- parse( ssl_post(URL, post_data(parameters)) )
383
+ parse( ssl_post(self.live_url, post_data(parameters)) )
384
384
  end
385
385
 
386
386
  # to be considered successful, transaction status must be either "approved" or "accepted"
@@ -420,4 +420,4 @@ module ActiveMerchant #:nodoc:
420
420
 
421
421
  end
422
422
  end
423
- end
423
+ end
@@ -6,6 +6,8 @@ module ActiveMerchant #:nodoc:
6
6
  #
7
7
  class UsaEpayGateway < Gateway
8
8
 
9
+ self.abstract_class = true
10
+
9
11
  ##
10
12
  # Creates an instance of UsaEpayTransactionGateway by default, but if
11
13
  # :software id or :live_url are passed in the options hash it will
@@ -64,11 +64,12 @@ module ActiveMerchant #:nodoc:
64
64
  class UsaEpayAdvancedGateway < Gateway
65
65
  API_VERSION = "1.4"
66
66
 
67
- class_attribute :test_url, :live_url
68
-
69
67
  TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' #:nodoc:
70
68
  LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' #:nodoc:
71
69
 
70
+ self.test_url = TEST_URL_BASE
71
+ self.live_url = LIVE_URL_BASE
72
+
72
73
  FAILURE_MESSAGE = "Default Failure" #:nodoc:
73
74
 
74
75
  self.supported_countries = ['US']
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
 
4
4
  class UsaEpayTransactionGateway < Gateway
5
- URL = 'https://www.usaepay.com/gate.php'
5
+ self.test_url = self.live_url = 'https://www.usaepay.com/gate.php'
6
6
 
7
7
  self.supported_cardtypes = [:visa, :master, :american_express]
8
8
  self.supported_countries = ['US']
@@ -66,6 +66,10 @@ module ActiveMerchant #:nodoc:
66
66
  commit(:void, post)
67
67
  end
68
68
 
69
+ def test?
70
+ @options[:test] || super
71
+ end
72
+
69
73
  private
70
74
 
71
75
  def add_amount(post, money)
@@ -169,7 +173,7 @@ module ActiveMerchant #:nodoc:
169
173
  end
170
174
 
171
175
  def commit(action, parameters)
172
- response = parse( ssl_post(URL, post_data(action, parameters)) )
176
+ response = parse( ssl_post(self.live_url, post_data(action, parameters)) )
173
177
 
174
178
  Response.new(response[:status] == 'Approved', message_from(response), response,
175
179
  :test => test?,
@@ -196,10 +200,6 @@ module ActiveMerchant #:nodoc:
196
200
 
197
201
  parameters.collect { |key, value| "UM#{key}=#{CGI.escape(value.to_s)}" }.join("&")
198
202
  end
199
-
200
- def test?
201
- @options[:test] || super
202
- end
203
203
  end
204
204
  end
205
205
  end
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  :company, :address1, :address2, :city, :state, :zip, :country, :phone ]
10
10
  end
11
11
 
12
- URL = 'https://secure.verifi.com/gw/api/transact.php'
12
+ self.live_url = self.test_url = 'https://secure.verifi.com/gw/api/transact.php'
13
13
 
14
14
  RESPONSE_CODE_MESSAGES = {
15
15
  "100" => "Transaction was Approved",
@@ -200,7 +200,7 @@ module ActiveMerchant #:nodoc:
200
200
  def commit(trx_type, money, post)
201
201
  post[:amount] = amount(money)
202
202
 
203
- response = parse( ssl_post(URL, post_data(trx_type, post)) )
203
+ response = parse( ssl_post(self.live_url, post_data(trx_type, post)) )
204
204
 
205
205
  Response.new(response[:response].to_i == SUCCESS, message_from(response), response,
206
206
  :test => test?,
@@ -4,10 +4,10 @@ module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class WirecardGateway < Gateway
6
6
  # Test server location
7
- TEST_URL = 'https://c3-test.wirecard.com/secure/ssl-gateway'
7
+ self.test_url = 'https://c3-test.wirecard.com/secure/ssl-gateway'
8
8
 
9
9
  # Live server location
10
- LIVE_URL = 'https://c3.wirecard.com/secure/ssl-gateway'
10
+ self.live_url = 'https://c3.wirecard.com/secure/ssl-gateway'
11
11
 
12
12
  # The Namespaces are not really needed, because it just tells the System, that there's actually no namespace used.
13
13
  # It's just specified here for completeness.
@@ -109,11 +109,11 @@ module ActiveMerchant #:nodoc:
109
109
  headers = { 'Content-Type' => 'text/xml',
110
110
  'Authorization' => encoded_credentials }
111
111
 
112
- response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, request, headers))
112
+ response = parse(ssl_post(test? ? self.test_url : self.live_url, request, headers))
113
113
  # Pending Status also means Acknowledged (as stated in their specification)
114
114
  success = response[:FunctionResult] == "ACK" || response[:FunctionResult] == "PENDING"
115
115
  message = response[:Message]
116
- authorization = (success && action == :authorization) ? response[:GuWID] : nil
116
+ authorization = response[:GuWID]
117
117
 
118
118
  Response.new(success, message, response,
119
119
  :test => test?,
@@ -1,13 +1,13 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class WorldpayGateway < Gateway
4
- TEST_URL = 'https://secure-test.wp3.rbsworldpay.com/jsp/merchant/xml/paymentService.jsp'
5
- LIVE_URL = 'https://secure.wp3.rbsworldpay.com/jsp/merchant/xml/paymentService.jsp'
4
+ self.test_url = 'https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp'
5
+ self.live_url = 'https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp'
6
6
 
7
7
  self.default_currency = 'GBP'
8
8
  self.money_format = :cents
9
9
  self.supported_countries = ['HK', 'US', 'GB', 'AU']
10
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
10
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro, :laser]
11
11
  self.homepage_url = 'http://www.worldpay.com/'
12
12
  self.display_name = 'WorldPay'
13
13
 
@@ -33,34 +33,54 @@ module ActiveMerchant #:nodoc:
33
33
 
34
34
  def authorize(money, payment_method, options = {})
35
35
  requires!(options, :order_id)
36
- commit 'authorize', build_authorization_request(money, payment_method, options)
36
+ authorize_request(money, payment_method, options)
37
37
  end
38
38
 
39
39
  def capture(money, authorization, options = {})
40
40
  MultiResponse.new.tap do |r|
41
- r.process{inquire(authorization, options)} unless options[:authorization_validated]
42
- r.process{commit('capture', build_capture_request(money, authorization, options))}
41
+ r.process{inquire_request(authorization, options, "AUTHORISED")} unless options[:authorization_validated]
42
+ r.process{capture_request(money, authorization, options)}
43
43
  end
44
44
  end
45
45
 
46
46
  def void(authorization, options = {})
47
47
  MultiResponse.new.tap do |r|
48
- r.process{inquire(authorization, options)}
49
- r.process{commit('cancel', build_void_request(authorization, options))}
48
+ r.process{inquire_request(authorization, options, "AUTHORISED")}
49
+ r.process{cancel_request(authorization, options)}
50
50
  end
51
51
  end
52
52
 
53
53
  def refund(money, authorization, options = {})
54
54
  MultiResponse.new.tap do |r|
55
- r.process{inquire(authorization, options)}
56
- r.process{commit('refund', build_refund_request(money, authorization, options))}
55
+ r.process{inquire_request(authorization, options, "CAPTURED")}
56
+ r.process{refund_request(money, authorization, options)}
57
57
  end
58
58
  end
59
59
 
60
+ def test?
61
+ @options[:test] || super
62
+ end
63
+
60
64
  private
61
65
 
62
- def inquire(authorization, options={})
63
- commit('inquiry', build_order_inquiry_request(authorization, options))
66
+ def authorize_request(money, payment_method, options)
67
+ commit('authorize', build_authorization_request(money, payment_method, options), "AUTHORISED")
68
+ end
69
+
70
+ def capture_request(money, authorization, options)
71
+ commit('capture', build_capture_request(money, authorization, options), :ok)
72
+ end
73
+
74
+ def cancel_request(authorization, options)
75
+ commit('cancel', build_void_request(authorization, options), :ok)
76
+ end
77
+
78
+ def inquire_request(authorization, options, success_criteria)
79
+ commit('inquiry', build_order_inquiry_request(authorization, options), success_criteria)
80
+ end
81
+
82
+ def refund_request(money, authorization, options)
83
+ commit('inquiry', build_refund_request(money, authorization, options), :ok)
64
84
  end
65
85
 
66
86
  def build_request
@@ -204,8 +224,8 @@ module ActiveMerchant #:nodoc:
204
224
  raw
205
225
  end
206
226
 
207
- def commit(action, request)
208
- xmr = ssl_post((test? ? TEST_URL : LIVE_URL),
227
+ def commit(action, request, success_criteria)
228
+ xmr = ssl_post((test? ? self.test_url : self.live_url),
209
229
  request,
210
230
  'Content-Type' => 'text/xml',
211
231
  'Authorization' => encoded_credentials)
@@ -213,12 +233,11 @@ module ActiveMerchant #:nodoc:
213
233
  raw = parse(action, xmr)
214
234
 
215
235
  Response.new(
216
- success_from(raw),
236
+ success_from(raw, success_criteria),
217
237
  message_from(raw),
218
238
  raw,
219
239
  :authorization => authorization_from(raw),
220
240
  :test => test?)
221
-
222
241
  rescue ActiveMerchant::ResponseError => e
223
242
  if e.response.code.to_s == "401"
224
243
  return Response.new(false, "Invalid credentials", {}, :test => test?)
@@ -227,8 +246,8 @@ module ActiveMerchant #:nodoc:
227
246
  end
228
247
  end
229
248
 
230
- def success_from(raw)
231
- (raw[:last_event] == "AUTHORISED" ||
249
+ def success_from(raw, success_criteria)
250
+ (raw[:last_event] == success_criteria ||
232
251
  raw[:ok].present?)
233
252
  end
234
253