activemerchant 1.7.1 → 1.7.2

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,10 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
+ == Version 1.7.2 (August 27, 2010)
4
+
5
+ * Update Braintree integration to play nicely with the braintree 2.5.0 gem [Soleone]
6
+ * Fix SagePay to not send fractional amounts for Chinese YEN currency [Soleone]
7
+
3
8
  == Version 1.7.1 (July 28, 2010)
4
9
 
5
10
  * Pull in only the necessary components of Active Support. Enables use of ActiveMerchant with Rails 3 [railsjedi]
@@ -22,7 +22,7 @@ module ActiveMerchant #:nodoc:
22
22
  Braintree::Configuration.public_key = options[:public_key]
23
23
  Braintree::Configuration.private_key = options[:private_key]
24
24
  Braintree::Configuration.environment = test? ? :sandbox : :production
25
- Braintree::Configuration.logger.level = Logger::ERROR#DEBUG
25
+ Braintree::Configuration.logger.level = Logger::ERROR if Braintree::Configuration.logger
26
26
  Braintree::Configuration.custom_user_agent = "ActiveMerchant #{ActiveMerchant::VERSION}"
27
27
  super
28
28
  end
@@ -31,6 +31,8 @@ module ActiveMerchant #:nodoc:
31
31
  :diners_club => "DC",
32
32
  :jcb => "JCB"
33
33
  }
34
+
35
+ CURRENCIES_WITHOUT_FRACTIONS = [ 'YEN' ]
34
36
 
35
37
  ELECTRON = /^(424519|42496[23]|450875|48440[6-8]|4844[1-5][1-5]|4917[3-5][0-9]|491880)\d{10}(\d{3})?$/
36
38
 
@@ -138,8 +140,9 @@ module ActiveMerchant #:nodoc:
138
140
  end
139
141
 
140
142
  def add_amount(post, money, options)
141
- add_pair(post, :Amount, amount(money), :required => true)
142
- add_pair(post, :Currency, options[:currency] || currency(money), :required => true)
143
+ currency = options[:currency] || currency(money)
144
+ add_pair(post, :Amount, localized_amount(money, currency), :required => true)
145
+ add_pair(post, :Currency, currency, :required => true)
143
146
  end
144
147
 
145
148
  # doesn't actually use the currency -- dodgy!
@@ -303,6 +306,11 @@ module ActiveMerchant #:nodoc:
303
306
  first_name = name.join(' ')
304
307
  [ first_name[0,20], last_name[0,20] ]
305
308
  end
309
+
310
+ def localized_amount(money, currency)
311
+ amount = amount(money)
312
+ CURRENCIES_WITHOUT_FRACTIONS.include?(currency.to_s) ? amount.split('.').first : amount
313
+ end
306
314
  end
307
315
  end
308
316
  end
@@ -44,34 +44,31 @@ module ActiveMerchant #:nodoc:
44
44
 
45
45
  integration_module = ActiveMerchant::Billing::Integrations.const_get(options.delete(:service).to_s.classify)
46
46
 
47
- if ignore_binding?
48
- concat(form_tag(integration_module.service_url, options.delete(:html) || {}))
49
- else
50
- concat(form_tag(integration_module.service_url, options.delete(:html) || {}), proc.binding)
51
- end
52
- result = "\n"
47
+ result = []
48
+ result << form_tag(integration_module.service_url, options.delete(:html) || {})
53
49
 
54
50
  service_class = integration_module.const_get('Helper')
55
51
  service = service_class.new(order, account, options)
56
- yield service
57
-
58
- result << service.form_fields.collect do |field, value|
59
- hidden_field_tag(field, value)
60
- end.join("\n")
61
52
 
62
- result << "\n"
63
- result << '</form>'
53
+ result << capture(service, &proc)
64
54
 
65
- if ignore_binding?
66
- concat(result)
67
- else
68
- concat(result, proc.binding)
55
+ service.form_fields.each do |field, value|
56
+ result << hidden_field_tag(field, value)
69
57
  end
58
+
59
+ result << '</form>'
60
+
61
+ concat(html_safe_string(result.join("\n")))
70
62
  end
71
63
 
72
64
  private
73
- def ignore_binding?
74
- ActionPack::VERSION::MAJOR >= 3 || (ActionPack::VERSION::MAJOR >= 2 && ActionPack::VERSION::MINOR >= 2)
65
+
66
+ def html_safe_string(string)
67
+ if string.respond_to?(:html_safe)
68
+ string.html_safe
69
+ else
70
+ string
71
+ end
75
72
  end
76
73
  end
77
74
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.7.1"
2
+ VERSION = "1.7.2"
3
3
  end
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: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
- - 1
10
- version: 1.7.1
9
+ - 2
10
+ version: 1.7.2
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-07-28 00:00:00 -04:00
39
+ date: 2010-08-27 00:00:00 -04:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file