activemerchant 1.66.0 → 1.67.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.
@@ -34,7 +34,7 @@ module ActiveMerchant
34
34
  params = {transaction_type: 'purchase'}
35
35
 
36
36
  add_invoice(params, options)
37
- add_payment_method(params, payment_method)
37
+ add_payment_method(params, payment_method, options)
38
38
  add_address(params, options)
39
39
  add_amount(params, amount, options)
40
40
  add_soft_descriptors(params, options)
@@ -46,7 +46,7 @@ module ActiveMerchant
46
46
  params = {transaction_type: 'authorize'}
47
47
 
48
48
  add_invoice(params, options)
49
- add_payment_method(params, payment_method)
49
+ add_payment_method(params, payment_method, options)
50
50
  add_address(params, options)
51
51
  add_amount(params, amount, options)
52
52
  add_soft_descriptors(params, options)
@@ -119,9 +119,9 @@ module ActiveMerchant
119
119
  params[:method] = method
120
120
  end
121
121
 
122
- def add_payment_method(params, payment_method)
122
+ def add_payment_method(params, payment_method, options)
123
123
  if payment_method.is_a? Check
124
- add_echeck(params, payment_method)
124
+ add_echeck(params, payment_method, options)
125
125
  else
126
126
  add_creditcard(params, payment_method)
127
127
  end
@@ -140,14 +140,17 @@ module ActiveMerchant
140
140
  params[:credit_card] = credit_card
141
141
  end
142
142
 
143
- def add_echeck(params, echeck)
143
+ def add_echeck(params, echeck, options)
144
144
  tele_check = {}
145
145
 
146
- tele_check[:check_number] = echeck.number
146
+ tele_check[:check_number] = echeck.number || "001"
147
147
  tele_check[:check_type] = "P"
148
148
  tele_check[:routing_number] = echeck.routing_number
149
149
  tele_check[:account_number] = echeck.account_number
150
150
  tele_check[:accountholder_name] = "#{echeck.first_name} #{echeck.last_name}"
151
+ tele_check[:customer_id_type] = options[:customer_id_type] if options[:customer_id_type]
152
+ tele_check[:customer_id_number] = options[:customer_id_number] if options[:customer_id_number]
153
+ tele_check[:client_email] = options[:client_email] if options[:client_email]
151
154
 
152
155
  params[:method] = 'tele_check'
153
156
  params[:tele_check] = tele_check
@@ -16,25 +16,33 @@ module ActiveMerchant
16
16
 
17
17
  def purchase(money, credit_card_or_reference, options = {})
18
18
  MultiResponse.run(true) do |r|
19
+ if credit_card_or_reference.is_a?(String)
20
+ r.process { create_token(credit_card_or_reference, options) }
21
+ credit_card_or_reference = r.authorization
22
+ end
19
23
  r.process { create_payment(money, options) }
20
24
  r.process {
21
25
  post = authorization_params(money, credit_card_or_reference, options)
22
26
  add_autocapture(post, false)
23
- commit(synchronized_path("/payments/#{r.authorization}/authorize"), post)
27
+ commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/authorize"), post)
24
28
  }
25
29
  r.process {
26
30
  post = capture_params(money, credit_card_or_reference, options)
27
- commit(synchronized_path("/payments/#{r.authorization}/capture"), post)
31
+ commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/capture"), post)
28
32
  }
29
33
  end
30
34
  end
31
35
 
32
36
  def authorize(money, credit_card_or_reference, options = {})
33
37
  MultiResponse.run(true) do |r|
38
+ if credit_card_or_reference.is_a?(String)
39
+ r.process { create_token(credit_card_or_reference, options) }
40
+ credit_card_or_reference = r.authorization
41
+ end
34
42
  r.process { create_payment(money, options) }
35
43
  r.process {
36
44
  post = authorization_params(money, credit_card_or_reference, options)
37
- commit(synchronized_path("/payments/#{r.authorization}/authorize"), post)
45
+ commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/authorize"), post)
38
46
  }
39
47
  end
40
48
  end
@@ -71,12 +79,10 @@ module ActiveMerchant
71
79
  MultiResponse.run do |r|
72
80
  r.process { create_store(options) }
73
81
  r.process { authorize_store(r.authorization, credit_card, options)}
74
- r.process { create_token(r.authorization, options.merge({id: r.authorization}))}
75
82
  end
76
83
  end
77
84
 
78
85
  def unstore(identification)
79
- identification = identification.split(";").last
80
86
  commit(synchronized_path "/cards/#{identification}/cancel")
81
87
  end
82
88
 
@@ -93,11 +99,11 @@ module ActiveMerchant
93
99
 
94
100
  private
95
101
 
96
- def authorization_params(money, credit_card, options = {})
102
+ def authorization_params(money, credit_card_or_reference, options = {})
97
103
  post = {}
98
104
 
99
105
  add_amount(post, money, options)
100
- add_credit_card_or_reference(post, credit_card)
106
+ add_credit_card_or_reference(post, credit_card_or_reference)
101
107
  add_additional_params(:authorize, post, options)
102
108
 
103
109
  post
@@ -126,7 +132,7 @@ module ActiveMerchant
126
132
 
127
133
  def create_token(identification, options)
128
134
  post = {}
129
- post[:id] = options[:id]
135
+ # post[:id] = options[:id]
130
136
  commit(synchronized_path("/cards/#{identification}/tokens"), post)
