activemerchant 1.38.1 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/CHANGELOG +23 -0
  2. data/CONTRIBUTORS +8 -0
  3. data/README.md +65 -59
  4. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +6 -2
  5. data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
  6. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +1 -1
  7. data/lib/active_merchant/billing/gateways/blue_pay.rb +0 -3
  8. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
  9. data/lib/active_merchant/billing/gateways/braintree_blue.rb +70 -67
  10. data/lib/active_merchant/billing/gateways/cyber_source.rb +2 -4
  11. data/lib/active_merchant/billing/gateways/eway_rapid.rb +75 -2
  12. data/lib/active_merchant/billing/gateways/moneris.rb +62 -10
  13. data/lib/active_merchant/billing/gateways/money_movers.rb +160 -0
  14. data/lib/active_merchant/billing/gateways/ogone.rb +21 -8
  15. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +6 -6
  16. data/lib/active_merchant/billing/gateways/payflow_uk.rb +2 -2
  17. data/lib/active_merchant/billing/gateways/paymill.rb +12 -2
  18. data/lib/active_merchant/billing/gateways/paypal.rb +2 -2
  19. data/lib/active_merchant/billing/gateways/quickpay.rb +32 -2
  20. data/lib/active_merchant/billing/gateways/realex.rb +11 -7
  21. data/lib/active_merchant/billing/gateways/sage_pay.rb +1 -1
  22. data/lib/active_merchant/billing/gateways/secure_net.rb +7 -10
  23. data/lib/active_merchant/billing/gateways/spreedly_core.rb +9 -2
  24. data/lib/active_merchant/billing/gateways/stripe.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -2
  26. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/worldpay.rb +2 -2
  28. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +1 -1
  29. data/lib/active_merchant/billing/integrations/action_view_helper.rb +2 -1
  30. data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +41 -0
  31. data/lib/active_merchant/billing/integrations/bit_pay/notification.rb +56 -0
  32. data/lib/active_merchant/billing/integrations/bit_pay.rb +18 -0
  33. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +1 -1
  34. data/lib/active_merchant/billing/integrations/citrus/helper.rb +40 -0
  35. data/lib/active_merchant/billing/integrations/citrus/notification.rb +133 -0
  36. data/lib/active_merchant/billing/integrations/citrus/return.rb +40 -0
  37. data/lib/active_merchant/billing/integrations/citrus.rb +51 -0
  38. data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +1 -1
  39. data/lib/active_merchant/billing/integrations/directebanking/notification.rb +1 -1
  40. data/lib/active_merchant/billing/integrations/dotpay/notification.rb +1 -1
  41. data/lib/active_merchant/billing/integrations/dwolla/notification.rb +1 -1
  42. data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +1 -1
  43. data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +1 -1
  44. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +1 -1
  45. data/lib/active_merchant/billing/integrations/helper.rb +1 -1
  46. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +1 -1
  47. data/lib/active_merchant/billing/integrations/liqpay/return.rb +1 -1
  48. data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +1 -1
  49. data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +1 -1
  50. data/lib/active_merchant/billing/integrations/nochex/notification.rb +1 -1
  51. data/lib/active_merchant/billing/integrations/paxum/notification.rb +1 -1
  52. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +1 -1
  53. data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +1 -1
  54. data/lib/active_merchant/billing/integrations/paypal/notification.rb +1 -1
  55. data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +13 -2
  56. data/lib/active_merchant/billing/integrations/payu_in/notification.rb +1 -1
  57. data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +19 -0
  58. data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +23 -0
  59. data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +16 -0
  60. data/lib/active_merchant/billing/integrations/payu_in_paisa.rb +30 -0
  61. data/lib/active_merchant/billing/integrations/platron/notification.rb +1 -1
  62. data/lib/active_merchant/billing/integrations/pxpay/notification.rb +1 -1
  63. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +28 -6
  64. data/lib/active_merchant/billing/integrations/quickpay/notification.rb +1 -1
  65. data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +1 -1
  66. data/lib/active_merchant/billing/integrations/robokassa/notification.rb +1 -1
  67. data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +1 -1
  68. data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +1 -1
  69. data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +1 -1
  70. data/lib/active_merchant/billing/integrations/web_pay/notification.rb +1 -1
  71. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +1 -1
  72. data/lib/active_merchant/billing/integrations/world_pay/notification.rb +1 -1
  73. data/lib/active_merchant/version.rb +1 -1
  74. data/lib/support/gateway_support.rb +16 -10
  75. data.tar.gz.sig +0 -0
  76. metadata +23 -3
  77. metadata.gz.sig +2 -2
