activemerchant 1.74.0 → 1.75.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9058f19bf43858097b6bbd6a911b01a62aafa568
4
- data.tar.gz: 5fc5302b4559796e838bc675a5b03ce61c42aa11
3
+ metadata.gz: 50bb4461b27b49be6e87608a11f5db29a02d0adc
4
+ data.tar.gz: d5b76878be3ec6d7334cb343d439837b6fb3d599
5
5
  SHA512:
6
- metadata.gz: 792627ab57f85f7d6036a94ad5192e4fa0bc266154bde86f9a0f643ec35a8637c874749a758ff55c34b6069476829fc62b1df17ba59ae749a0e204545e88e503
7
- data.tar.gz: 9c382d5af0c5c9794c1091b5706c264fd2317b84ea5a9cc6940f599b7981d45d012692f9af77ab5fc8e342035c8340acfbcd6f49cbc10ada944d2c4019bd7dd6
6
+ metadata.gz: 3eff219643c61371a81f0242548576dadfd8032cd3939a5859e6d5a8ca1aa4b822454754ed6aef844c14096af72a69b90b6ae5cb2ba8491fb662beba6aeb8447
7
+ data.tar.gz: 2cc15eaa916a7b90c66e8686668ec01cc56cebdfe2029c555033e2e1907fc931842e24bad2c8fb7760d543940cdfb6d84da0d8e1da24ccaa4927adc7646950d9
data/CHANGELOG CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  == HEAD
4
4
 
5
+ == Version 1.75.0 (November 9, 2017)
6
+ * Barclaycard Smartpay: Clean up test options hashes [bpollack] #2632
7
+ * Barclaycard Smartpay: Extra data fields for credits [bpollack] #2631
8
+ * Cyber Source: Correctly passes subscriptionID for store [deedeelavinder] #2633
9
+ * Ebanx: Pass fields for business person responsible [curiousepic] #2635
10
+ * Ebanx: Support Colombian transactions [bpollack] #2636
11
+ * FirstData E4 (Payeezy): Ensure numeric ECI values are zero padded [jasonwebster] #2630
12
+ * Netbanx: Only send currency and billing_details for auths and sales [anotherjosmith] #2643
13
+ * Netbanx: Revert "Fixes basic auth for netbanx by sending the account_number and api_key" [anotherjosmith] #2644
14
+ * PayU Latam: Adds `partnerID`, adjusts phone preferences, allows empty `ip_address`, and adjusts for no `cvv` [deedeelavinder] #2634
15
+ * Sage Payment Solutions: Scrub check info [curiousepic] #2639
16
+ * Worldbank US: Allow using the backup URL [bpollack] #2641
17
+ * Worldbank US: Allow using the backup URL per-request [bpollack] #2645
18
+
5
19
  == Version 1.74.0 (October 24, 2017)
6
20
  * Adyen: Update list of supported countries [dtykocki] #2600
7
21
  * Authorize.net CIM: Handle multiple error messages [amandapuff] #2537
@@ -60,6 +60,10 @@ module ActiveMerchant #:nodoc:
60
60
  post = payment_request(money, options)
61
61
  post[:amount] = amount_hash(money, options[:currency])
62
62
  post[:card] = credit_card_hash(creditcard)
63
+ post[:dateOfBirth] = options[:date_of_birth] if options[:date_of_birth]
64
+ post[:entityType] = options[:entity_type] if options[:entity_type]
65
+ post[:nationality] = options[:nationality] if options[:nationality]
66
+ post[:shopperName] = options[:shopper_name] if options[:shopper_name]
63
67
 
64
68
  commit('refundWithData', post)
65
69
  end
@@ -618,7 +618,7 @@ module ActiveMerchant #:nodoc:
618
618
 
619
619
  xml.tag! 'recurringSubscriptionInfo' do
620
620
  if reference
621
- _, subscription_id, _ = reference.split(";")
621
+ subscription_id = reference.split(";")[6]
622
622
  xml.tag! 'subscriptionID', subscription_id
623
623
  end
624
624
 
@@ -709,7 +709,7 @@ module ActiveMerchant #:nodoc:
709
709
  success = response[:decision] == "ACCEPT"
710
710
  message = response[:message]
711
711
 
712
- authorization = success ? [ options[:order_id], response[:requestID], response[:requestToken], action, amount, options[:currency]].compact.join(";") : nil
712
+ authorization = success ? authorization_from(response, action, amount, options) : nil
713
713
 
