smulube-activemerchant 1.7.1 → 1.7.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/active_merchant/billing/gateways/payflow_nvp_uk.rb +43 -41
- data/lib/active_merchant/version.rb +1 -1
- metadata +4 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
@@ -3,7 +3,7 @@ module ActiveMerchant #:nodoc:
|
|
3
3
|
class PayflowNvpUkGateway < Gateway
|
4
4
|
TEST_URL = 'https://pilot-payflowpro.paypal.com'
|
5
5
|
LIVE_URL = 'https://payflowpro.paypal.com'
|
6
|
-
|
6
|
+
|
7
7
|
self.class_inheritable_accessor :partner
|
8
8
|
self.class_inheritable_accessor :timeout
|
9
9
|
|
@@ -14,25 +14,25 @@ module ActiveMerchant #:nodoc:
|
|
14
14
|
# subsequent Responses will have a :duplicate parameter set in the params
|
15
15
|
# hash.
|
16
16
|
self.retry_safe = true
|
17
|
-
|
17
|
+
|
18
18
|
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
19
19
|
self.supported_countries = ['GB']
|
20
|
-
|
20
|
+
|
21
21
|
# The card types supported by the payment gateway
|
22
22
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :solo, :switch]
|
23
|
-
|
23
|
+
|
24
24
|
# The homepage URL of the gateway
|
25
25
|
self.homepage_url = 'https://www.paypal.com/uk/cgi-bin/webscr?cmd=_wp-pro-overview-outside'
|
26
|
-
|
26
|
+
|
27
27
|
# The name of the gateway
|
28
28
|
self.display_name = 'PayPal Website Payments Pro (UK) [NVP API]'
|
29
|
-
|
29
|
+
|
30
30
|
self.default_currency = 'GBP'
|
31
31
|
self.partner = 'PayPalUk'
|
32
32
|
self.money_format = :dollars
|
33
33
|
self.timeout = 30
|
34
34
|
|
35
|
-
TRANSACTIONS = {
|
35
|
+
TRANSACTIONS = {
|
36
36
|
:purchase => "S",
|
37
37
|
:authorization => "A",
|
38
38
|
:capture => "D",
|
@@ -65,7 +65,7 @@ module ActiveMerchant #:nodoc:
|
|
65
65
|
#
|
66
66
|
# The gateway requires that a valid login and password be passed
|
67
67
|
# in the +options+ hash.
|
68
|
-
#
|
68
|
+
#
|
69
69
|
# ==== Parameters
|
70
70
|
#
|
71
71
|
# * <tt>options</tt>
|
@@ -122,15 +122,15 @@ module ActiveMerchant #:nodoc:
|
|
122
122
|
def authorize(money, creditcard, options = {})
|
123
123
|
post = {}
|
124
124
|
add_invoice(post, options)
|
125
|
-
add_creditcard(post, creditcard)
|
125
|
+
add_creditcard(post, creditcard)
|
126
126
|
add_currency(post, money, options)
|
127
127
|
add_address(post, options[:billing_address] || options[:address])
|
128
128
|
add_address(post, options[:shipping_address], "shipto")
|
129
129
|
add_customer_data(post, options)
|
130
|
-
|
130
|
+
|
131
131
|
commit(TRANSACTIONS[:authorize], money, post)
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
# A purchase transaction authorizes and captures in a single hit. We can only
|
135
135
|
# do this for transactions where you provide immediate fulfillment of products or services.
|
136
136
|
#
|
@@ -159,15 +159,15 @@ module ActiveMerchant #:nodoc:
|
|
159
159
|
def purchase(money, creditcard, options = {})
|
160
160
|
post = {}
|
161
161
|
add_invoice(post, options)
|
162
|
-
add_creditcard(post, creditcard)
|
162
|
+
add_creditcard(post, creditcard)
|
163
163
|
add_currency(post, money, options)
|
164
|
-
add_address(post, options[:billing_address] || options[:address])
|
164
|
+
add_address(post, options[:billing_address] || options[:address])
|
165
165
|
add_address(post, options[:shipping_address], "shipto")
|
166
166
|
add_customer_data(post, options)
|
167
|
-
|
167
|
+
|
168
168
|
commit(TRANSACTIONS[:purchase], money, post)
|
169
|
-
end
|
170
|
-
|
169
|
+
end
|
170
|
+
|
171
171
|
# Captures authorized funds.
|
172
172
|
#
|
173
173
|
# ==== Parameters
|
@@ -203,15 +203,15 @@ module ActiveMerchant #:nodoc:
|
|
203
203
|
# * <tt>options</tt> - not currently used
|
204
204
|
def credit(money, authorization_or_card, options = {})
|
205
205
|
post = {}
|
206
|
-
|
206
|
+
|
207
207
|
if authorization_or_card.is_a?(String)
|
208
208
|
# perform a referenced credit
|
209
209
|
post[:origid] = authorization
|
210
210
|
else
|
211
211
|
# perform an unreferenced credit
|
212
|
-
add_creditcard(post, creditcard)
|
212
|
+
add_creditcard(post, creditcard)
|
213
213
|
end
|
214
|
-
|
214
|
+
|
215
215
|
commit(TRANSACTIONS[:credit], money, post)
|
216
216
|
end
|
217
217
|
|
@@ -271,9 +271,9 @@ module ActiveMerchant #:nodoc:
|
|
271
271
|
|
272
272
|
commit(TRANSACTIONS[:recurring], nil, post)
|
273
273
|
end
|
274
|
-
|
275
|
-
private
|
276
|
-
|
274
|
+
|
275
|
+
private
|
276
|
+
|
277
277
|
def add_customer_data(post, options)
|
278
278
|
post[:email] = options[:email].to_s if options.has_key?(:email)
|
279
279
|
post[:custref] = options[:customer].to_s.slice(0,12) if options[:customer]
|
@@ -283,29 +283,30 @@ module ActiveMerchant #:nodoc:
|
|
283
283
|
# NOTE : If you pass in any of the ship-to address parameters such as SHIPTOCITY or
|
284
284
|
# SHIPTOSTATE, you must pass in the complete set (that is, SHIPTOSTREET,
|
285
285
|
# SHIPTOCITY, SHIPTOSTATE, SHIPTOCOUNTRY, and SHIPTOZIP).
|
286
|
-
def add_address(post, address, prefix = '')
|
286
|
+
def add_address(post, address, prefix = '')
|
287
287
|
unless address.blank? or address.values.blank?
|
288
288
|
post[prefix+"street"] = address[:address1].to_s
|
289
289
|
post[prefix+"city"] = address[:city].to_s
|
290
290
|
post[prefix+"state"] = address[:state].blank? ? 'n/a' : address[:state]
|
291
291
|
post[prefix+"country"] = address[:country].to_s
|
292
292
|
post[prefix+"zip"] = address[:zip].to_s.sub(/\s+/,'')
|
293
|
-
end
|
293
|
+
end
|
294
294
|
end
|
295
295
|
|
296
296
|
def add_invoice(post, options)
|
297
|
-
post[:invnum] = (options[:invoice] || options[:order_id]).to_s.slice(0,127) if options.has_key?(:invoice) || options.has_key?(:order_id)
|
297
|
+
post[:invnum] = (options[:invoice] || options[:order_id]).to_s.slice(0,127) if options.has_key?(:invoice) || options.has_key?(:order_id)
|
298
298
|
end
|
299
|
-
|
300
|
-
def add_creditcard(post, creditcard)
|
299
|
+
|
300
|
+
def add_creditcard(post, creditcard)
|
301
301
|
unless creditcard.nil?
|
302
302
|
post[:acct] = creditcard.number
|
303
303
|
post[:cvv2] = creditcard.verification_value
|
304
304
|
post[:expdate] = expdate(creditcard)
|
305
|
-
post[:
|
305
|
+
post[:firstname] = creditcard.first_name
|
306
|
+
post[:lastname] = creditcard.last_name
|
306
307
|
end
|
307
308
|
end
|
308
|
-
|
309
|
+
|
309
310
|
def add_currency(post, money, options)
|
310
311
|
post[:currency] = options[:currency] || currency(money)
|
311
312
|
end
|
@@ -349,9 +350,9 @@ module ActiveMerchant #:nodoc:
|
|
349
350
|
key,val = pair.split(/=/)
|
350
351
|
results[key] = val
|
351
352
|
end
|
352
|
-
|
353
|
+
|
353
354
|
results
|
354
|
-
end
|
355
|
+
end
|
355
356
|
|
356
357
|
def build_request(parameters, action = nil)
|
357
358
|
post = {}
|
@@ -362,7 +363,7 @@ module ActiveMerchant #:nodoc:
|
|
362
363
|
post[:trxtype] = action if action
|
363
364
|
post[:tender] = "C"
|
364
365
|
post[:verbosity] = "MEDIUM"
|
365
|
-
|
366
|
+
|
366
367
|
request = post.merge(parameters).sort { |a, b| a[0].to_s <=> b[0].to_s }.map { |pair| "#{pair[0].to_s.upcase}=#{CGI.escape(pair[1].to_s)}" }.join("&") #.map { |kv_pair| "#{kv_pair[0].to_s.upcase}=#{CGI.escape(kv_pair[1].to_s)}" }.join("&")
|
367
368
|
|
368
369
|
request
|
@@ -372,29 +373,30 @@ module ActiveMerchant #:nodoc:
|
|
372
373
|
{
|
373
374
|
"Content-Type" => "text/namevalue",
|
374
375
|
"Content-Length" => content_length.to_s,
|
375
|
-
|
376
|
-
|
376
|
+
"X-VPS-Client-Timeout" => timeout.to_s,
|
377
|
+
"X-VPS-VIT-Integration-Product" => "ActiveMerchant",
|
377
378
|
"X-VPS-VIT-Integration-Version" => ActiveMerchant::VERSION,
|
378
|
-
|
379
|
-
|
380
|
-
|
379
|
+
"X-VPS-VIT-Runtime-Version" => RUBY_VERSION,
|
380
|
+
"X-VPS-Request-ID" => Utils.generate_unique_id
|
381
|
+
}
|
381
382
|
end
|
382
|
-
|
383
|
+
|
383
384
|
def commit(action, money, parameters)
|
384
385
|
parameters[:amt] = amount(money) if money
|
385
386
|
|
386
387
|
request = build_request(parameters, action)
|
388
|
+
|
387
389
|
headers = build_headers(request.size)
|
388
390
|
|
389
|
-
|
391
|
+
response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, request, headers))
|
390
392
|
|
391
|
-
Response.new(response["RESULT"] == "0", response["RESPMSG"], response,
|
393
|
+
Response.new(response["RESULT"] == "0", response["RESPMSG"], response,
|
392
394
|
:authorization => response["PNREF"],
|
393
395
|
:test => test?,
|
394
396
|
:cvv_result => response["PROCCVV2"],
|
395
397
|
:avs_result => { :code => response["PROCAVS"], :postal_match => response["AVSZIP"], :street_match => response["AVSADDR"] }
|
396
398
|
)
|
397
|
-
|
399
|
+
|
398
400
|
end
|
399
401
|
end
|
400
402
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smulube-activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 101
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
9
|
- 1
|
10
|
-
|
10
|
+
- 3
|
11
|
+
version: 1.7.1.3
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Tobias Luetke
|
@@ -36,7 +37,7 @@ cert_chain:
|
|
36
37
|
RGv1VYD5jSaHiQ==
|
37
38
|
-----END CERTIFICATE-----
|
38
39
|
|
39
|
-
date: 2010-
|
40
|
+
date: 2010-09-09 00:00:00 +01:00
|
40
41
|
default_executable:
|
41
42
|
dependencies:
|
42
43
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|