@@ -35,7 +35,7 @@ module ActiveMerchant #:nodoc:
35
35
 
36
36
  # visa, master, american_express, discover
37
37
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
38
- self.supported_countries = ['US']
38
+ self.supported_countries = %w(US BR CA CN DK FI FR DE JP MX NO SE GB SG)
39
39
  self.default_currency = 'USD'
40
40
  self.homepage_url = 'http://www.cybersource.com'
41
41
  self.display_name = 'CyberSource'
@@ -401,8 +401,6 @@ module ActiveMerchant #:nodoc:
401
401
  end
402
402
 
403
403
  def add_address(xml, payment_method, address, options, shipTo = false)
404
- requires!(options, :email)
405
-
406
404
  xml.tag! shipTo ? 'shipTo' : 'billTo' do
407
405
  xml.tag! 'firstName', payment_method.first_name if payment_method
408
406
  xml.tag! 'lastName', payment_method.last_name if payment_method
@@ -414,7 +412,7 @@ module ActiveMerchant #:nodoc:
414
412
  xml.tag! 'country', address[:country]
415
413
  xml.tag! 'company', address[:company] unless address[:company].blank?
416
414
  xml.tag! 'companyTaxID', address[:companyTaxID] unless address[:company_tax_id].blank?
417
- xml.tag! 'phoneNumber', address[:phone_number] unless address[:phone_number].blank?
415
+ xml.tag! 'phoneNumber', address[:phone] unless address[:phone].blank?
418
416
  xml.tag! 'email', options[:email]
419
417
  xml.tag! 'driversLicenseNumber', options[:drivers_license_number] unless options[:drivers_license_number].blank?
420
418
  xml.tag! 'driversLicenseState', options[:drivers_license_state] unless options[:drivers_license_state].blank?
@@ -271,11 +271,11 @@ module ActiveMerchant #:nodoc:
271
271
 
272
272
  def message_from(succeeded, response)
273
273
  if response[:errors]
274
- response[:errors]
274
+ (MESSAGES[response[:errors]] || response[:errors])
275
275
  elsif response[:responsecode]
276
276
  ActiveMerchant::Billing::EwayGateway::MESSAGES[response[:responsecode]]
277
277
  elsif response[:responsemessage]
278
- response[:responsemessage]
278
+ (MESSAGES[response[:responsemessage]] || response[:responsemessage])
279
279
  elsif succeeded
280
280
  "Succeeded"
281
281
  else
@@ -315,6 +315,79 @@ module ActiveMerchant #:nodoc:
315
315
  params["formactionurl"]
316
316
  end
317
317
  end