714
714
  Response.new(success, message, response,
715
715
  :test => test?,
@@ -759,6 +759,11 @@ module ActiveMerchant #:nodoc:
759
759
  return if reason_code.blank?
760
760
  @@response_codes[:"r#{reason_code}"]
761
761
  end
762
+
763
+ def authorization_from(response, action, amount, options)
764
+ [options[:order_id], response[:requestID], response[:requestToken], action, amount,
765
+ options[:currency], response[:subscriptionID]].join(";")
766
+ end
762
767
  end
763
768
  end
764
769
  end
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  self.test_url = 'https://sandbox.ebanx.com/ws/'
5
5
  self.live_url = 'https://api.ebanx.com/ws/'
6
6
 
7
- self.supported_countries = ['BR', 'MX']
7
+ self.supported_countries = ['BR', 'MX', 'CO']
8
8
  self.default_currency = 'USD'
9
9
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
10
10
 
@@ -149,9 +149,9 @@ module ActiveMerchant #:nodoc:
149
149
  post[:payment][:person_type] = options[:person_type] if options[:person_type]
150
150
  if options[:person_type] && options[:person_type].downcase == 'business'
151
151
  post[:payment][:responsible] = {}
152
- post[:payment][:responsible][:name] = customer_name(payment, options)
153
- post[:payment][:responsible][:document] = options[:document] if options[:document]
154
- post[:payment][:responsible][:birth_date] = options[:birth_date] if options[:birth_date]
152
+ post[:payment][:responsible][:name] = options[:responsible_name] if options[:responsible_name]
153
+ post[:payment][:responsible][:document] = options[:responsible_document] if options[:responsible_document]
154
+ post[:payment][:responsible][:birth_date] = options[:responsible_birth_date] if options[:responsible_birth_date]
155
155
  end
156
156
  end
157
157
 
@@ -238,7 +238,7 @@ module ActiveMerchant #:nodoc:
238
238
  xml.tag! "CardType", card_type(credit_card.brand)
239
239
 
240
240
  eci = (credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
241
- xml.tag! "Ecommerce_Flag", eci
241
+ xml.tag! "Ecommerce_Flag", eci.to_s =~ /^[0-9]+$/ ? eci.to_s.rjust(2, '0') : eci
242
242
 
243
243
  add_credit_card_verification_strings(xml, credit_card, options)
244
244
  end
@@ -31,7 +31,7 @@ module ActiveMerchant #:nodoc:
31
31
  post = {}
32
32
  add_invoice(post, money, options)
33
33
  add_settle_with_auth(post)
34
- add_payment(post, payment)
34
+ add_payment(post, payment, options)
35
35
 
36
36
  commit(:post, 'auths', post)
37
37
  end
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
  def authorize(money, payment, options={})
40
40
  post = {}
41
41
  add_invoice(post, money, options)
42
- add_payment(post, payment)
42
+ add_payment(post, payment, options)
43
43
 
44
44
  commit(:post, 'auths', post)
45
45
  end
@@ -132,13 +132,7 @@ module ActiveMerchant #:nodoc:
132
132
 
133
133
  def add_invoice(post, money, options)
134
134
  post[:amount] = amount(money)
135
- post[:currencyCode] = options[:currency] if options[:currency]
136
135
  add_order_id(post, options)
137
-
138
- if options[:billing_address]
139
- post[:billingDetails] = map_address(options[:billing_address])
140
- end
141
-
142
136
  end
143
137
 
144
138
  def add_payment(post, credit_card_or_reference, options = {})
@@ -150,6 +144,9 @@ module ActiveMerchant #:nodoc:
150
144
  post[:card][:cvv] = credit_card_or_reference.verification_value
151
145
  post[:card][:cardExpiry] = expdate(credit_card_or_reference)
152
146
  end
147
+
148
+ post[:currencyCode] = options[:currency] if options[:currency]
149
+ post[:billingDetails] = map_address(options[:billing_address]) if options[:billing_address]
153
150
  end
154
151
 
155
152
  def expdate(credit_card)
@@ -241,15 +238,11 @@ module ActiveMerchant #:nodoc:
241
238
  {
242
239
  'Accept' => 'application/json',
243
240
  'Content-type' => 'application/json',
244
- 'Authorization' => "Basic #{basic_auth}",
241
+ 'Authorization' => "Basic #{Base64.strict_encode64(@options[:api_key].to_s)}",
245
242
  'User-Agent' => "Netbanx-Paysafe v1.0/ActiveMerchant #{ActiveMerchant::VERSION}"
246
243
  }
247
244
  end
248
245
 
249
- def basic_auth
250
- Base64.strict_encode64("#{@options[:account_number]}:#{@options[:api_key]}")
251
- end
252
-
253
246
  def error_code_from(response)
254
247
  unless success_from(response)
255
248
  case response['errorCode']
@@ -141,7 +141,7 @@ module ActiveMerchant #:nodoc:
141
141
  transaction = {}
142
142
  transaction[:paymentCountry] = @options[:payment_country] || (options[:billing_address][:country] if options[:billing_address])
143
143
  transaction[:type] = type
144
- transaction[:ipAddress] = options[:ip] if options[:ip]
144
+ transaction[:ipAddress] = options[:ip] || ''
145
145
  transaction[:userAgent] = options[:user_agent] if options[:user_agent]
146
146
  transaction[:cookie] = options[:cookie] if options[:cookie]
147
147
  transaction[:deviceSessionId] = options[:device_session_id] if options[:device_session_id]
@@ -151,6 +151,7 @@ module ActiveMerchant #:nodoc:
151
151
  def add_order(post, options)
152
152
  order = {}
153
153
  order[:accountId] = @options[:account_id]
154
+ order[:partnerId] = options[:partner_id] if options[:partner_id]
154
155
  order[:referenceCode] = options[:order_id] || generate_unique_id
155
156
  order[:description] = options[:description] || 'unspecified'
156
157
  order[:language] = 'en'
@@ -192,7 +193,7 @@ module ActiveMerchant #:nodoc:
192
193
  buyer[:dniType] = buyer_hash[:dni_type]
193
194
  buyer[:cnpj] = buyer_hash[:cnpj] if options[:payment_country] == 'BR'
194
195
  buyer[:emailAddress] = buyer_hash[:email]
195
- buyer[:contactPhone] = options[:shipping_address][:phone] if options[:shipping_address]
196
+ buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone] if options[:shipping_address]) || ''
196
197
  buyer[:shippingAddress] = shipping_address_fields(options) if options[:shipping_address]
