google4r-checkout 1.0.0 → 1.0.1

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.
@@ -67,141 +67,3 @@ class Google4R::Checkout::AuthorizationAmountNotificationTest < Test::Unit::Test
67
67
  assert_equal 'Y', notification.cvn_response
68
68
  end
69
69
  end
70
- #--
71
- # Project: google_checkout4r
72
- # File: test/unit/authorization_amount_notification_test.rb
73
- # Author: Tony Chan <api.htchan AT gmail.com>
74
- # Copyright: (c) 2007 by Tony Chan
75
- # License: MIT License as follows:
76
- #
77
- # Permission is hereby granted, free of charge, to any person obtaining
78
- # a copy of this software and associated documentation files (the
79
- # "Software"), to deal in the Software without restriction, including
80
- # without limitation the rights to use, copy, modify, merge, publish,
81
- # distribute, sublicense, and/or sell copies of the Software, and to permit
82
- # persons to whom the Software is furnished to do so, subject to the
83
- # following conditions:
84
- #
85
- # The above copyright notice and this permission notice shall be included
86
- # in all copies or substantial portions of the Software.
87
- #
88
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
89
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
90
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
91
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
92
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
93
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
94
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
95
- #++
96
-
97
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
98
-
99
- require 'google4r/checkout'
100
- require 'rexml/document'
101
- require 'test/frontend_configuration'
102
-
103
- # Test for the class AuthorizationAmountNotification
104
- class Google4R::Checkout::AuthorizationAmountNotificationTest < Test::Unit::TestCase
105
- include Google4R::Checkout
106
-
107
- def setup
108
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
109
- @frontend.tax_table_factory = TestTaxTableFactory.new
110
-
111
- @example_xml = %q{
112
- <?xml version="1.0" encoding="UTF-8"?>
113
- <authorization-amount-notification xmlns="http://checkout.google.com/schema/2"
114
- serial-number="bea6bc1b-e1e2-44fe-80ff-2391b25c2510">
115
- <google-order-number>841171949013218</google-order-number>
116
- <authorization-amount currency="GBP">226.06</authorization-amount>
117
- <authorization-expiration-date>2006-03-18T20:25:31</authorization-expiration-date>
118
- <avs-response>Y</avs-response>
119
- <cvn-response>Y</cvn-response>
120
- <timestamp>2006-03-18T20:25:31</timestamp>
121
- </authorization-amount-notification>
122
- }
123
- end
124
-
125
- def test_create_from_element_works_correctly
126
- root = REXML::Document.new(@example_xml).root
127
-
128
- notification = AuthorizationAmountNotification.create_from_element(root, @frontend)
129
-
130
- assert_equal 'bea6bc1b-e1e2-44fe-80ff-2391b25c2510', notification.serial_number
131
- assert_equal '841171949013218', notification.google_order_number
132
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
133
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.authorization_expiration_date
134
- assert_equal(Money.new(22606, 'GBP'), notification.authorization_amount)
135
- assert_equal 'Y', notification.avs_response
136
- assert_equal 'Y', notification.cvn_response
137
- end
138
- end
139
- #--
140
- # Project: google_checkout4r
141
- # File: test/unit/authorization_amount_notification_test.rb
142
- # Author: Tony Chan <api.htchan AT gmail.com>
143
- # Copyright: (c) 2007 by Tony Chan
144
- # License: MIT License as follows:
145
- #
146
- # Permission is hereby granted, free of charge, to any person obtaining
147
- # a copy of this software and associated documentation files (the
148
- # "Software"), to deal in the Software without restriction, including
149
- # without limitation the rights to use, copy, modify, merge, publish,
150
- # distribute, sublicense, and/or sell copies of the Software, and to permit
151
- # persons to whom the Software is furnished to do so, subject to the
152
- # following conditions:
153
- #
154
- # The above copyright notice and this permission notice shall be included
155
- # in all copies or substantial portions of the Software.
156
- #
157
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
158
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
159
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
160
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
161
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
162
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
163
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
164
- #++
165
-
166
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
167
-
168
- require 'google4r/checkout'
169
- require 'rexml/document'
170
- require 'test/frontend_configuration'
171
-
172
- # Test for the class AuthorizationAmountNotification
173
- class Google4R::Checkout::AuthorizationAmountNotificationTest < Test::Unit::TestCase
174
- include Google4R::Checkout
175
-
176
- def setup
177
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
178
- @frontend.tax_table_factory = TestTaxTableFactory.new
179
-
180
- @example_xml = %q{
181
- <?xml version="1.0" encoding="UTF-8"?>
182
- <authorization-amount-notification xmlns="http://checkout.google.com/schema/2"
183
- serial-number="bea6bc1b-e1e2-44fe-80ff-2391b25c2510">
184
- <google-order-number>841171949013218</google-order-number>
185
- <authorization-amount currency="GBP">226.06</authorization-amount>
186
- <authorization-expiration-date>2006-03-18T20:25:31</authorization-expiration-date>
187
- <avs-response>Y</avs-response>
188
- <cvn-response>Y</cvn-response>
189
- <timestamp>2006-03-18T20:25:31</timestamp>
190
- </authorization-amount-notification>
191
- }
192
- end
193
-
194
- def test_create_from_element_works_correctly
195
- root = REXML::Document.new(@example_xml).root
196
-
197
- notification = AuthorizationAmountNotification.create_from_element(root, @frontend)
198
-
199
- assert_equal 'bea6bc1b-e1e2-44fe-80ff-2391b25c2510', notification.serial_number
200
- assert_equal '841171949013218', notification.google_order_number
201
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
202
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.authorization_expiration_date
203
- assert_equal(Money.new(22606, 'GBP'), notification.authorization_amount)
204
- assert_equal 'Y', notification.avs_response
205
- assert_equal 'Y', notification.cvn_response
206
- end
207
- end
@@ -31,138 +31,6 @@ require 'google4r/checkout'
31
31
 
