activemerchant 1.28.0 → 1.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. data/CHANGELOG +41 -0
  2. data/CONTRIBUTORS +12 -0
  3. data/README.md +6 -0
  4. data/lib/active_merchant/billing/gateway.rb +2 -1
  5. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  6. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
  7. data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
  8. data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
  9. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
  10. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
  11. data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
  12. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
  13. data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
  14. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
  15. data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
  16. data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
  17. data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
  18. data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
  19. data/lib/active_merchant/billing/gateways/epay.rb +0 -1
  20. data/lib/active_merchant/billing/gateways/eway.rb +88 -93
  21. data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
  22. data/lib/active_merchant/billing/gateways/eway_rapid.rb +300 -0
  23. data/lib/active_merchant/billing/gateways/exact.rb +45 -54
  24. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
  25. data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
  26. data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
  27. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  28. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
  29. data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
  30. data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
  31. data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
  32. data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
  33. data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
  34. data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
  35. data/lib/active_merchant/billing/gateways/litle.rb +1 -5
  36. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
  37. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
  38. data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
  39. data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
  40. data/lib/active_merchant/billing/gateways/migs.rb +5 -3
  41. data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
  42. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
  43. data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
  44. data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
  45. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
  46. data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
  47. data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
  48. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  49. data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
  50. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
  51. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  52. data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
  53. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
  54. data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
  55. data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
  56. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
  57. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
  58. data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
  59. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
  60. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
  61. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
  62. data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
  63. data/lib/active_merchant/billing/gateways/payway.rb +2 -9
  64. data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
  65. data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
  66. data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
  67. data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
  68. data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
  69. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
  70. data/lib/active_merchant/billing/gateways/realex.rb +6 -16
  71. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  72. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
  73. data/lib/active_merchant/billing/gateways/sage.rb +15 -16
  74. data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
  75. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  76. data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
  77. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  78. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
  79. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
  80. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
  81. data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
  82. data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
  83. data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
  84. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
  85. data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
  86. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
  87. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
  88. data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
  89. data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
  90. data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
  91. data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
  92. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
  93. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
  94. data/lib/active_merchant/billing/gateways.rb +6 -7
  95. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  96. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  97. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  98. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  99. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  100. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  101. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  102. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -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/common.rb +42 -0
  106. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  107. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  108. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  109. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -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 +17 -4
  114. data/lib/active_merchant/version.rb +1 -1
  115. data.tar.gz.sig +0 -0
  116. metadata +46 -27
  117. metadata.gz.sig +0 -0
@@ -10,13 +10,12 @@ module ActiveMerchant #:nodoc:
10
10
  self.money_format = :cents
11
11
  self.homepage_url = 'http://www.barclaycard.co.uk/business/accepting-payments/epdq-mpi/'
12
12
  self.display_name = 'Barclays ePDQ'
13
-
13
+
14
14
  def initialize(options = {})
15
15
  requires!(options, :login, :password, :client_id)
16
- @options = options
17
16
  super
18
- end
19
-
17
+ end
18
+
20
19
  def authorize(money, creditcard, options = {})
21
20
  document = Document.new(self, @options) do
22
21
  add_order_form(options[:order_id]) do
@@ -29,7 +28,7 @@ module ActiveMerchant #:nodoc:
29
28
 
30
29
  commit(document)
31
30
  end
32
-
31
+
33
32
  def purchase(money, creditcard, options = {})
34
33
  # disable fraud checks if this is a repeat order:
35
34
  if options[:payment_number] && (options[:payment_number] > 1)
@@ -46,9 +45,9 @@ module ActiveMerchant #:nodoc:
46
45
  end
47
46
  end
48
47
  commit(document)
49
- end
50
-
51
- # authorization is your unique order ID, not the authorization
48
+ end
49
+
50
+ # authorization is your unique order ID, not the authorization
52
51
  # code returned by ePDQ
53
52
  def capture(money, authorization, options = {})
54
53
  document = Document.new(self, @options) do