197
198
  else
198
199
  buyer[:fullName] = payment_method.name.strip
@@ -200,7 +201,7 @@ module ActiveMerchant #:nodoc:
200
201
  buyer[:dniType] = options[:dni_type]
201
202
  buyer[:cnpj] = options[:cnpj] if options[:payment_country] == 'BR'
202
203
  buyer[:emailAddress] = options[:email]
203
- buyer[:contactPhone] = (options[:shipping_address][:phone] if options[:shipping_address]) || (options[:billing_address][:phone] if options[:billing_address])
204
+ buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone] if options[:shipping_address]) || ''
204
205
  buyer[:shippingAddress] = shipping_address_fields(options) if options[:shipping_address]
205
206
  end
206
207
  post[:transaction][:order][:buyer] = buyer
@@ -268,7 +269,7 @@ module ActiveMerchant #:nodoc:
268
269
  else
269
270
  credit_card = {}
270
271
  credit_card[:number] = payment_method.number
271
- credit_card[:securityCode] = add_security_code(payment_method, options)
272
+ credit_card[:securityCode] = payment_method.verification_value || options[:cvv]
272
273
  credit_card[:expirationDate] = format(payment_method.year, :four_digits).to_s + '/' + format(payment_method.month, :two_digits).to_s
273
274
  credit_card[:name] = payment_method.name.strip
274
275
  credit_card[:processWithoutCvv2] = true if add_process_without_cvv2(payment_method, options)
@@ -277,13 +278,6 @@ module ActiveMerchant #:nodoc:
277
278
  end
278
279
  end
279
280
 
280
- def add_security_code(payment_method, options)
281
- return payment_method.verification_value unless payment_method.verification_value.blank?
282
- return options[:cvv] unless options[:cvv].blank?
283
- return "0000" if BRAND_MAP[payment_method.brand.to_s] == "AMEX"
284
- "000"
285
- end
286
-
287
281
  def add_process_without_cvv2(payment_method, options)
288
282
  return true if payment_method.verification_value.blank? && options[:cvv].blank?
289
283
  false
@@ -102,6 +102,9 @@ module ActiveMerchant #:nodoc:
102
102
  gsub(%r((M_key=)[^&]*), '\1[FILTERED]').
103
103
  gsub(%r((C_cardnumber=)[^&]*), '\1[FILTERED]').
