activemerchant 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,5 +1,16 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
+ == Version 1.9.1 (November 24, 2010)
4
+
5
+ * PayPal Express and PayPal Pro: Send JPY currency correctly without decimals [Soleone]
6
+ * Netaxept: Make sure password (token) is URL escaped and update remote tests for updated server behavior [Soleone]
7
+ * DirecPay: Add support for additional options in Return class and add convenience method to get transaction status update [Soleone]
8
+ * Add new alias credit_card.brand for credit_card.type and handle the brand correctly in Netaxept [Soleone]
9
+ * Iridium: Do not depend on ExpiryDate class for credit_card [Soleone]
10
+ * PayFlow: Use same timeout of 60 seconds in HTTP header and XML for all requests [Soleone]
11
+ * PayPal Website Payments Pro CA no longer supports American Express cards [Soleone]
12
+ * Updated BIN ranges for Discover to match recent documents [kaunartist]
13
+
3
14
  == Version 1.9.0 (October 14, 2010)
4
15
 
5
16
  * Add support for DirecPay gateway [Soleone]
@@ -53,6 +53,8 @@ module ActiveMerchant #:nodoc:
53
53
  # run validation on the passed in value if it is supplied
54
54
  attr_accessor :verification_value
55
55
 
56
+ alias_method :brand, :type
57
+
56
58
  # Provides proxy access to an expiry date object
57
59
  def expiry_date
58
60
  ExpiryDate.new(@month, @year)
@@ -5,11 +5,11 @@ module ActiveMerchant #:nodoc:
5
5
  CARD_COMPANIES = {
6
6
  'visa' => /^4\d{12}(\d{3})?$/,
7
7
  'master' => /^(5[1-5]\d{4}|677189)\d{10}$/,
8
- 'discover' => /^(6011|65\d{2})\d{12}$/,
8
+ 'discover' => /^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/,
9
9
  'american_express' => /^3[47]\d{13}$/,
10
10
  'diners_club' => /^3(0[0-5]|[68]\d)\d{11}$/,
11
11
  'jcb' => /^35(28|29|[3-8]\d)\d{12}$/,
12
- 'switch' => /^6759\d{12}(\d{2,3})?$/,
12
+ 'switch' => /^6759\d{12}(\d{2,3})?$/,
13
13
  'solo' => /^6767\d{12}(\d{2,3})?$/,
14
14
  'dankort' => /^5019\d{12}$/,
15
15
  'maestro' => /^(5[06-8]|6\d)\d{10,17}$/,
@@ -122,4 +122,4 @@ module ActiveMerchant #:nodoc:
122
122
  end
123
123
  end
124
124
  end
125
- end
125
+ end
@@ -62,7 +62,8 @@ module ActiveMerchant #:nodoc:
62
62
  include Utils
63
63
 
64
64
  DEBIT_CARDS = [ :switch, :solo ]
65
-
65
+ CURRENCIES_WITHOUT_FRACTIONS = [ 'JPY' ]
66
+
66
67
  cattr_reader :implementations
67
68
  @@implementations = []
68
69
 
@@ -149,6 +150,11 @@ module ActiveMerchant #:nodoc:
149
150
  sprintf("%.2f", cents.to_f / 100)
150
151
  end
151
152
  end
153
+
154
+ def localized_amount(money, currency)
155
+ amount = amount(money)
156
+ CURRENCIES_WITHOUT_FRACTIONS.include?(currency.to_s) ? amount.split('.').first : amount
157
+ end
152
158
 
153
159
  def currency(money)
154
160
  money.respond_to?(:currency) ? money.currency : self.default_currency
@@ -89,7 +89,7 @@ module ActiveMerchant #:nodoc:
89
89
  end
90
90
 
91
91
  def add_invoice(post, options)
92
- post[:trackid] = rand(Time.now)
92
+ post[:trackid] = rand(Time.now.to_i)
93
93
  end
94
94
 
95
95
  def add_creditcard(post, creditcard)
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
10
10
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
11
 
12
12
  # The homepage URL of the gateway
13
- self.homepage_url = 'https://ccpos.garanti.com.tr/ccRaporlar/garanti/ccReports'
13
+ self.homepage_url = 'https://sanalposweb.garanti.com.tr/gvpsui/login/LoginStart.jsp'
14
14
 
15
15
  # The name of the gateway
16
16
  self.display_name = 'Garanti Sanal POS'
@@ -157,7 +157,7 @@ module ActiveMerchant #:nodoc:
157
157
  xml.tag! 'CardName', creditcard.name
158
158
  xml.tag! 'CV2', creditcard.verification_value if creditcard.verification_value
159
159
  xml.tag! 'CardNumber', creditcard.number
160
- xml.tag! 'ExpiryDate', { 'Month' => creditcard.expiry_date.month.to_s.rjust(2, "0"), 'Year' => creditcard.expiry_date.year.to_s[/\d\d$/] }
160
+ xml.tag! 'ExpiryDate', { 'Month' => creditcard.month.to_s.rjust(2, "0"), 'Year' => creditcard.year.to_s[/\d\d$/] }
161
161
  end
162
162
  end
163
163
 
@@ -106,9 +106,10 @@ module ActiveMerchant #:nodoc:
106
106
  'american_express' => 'a',
107
107
  }