@@ -60,7 +59,7 @@ module ActiveMerchant #:nodoc:
60
59
  commit(document)
61
60
  end
62
61
 
63
- # authorization is your unique order ID, not the authorization
62
+ # authorization is your unique order ID, not the authorization
64
63
  # code returned by ePDQ
65
64
  def credit(money, creditcard_or_authorization, options = {})
66
65
  if creditcard_or_authorization.is_a?(String)
@@ -85,7 +84,7 @@ module ActiveMerchant #:nodoc:
85
84
  commit(document)
86
85
  end
87
86
 
88
- private
87
+ private
89
88
  def credit_new_order(money, creditcard, options)
90
89
  document = Document.new(self, @options) do
91
90
  add_order_form do
@@ -106,10 +105,10 @@ module ActiveMerchant #:nodoc:
106
105
  add_transaction(:Credit, money)
107
106
  end
108
107
  end
109
-
108
+
110
109
  commit(document)
111
110
  end
112
-
111
+
113
112
  def parse(body)
114
113
  parser = Parser.new(body)
115
114
  response = parser.parse
@@ -121,8 +120,8 @@ module ActiveMerchant #:nodoc:
121
120
  :order_id => response[:order_id],
122
121
  :raw_response => response[:raw_response]
123
122
  )
124
- end
125
-
123
+ end
124
+
126
125
  def commit(document)
127
126
  url = (test? ? self.test_url : self.live_url)
128
127
  data = ssl_post(url, document.to_xml)
@@ -150,7 +149,7 @@ module ActiveMerchant #:nodoc:
150
149
  success = find(doc, "//Transaction/AuthCode").present?
151
150
  end
152
151
 