318
+
319
+ MESSAGES = {
320
+ 'V6000' => 'Validation error',
321
+ 'V6001' => 'Invalid CustomerIP',
322
+ 'V6002' => 'Invalid DeviceID',
323
+ 'V6011' => 'Invalid Payment TotalAmount',
324
+ 'V6012' => 'Invalid Payment InvoiceDescription',
325
+ 'V6013' => 'Invalid Payment InvoiceNumber',
326
+ 'V6014' => 'Invalid Payment InvoiceReference',
327
+ 'V6015' => 'Invalid Payment CurrencyCode',
328
+ 'V6016' => 'Payment Required',
329
+ 'V6017' => 'Payment CurrencyCode Required',
330
+ 'V6018' => 'Unknown Payment CurrencyCode',
331
+ 'V6021' => 'EWAY_CARDHOLDERNAME Required',
332
+ 'V6022' => 'EWAY_CARDNUMBER Required',
333
+ 'V6023' => 'EWAY_CARDCVN Required',
334
+ 'V6033' => 'Invalid Expiry Date',
335
+ 'V6034' => 'Invalid Issue Number',
336
+ 'V6035' => 'Invalid Valid From Date',
337
+ 'V6040' => 'Invalid TokenCustomerID',
338
+ 'V6041' => 'Customer Required',
339
+ 'V6042' => 'Customer FirstName Required',
340
+ 'V6043' => 'Customer LastName Required',
341
+ 'V6044' => 'Customer CountryCode Required',
342
+ 'V6045' => 'Customer Title Required',
343
+ 'V6046' => 'TokenCustomerID Required',
344
+ 'V6047' => 'RedirectURL Required',
345
+ 'V6051' => 'Invalid Customer FirstName',
346
+ 'V6052' => 'Invalid Customer LastName',
347
+ 'V6053' => 'Invalid Customer CountryCode',
348
+ 'V6058' => 'Invalid Customer Title',
349
+ 'V6059' => 'Invalid RedirectURL',
350
+ 'V6060' => 'Invalid TokenCustomerID',
351
+ 'V6061' => 'Invalid Customer Reference',
352
+ 'V6062' => 'Invalid Customer CompanyName',
353
+ 'V6063' => 'Invalid Customer JobDescription',
354
+ 'V6064' => 'Invalid Customer Street1',
355
+ 'V6065' => 'Invalid Customer Street2',
356
+ 'V6066' => 'Invalid Customer City',
357
+ 'V6067' => 'Invalid Customer State',
358
+ 'V6068' => 'Invalid Customer PostalCode',
359
+ 'V6069' => 'Invalid Customer Email',
360
+ 'V6070' => 'Invalid Customer Phone',
361
+ 'V6071' => 'Invalid Customer Mobile',
362
+ 'V6072' => 'Invalid Customer Comments',
363
+ 'V6073' => 'Invalid Customer Fax',
364
+ 'V6074' => 'Invalid Customer URL',
365
+ 'V6075' => 'Invalid ShippingAddress FirstName',
366
+ 'V6076' => 'Invalid ShippingAddress LastName',
367
+ 'V6077' => 'Invalid ShippingAddress Street1',
368
+ 'V6078' => 'Invalid ShippingAddress Street2',
369
+ 'V6079' => 'Invalid ShippingAddress City',
370
+ 'V6080' => 'Invalid ShippingAddress State',
371
+ 'V6081' => 'Invalid ShippingAddress PostalCode',
372
+ 'V6082' => 'Invalid ShippingAddress Email',
373
+ 'V6083' => 'Invalid ShippingAddress Phone',
374
+ 'V6084' => 'Invalid ShippingAddress Country',
375
+ 'V6085' => 'Invalid ShippingAddress ShippingMethod',
376
+ 'V6086' => 'Invalid ShippingAddress Fax ',
377
+ 'V6091' => 'Unknown Customer CountryCode',
378
+ 'V6092' => 'Unknown ShippingAddress CountryCode',
379
+ 'V6100' => 'Invalid EWAY_CARDNAME',
380
+ 'V6101' => 'Invalid EWAY_CARDEXPIRYMONTH',
381
+ 'V6102' => 'Invalid EWAY_CARDEXPIRYYEAR',
382
+ 'V6103' => 'Invalid EWAY_CARDSTARTMONTH',
383
+ 'V6104' => 'Invalid EWAY_CARDSTARTYEAR',
384
+ 'V6105' => 'Invalid EWAY_CARDISSUENUMBER',
385
+ 'V6106' => 'Invalid EWAY_CARDCVN',
386
+ 'V6107' => 'Invalid EWAY_ACCESSCODE',
387
+ 'V6108' => 'Invalid CustomerHostAddress',
388
+ 'V6109' => 'Invalid UserAgent',
389
+ 'V6110' => 'Invalid EWAY_CARDNUMBER'
390
+ }
318
391
  end
319
392
  end
320
393
  end
@@ -18,10 +18,21 @@ module ActiveMerchant #:nodoc:
18
18
  self.homepage_url = 'http://www.moneris.com/'
19
19
  self.display_name = 'Moneris'
20
20
 
21
- # login is your Store ID
22
- # password is your API Token
21
+ # Initialize the Gateway
22
+ #
23
+ # The gateway requires that a valid login and password be passed
24
+ # in the +options+ hash.
25
+ #
26
+ # ==== Options
27
+ #
28
+ # * <tt>:login</tt> -- Your Store ID
29
+ # * <tt>:password</tt> -- Your API Token
30
+ # * <tt>:cvv_enabled</tt> -- Specify that you would like the CVV passed to the gateway.
31
+ # Only particular account types at Moneris will allow this.
32
+ # Defaults to false. (optional)
23
33
  def initialize(options = {})
24
34
  requires!(options, :login, :password)
