activemerchant 1.52.0 → 1.53.0

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +56 -0
  3. data/README.md +1 -1
  4. data/lib/active_merchant/billing/gateways/authorize_net.rb +4 -1
  5. data/lib/active_merchant/billing/gateways/banwire.rb +11 -0
  6. data/lib/active_merchant/billing/gateways/beanstream.rb +12 -1
  7. data/lib/active_merchant/billing/gateways/blue_pay.rb +519 -506
  8. data/lib/active_merchant/billing/gateways/borgun.rb +10 -0
  9. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +13 -1
  10. data/lib/active_merchant/billing/gateways/braintree_blue.rb +2 -2
  11. data/lib/active_merchant/billing/gateways/braintree_orange.rb +0 -1
  12. data/lib/active_merchant/billing/gateways/card_stream.rb +14 -19
  13. data/lib/active_merchant/billing/gateways/cecabank.rb +11 -1
  14. data/lib/active_merchant/billing/gateways/cenpos.rb +62 -2
  15. data/lib/active_merchant/billing/gateways/checkout.rb +1 -1
  16. data/lib/active_merchant/billing/gateways/checkout_v2.rb +3 -3
  17. data/lib/active_merchant/billing/gateways/conekta.rb +11 -1
  18. data/lib/active_merchant/billing/gateways/creditcall.rb +208 -0
  19. data/lib/active_merchant/billing/gateways/epay.rb +12 -0
  20. data/lib/active_merchant/billing/gateways/eway.rb +11 -0
  21. data/lib/active_merchant/billing/gateways/eway_rapid.rb +11 -0
  22. data/lib/active_merchant/billing/gateways/forte.rb +238 -0
  23. data/lib/active_merchant/billing/gateways/iridium.rb +11 -0
  24. data/lib/active_merchant/billing/gateways/jetpay.rb +10 -1
  25. data/lib/active_merchant/billing/gateways/linkpoint.rb +11 -0
  26. data/lib/active_merchant/billing/gateways/litle.rb +8 -1
  27. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/micropayment.rb +167 -0
  29. data/lib/active_merchant/billing/gateways/migs.rb +13 -4
  30. data/lib/active_merchant/billing/gateways/monei.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/netbilling.rb +11 -1
  32. data/lib/active_merchant/billing/gateways/nmi.rb +164 -178
  33. data/lib/active_merchant/billing/gateways/ogone.rb +50 -15
  34. data/lib/active_merchant/billing/gateways/openpay.rb +10 -1
  35. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
  36. data/lib/active_merchant/billing/gateways/payment_express.rb +11 -0
  37. data/lib/active_merchant/billing/gateways/paymill.rb +11 -0
  38. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  40. data/lib/active_merchant/billing/gateways/pin.rb +10 -0
  41. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +106 -57
  42. data/lib/active_merchant/billing/gateways/realex.rb +10 -0
  43. data/lib/active_merchant/billing/gateways/redsys.rb +20 -0
  44. data/lib/active_merchant/billing/gateways/s5.rb +1 -0
  45. data/lib/active_merchant/billing/gateways/sage_pay.rb +11 -0
  46. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -0
  47. data/lib/active_merchant/billing/gateways/stripe.rb +10 -4
  48. data/lib/active_merchant/billing/gateways/tns.rb +15 -4
  49. data/lib/active_merchant/billing/gateways/trust_commerce.rb +11 -0
  50. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +12 -2
  51. data/lib/active_merchant/billing/gateways/wirecard.rb +11 -1
  52. data/lib/active_merchant/billing/gateways/worldpay.rb +11 -0
  53. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +1 -1
  54. data/lib/active_merchant/version.rb +1 -1
  55. metadata +5 -2
@@ -83,6 +83,16 @@ module ActiveMerchant
83
83
  commit(request)
84
84
  end
85
85
 
86
+ def supports_scrubbing
87
+ true
88
+ end
89
+
90
+ def scrub(transcript)
91
+ transcript.
92
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
93
+ gsub(%r((<number>)\d+(</number>))i, '\1[FILTERED]\2')
94
+ end
95
+
86
96
  private
87
97
  def commit(request)
88
98
  response = parse(ssl_post(self.live_url, request))
@@ -38,6 +38,7 @@ module ActiveMerchant #:nodoc:
38
38
  self.display_name = "Redsys"
39
39
 