32
32
  require 'test/frontend_configuration'
33
33
 
34
- # Tests for the AuthorizeOrderCommand class.
35
- class Google4R::Checkout::AuthorizeOrderCommandTest < Test::Unit::TestCase
36
- include Google4R::Checkout
37
-
38
- def setup
39
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
40
- @command = @frontend.create_authorize_order_command
41
-
42
- @command.google_order_number = '841171949013218'
43
-
44
- @sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
45
- <authorize-order xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'/>}
46
- end
47
-
48
- def test_behaves_correctly
49
- [ :google_order_number ].each do |symbol|
50
- assert_respond_to @command, symbol
51
- end
52
- end
53
-
54
- def test_xml
55
- assert_strings_equal(@sample_xml, @command.to_xml)
56
- end
57
-
58
- def test_accessors
59
- assert_equal('841171949013218', @command.google_order_number)
60
- end
61
-
62
- def test_to_xml_does_not_raise_exception
63
- assert_nothing_raised { @command.to_xml }
64
- end
65
-
66
- end
67
- #--
68
- # Project: google_checkout4r
69
- # File: test/unit/authorize_order_command_test.rb
70
- # Author: Tony Chan <api.htchan at gmail dot com>
71
- # Copyright: (c) 2007 by Tony Chan
72
- # License: MIT License as follows:
73
- #
74
- # Permission is hereby granted, free of charge, to any person obtaining
75
- # a copy of this software and associated documentation files (the
76
- # "Software"), to deal in the Software without restriction, including
77
- # without limitation the rights to use, copy, modify, merge, publish,
78
- # distribute, sublicense, and/or sell copies of the Software, and to permit
79
- # persons to whom the Software is furnished to do so, subject to the
80
- # following conditions:
81
- #
82
- # The above copyright notice and this permission notice shall be included
83
- # in all copies or substantial portions of the Software.
84
- #
85
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
86
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
87
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
88
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
89
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
90
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
91
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
92
- #++
93
-
94
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
95
-
96
- require 'google4r/checkout'
97
-
98
- require 'test/frontend_configuration'
99
-
100
- # Tests for the AuthorizeOrderCommand class.
101
- class Google4R::Checkout::AuthorizeOrderCommandTest < Test::Unit::TestCase
102
- include Google4R::Checkout
103
-
104
- def setup
105
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
106
- @command = @frontend.create_authorize_order_command
107
-
108
- @command.google_order_number = '841171949013218'
109
-
110
- @sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
111
- <authorize-order xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'/>}
112
- end
113
-
114
- def test_behaves_correctly
115
- [ :google_order_number ].each do |symbol|
116
- assert_respond_to @command, symbol
117
- end
118
- end
119
-
120
- def test_xml
121
- assert_strings_equal(@sample_xml, @command.to_xml)
122
- end
123
-
124
- def test_accessors
125
- assert_equal('841171949013218', @command.google_order_number)
126
- end
127
-
128
- def test_to_xml_does_not_raise_exception
129
- assert_nothing_raised { @command.to_xml }
130
- end
131
-
132
- end
133
- #--
134
- # Project: google_checkout4r
135
- # File: test/unit/authorize_order_command_test.rb
136
- # Author: Tony Chan <api.htchan at gmail dot com>
137
- # Copyright: (c) 2007 by Tony Chan
138
- # License: MIT License as follows:
139
- #
140
- # Permission is hereby granted, free of charge, to any person obtaining
141
- # a copy of this software and associated documentation files (the
142
- # "Software"), to deal in the Software without restriction, including
143
- # without limitation the rights to use, copy, modify, merge, publish,
144
- # distribute, sublicense, and/or sell copies of the Software, and to permit
145
- # persons to whom the Software is furnished to do so, subject to the
146
- # following conditions:
147
- #
148
- # The above copyright notice and this permission notice shall be included
149
- # in all copies or substantial portions of the Software.
150
- #
151
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
152
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
153
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
154
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
155
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
156
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
157
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
158
- #++
159
-
160
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
161
-
162
- require 'google4r/checkout'
163
-
164
- require 'test/frontend_configuration'
165
-
166
34
  # Tests for the AuthorizeOrderCommand class.