35
+ @cvv_enabled = options[:cvv_enabled]
25
36
  options = { :crypt_type => 7 }.merge(options)
26
37
  super
27
38
  end
@@ -70,13 +81,28 @@ module ActiveMerchant #:nodoc:
70
81
  commit 'completion', crediting_params(authorization, :comp_amount => amount(money))
71
82
  end
72
83
 
73
- # Voiding cancels an open authorization.
84
+ # Voiding requires the original transaction ID and order ID of some open
85
+ # transaction. Closed transactions must be refunded.
86
+ #
87
+ # Moneris supports the voiding of an unsettled capture or purchase via
88
+ # its <tt>purchasecorrection</tt> command. This action can only occur
89
+ # on the same day as the capture/purchase prior to 22:00-23:00 EST. If
90
+ # you want to do this, pass <tt>:purchasecorrection => true</tt> as
91
+ # an option.
92
+ #
93
+ # Fun, Historical Trivia:
94
+ # Voiding an authorization in Moneris is a relatively new feature
95
+ # (September, 2011). It is actually done by doing a $0 capture.
74
96
  #
75
97
  # Concatenate your transaction number and order_id by using a semicolon
76
98
  # (';'). This is to keep the Moneris interface consistent with other
77
99
  # gateways. (See +capture+ for details.)
78
100
  def void(authorization, options = {})
79
- capture(0, authorization, options)
101
+ if options[:purchasecorrection]
102
+ commit 'purchasecorrection', crediting_params(authorization)
103
+ else
104
+ capture(0, authorization, options)
105
+ end
80
106
  end
81
107
 
82
108
  # Performs a refund. This method requires that the original transaction
@@ -128,6 +154,7 @@ module ActiveMerchant #:nodoc:
128
154
  else
129
155
  post[:pan] = source.number
130
156
  post[:expdate] = expdate(source)
157
+ post[:cvd_value] = source.verification_value if source.verification_value?
131
158
  end
132
159
  end
133
160
 
@@ -151,10 +178,14 @@ module ActiveMerchant #:nodoc:
151
178
  end
152
179
 
153
180
  def commit(action, parameters = {})
154
- response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(action, parameters)))
181
+ data = post_data(action, parameters)
182
+ url = test? ? self.test_url : self.live_url
183
+ raw = ssl_post(url, data)
184
+ response = parse(raw)
155
185
 
156
186
  Response.new(successful?(response), message_from(response[:message]), response,
157
187
  :test => test?,
188
+ :cvv_result => response[:cvd_result_code].try(:last),
158
189
  :authorization => authorization_from(response)
159
190
  )
160
191
  end
@@ -192,14 +223,35 @@ module ActiveMerchant #:nodoc:
192
223
  root = xml.add_element("request")
193
224
  root.add_element("store_id").text = options[:login]
194
225
  root.add_element("api_token").text = options[:password]
195
- transaction = root.add_element(action)
226
+ root.add_element(transaction_element(action, parameters))
227
+
228
+ xml.to_s
229
+ end
230
+
231
+ def transaction_element(action, parameters)
232
+ transaction = REXML::Element.new(action)
196
233
 
197
234
  # Must add the elements in the correct order
198
235
  actions[action].each do |key|
199
- transaction.add_element(key.to_s).text = parameters[key] unless parameters[key].blank?
236
+ if((key == :cvd_info) && @cvv_enabled)
237
+ transaction.add_element(cvd_element(parameters[:cvd_value]))
238
+ else
239
+ transaction.add_element(key.to_s).text = parameters[key] unless parameters[key].blank?
240
+ end
200
241
  end
201
242
 
202
- xml.to_s
243
+ transaction
244
+ end
245
+
246
+ def cvd_element(cvd_value)
247
+ element = REXML::Element.new('cvd_info')
248
+ if cvd_value
249
+ element.add_element('cvd_indicator').text = "1"
250
+ element.add_element('cvd_value').text = cvd_value
251
+ else
252
+ element.add_element('cvd_indicator').text = "0"
253
+ end
254
+ element
203
255
  end
204
256
 
205
257
  def message_from(message)
@@ -219,8 +271,8 @@ module ActiveMerchant #:nodoc:
219
271
 
220
272
  def actions
221
273
  {
222
- "purchase" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
223
- "preauth" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
274
+ "purchase" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :cvd_info],
275
+ "preauth" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :cvd_info],
224
276
  "command" => [:order_id],