40
40
  CURRENCY_CODES = {
41
+ "AED" => '784',
41
42
  "ARS" => '32',
42
43
  "AUD" => '36',
43
44
  "BRL" => '986',
@@ -46,16 +47,22 @@ module ActiveMerchant #:nodoc:
46
47
  "CHF" => '756',
47
48
  "CLP" => '152',
48
49
  "COP" => '170',
50
+ "CZK" => '203',
49
51
  "EUR" => '978',
50
52
  "GBP" => '826',
51
53
  "GTQ" => '320',
54
+ "HUF" => '348',
52
55
  "JPY" => '392',
53
56
  "MYR" => '458',
54
57
  "MXN" => '484',
58
+ "NOK" => '578',
55
59
  "NZD" => '554',
56
60
  "PEN" => '604',
61
+ "PLN" => '616',
57
62
  "RUB" => '643',
63
+ "SEK" => '752',
58
64
  "SGD" => '702',
65
+ "THB" => '764',
59
66
  "USD" => '840',
60
67
  "UYU" => '858'
61
68
  }
@@ -228,6 +235,19 @@ module ActiveMerchant #:nodoc:
228
235
  end
229
236
  end
230
237
 
238
+ def supports_scrubbing
239
+ true
240
+ end
241
+
242
+ def scrub(transcript)
243
+ transcript.
244
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
245
+ gsub(%r((%3CDS_MERCHANT_PAN%3E)\d+(%3C%2FDS_MERCHANT_PAN%3E))i, '\1[FILTERED]\2').
246
+ gsub(%r((%3CDS_MERCHANT_CVV2%3E)\d+(%3C%2FDS_MERCHANT_CVV2%3E))i, '\1[FILTERED]\2').
247
+ gsub(%r((<DS_MERCHANT_PAN>)\d+(</DS_MERCHANT_PAN>))i, '\1[FILTERED]\2').
248
+ gsub(%r((<DS_MERCHANT_CVV2>)\d+(</DS_MERCHANT_CVV2>))i, '\1[FILTERED]\2')
249
+ end
250
+
231
251
  private
232
252
 
233
253
  def add_action(data, action)
@@ -81,6 +81,7 @@ module ActiveMerchant #:nodoc:
81
81
  xml.Payment(code: SUPPORTED_TRANSACTIONS["store"])
82
82
  add_account(xml, payment)
83
83
  add_customer(xml, payment, options)
84
+ add_recurrence_mode(xml, options)
84
85
  end
85
86
 
86
87
  commit(request)
@@ -145,6 +145,17 @@ module ActiveMerchant #:nodoc:
145
145
  end
146
146
  end
147
147
 
148
+ def supports_scrubbing
149
+ true
150
+ end
151
+
152
+ def scrub(transcript)
153
+ transcript.
154
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
155
+ gsub(%r((&?CardNumber=)\d+(&?)), '\1[FILTERED]\2').
156
+ gsub(%r((&?CV2=)\d+(&?)), '\1[FILTERED]\2')
157
+ end
158
+
148
159
  private
149
160
  def add_reference(post, identification)
150
161
  order_id, transaction_id, authorization, security_key = identification.split(';')
@@ -212,6 +212,7 @@ module ActiveMerchant #:nodoc:
212
212
  xml.tag! 'TEST', 'TRUE' if test?
213
213
  xml.tag! 'TOTAL_INSTALLMENTCOUNT', 0
214
214
  xml.tag! 'TRANSACTION_SERVICE', 0
215
+ xml.tag! 'DEVELOPERID', options[:developer_id] if options[:developer_id]
215
216
  end
216
217
 
217
218
  def success?(response)
@@ -63,7 +63,11 @@ module ActiveMerchant #:nodoc:
63
63
  end
64
64
  r.process do
65
65
  post = create_post_for_auth_or_purchase(money, payment, options)
66
- post[:capture] = "false" unless emv_payment?(payment)
66
+ if emv_payment?(payment)
67
+ add_application_fee(post, options)
68
+ else
69
+ post[:capture] = "false"
70
+ end
67
71
  commit(:post, 'charges', post, options)
68
72
  end
69
73
  end.responses.last
@@ -92,12 +96,11 @@ module ActiveMerchant #:nodoc:
92
96
  def capture(money, authorization, options = {})
93
97
  post = {}
94
98
 
95
- add_application_fee(post, options)
96
-
97
99
  if emv_tc_response = options.delete(:icc_data)
98
100
  post[:card] = { emv_approval_data: emv_tc_response }
99
101
  commit(:post, "charges/#{CGI.escape(authorization)}", post, options)
100
102
  else
103
+ add_application_fee(post, options)
101
104
  add_amount(post, money, options)
102
105
  commit(:post, "charges/#{CGI.escape(authorization)}/capture", post, options)
103
106
  end
@@ -159,6 +162,7 @@ module ActiveMerchant #:nodoc:
159
162
  add_creditcard(card_params, payment, options)
160
163
  end
161
164
 