167
35
  class Google4R::Checkout::AuthorizeOrderCommandTest < Test::Unit::TestCase
168
36
  include Google4R::Checkout
@@ -63,133 +63,3 @@ class Google4R::Checkout::ChargebackAmountNotificationTest < Test::Unit::TestCas
63
63
  assert_equal(Money.new(22606, 'GBP'), notification.latest_chargeback_amount)
64
64
  end
65
65
  end
66
- #--
67
- # Project: google_checkout4r
68
- # File: test/unit/chargeback_amount_notification_test.rb
69
- # Author: Tony Chan <api.htchan AT gmail.com>
70
- # Copyright: (c) 2007 by Tony Chan
71
- # License: MIT License as follows:
72
- #
73
- # Permission is hereby granted, free of charge, to any person obtaining
74
- # a copy of this software and associated documentation files (the
75
- # "Software"), to deal in the Software without restriction, including
76
- # without limitation the rights to use, copy, modify, merge, publish,
77
- # distribute, sublicense, and/or sell copies of the Software, and to permit
78
- # persons to whom the Software is furnished to do so, subject to the
79
- # following conditions:
80
- #
81
- # The above copyright notice and this permission notice shall be included
82
- # in all copies or substantial portions of the Software.
83
- #
84
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
85
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
86
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
87
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
88
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
89
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
90
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
91
- #++
92
-
93
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
94
-
95
- require 'google4r/checkout'
96
- require 'rexml/document'
97
- require 'test/frontend_configuration'
98
-
99
- # Test for the class ChargebackAmountNotification
100
- class Google4R::Checkout::ChargebackAmountNotificationTest < Test::Unit::TestCase
101
- include Google4R::Checkout
102
-
103
- def setup
104
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
105
- @frontend.tax_table_factory = TestTaxTableFactory.new
106
-
107
- @example_xml = %q{
108
- <?xml version="1.0" encoding="UTF-8"?>
109
- <chargeback-amount-notification xmlns="http://checkout.google.com/schema/2"
110
- serial-number="bea6bc1b-e1e2-44fe-80ff-0180e33a2614">
111
- <google-order-number>841171949013218</google-order-number>
112
- <latest-chargeback-amount currency="GBP">226.06</latest-chargeback-amount>
113
- <total-chargeback-amount currency="GBP">226.06</total-chargeback-amount>
114
- <timestamp>2006-03-18T20:25:31</timestamp>
115
- </chargeback-amount-notification>
116
- }
117
- end
118
-
119
- def test_create_from_element_works_correctly
120
- root = REXML::Document.new(@example_xml).root
121
-
122
- notification = ChargebackAmountNotification.create_from_element(root, @frontend)
123
-
124
- assert_equal 'bea6bc1b-e1e2-44fe-80ff-0180e33a2614', notification.serial_number
125
- assert_equal '841171949013218', notification.google_order_number
126
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
127
- assert_equal(Money.new(22606, 'GBP'), notification.total_chargeback_amount)
128
- assert_equal(Money.new(22606, 'GBP'), notification.latest_chargeback_amount)
129
- end
130
- end
131
- #--
132
- # Project: google_checkout4r
133
- # File: test/unit/chargeback_amount_notification_test.rb
134
- # Author: Tony Chan <api.htchan AT gmail.com>
135
- # Copyright: (c) 2007 by Tony Chan
136
- # License: MIT License as follows:
137
- #
138
- # Permission is hereby granted, free of charge, to any person obtaining
139
- # a copy of this software and associated documentation files (the
140
- # "Software"), to deal in the Software without restriction, including
141
- # without limitation the rights to use, copy, modify, merge, publish,
142
- # distribute, sublicense, and/or sell copies of the Software, and to permit
143
- # persons to whom the Software is furnished to do so, subject to the
144
- # following conditions:
145
- #
146
- # The above copyright notice and this permission notice shall be included
147
- # in all copies or substantial portions of the Software.
148
- #
149
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
150
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
151
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
152
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
153
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
154
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
155
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
156
- #++
157
-
158
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
159
-
160
- require 'google4r/checkout'
161
- require 'rexml/document'
162
- require 'test/frontend_configuration'
163
-
164
- # Test for the class ChargebackAmountNotification
165
- class Google4R::Checkout::ChargebackAmountNotificationTest < Test::Unit::TestCase
166
- include Google4R::Checkout
167
-
168
- def setup
169
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
170
- @frontend.tax_table_factory = TestTaxTableFactory.new
171
-
172
- @example_xml = %q{
173
- <?xml version="1.0" encoding="UTF-8"?>
174
- <chargeback-amount-notification xmlns="http://checkout.google.com/schema/2"
175
- serial-number="bea6bc1b-e1e2-44fe-80ff-0180e33a2614">
176
- <google-order-number>841171949013218</google-order-number>
177
- <latest-chargeback-amount currency="GBP">226.06</latest-chargeback-amount>
178
- <total-chargeback-amount currency="GBP">226.06</total-chargeback-amount>
179
- <timestamp>2006-03-18T20:25:31</timestamp>
180
- </chargeback-amount-notification>
181
- }
182
- end
183
-
184
- def test_create_from_element_works_correctly
185
- root = REXML::Document.new(@example_xml).root
186
-
187
- notification = ChargebackAmountNotification.create_from_element(root, @frontend)
188
-
189
- assert_equal 'bea6bc1b-e1e2-44fe-80ff-0180e33a2614', notification.serial_number
190
- assert_equal '841171949013218', notification.google_order_number
191
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
192
- assert_equal(Money.new(22606, 'GBP'), notification.total_chargeback_amount)
193
- assert_equal(Money.new(22606, 'GBP'), notification.latest_chargeback_amount)
194
- end
195
- end
@@ -63,133 +63,3 @@ class Google4R::Checkout::RefundAmountNotificationTest < Test::Unit::TestCase
63
63
  assert_equal(Money.new(22606, 'GBP'), notification.latest_refund_amount)