225
277
  "refund" => [:order_id, :amount, :txn_number, :crypt_type],
226
278
  "indrefund" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
@@ -0,0 +1,160 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class MoneyMoversGateway < Gateway
4
+ self.live_url = self.test_url = 'https://secure.mmoagateway.com/api/transact.php'
5
+
6
+ APPROVED, DECLINED, ERROR = 1, 2, 3
7
+
8
+ self.homepage_url = 'http://mmoa.us/'
9
+ self.display_name = 'MoneyMovers'
10
+ self.supported_countries = ['US']
11
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
12
+ self.ssl_version = :SSLv3
13
+
14
+ def initialize(options = {})
15
+ requires!(options, :login, :password)
16
+ @options = options
17
+ super
18
+ end
19
+
20
+ def purchase(money, creditcard, options = {})
21
+ post = {}
22
+ add_invoice(post, options)
23
+ add_creditcard(post, creditcard)
24
+ add_address(post, options)
25
+ add_customer_data(post, options)
26
+ commit('sale', money, post)
27
+ end
28
+
29
+ def authorize(money, creditcard, options = {})
30
+ post = {}
31
+ add_invoice(post, options)
32
+ add_creditcard(post, creditcard)
33
+ add_address(post, options)
34
+ add_customer_data(post, options)
35
+ commit('auth', money, post)
36
+ end
37
+
38
+ def capture(money, authorization, options = {})
39
+ options[:transactionid] = authorization
40
+ commit('capture', money, options)
41
+ end
42
+
43
+ def void(authorization, options = {})
44
+ options[:transactionid] = authorization
45
+ commit('void', nil, options)
46
+ end
47
+
48
+ def refund(money, authorization, options = {})
49
+ commit('refund', money, options.merge(:transactionid => authorization))
50
+ end
51
+
52
+ def credit(money, authorization, options = {})
53
+ deprecated CREDIT_DEPRECATION_MESSAGE
54
+ refund(money, authorization, options)
55
+ end
56
+
57
+ private
58
+
59
+ def add_customer_data(post, options)
60
+ post[:firstname] = options[:first_name]
61
+ post[:lastname] = options[:last_name]
62
+
63
+ post[:email] = options[:email]
64
+ end
65
+
66
+ def add_address(post, options)
67
+ if address = (options[:billing_address] || options[:address])
68
+ post[:company] = address[:company]
69
+ post[:address1] = address[:address1]
70
+ post[:address2] = address[:address2]
71
+ post[:city] = address[:city]
72
+ post[:state] = address[:state]
73
+ post[:zip] = address[:zip]
74
+ post[:country] = address[:country]
75
+ post[:phone] = address[:phone]
76
+ end
77
+ if address = options[:shipping_address]
78
+ post[:shipping_firstname] = address[:first_name]
79
+ post[:shipping_lastname] = address[:last_name]
80
+ post[:shipping_company] = address[:company]
81
+ post[:shipping_address1] = address[:address1]
82
+ post[:shipping_address2] = address[:address2]
83
+ post[:shipping_city] = address[:city]
84
+ post[:shipping_state] = address[:state]
85
+ post[:shipping_zip] = address[:zip]
86
+ post[:shipping_country] = address[:country]
87
+ post[:shipping_email] = address[:email]
88
+ end
89
+ end
90
+
91
+ def add_invoice(post, options)
92
+ post[:orderid] = options[:order_id]
93
+ post[:orderdescription] = options[:description]
94
+ end
95
+
96
+ def add_creditcard(post, creditcard)
97
+ post[:ccnumber] = creditcard.number
98
+ post[:ccexp] = expdate(creditcard)
99
+ post[:cvv] = creditcard.verification_value
100
+ end
101
+
102
+ def expdate(creditcard)
103
+ year = sprintf("%.4i", creditcard.year)
104
+ month = sprintf("%.2i", creditcard.month)
105
+ "#{month}#{year[-2..-1]}"
106
+ end
107
+
108
+ def parse(body)
109
+ body.split('&').inject({}) do |memo, x|
110
+ k, v = x.split('=')
111
+ memo[k] = v
112
+ memo
113
+ end
114
+ end
115
+
116
+ def commit(action, money, parameters)
117
+ parameters[:amount] = amount(money)
118
+
119
+ data = ssl_post(self.live_url, post_data(action, parameters))
120
+ response = parse(data)
121
+ message = message_from(response)
122
+ test_mode = test?
123
+
124
+ Response.new(success?(response), message, response,
125
+ :test => test?,
126
+ :authorization => response['transactionid'],
127
+ :avs_result => {:code => response['avsresponse']},
128
+ :cvv_result => response['cvvresponse']
129
+ )
130
+ end
131
+
132
+ def success?(response)
133
+ response['response'] == '1'
134
+ end
135
+
136
+ def test?
137
+ (@options[:login].eql?('demo')) && (@options[:password].eql?('password'))
138
+ end
139
+
140
+ def message_from(response)
141
+ case response['response'].to_i
142
+ when APPROVED
143
+ "Transaction Approved"
144
+ when DECLINED
145
+ "Transaction Declined"
146
+ else
147
+ "Error in transaction data or system error"
148
+ end
149
+ end
150
+
151
+ def post_data(action, parameters = {})
152
+ parameters[:type] = action
153
+ parameters[:username] = @options[:login]
154
+ parameters[:password] = @options[:password]
155
+ parameters.map{|k, v| "#{k}=#{CGI.escape(v.to_s)}"}.join('&')
156
+ end
157
+ end
158
+ end
159
+ end
160
+
@@ -32,13 +32,13 @@ module ActiveMerchant #:nodoc:
32
32
  # == Usage