165
+ post[:validate] = options[:validate] unless options[:validate].nil?
162
166
  post[:description] = options[:description] if options[:description]
163
167
  post[:email] = options[:email] if options[:email]
164
168
 
@@ -383,7 +387,7 @@ module ActiveMerchant #:nodoc:
383
387
  return nil unless params
384
388
 
385
389
  params.map do |key, value|
386
- next if value.blank?
390
+ next if value != false && value.blank?
387
391
  if value.is_a?(Hash)
388
392
  h = {}
389
393
  value.each do |k, v|
@@ -460,6 +464,8 @@ module ActiveMerchant #:nodoc:
460
464
  [response["id"], response["sources"]["data"].first["id"]].join("|")
461
465
  elsif method == :post && url.match(/customers\/.*\/cards/)
462
466
  [response["customer"], response["id"]].join("|")
467
+ elsif url.include?("refund") && response["refunds"]
468
+ response["refunds"]["data"].first["id"]
463
469
  else
464
470
  response["id"]
465
471
  end
@@ -118,7 +118,7 @@ module ActiveMerchant #:nodoc:
118
118
  billing[:address][:city] = billing_address[:city]
119
119
  billing[:address][:stateProvince] = billing_address[:state]
120
120
  billing[:address][:postcodeZip] = billing_address[:zip]
121
- billing[:address][:country] = billing_address[:country]
121
+ billing[:address][:country] = country_code(billing_address[:country])
122
122
  billing[:phone] = billing_address[:phone]
123
123
 
124
124
  customer[:email] = options[:email] if options[:email]
@@ -132,7 +132,7 @@ module ActiveMerchant #:nodoc:
132
132
  shipping[:address][:city] = shipping_address[:city]
133
133
  shipping[:address][:stateProvince] = shipping_address[:state]
134
134
  shipping[:address][:postcodeZip] = shipping_address[:zip]
135
- shipping[:address][:shipcountry] = shipping_address[:country]
135
+ shipping[:address][:shipcountry] = country_code(shipping_address[:country])
136
136
 
137
137
  last_name, first_middle_names = split_name(shipping_address[:name])
138
138
  shipping[:firstName] = first_middle_names if first_middle_names
@@ -143,6 +143,14 @@ module ActiveMerchant #:nodoc:
143
143
  post[:customer].merge!(customer)
144
144
  end
145
145
 
146
+ def country_code(country)
147
+ if country
148
+ country = ActiveMerchant::Country.find(country)
149
+ country.code(:alpha3).value
150
+ end
151
+ rescue InvalidCountryCodeError
152
+ end
153
+
146
154
  def commit(action, post)
147
155
  url = build_url(post.delete(:orderid), post.delete(:transactionid))
148
156
  headers = {
@@ -150,8 +158,11 @@ module ActiveMerchant #:nodoc:
150
158
  'Content-Type' => 'application/json',
151
159
  }
152
160
  post[:apiOperation] = action.upcase
153
- raw = parse(ssl_request(:put, url, build_request(post), headers))
154
-
161
+ begin
162
+ raw = parse(ssl_request(:put, url, build_request(post), headers))
163
+ rescue ResponseError => e
164
+ raw = parse(e.response.body)
165
+ end
155
166
  succeeded = success_from(raw['result'])
