google4r-checkout 0.1.0 → 1.0.0
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.
- data/CHANGES +16 -2
- data/README +1 -19
- data/lib/google4r/checkout/commands.rb +208 -23
- data/lib/google4r/checkout/frontend.rb +62 -2
- data/lib/google4r/checkout/notifications.rb +302 -11
- data/lib/google4r/checkout/shared.rb +3 -3
- data/lib/google4r/checkout/xml_generation.rb +429 -225
- data/test/unit/add_merchant_order_number_command_test.rb +210 -0
- data/test/unit/add_tracking_data_command_test.rb +225 -0
- data/test/unit/archive_order_command_test.rb +198 -0
- data/test/unit/authorization_amount_notification_test.rb +207 -0
- data/test/unit/authorize_order_command_test.rb +198 -0
- data/test/unit/cancel_order_command_test.rb +83 -0
- data/test/unit/charge_amount_notification_test.rb +64 -0
- data/test/unit/charge_order_command_test.rb +77 -0
- data/test/unit/chargeback_amount_notification_test.rb +195 -0
- data/test/unit/checkout_command_xml_generator_test.rb +12 -4
- data/test/unit/deliver_order_command_test.rb +70 -0
- data/test/unit/frontend_test.rb +14 -1
- data/test/unit/notification_handler_test.rb +28 -8
- data/test/unit/order_state_change_notification_test.rb +1 -2
- data/test/unit/refund_amount_notification_test.rb +195 -0
- data/test/unit/refund_order_command_test.rb +258 -0
- data/test/unit/risk_information_notification_test.rb +98 -0
- data/test/unit/send_buyer_message_command_test.rb +219 -0
- data/test/unit/unarchive_order_command_test.rb +198 -0
- metadata +17 -2
@@ -0,0 +1,210 @@
|
|
1
|
+
#--
|
2
|
+
# Project: google_checkout4r
|
3
|
+
# File: test/unit/add_merchant_order_number_command_test.rb
|
4
|
+
# Author: Tony Chan <api.htchan at gmail dot com>
|
5
|
+
# Copyright: (c) 2007 by Tony Chan
|
6
|
+
# License: MIT License as follows:
|
7
|
+
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
13
|
+
# persons to whom the Software is furnished to do so, subject to the
|
14
|
+
# following conditions:
|
15
|
+
#
|
16
|
+
# The above copyright notice and this permission notice shall be included
|
17
|
+
# in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
20
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
22
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
23
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
25
|
+
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
|
+
#++
|
27
|
+
|
28
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
29
|
+
|
30
|
+
require 'google4r/checkout'
|
31
|
+
|
32
|
+
require 'test/frontend_configuration'
|
33
|
+
|
34
|
+
# Tests for the AddMerchantOrderNumberCommand class.
|
35
|
+
class Google4R::Checkout::AddMerchantOrderNumberCommandTest < Test::Unit::TestCase
|
36
|
+
include Google4R::Checkout
|
37
|
+
|
38
|
+
def setup
|
39
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
40
|
+
@command = @frontend.create_add_merchant_order_number_command
|
41
|
+
|
42
|
+
@command.google_order_number = '841171949013218'
|
43
|
+
@command.merchant_order_number = 'P6502-53-7861SBJD'
|
44
|
+
|
45
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
46
|
+
<add-merchant-order-number xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'>
|
47
|
+
<merchant-order-number>P6502-53-7861SBJD</merchant-order-number>
|
48
|
+
</add-merchant-order-number>}
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_behaves_correctly
|
52
|
+
[ :google_order_number, :merchant_order_number ].each do |symbol|
|
53
|
+
assert_respond_to @command, symbol
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_xml
|
58
|
+
assert_strings_equal(@sample_xml, @command.to_xml)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_accessors
|
62
|
+
assert_equal('841171949013218', @command.google_order_number)
|
63
|
+
assert_equal('P6502-53-7861SBJD', @command.merchant_order_number)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_to_xml_does_not_raise_exception
|
67
|
+
assert_nothing_raised { @command.to_xml }
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
#--
|
72
|
+
# Project: google_checkout4r
|
73
|
+
# File: test/unit/add_merchant_order_number_command_test.rb
|
74
|
+
# Author: Tony Chan <api.htchan at gmail dot com>
|
75
|
+
# Copyright: (c) 2007 by Tony Chan
|
76
|
+
# License: MIT License as follows:
|
77
|
+
#
|
78
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
79
|
+
# a copy of this software and associated documentation files (the
|
80
|
+
# "Software"), to deal in the Software without restriction, including
|
81
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
82
|
+
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
83
|
+
# persons to whom the Software is furnished to do so, subject to the
|
84
|
+
# following conditions:
|
85
|
+
#
|
86
|
+
# The above copyright notice and this permission notice shall be included
|
87
|
+
# in all copies or substantial portions of the Software.
|
88
|
+
#
|
89
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
90
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
91
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
92
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
93
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
94
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
95
|
+
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
96
|
+
#++
|
97
|
+
|
98
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
99
|
+
|
100
|
+
require 'google4r/checkout'
|
101
|
+
|
102
|
+
require 'test/frontend_configuration'
|
103
|
+
|
104
|
+
# Tests for the AddMerchantOrderNumberCommand class.
|
105
|
+
class Google4R::Checkout::AddMerchantOrderNumberCommandTest < Test::Unit::TestCase
|
106
|
+
include Google4R::Checkout
|
107
|
+
|
108
|
+
def setup
|
109
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
110
|
+
@command = @frontend.create_add_merchant_order_number_command
|
111
|
+
|
112
|
+
@command.google_order_number = '841171949013218'
|
113
|
+
@command.merchant_order_number = 'P6502-53-7861SBJD'
|
114
|
+
|
115
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
116
|
+
<add-merchant-order-number xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'>
|
117
|
+
<merchant-order-number>P6502-53-7861SBJD</merchant-order-number>
|
118
|
+
</add-merchant-order-number>}
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_behaves_correctly
|
122
|
+
[ :google_order_number, :merchant_order_number ].each do |symbol|
|
123
|
+
assert_respond_to @command, symbol
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_xml
|
128
|
+
assert_strings_equal(@sample_xml, @command.to_xml)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_accessors
|
132
|
+
assert_equal('841171949013218', @command.google_order_number)
|
133
|
+
assert_equal('P6502-53-7861SBJD', @command.merchant_order_number)
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_to_xml_does_not_raise_exception
|
137
|
+
assert_nothing_raised { @command.to_xml }
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
#--
|
142
|
+
# Project: google_checkout4r
|
143
|
+
# File: test/unit/add_merchant_order_number_command_test.rb
|
144
|
+
# Author: Tony Chan <api.htchan at gmail dot com>
|
145
|
+
# Copyright: (c) 2007 by Tony Chan
|
146
|
+
# License: MIT License as follows:
|
147
|
+
#
|
148
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
149
|
+
# a copy of this software and associated documentation files (the
|
150
|
+
# "Software"), to deal in the Software without restriction, including
|
151
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
152
|
+
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
153
|
+
# persons to whom the Software is furnished to do so, subject to the
|
154
|
+
# following conditions:
|
155
|
+
#
|
156
|
+
# The above copyright notice and this permission notice shall be included
|
157
|
+
# in all copies or substantial portions of the Software.
|
158
|
+
#
|
159
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
160
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
161
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
162
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
163
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
164
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
165
|
+
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
166
|
+
#++
|
167
|
+
|
168
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
169
|
+
|
170
|
+
require 'google4r/checkout'
|
171
|
+
|
172
|
+
require 'test/frontend_configuration'
|
173
|
+
|
174
|
+
# Tests for the AddMerchantOrderNumberCommand class.
|
175
|
+
class Google4R::Checkout::AddMerchantOrderNumberCommandTest < Test::Unit::TestCase
|
176
|
+
include Google4R::Checkout
|
177
|
+
|
178
|
+
def setup
|
179
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
180
|
+
@command = @frontend.create_add_merchant_order_number_command
|
181
|
+
|
182
|
+
@command.google_order_number = '841171949013218'
|
183
|
+
@command.merchant_order_number = 'P6502-53-7861SBJD'
|
184
|
+
|
185
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
186
|
+
<add-merchant-order-number xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'>
|
187
|
+
<merchant-order-number>P6502-53-7861SBJD</merchant-order-number>
|
188
|
+
</add-merchant-order-number>}
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_behaves_correctly
|
192
|
+
[ :google_order_number, :merchant_order_number ].each do |symbol|
|
193
|
+
assert_respond_to @command, symbol
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def test_xml
|
198
|
+
assert_strings_equal(@sample_xml, @command.to_xml)
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_accessors
|
202
|
+
assert_equal('841171949013218', @command.google_order_number)
|
203
|
+
assert_equal('P6502-53-7861SBJD', @command.merchant_order_number)
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_to_xml_does_not_raise_exception
|
207
|
+
assert_nothing_raised { @command.to_xml }
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
#--
|
2
|
+
# Project: google_checkout4r
|
3
|
+
# File: test/unit/add_tracking_data_command_test.rb
|
4
|
+
# Author: Tony Chan <api.htchan at gmail dot com>
|
5
|
+
# Copyright: (c) 2007 by Tony Chan
|
6
|
+
# License: MIT License as follows:
|
7
|
+
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
13
|
+
# persons to whom the Software is furnished to do so, subject to the
|
14
|
+
# following conditions:
|
15
|
+
#
|
16
|
+
# The above copyright notice and this permission notice shall be included
|
17
|
+
# in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
20
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
22
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
23
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
25
|
+
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
|
+
#++
|
27
|
+
|
28
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
29
|
+
|
30
|
+
require 'google4r/checkout'
|
31
|
+
|
32
|
+
require 'test/frontend_configuration'
|
33
|
+
|
34
|
+
# Tests for the AddTrackingDataCommand class.
|
35
|
+
class Google4R::Checkout::AddTrackingDataCommandTest < Test::Unit::TestCase
|
36
|
+
include Google4R::Checkout
|
37
|
+
|
38
|
+
def setup
|
39
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
40
|
+
@command = @frontend.create_add_tracking_data_command
|
41
|
+
|
42
|
+
@command.google_order_number = '841171949013218'
|
43
|
+
@command.carrier = 'UPS'
|
44
|
+
@command.tracking_number = 'Z9842W69871281267'
|
45
|
+
|
46
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
47
|
+
<add-tracking-data xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'>
|
48
|
+
<tracking-data>
|
49
|
+
<carrier>UPS</carrier>
|
50
|
+
<tracking-number>Z9842W69871281267</tracking-number>
|
51
|
+
</tracking-data>
|
52
|
+
</add-tracking-data>}
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_behaves_correctly
|
56
|
+
[ :google_order_number, :carrier, :tracking_number ].each do |symbol|
|
57
|
+
assert_respond_to @command, symbol
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_xml
|
62
|
+
assert_strings_equal(@sample_xml, @command.to_xml)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_accessors
|
66
|
+
assert_equal('841171949013218', @command.google_order_number)
|
67
|
+
assert_equal('Z9842W69871281267', @command.tracking_number)
|
68
|
+
assert_equal('UPS', @command.carrier)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_to_xml_does_not_raise_exception
|
72
|
+
assert_nothing_raised { @command.to_xml }
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
#--
|
77
|
+
# Project: google_checkout4r
|
78
|
+
# File: test/unit/add_tracking_data_command_test.rb
|
79
|
+
# Author: Tony Chan <api.htchan at gmail dot com>
|
80
|
+
# Copyright: (c) 2007 by Tony Chan
|
81
|
+
# License: MIT License as follows:
|
82
|
+
#
|
83
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
84
|
+
# a copy of this software and associated documentation files (the
|
85
|
+
# "Software"), to deal in the Software without restriction, including
|
86
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
87
|
+
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
88
|
+
# persons to whom the Software is furnished to do so, subject to the
|
89
|
+
# following conditions:
|
90
|
+
#
|
91
|
+
# The above copyright notice and this permission notice shall be included
|
92
|
+
# in all copies or substantial portions of the Software.
|
93
|
+
#
|
94
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
95
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
96
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
97
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
98
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
99
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
100
|
+
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
101
|
+
#++
|
102
|
+
|
103
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
104
|
+
|
105
|
+
require 'google4r/checkout'
|
106
|
+
|
107
|
+
require 'test/frontend_configuration'
|
108
|
+
|
109
|
+
# Tests for the AddTrackingDataCommand class.
|
110
|
+
class Google4R::Checkout::AddTrackingDataCommandTest < Test::Unit::TestCase
|
111
|
+
include Google4R::Checkout
|
112
|
+
|
113
|
+
def setup
|
114
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
115
|
+
@command = @frontend.create_add_tracking_data_command
|
116
|
+
|
117
|
+
@command.google_order_number = '841171949013218'
|
118
|
+
@command.carrier = 'UPS'
|
119
|
+
@command.tracking_number = 'Z9842W69871281267'
|
120
|
+
|
121
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
122
|
+
<add-tracking-data xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'>
|
123
|
+
<tracking-data>
|
124
|
+
<carrier>UPS</carrier>
|
125
|
+
<tracking-number>Z9842W69871281267</tracking-number>
|
126
|
+
</tracking-data>
|
127
|
+
</add-tracking-data>}
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_behaves_correctly
|
131
|
+
[ :google_order_number, :carrier, :tracking_number ].each do |symbol|
|
132
|
+
assert_respond_to @command, symbol
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_xml
|
137
|
+
assert_strings_equal(@sample_xml, @command.to_xml)
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_accessors
|
141
|
+
assert_equal('841171949013218', @command.google_order_number)
|
142
|
+
assert_equal('Z9842W69871281267', @command.tracking_number)
|
143
|
+
assert_equal('UPS', @command.carrier)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_to_xml_does_not_raise_exception
|
147
|
+
assert_nothing_raised { @command.to_xml }
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
#--
|
152
|
+
# Project: google_checkout4r
|
153
|
+
# File: test/unit/add_tracking_data_command_test.rb
|
154
|
+
# Author: Tony Chan <api.htchan at gmail dot com>
|
155
|
+
# Copyright: (c) 2007 by Tony Chan
|
156
|
+
# License: MIT License as follows:
|
157
|
+
#
|
158
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
159
|
+
# a copy of this software and associated documentation files (the
|
160
|
+
# "Software"), to deal in the Software without restriction, including
|
161
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
162
|
+
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
163
|
+
# persons to whom the Software is furnished to do so, subject to the
|
164
|
+
# following conditions:
|
165
|
+
#
|
166
|
+
# The above copyright notice and this permission notice shall be included
|
167
|
+
# in all copies or substantial portions of the Software.
|
168
|
+
#
|
169
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
170
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
171
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
172
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
173
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
174
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
175
|
+
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
176
|
+
#++
|
177
|
+
|
178
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
179
|
+
|
180
|
+
require 'google4r/checkout'
|
181
|
+
|
182
|
+
require 'test/frontend_configuration'
|
183
|
+
|
184
|
+
# Tests for the AddTrackingDataCommand class.
|
185
|
+
class Google4R::Checkout::AddTrackingDataCommandTest < Test::Unit::TestCase
|
186
|
+
include Google4R::Checkout
|
187
|
+
|
188
|
+
def setup
|
189
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
190
|
+
@command = @frontend.create_add_tracking_data_command
|
191
|
+
|
192
|
+
@command.google_order_number = '841171949013218'
|
193
|
+
@command.carrier = 'UPS'
|
194
|
+
@command.tracking_number = 'Z9842W69871281267'
|
195
|
+
|
196
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
197
|
+
<add-tracking-data xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'>
|
198
|
+
<tracking-data>
|
199
|
+
<carrier>UPS</carrier>
|
200
|
+
<tracking-number>Z9842W69871281267</tracking-number>
|
201
|
+
</tracking-data>
|
202
|
+
</add-tracking-data>}
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_behaves_correctly
|
206
|
+
[ :google_order_number, :carrier, :tracking_number ].each do |symbol|
|
207
|
+
assert_respond_to @command, symbol
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def test_xml
|
212
|
+
assert_strings_equal(@sample_xml, @command.to_xml)
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_accessors
|
216
|
+
assert_equal('841171949013218', @command.google_order_number)
|
217
|
+
assert_equal('Z9842W69871281267', @command.tracking_number)
|
218
|
+
assert_equal('UPS', @command.carrier)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_to_xml_does_not_raise_exception
|
222
|
+
assert_nothing_raised { @command.to_xml }
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
#--
|
2
|
+
# Project: google_checkout4r
|
3
|
+
# File: test/unit/archive_command_test.rb
|
4
|
+
# Author: Tony Chan <api.htchan at gmail dot com>
|
5
|
+
# Copyright: (c) 2007 by Tony Chan
|
6
|
+
# License: MIT License as follows:
|
7
|
+
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
13
|
+
# persons to whom the Software is furnished to do so, subject to the
|
14
|
+
# following conditions:
|
15
|
+
#
|
16
|
+
# The above copyright notice and this permission notice shall be included
|
17
|
+
# in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
20
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
22
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
23
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
25
|
+
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
|
+
#++
|
27
|
+
|
28
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
29
|
+
|
30
|
+
require 'google4r/checkout'
|
31
|
+
|
32
|
+
require 'test/frontend_configuration'
|
33
|
+
|
34
|
+
# Tests for the ArchiveOrderCommand class.
|
35
|
+
class Google4R::Checkout::ArchiveOrderCommandTest < Test::Unit::TestCase
|
36
|
+
include Google4R::Checkout
|
37
|
+
|
38
|
+
def setup
|
39
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
40
|
+
@command = @frontend.create_archive_order_command
|
41
|
+
|
42
|
+
@command.google_order_number = '841171949013218'
|
43
|
+
|
44
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
45
|
+
<archive-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/archive_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 ArchiveOrderCommand class.
|
101
|
+
class Google4R::Checkout::ArchiveOrderCommandTest < Test::Unit::TestCase
|
102
|
+
include Google4R::Checkout
|
103
|
+
|
104
|
+
def setup
|
105
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
106
|
+
@command = @frontend.create_archive_order_command
|
107
|
+
|
108
|
+
@command.google_order_number = '841171949013218'
|
109
|
+
|
110
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
111
|
+
<archive-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/archive_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
|
+
# Tests for the ArchiveOrderCommand class.
|
167
|
+
class Google4R::Checkout::ArchiveOrderCommandTest < Test::Unit::TestCase
|
168
|
+
include Google4R::Checkout
|
169
|
+
|
170
|
+
def setup
|
171
|
+
@frontend = Frontend.new(FRONTEND_CONFIGURATION)
|
172
|
+
@command = @frontend.create_archive_order_command
|
173
|
+
|
174
|
+
@command.google_order_number = '841171949013218'
|
175
|
+
|
176
|
+
@sample_xml=%Q{<?xml version='1.0' encoding='UTF-8'?>
|
177
|
+
<archive-order xmlns='http://checkout.google.com/schema/2' google-order-number='841171949013218'/>}
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_behaves_correctly
|
181
|
+
[ :google_order_number ].each do |symbol|
|
182
|
+
assert_respond_to @command, symbol
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def test_xml
|
187
|
+
assert_strings_equal(@sample_xml, @command.to_xml)
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_accessors
|
191
|
+
assert_equal('841171949013218', @command.google_order_number)
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_to_xml_does_not_raise_exception
|
195
|
+
assert_nothing_raised { @command.to_xml }
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|