33
33
  #
34
34
  # gateway = ActiveMerchant::Billing::OgoneGateway.new(
35
- # :login => "my_ogone_psp_id",
36
- # :user => "my_ogone_user_id",
37
- # :password => "my_ogone_pswd",
38
- # :signature => "my_ogone_sha_signature", # Only if you configured your Ogone environment so.
39
- # :signature_encryptor => "sha512", # Can be "none" (default), "sha1", "sha256" or "sha512".
35
+ # :login => "my_ogone_psp_id",
36
+ # :user => "my_ogone_user_id",
37
+ # :password => "my_ogone_pswd",
38
+ # :signature => "my_ogone_sha_signature", # Only if you configured your Ogone environment so.
39
+ # :signature_encryptor => "sha512" # Can be "none" (default), "sha1", "sha256" or "sha512".
40
40
  # # Must be the same as the one configured in your Ogone account.
41
- # )
41
+ # )
42
42
  #
43
43
  # # set up credit card object as in main ActiveMerchant example
44
44
  # creditcard = ActiveMerchant::Billing::CreditCard.new(
@@ -75,7 +75,19 @@ module ActiveMerchant #:nodoc:
75
75
  #
76
76
  # # When using store, you can also let Ogone generate the alias for you
77
77
  # response = gateway.store(creditcard)
78
- # puts response.billing_id # Retrieve the generated alias
78
+ # puts response.billing_id # Retrieve the generated alias
79
+ #
80
+ # # By default, Ogone tries to authorize 0.01 EUR but you can change this
81
+ # # amount using the :store_amount option when creating the gateway object:
82
+ # gateway = ActiveMerchant::Billing::OgoneGateway.new(
83
+ # :login => "my_ogone_psp_id",
84
+ # :user => "my_ogone_user_id",
85
+ # :password => "my_ogone_pswd",
86
+ # :signature => "my_ogone_sha_signature",
87
+ # :signature_encryptor => "sha512",
88
+ # :store_amount => 100 # The store method will try to authorize 1 EUR instead of 0.01 EUR
89
+ # )
90
+ # response = gateway.store(creditcard) # authorize 1 EUR and void the authorization right away
79
91
  #
80
92
  # == 3-D Secure feature
81
93
  #
@@ -129,6 +141,7 @@ module ActiveMerchant #:nodoc:
129
141
  self.display_name = 'Ogone'
130
142
  self.default_currency = 'EUR'
131
143
  self.money_format = :cents
144
+ self.ssl_version = :TLSv1
132
145
 
133
146
  def initialize(options = {})
134
147
  requires!(options, :login, :user, :password)
@@ -195,7 +208,7 @@ module ActiveMerchant #:nodoc:
195
208
  # Store a credit card by creating an Ogone Alias
196
209
  def store(payment_source, options = {})
197
210
  options.merge!(:alias_operation => 'BYPSP') unless(options.has_key?(:billing_id) || options.has_key?(:store))