64
64
  end
65
65
  end
66
- #--
67
- # Project: google_checkout4r
68
- # File: test/unit/refund_amount_notification_test.rb
69
- # Author: Tony Chan <api.htchan AT gmail.com>
70
- # Copyright: (c) 2007 by Tony Chan
71
- # License: MIT License as follows:
72
- #
73
- # Permission is hereby granted, free of charge, to any person obtaining
74
- # a copy of this software and associated documentation files (the
75
- # "Software"), to deal in the Software without restriction, including
76
- # without limitation the rights to use, copy, modify, merge, publish,
77
- # distribute, sublicense, and/or sell copies of the Software, and to permit
78
- # persons to whom the Software is furnished to do so, subject to the
79
- # following conditions:
80
- #
81
- # The above copyright notice and this permission notice shall be included
82
- # in all copies or substantial portions of the Software.
83
- #
84
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
85
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
86
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
87
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
88
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
89
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
90
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
91
- #++
92
-
93
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
94
-
95
- require 'google4r/checkout'
96
- require 'rexml/document'
97
- require 'test/frontend_configuration'
98
-
99
- # Test for the class RefundAmountNotification
100
- class Google4R::Checkout::RefundAmountNotificationTest < Test::Unit::TestCase
101
- include Google4R::Checkout
102
-
103
- def setup
104
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
105
- @frontend.tax_table_factory = TestTaxTableFactory.new
106
-
107
- @example_xml = %q{
108
- <?xml version="1.0" encoding="UTF-8"?>
109
- <refund-amount-notification xmlns="http://checkout.google.com/schema/2"
110
- serial-number="d669f8c7-6d75-4ad6-9278-d2fc997d15f2">
111
- <google-order-number>841171949013218</google-order-number>
112
- <latest-refund-amount currency="GBP">226.06</latest-refund-amount>
113
- <total-refund-amount currency="GBP">226.06</total-refund-amount>
114
- <timestamp>2006-03-18T20:25:31</timestamp>
115
- </refund-amount-notification>
116
- }
117
- end
118
-
119
- def test_create_from_element_works_correctly
120
- root = REXML::Document.new(@example_xml).root
121
-
122
- notification = RefundAmountNotification.create_from_element(root, @frontend)
123
-
124
- assert_equal 'd669f8c7-6d75-4ad6-9278-d2fc997d15f2', notification.serial_number
125
- assert_equal '841171949013218', notification.google_order_number
126
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
127
- assert_equal(Money.new(22606, 'GBP'), notification.total_refund_amount)
128
- assert_equal(Money.new(22606, 'GBP'), notification.latest_refund_amount)
129
- end
130
- end
131
- #--
132
- # Project: google_checkout4r
133
- # File: test/unit/refund_amount_notification_test.rb
134
- # Author: Tony Chan <api.htchan AT gmail.com>
135
- # Copyright: (c) 2007 by Tony Chan
136
- # License: MIT License as follows:
137
- #
138
- # Permission is hereby granted, free of charge, to any person obtaining
139
- # a copy of this software and associated documentation files (the
140
- # "Software"), to deal in the Software without restriction, including
141
- # without limitation the rights to use, copy, modify, merge, publish,
142
- # distribute, sublicense, and/or sell copies of the Software, and to permit
143
- # persons to whom the Software is furnished to do so, subject to the
144
- # following conditions:
145
- #
146
- # The above copyright notice and this permission notice shall be included
147
- # in all copies or substantial portions of the Software.
148
- #
149
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
150
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
151
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
152
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
153
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
154
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
155
- # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
156
- #++
157
-
158
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
159
-
160
- require 'google4r/checkout'
161
- require 'rexml/document'
162
- require 'test/frontend_configuration'
163
-
164
- # Test for the class RefundAmountNotification
165
- class Google4R::Checkout::RefundAmountNotificationTest < Test::Unit::TestCase
166
- include Google4R::Checkout
167
-
168
- def setup
169
- @frontend = Frontend.new(FRONTEND_CONFIGURATION)
170
- @frontend.tax_table_factory = TestTaxTableFactory.new
171
-
172
- @example_xml = %q{
173
- <?xml version="1.0" encoding="UTF-8"?>
174
- <refund-amount-notification xmlns="http://checkout.google.com/schema/2"
175
- serial-number="d669f8c7-6d75-4ad6-9278-d2fc997d15f2">
176
- <google-order-number>841171949013218</google-order-number>
177
- <latest-refund-amount currency="GBP">226.06</latest-refund-amount>
178
- <total-refund-amount currency="GBP">226.06</total-refund-amount>
179
- <timestamp>2006-03-18T20:25:31</timestamp>
180
- </refund-amount-notification>
181
- }
182
- end
183
-
184
- def test_create_from_element_works_correctly
185
- root = REXML::Document.new(@example_xml).root
186
-
187
- notification = RefundAmountNotification.create_from_element(root, @frontend)
188
-
189
- assert_equal 'd669f8c7-6d75-4ad6-9278-d2fc997d15f2', notification.serial_number
190
- assert_equal '841171949013218', notification.google_order_number
191
- assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
192
- assert_equal(Money.new(22606, 'GBP'), notification.total_refund_amount)
193
- assert_equal(Money.new(22606, 'GBP'), notification.latest_refund_amount)
194
- end
195
- end