156
167
  Response.new(
157
168
  succeeded,
@@ -292,6 +292,17 @@ module ActiveMerchant #:nodoc:
292
292
  commit('unstore', parameters)
293
293
  end
294
294
 
295
+ def supports_scrubbing
296
+ true
297
+ end
298
+
299
+ def scrub(transcript)
300
+ transcript.
301
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
302
+ gsub(%r((&?cc=)\d*(&?)), '\1[FILTERED]\2').
303
+ gsub(%r((&?cvv=)\d*(&?)), '\1[FILTERED]\2')
304
+ end
305
+
295
306
  private
296
307
  def add_payment_source(params, source)
297
308
  if source.is_a?(String)
@@ -141,9 +141,10 @@ module ActiveMerchant #:nodoc:
141
141
 
142
142
  def add_address_for_type(type, post, credit_card, address)
143
143
  prefix = address_key_prefix(type)
144
+ first_name, last_name = split_names(address[:name])
144
145
 
145
- post[address_key(prefix, 'fname')] = credit_card.first_name
146
- post[address_key(prefix, 'lname')] = credit_card.last_name
146
+ post[address_key(prefix, 'fname')] = first_name.blank? && last_name.blank? ? credit_card.first_name : first_name
147
+ post[address_key(prefix, 'lname')] = first_name.blank? && last_name.blank? ? credit_card.last_name : last_name
147
148
  post[address_key(prefix, 'company')] = address[:company] unless address[:company].blank?
148
149
  post[address_key(prefix, 'street')] = address[:address1] unless address[:address1].blank?
149
150
  post[address_key(prefix, 'street2')] = address[:address2] unless address[:address2].blank?
@@ -154,6 +155,15 @@ module ActiveMerchant #:nodoc:
154
155
  post[address_key(prefix, 'phone')] = address[:phone] unless address[:phone].blank?
155
156
  end
156
157
 
158
+ def split_names(full_name)
159
+ names = (full_name || '').split
160
+ return [nil, nil] if names.size == 0
161
+
162
+ last_name = names.pop
163
+ first_name = names.join(' ')
164
+ [first_name, last_name]
165
+ end
166
+
157
167
  def address_key_prefix(type)
158
168
  case type
159
169
  when :shipping then 'ship'
@@ -126,6 +126,17 @@ module ActiveMerchant #:nodoc:
126
126
  end
127
127
  end
128
128
 
129
+ def supports_scrubbing
130
+ true
131
+ end
132
+
133
+ def scrub(transcript)
134
+ transcript.
135
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
136
+ gsub(%r((<CreditCardNumber>)\d+(</CreditCardNumber>)), '\1[FILTERED]\2').
137
+ gsub(%r((<CVC2>)[^<]+(</CVC2>)), '\1[FILTERED]\2')
138
+ end
139
+
129
140
  private
130
141
  def clean_description(description)
131
142
  description.to_s.slice(0,32).encode("US-ASCII", invalid: :replace, undef: :replace, replace: '?')
@@ -417,4 +428,3 @@ module ActiveMerchant #:nodoc:
417
428
  end
418
429
  end
419
430
  end
420
-
@@ -65,6 +65,17 @@ module ActiveMerchant #:nodoc:
65
65
  end
66
66
  end
67
67
 
68
+ def supports_scrubbing
69
+ true
70
+ end
71
+
72
+ def scrub(transcript)
73
+ transcript.
74
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
75
+ gsub(%r((<cardNumber>)\d+(</cardNumber>)), '\1[FILTERED]\2').
76
+ gsub(%r((<cvc>)[^<]+(</cvc>)), '\1[FILTERED]\2')
77
+ end
78
+
68
79
  private
69
80
 
70
81
  def authorize_request(money, payment_method, options)
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
 
8
8
  self.money_format = :cents
9
9
 
10
- self.supported_countries = %w(HK US GB AU AD BE CH CY CZ DE DK ES FI FR GI GR HU IE IL IT LI LU MC MT NL NO NZ PL PT SE SG SI SM TR UM VA)
10
+ self.supported_countries = %w(HK US GB BE CH CZ DE DK ES FI FR GR HU IE IT LU MT NL NO PL PT SE SG TR)
11
11
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro, :laser, :switch]
12
12
 
13
13
  self.homepage_url = 'http://online.worldpay.com'
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.52.0"
2
+ VERSION = "1.53.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.52.0
4
+ version: 1.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-20 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -196,6 +196,7 @@ files:
196
196
  - lib/active_merchant/billing/gateways/checkout_v2.rb
197
197
  - lib/active_merchant/billing/gateways/commercegate.rb
198
198
  - lib/active_merchant/billing/gateways/conekta.rb
199
+ - lib/active_merchant/billing/gateways/creditcall.rb
199
200
  - lib/active_merchant/billing/gateways/cyber_source.rb
200
201
  - lib/active_merchant/billing/gateways/data_cash.rb
201
202
  - lib/active_merchant/billing/gateways/dibs.rb
@@ -216,6 +217,7 @@ files:
216
217
  - lib/active_merchant/billing/gateways/firstdata_e4.rb
217
218
  - lib/active_merchant/billing/gateways/flo2cash.rb
218
219
  - lib/active_merchant/billing/gateways/flo2cash_simple.rb
220
+ - lib/active_merchant/billing/gateways/forte.rb
219
221
  - lib/active_merchant/billing/gateways/garanti.rb
220
222
  - lib/active_merchant/billing/gateways/global_transport.rb
221
223
  - lib/active_merchant/billing/gateways/hdfc.rb
@@ -242,6 +244,7 @@ files:
242
244
  - lib/active_merchant/billing/gateways/merchant_warrior.rb
243
245
  - lib/active_merchant/billing/gateways/mercury.rb
244
246
  - lib/active_merchant/billing/gateways/metrics_global.rb
247
+ - lib/active_merchant/billing/gateways/micropayment.rb
245
248
  - lib/active_merchant/billing/gateways/migs.rb
246
249
  - lib/active_merchant/billing/gateways/migs/migs_codes.rb
247
250
  - lib/active_merchant/billing/gateways/modern_payments.rb