198
- response = authorize(1, payment_source, options)
211
+ response = authorize(@options[:store_amount] || 1, payment_source, options)
199
212
  void(response.authorization) if response.success?
200
213
  response
201
214
  end
@@ -32,12 +32,12 @@ module ActiveMerchant #:nodoc:
32
32
  'JB' => 'International street address match. Postal code not verified',
33
33
  'JC' => 'International street address and postal code not verified',
34
34
  'JD' => 'International postal code match. Street address not verified',
35
- 'M1' => 'Merchant Override Decline',
35
+ 'M1' => 'Cardholder name matches',
36
36
  'M2' => 'Cardholder name, billing address, and postal code matches',
37
37
  'M3' => 'Cardholder name and billing code matches',
38
- 'M4' => 'Cardholder name and billing address matches',
38
+ 'M4' => 'Cardholder name and billing address match',
39
39
  'M5' => 'Cardholder name incorrect, billing address and postal code match',
40
- 'M6' => 'Cardholder name incorrect, billing address matches',
40
+ 'M6' => 'Cardholder name incorrect, billing postal code matches',
41
41
  'M7' => 'Cardholder name incorrect, billing address matches',
42
42
  'M8' => 'Cardholder name, billing address and postal code are all incorrect',
43
43
  'N3' => 'Address matches, ZIP not verified',
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  'N8' => 'Address and ZIP code match (International only)',
49
49
  'N9' => 'Address and ZIP code match (UK only)',
50
50
  'R' => 'Issuer does not participate in AVS',
51
- 'UX' => 'Unknown',
51
+ 'UK' => 'Unknown',
52
52
  'X' => 'Zip Match/Zip 4 Match/Address Match',
53
53
  'Z' => 'Zip Match/Locale no match',
54
54
  }
@@ -58,7 +58,7 @@ module ActiveMerchant #:nodoc:
58
58
  'Y' => %w( 9 A B C H JA JD M2 M3 M5 N5 N8 N9 X Z ),
59
59
  'N' => %w( D E F G M8 ),
60
60
  'X' => %w( 4 J R ),
61
- nil => %w( 1 2 3 5 6 7 8 JB JC M1 M4 M6 M7 N3 N4 N6 N7 UX )
61
+ nil => %w( 1 2 3 5 6 7 8 JB JC M1 M4 M6 M7 N3 N4 N6 N7 UK )
62
62
  }.inject({}) do |map, (type, codes)|
63
63
  codes.each { |code| map[code] = type }
64
64
  map
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
69
69
  'Y' => %w( 9 B D F H JA JB M2 M4 M5 M6 M7 N3 N5 N7 N8 N9 X ),
70
70
  'N' => %w( A C E G M8 Z ),
71
71
  'X' => %w( 4 J R ),
72
- nil => %w( 1 2 3 5 6 7 8 JC JD M1 M3 N4 N6 UX )
72
+ nil => %w( 1 2 3 5 6 7 8 JC JD M1 M3 N4 N6 UK )
73
73
  }.inject({}) do |map, (type, codes)|
74
74
  codes.each { |code| map[code] = type }
75
75
  map
@@ -13,8 +13,8 @@ module ActiveMerchant #:nodoc:
13
13
 
14
14
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :solo, :switch]
15
15
  self.supported_countries = ['GB']
16
- self.homepage_url = 'https://www.paypal.com/uk/cgi-bin/webscr?cmd=_wp-pro-overview-outside'
17
- self.display_name = 'PayPal Website Payments Pro (UK)'
16
+ self.homepage_url = 'https://www.paypal.com/uk/webapps/mpp/pro'
17
+ self.display_name = 'PayPal Payments Pro (UK)'
18
18
  end
19
19
  end
20
20
  end
@@ -57,6 +57,10 @@ module ActiveMerchant #:nodoc:
57
57
  commit(:post, "refunds/#{transaction_id(authorization)}", post)
58
58
  end
59
59
 
60
+ def void(authorization, options={})
61
+ commit(:delete, "preauthorizations/#{preauth(authorization)}")
62
+ end
63
+
60
64
  def store(credit_card, options={})
61
65
  save_card(credit_card)
62
66
  end
@@ -97,9 +101,12 @@ module ActiveMerchant #:nodoc:
97
101
  end
98
102
 
99
103
  def authorization_from(parsed_response)
104
+ parsed_data = parsed_response['data']
105
+ return '' unless parsed_data.kind_of?(Hash)
106
+
100
107
  [
101
- parsed_response['data']['id'],
102
- parsed_response['data']['preauthorization'].try(:[], 'id')
108
+ parsed_data['id'],
109
+ parsed_data['preauthorization'].try(:[], 'id')
103
110
  ].join(";")
104
111
  end
105
112
 
@@ -109,6 +116,7 @@ module ActiveMerchant #:nodoc:
109
116
  add_amount(post, money, options)
110
117
  post[:token] = card_token
111
118
  post[:description] = options[:description]
119
+ post[:client] = options[:customer]
112
120
  commit(:post, 'transactions', post)
113
121
  end
114
122
 
@@ -158,6 +166,8 @@ module ActiveMerchant #:nodoc:
158
166
  end
159
167
 
160
168
  def post_data(params)
169
+ return nil unless params
170
+
161
171
  no_blanks = params.reject { |key, value| value.blank? }
162
172
  no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
163
173
  end
@@ -10,8 +10,8 @@ module ActiveMerchant #:nodoc:
10
10
 
11
11
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
12
12
  self.supported_countries = ['US']
13
- self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside'
14
- self.display_name = 'PayPal Website Payments Pro (US)'
13
+ self.homepage_url = 'https://www.paypal.com/us/webapps/mpp/paypal-payments-pro'
14
+ self.display_name = 'PayPal Payments Pro (US)'
15
15
 
16
16
  def authorize(money, credit_card_or_referenced_id, options = {})
17
17
  requires!(options, :ip)
@@ -119,7 +119,36 @@ module ActiveMerchant #:nodoc:
119
119
  :status => %w(protocol msgtype merchant transaction apikey),
120
120
 
121
121
  :chstatus => %w(protocol msgtype merchant apikey)
122
- }
122
+ },
123
+
124
+ 7 => {
125
+ :authorize => %w(protocol msgtype merchant ordernumber amount
126
+ currency autocapture cardnumber expirationdate cvd
127
+ acquirer cardtypelock testmode fraud_remote_addr
128
+ fraud_http_accept fraud_http_accept_language
129
+ fraud_http_accept_encoding fraud_http_accept_charset
130
+ fraud_http_referer fraud_http_user_agent apikey),
131
+
132
+ :capture => %w(protocol msgtype merchant amount transaction
133
+ apikey),
134
+
135
+ :cancel => %w(protocol msgtype merchant transaction apikey),
136
+
137
+ :refund => %w(protocol msgtype merchant amount transaction apikey),
138
+
139
+ :subscribe => %w(protocol msgtype merchant ordernumber cardnumber
140
+ expirationdate cvd acquirer cardtypelock description testmode
141
+ fraud_remote_addr fraud_http_accept fraud_http_accept_language
142
+ fraud_http_accept_encoding fraud_http_accept_charset
143
+ fraud_http_referer fraud_http_user_agent apikey),
144
+
145
+ :recurring => %w(protocol msgtype merchant ordernumber amount currency
146
+ autocapture transaction apikey),
147
+
148
+ :status => %w(protocol msgtype merchant transaction apikey),
149
+
150
+ :chstatus => %w(protocol msgtype merchant apikey)
151
+ }
123
152
  }
124
153
 
125
154
  APPROVED = '000'
@@ -127,7 +156,7 @@ module ActiveMerchant #:nodoc:
127
156
  # The login is the QuickpayId
128
157
  # The password is the md5checkword from the Quickpay manager
129
158
  # To use the API-key from the Quickpay manager, specify :api-key
130
- # Using the API-key, requires that you use version 4+. Specify :version => 4/5/6 in options.
159
+ # Using the API-key, requires that you use version 4+. Specify :version => 4/5/6/7 in options.
131
160
  def initialize(options = {})
132
161
  requires!(options, :login, :password)
133
162
  @protocol = options.delete(:version) || 3 # default to protocol version 3
@@ -225,6 +254,7 @@ module ActiveMerchant #:nodoc:
225
254
  post[:cvd] = credit_card.verification_value
226
255
  post[:expirationdate] = expdate(credit_card)
227
256
  post[:cardtypelock] = options[:cardtypelock] unless options[:cardtypelock].blank?
257
+ post[:acquirer] = options[:acquirer] unless options[:acquirer].blank?
228
258
  end
229
259
 
230
260
  def add_reference(post, identification)