108
108
  def add_creditcard(post, creditcard)
109
- prefix = CARD_TYPE_PREFIXES[creditcard.type]
109
+ brand = Gateway.card_brand(creditcard)
110
+ prefix = CARD_TYPE_PREFIXES[brand]
110
111
  unless prefix
111
- raise ArgumentError.new("Card type #{creditcard.type} not supported.")
112
+ raise ArgumentError.new("Card type #{brand} not supported.")
112
113
  end
113
114
 
114
115
  post[:creditcard] = {}
@@ -215,7 +216,7 @@ module ActiveMerchant #:nodoc:
215
216
  end
216
217
 
217
218
  def encode(hash)
218
- hash.collect{|(k,v)| "#{URI.encode(k.to_s)}=#{URI.encode(v.to_s)}"}.join('&')
219
+ hash.collect{|(k,v)| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join('&')
219
220
  end
220
221
 
221
222
  class Response < Billing::Response
@@ -147,8 +147,6 @@ module ActiveMerchant #:nodoc:
147
147
  :timestamp => parameters[:dateq]),
148
148
  :test => test?,
149
149
  :authorization => response[:numappel].to_s + response[:numtrans].to_s,
150
- :cvv_result => '',
151
- :avs_result => '',
152
150
  :fraud_review => fraud_review?(response),
153
151
  :sent_params => parameters.delete_if{|key,value| ['porteur','dateval','cvv'].include?(key.to_s)}
154
152
  )
@@ -79,7 +79,7 @@ module ActiveMerchant #:nodoc:
79
79
  def build_request(body, request_type = nil)
80
80
  xml = Builder::XmlMarkup.new
81
81
  xml.instruct!
82
- xml.tag! 'XMLPayRequest', 'Timeout' => 30, 'version' => "2.1", "xmlns" => XMLNS do
82
+ xml.tag! 'XMLPayRequest', 'Timeout' => timeout.to_s, 'version' => "2.1", "xmlns" => XMLNS do
83
83
  xml.tag! 'RequestData' do
84
84
  xml.tag! 'Vendor', @options[:login]
85
85
  xml.tag! 'Partner', @options[:partner]
@@ -50,14 +50,14 @@ module ActiveMerchant #:nodoc:
50
50
  xml.tag! 'n2:ReferenceID', reference_id if transaction_type == 'DoReferenceTransaction'
51
51
  xml.tag! 'n2:PaymentAction', action
52
52
  xml.tag! 'n2:PaymentDetails' do
53
- xml.tag! 'n2:OrderTotal', amount(money), 'currencyID' => currency_code
53
+ xml.tag! 'n2:OrderTotal', localized_amount(money, currency_code), 'currencyID' => currency_code
54
54
 
55
55
  # All of the values must be included together and add up to the order total
56
56
  if [:subtotal, :shipping, :handling, :tax].all?{ |o| options.has_key?(o) }
57
- xml.tag! 'n2:ItemTotal', amount(options[:subtotal]), 'currencyID' => currency_code
58
- xml.tag! 'n2:ShippingTotal', amount(options[:shipping]),'currencyID' => currency_code
59
- xml.tag! 'n2:HandlingTotal', amount(options[:handling]),'currencyID' => currency_code
60
- xml.tag! 'n2:TaxTotal', amount(options[:tax]), 'currencyID' => currency_code
57
+ xml.tag! 'n2:ItemTotal', localized_amount(options[:subtotal], currency_code), 'currencyID' => currency_code
58
+ xml.tag! 'n2:ShippingTotal', localized_amount(options[:shipping], currency_code),'currencyID' => currency_code
59
+ xml.tag! 'n2:HandlingTotal', localized_amount(options[:handling], currency_code),'currencyID' => currency_code
60
+ xml.tag! 'n2:TaxTotal', localized_amount(options[:tax], currency_code), 'currencyID' => currency_code
61
61
  end
62
62
 
63
63
  xml.tag! 'n2:NotifyURL', options[:notify_url]
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  # The PayPal gateway for PayPal Website Payments Pro Canada only supports Visa and MasterCard
6
6
  class PaypalCaGateway < PaypalGateway
7
- self.supported_cardtypes = [:visa, :master, :american_express]
7
+ self.supported_cardtypes = [:visa, :master]
8
8
  self.supported_countries = ['CA']
9
9
  self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside'
10
10
  self.display_name = 'PayPal Website Payments Pro (CA)'
@@ -66,14 +66,14 @@ module ActiveMerchant #:nodoc:
66
66
  xml.tag! 'n2:Token', options[:token]
67
67
  xml.tag! 'n2:PayerID', options[:payer_id]
68
68
  xml.tag! 'n2:PaymentDetails' do
69
- xml.tag! 'n2:OrderTotal', amount(money), 'currencyID' => currency_code
69
+ xml.tag! 'n2:OrderTotal', localized_amount(money, currency_code), 'currencyID' => currency_code
70
70
 