153
- {
152
+ {
154
153
  :success => success,
155
154
  :message => message,
156
155
  :transaction_id => find(doc, "//Transaction/Id"),
@@ -169,7 +168,7 @@ module ActiveMerchant #:nodoc:
169
168
  class Document
170
169
  attr_reader :type, :xml
171
170
 
172
- PAYMENT_INTERVALS = {
171
+ PAYMENT_INTERVALS = {
173
172
  :days => 'D',
174
173
  :months => 'M'
175
174
  }
@@ -180,7 +179,7 @@ module ActiveMerchant #:nodoc:
180
179
  :switch => 9,
181
180
  :maestro => 10,
182
181
  }
183
-
182
+
184
183
  def initialize(gateway, options = {}, document_options = {}, &block)
185
184
  @gateway = gateway
186
185
  @options = options
@@ -206,7 +205,7 @@ module ActiveMerchant #:nodoc:
206
205
  end
207
206
  xml.Instructions do
208
207
  if @document_options[:no_fraud]
209
- xml.Pipeline "PaymentNoFraud"
208
+ xml.Pipeline "PaymentNoFraud"
210
209
  else
211
210
  xml.Pipeline "Payment"
212
211
  end
@@ -294,9 +293,9 @@ module ActiveMerchant #:nodoc:
294
293
  # date must be formatted MM/YY
295
294
  def format_expiry_date(creditcard)
296
295
  month_str = "%02d" % creditcard.month
297
- if match = creditcard.year.to_s.match(/^\d{2}(\d{2})$/)
296
+ if match = creditcard.year.to_s.match(/^\d{2}(\d{2})$/)
298
297
  year_str = "%02d" % match[1].to_i
299
- else
298
+ else
300
299
  year_str = "%02d" % creditcard.year
301
300
  end
302
301
  "#{month_str}/#{year_str}"
@@ -37,7 +37,7 @@ module ActiveMerchant #:nodoc:
37
37
  '5' => 'I',
38
38
  '9' => 'I'
39
39
  }
40
-
40
+
41
41
  PERIODS = {
42
42
  :days => 'D',
43
43
  :weeks => 'W',
@@ -75,28 +75,27 @@ module ActiveMerchant #:nodoc:
75
75
  # The name of the gateway
76
76
  base.display_name = 'Beanstream.com'
77
77
  end
78
-
79
- # Only <tt>:login</tt> is required by default,
80
- # which is the merchant's merchant ID. If you'd like to perform void,
78
+
79
+ # Only <tt>:login</tt> is required by default,
80
+ # which is the merchant's merchant ID. If you'd like to perform void,
81
81
  # capture or refund transactions then you'll also need to add a username
82
82
  # and password to your account under administration -> account settings ->
83
83
  # order settings -> Use username/password validation
84
84
  def initialize(options = {})
85
85
  requires!(options, :login)
86
- @options = options
87
86
  super
88
87
  end
89
-
88
+
90
89
  def capture(money, authorization, options = {})
91
90
  reference, amount, type = split_auth(authorization)
92
-
91
+
93
92
  post = {}
94
93
  add_amount(post, money)
95
94
  add_reference(post, reference)
96
95
  add_transaction_type(post, :capture)
97
96
  commit(post)
98
97
  end
99
-
98
+
100
99
  def refund(money, source, options = {})
101
100
  post = {}
102
101
  reference, amount, type = split_auth(source)
@@ -110,7 +109,7 @@ module ActiveMerchant #:nodoc:
110
109
  deprecated Gateway::CREDIT_DEPRECATION_MESSAGE
111
110
  refund(money, source, options)
112
111
  end
113
-
112
+
114
113
  private
115
114
  def purchase_action(source)
116
115
  if source.is_a?(Check)
@@ -119,38 +118,38 @@ module ActiveMerchant #:nodoc:
119
118
  :purchase
120
119
  end
121
120
  end
122
-
121
+
123
122
  def void_action(original_transaction_type)
124
123
  (original_transaction_type == TRANSACTIONS[:refund]) ? :void_refund : :void_purchase
125
124
  end
126
-
125
+
127
126
  def refund_action(type)
128
127
  (type == TRANSACTIONS[:check_purchase]) ? :check_refund : :refund
129
128
  end
130
-
129
+
131
130
  def secure_profile_action(type)
132
131
  PROFILE_OPERATIONS[type] || PROFILE_OPERATIONS[:new]
133
132
  end
134
-
133
+
135
134
  def split_auth(string)
136
135
  string.split(";")
137
136
  end
138
-
137
+
139
138
  def add_amount(post, money)
140
139
  post[:trnAmount] = amount(money)
141
140
  end
142
-
141
+
143
142
  def add_original_amount(post, amount)
144
143
  post[:trnAmount] = amount
145
144
  end
146
145
 
147
- def add_reference(post, reference)
146
+ def add_reference(post, reference)
148
147
  post[:adjId] = reference
149
148
  end
150
-
149
+
151
150
  def add_address(post, options)
152
151
  prepare_address_for_non_american_countries(options)
153
-
152
+
154
153
  if billing_address = options[:billing_address] || options[:address]
155
154
  post[:ordName] = billing_address[:name]
156
155
  post[:ordEmailAddress] = options[:email]
@@ -195,7 +194,7 @@ module ActiveMerchant #:nodoc:
195
194
  post[:ordTax2Price] = amount(options[:tax2])
196
195
  post[:ref1] = options[:custom]
197
196
  end
198
-
197
+
199
198
  def add_credit_card(post, credit_card)
200
199
  if credit_card
201
200
  post[:trnCardOwner] = credit_card.name
@@ -205,31 +204,31 @@ module ActiveMerchant #:nodoc:
205
204
  post[:trnCardCvd] = credit_card.verification_value
206
205
  end
207
206
  end
208
-
207
+
209
208
  def add_check(post, check)
210
209
  # The institution number of the consumer’s financial institution. Required for Canadian dollar EFT transactions.
211
210
  post[:institutionNumber] = check.institution_number
212
-
211
+
213
212
  # The bank transit number of the consumer’s bank account. Required for Canadian dollar EFT transactions.
214
213
  post[:transitNumber] = check.transit_number
215
-
214
+
216
215
  # The routing number of the consumer’s bank account. Required for US dollar EFT transactions.
217
216
  post[:routingNumber] = check.routing_number
218
-
217
+
219
218
  # The account number of the consumer’s bank account. Required for both Canadian and US dollar EFT transactions.
220
219
  post[:accountNumber] = check.account_number
221
220
  end
222
-
221
+
223
222
  def add_secure_profile_variables(post, options = {})
224
223
  post[:serviceVersion] = SP_SERVICE_VERSION
225
224
  post[:responseFormat] = 'QS'
226
225
  post[:cardValidation] = (options[:cardValidation].to_i == 1) || '0'
227
-
226
+
228
227
  post[:operationType] = options[:operationType] || options[:operation] || secure_profile_action(:new)
229
228
  post[:customerCode] = options[:billing_id] || options[:vault_id] || false
230
229
  post[:status] = options[:status]
231
230
  end
232
-
231
+
233
232
  def add_recurring_amount(post, money)
234
233
  post[:amount] = amount(money)
235
234
  end
@@ -293,14 +292,14 @@ module ActiveMerchant #:nodoc:
293
292
  results[key.to_sym] = val.nil? ? nil : CGI.unescape(val)
294
293
  end
295
294
  end
296
-
295
+
297
296
  # Clean up the message text if there is any
298
297
  if results[:messageText]
299
298
  results[:messageText].gsub!(/<LI>/, "")
300
299
  results[:messageText].gsub!(/(\.)?<br>/, ". ")
301
300
  results[:messageText].strip!
302
301
  end
303
-
302
+
304
303
  results
305
304
  end
306
305
 
@@ -314,7 +313,7 @@ module ActiveMerchant #:nodoc:
314
313
  def commit(params, use_profile_api = false)
315
314
  post(post_data(params,use_profile_api),use_profile_api)
316
315
  end
317
-
316
+
318
317
  def recurring_commit(params)
319
318
  recurring_post(post_data(params, false))
320
319
  end
@@ -329,7 +328,7 @@ module ActiveMerchant #:nodoc:
329
328
  :avs_result => { :code => (AVS_CODES.include? response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
330
329
  )
331
330
  end
332
-
331
+
333
332
  def recurring_post(data)
334
333
  response = recurring_parse(ssl_post(RECURRING_URL, data))
335
334
  build_response(recurring_success?(response), recurring_message_from(response), response)
@@ -350,7 +349,7 @@ module ActiveMerchant #:nodoc:
350
349
  def success?(response)
351
350
  response[:responseType] == 'R' || response[:trnApproved] == '1' || response[:responseCode] == '1'
352
351
  end
353
-
352
+
354
353
  def recurring_success?(response)
355
354
  response[:code] == '1'
356
355
  end
@@ -362,24 +361,24 @@ module ActiveMerchant #:nodoc:
362
361
  card_brand(source) == "check" ? add_check(post, source) : add_credit_card(post, source)
363
362
  end
364
363
  end
365
-
364
+
366
365
  def add_transaction_type(post, action)
367
366
  post[:trnType] = TRANSACTIONS[action]
368
367
  end
369
-
368
+
370
369
  def post_data(params, use_profile_api)
371
370
  params[:requestType] = 'BACKEND'
372
371
  if use_profile_api
373
- params[:merchantId] = @options[:login]
372
+ params[:merchantId] = @options[:login]
374
373
  params[:passCode] = @options[:secure_profile_api_key]
375
374
  else
376
375
  params[:username] = @options[:user] if @options[:user]
377
376
  params[:password] = @options[:password] if @options[:password]
378
- params[:merchant_id] = @options[:login]
377
+ params[:merchant_id] = @options[:login]
379
378
  end
380
379
  params[:vbvEnabled] = '0'
381
380
  params[:scEnabled] = '0'
382
-
381
+
383
382
  params.reject{|k, v| v.blank?}.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
384
383
  end
385
384