131
137
  end
132
138
 
@@ -150,15 +156,15 @@ module ActiveMerchant
150
156
 
151
157
  Response.new(success, message_from(success, response), response,
152
158
  :test => test?,
153
- :authorization => authorization_from(response, params[:id])
159
+ :authorization => authorization_from(response)
154
160
  )
155
161
  end
156
162
 
157
- def authorization_from(response, auth_id)
163
+ def authorization_from(response)
158
164
  if response["token"]
159
- "#{response["token"]};#{auth_id}"
165
+ response["token"].to_s
160
166
  else
161
- response["id"]
167
+ response["id"].to_s
162
168
  end
163
169
  end
164
170
 
@@ -205,8 +211,7 @@ module ActiveMerchant
205
211
  def add_credit_card_or_reference(post, credit_card_or_reference, options = {})
206
212
  post[:card] ||= {}
207
213
  if credit_card_or_reference.is_a?(String)
208
- reference = credit_card_or_reference.split(";").first
209
- post[:card][:token] = reference
214
+ post[:card][:token] = credit_card_or_reference
210
215
  else
211
216
  post[:card][:number] = credit_card_or_reference.number
212
217
  post[:card][:cvd] = credit_card_or_reference.verification_value
@@ -103,11 +103,8 @@ module ActiveMerchant
103
103
  response,
104
104
  :test => (response[:message] =~ %r{\[ test system \]}),
105
105
  :authorization => authorization_from(response),
106
- :cvv_result => response[:cvnresult],
107
- :avs_result => {
108
- :street_match => response[:avspostcoderesponse],
109
- :postal_match => response[:avspostcoderesponse]
110
- }
106
+ avs_result: AVSResult.new(code: response[:avspostcoderesponse]),
107
+ cvv_result: CVVResult.new(response[:cvnresult])
111
108
  )
112
109
  end
113
110
 
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
6
6
  self.test_url = 'https://process.sandbox.safecharge.com/service.asmx/Process'
7
7
  self.live_url = 'https://process.safecharge.com/service.asmx/Process'
8
8
 
9
- self.supported_countries = ['US']
9
+ self.supported_countries = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'GR', 'ES', 'FI', 'FR', 'HR', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SE', 'SI', 'SK', 'GB', 'US']
10
10
  self.default_currency = 'USD'
11
11
  self.supported_cardtypes = [:visa, :master]
12
12
 
@@ -114,6 +114,7 @@ module ActiveMerchant #:nodoc:
114
114
  post[:sg_ClientPassword] = @options[:client_password]
115
115
  post[:sg_ResponseFormat] = "4"
116
116
  post[:sg_Version] = VERSION
117
+ post[:sg_ClientUniqueID] = options[:order_id] if options[:order_id]
117
118
  end
118
119
 
119
120
  def add_payment(post, payment)
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  self.test_url = 'https://stage.wepayapi.com/v2'
5
5
  self.live_url = 'https://wepayapi.com/v2'
6
6
 
7
- self.supported_countries = ['US']
7
+ self.supported_countries = ['US', 'CA']
8
8
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
9
9
  self.homepage_url = 'https://www.wepay.com/'
10
10
  self.default_currency = 'USD'
@@ -224,12 +224,17 @@ module ActiveMerchant #:nodoc:
224
224
  end
225
225
 
226
226
  def headers(options)
227
- {
228
- "Content-Type" => "application/json",
229
- "User-Agent" => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
230
- "Authorization" => "Bearer #{@options[:access_token]}",
231
- "Api-Version" => api_version(options)
227
+ headers = {
228
+ "Content-Type" => "application/json",
229
+ "User-Agent" => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
230
+ "Authorization" => "Bearer #{@options[:access_token]}",
231
+ "Api-Version" => api_version(options)
232
232
  }
233
+
234
+ headers["Client-IP"] = options[:ip] if options[:ip]
235
+ headers["WePay-Risk-Token"] = options[:risk_token] if options[:risk_token]
236
+
237
+ headers
233
238
  end
234
239
 
235
240
  def api_version(options)
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.66.0"
2
+ VERSION = "1.67.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.66.0
4
+ version: 1.67.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-05-04 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -207,6 +207,7 @@ files:
207
207
  - lib/active_merchant/billing/gateways/data_cash.rb
208
208
  - lib/active_merchant/billing/gateways/dibs.rb
209
209
  - lib/active_merchant/billing/gateways/digitzs.rb
210
+ - lib/active_merchant/billing/gateways/ebanx.rb
210
211
  - lib/active_merchant/billing/gateways/efsnet.rb
211
212
  - lib/active_merchant/billing/gateways/elavon.rb
212
213
  - lib/active_merchant/billing/gateways/element.rb
@@ -244,6 +245,7 @@ files:
244
245
  - lib/active_merchant/billing/gateways/itransact.rb
245
246
  - lib/active_merchant/billing/gateways/iveri.rb
246
247
  - lib/active_merchant/billing/gateways/jetpay.rb
248
+ - lib/active_merchant/billing/gateways/jetpay_v2.rb
247
249
  - lib/active_merchant/billing/gateways/komoju.rb
248
250
  - lib/active_merchant/billing/gateways/kushki.rb
249
251
  - lib/active_merchant/billing/gateways/latitude19.rb