71
71
  # All of the values must be included together and add up to the order total
72
72
  if [:subtotal, :shipping, :handling, :tax].all?{ |o| options.has_key?(o) }
73
- xml.tag! 'n2:ItemTotal', amount(options[:subtotal]), 'currencyID' => currency_code
74
- xml.tag! 'n2:ShippingTotal', amount(options[:shipping]),'currencyID' => currency_code
75
- xml.tag! 'n2:HandlingTotal', amount(options[:handling]),'currencyID' => currency_code
76
- xml.tag! 'n2:TaxTotal', amount(options[:tax]), 'currencyID' => currency_code
73
+ xml.tag! 'n2:ItemTotal', localized_amount(options[:subtotal], currency_code), 'currencyID' => currency_code
74
+ xml.tag! 'n2:ShippingTotal', localized_amount(options[:shipping], currency_code),'currencyID' => currency_code
75
+ xml.tag! 'n2:HandlingTotal', localized_amount(options[:handling], currency_code),'currencyID' => currency_code
76
+ xml.tag! 'n2:TaxTotal', localized_amount(options[:tax], currency_code), 'currencyID' => currency_code
77
77
  end
78
78
 
79
79
  xml.tag! 'n2:NotifyURL', options[:notify_url]
@@ -87,15 +87,17 @@ module ActiveMerchant #:nodoc:
87
87
  end
88
88
 
89
89
  def build_setup_request(action, money, options)
90
+ currency_code = options[:currency] || currency(money)
91
+
90
92
  xml = Builder::XmlMarkup.new :indent => 2
91
93
  xml.tag! 'SetExpressCheckoutReq', 'xmlns' => PAYPAL_NAMESPACE do
92
94
  xml.tag! 'SetExpressCheckoutRequest', 'xmlns:n2' => EBAY_NAMESPACE do
93
95
  xml.tag! 'n2:Version', API_VERSION
94
96
  xml.tag! 'n2:SetExpressCheckoutRequestDetails' do
95
97
  xml.tag! 'n2:PaymentAction', action
96
- xml.tag! 'n2:OrderTotal', amount(money).to_f.zero? ? amount(100) : amount(money), 'currencyID' => options[:currency] || currency(money)
98
+ xml.tag! 'n2:OrderTotal', amount(money).to_f.zero? ? localized_amount(100, currency_code) : localized_amount(money, currency_code), 'currencyID' => currency_code
97
99
  if options[:max_amount]
98
- xml.tag! 'n2:MaxAmount', amount(options[:max_amount]), 'currencyID' => options[:currency] || currency(options[:max_amount])
100
+ xml.tag! 'n2:MaxAmount', localized_amount(options[:max_amount], currency_code), 'currencyID' => currency_code
99
101
  end
100
102
  add_address(xml, 'n2:Address', options[:shipping_address] || options[:address])
101
103
  xml.tag! 'n2:AddressOverride', options[:address_override] ? '1' : '0'
@@ -32,8 +32,6 @@ module ActiveMerchant #:nodoc:
32
32
  :jcb => "JCB"
33
33
  }
34
34
 
35
- CURRENCIES_WITHOUT_FRACTIONS = [ 'JPY' ]
36
-
37
35
  ELECTRON = /^(424519|42496[23]|450875|48440[6-8]|4844[1-5][1-5]|4917[3-5][0-9]|491880)\d{10}(\d{3})?$/
38
36
 
39
37
  AVS_CVV_CODE = {
@@ -28,8 +28,12 @@ module ActiveMerchant #:nodoc:
28
28
  Notification.new(post)
29
29
  end
30
30
 
31
- def self.return(query_string)
32
- Return.new(query_string)
31
+ def self.return(query_string, options = {})
32
+ Return.new(query_string, options)
33
+ end
34
+
35
+ def self.request_status_update(mid, transaction_id, notification_url)
36
+ Status.new(mid).update(transaction_id, notification_url)
33
37
  end
34
38
  end
35
39
  end
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
18
18
  end
19
19
 
20
20
  def received_at
21
- Time.local(*params['time'].scan(/../))
21
+ Time.parse("20#{params['time']}")
22
22
  end
23
23
 
24
24
  def gross
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
46
46
  end
47
47
 
48
48
  def code(format)
49
- @codes.select{|c| c.format == format}
49
+ @codes.detect{|c| c.format == format}
50
50
  end
51
51
 
52
52
  def ==(other)
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.9.0"
2
+ VERSION = "1.9.1"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'active_support'
3
- require 'lib/active_merchant'
3
+ require 'active_merchant'
4
4
 
5
5
 
6
6
  class GatewaySupport #:nodoc:
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 9
9
- - 0
10
- version: 1.9.0
9
+ - 1
10
+ version: 1.9.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Luetke
@@ -36,7 +36,7 @@ cert_chain:
36
36
  hPaSTyVU0yCSnw==
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2010-10-14 00:00:00 -04:00
39
+ date: 2010-11-24 00:00:00 -05:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file