google4r-checkout 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,9 @@
1
1
  =google4r-checkout Changelog
2
2
 
3
+ == 1.1.5 (2012-08-01)
4
+
5
+ * Raise a more informative exception for non-XML notifications, contributed by James Martin
6
+
3
7
  == 1.1.4 (2012-07-31)
4
8
 
5
9
  * Carrier shipping adjustment support, contributed by Ben Hutton
@@ -101,6 +101,9 @@ module Google4R #:nodoc:
101
101
  # # ...
102
102
  # end
103
103
  class NotificationHandler
104
+ class NonXmlNotification
105
+ end
106
+
104
107
  # The Frontend object that created this NotificationHandler
105
108
  attr_accessor :frontend
106
109
 
@@ -117,7 +120,7 @@ module Google4R #:nodoc:
117
120
  # TODO: Add parsing of other notifications here (merchant calculation and the like) when they have been implemented.
118
121
  #++
119
122
  def handle(xml_str)
120
- root = REXML::Document.new(xml_str).root
123
+ root = REXML::Document.new(xml_str).root || NonXmlNotification
121
124
 
122
125
  case root.name
123
126
  when 'new-order-notification' then
@@ -83,6 +83,11 @@ class Google4R::Checkout::NotificationHandlerTest < Test::Unit::TestCase
83
83
  [
84
84
  '<unknown-notification />'
85
85
  ]
86
+
87
+ @non_xmls =
88
+ [
89
+ 'some-key-value=pair'
90
+ ]
86
91
  end
87
92
 
88
93
  def test_handler_gets_initialized_correctly
@@ -110,4 +115,10 @@ class Google4R::Checkout::NotificationHandlerTest < Test::Unit::TestCase
110
115
  assert_raises(UnknownNotificationType) { @notification_handler.handle(xml_str) }
111
116
  end
112
117
  end
118
+
119
+ def test_raises_exception_on_non_xml_notifications
120
+ @non_xmls.each do |str|
121
+ assert_raises(UnknownNotificationType) { @notification_handler.handle(str) }
122
+ end
123
+ end
113
124
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google4r-checkout
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,10 +15,11 @@ authors:
15
15
  - Larry Salibra
16
16
  - Paul Schreiber
17
17
  - Ben Hutton
18
+ - James Martin
18
19
  autorequire:
19
20
  bindir: bin
20
21
  cert_chain: []
21
- date: 2012-07-31 00:00:00.000000000 Z
22
+ date: 2012-08-01 00:00:00.000000000 Z
22
23
  dependencies:
23
24
  - !ruby/object:Gem::Dependency
24
25
  name: money