104
104
  gsub(%r((C_cvv=)[^&]*), '\1[FILTERED]').
105
+ gsub(%r((C_rte=)[^&]*), '\1[FILTERED]').
106
+ gsub(%r((C_acct=)[^&]*), '\1[FILTERED]').
107
+ gsub(%r((C_ssn=)[^&]*), '\1[FILTERED]').
105
108
  gsub(%r((<ns1:CARDNUMBER>).+(</ns1:CARDNUMBER>)), '\1[FILTERED]\2').
106
109
  gsub(%r((<ns1:M_ID>).+(</ns1:M_ID>)), '\1[FILTERED]\2').
107
110
  gsub(%r((<ns1:M_KEY>).+(</ns1:M_KEY>)), '\1[FILTERED]\2')
@@ -3,11 +3,14 @@ require "nokogiri"
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class WorldpayUsGateway < Gateway
6
+ class_attribute :backup_url
7
+
6
8
  self.display_name = "Worldpay US"
7
9
  self.homepage_url = "http://www.worldpay.com/us"
8
10
 
9
11
  # No sandbox, just use test cards.
10
- self.live_url = 'https://trans.worldpay.us/cgi-bin/process.cgi'
12
+ self.live_url = 'https://trans.worldpay.us/cgi-bin/process.cgi'
13
+ self.backup_url = 'https://trans.gwtx01.com/cgi-bin/process.cgi'
11
14
 
12
15
  self.supported_countries = ['US']
13
16
  self.default_currency = 'USD'
@@ -25,7 +28,7 @@ module ActiveMerchant #:nodoc:
25
28
  add_payment_method(post, payment_method)
26
29
  add_customer_data(post, options)
27
30
 
28
- commit('purchase', post)
31
+ commit('purchase', options, post)
29
32
  end
30
33
 
31
34
  def authorize(money, payment, options={})
@@ -34,7 +37,7 @@ module ActiveMerchant #:nodoc:
34
37
  add_credit_card(post, payment)
35
38
  add_customer_data(post, options)
36
39
 
37
- commit('authorize', post)
40
+ commit('authorize', options, post)
38
41
  end
39
42
 
40
43
  def capture(amount, authorization, options={})
@@ -43,7 +46,7 @@ module ActiveMerchant #:nodoc:
43
46
  add_reference(post, authorization)
44
47
  add_customer_data(post, options)
45
48
 
46
- commit('capture', post)
49
+ commit('capture', options, post)
47
50
  end
48
51
 
49
52
  def refund(amount, authorization, options={})
@@ -52,14 +55,14 @@ module ActiveMerchant #:nodoc:
52
55
  add_reference(post, authorization)
53
56
  add_customer_data(post, options)
54
57
 
55
- commit("refund", post)
58
+ commit("refund", options, post)
56
59
  end
57
60
 
58
61
  def void(authorization, options={})
59
62
  post = {}
60
63
  add_reference(post, authorization)
61
64
 
62
- commit('void', post)
65
+ commit('void', options, post)
63
66
  end
64
67
 
65
68
  def verify(credit_card, options={})
@@ -71,6 +74,10 @@ module ActiveMerchant #:nodoc:
71
74
 
72
75
  private
73
76
 
77
+ def url(options)
78
+ options[:use_backup_url].to_s == "true" ? self.backup_url : self.live_url
79
+ end
80
+
74
81
  def add_customer_data(post, options)
75
82
  if(billing_address = (options[:billing_address] || options[:address]))
76
83
  post[:ci_companyname] = billing_address[:company]
@@ -162,7 +169,7 @@ module ActiveMerchant #:nodoc:
162
169
  "void" => "ns_void",
163
170
  }
164
171
 
165
- def commit(action, post)
172
+ def commit(action, options, post)
166
173
  post[:action] = ACTIONS[action] unless post[:action]
167
174
  post[:acctid] = @options[:acctid]
168
175
  post[:subid] = @options[:subid]
@@ -170,7 +177,7 @@ module ActiveMerchant #:nodoc:
170
177
 
171
178
  post[:authonly] = '1' if action == 'authorize'
172
179
 
173
- raw = parse(ssl_post(live_url, post.to_query))
180
+ raw = parse(ssl_post(url(options), post.to_query))
174
181
 
175
182
  succeeded = success_from(raw['result'])
176
183
  Response.new(
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.74.0"
2
+ VERSION = "1.75.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.74.0
4
+ version: 1.75.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: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2017-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport