google4r-checkout-jn 1.1.jniziol

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.
Files changed (79) hide show
  1. data/CHANGES +136 -0
  2. data/LICENSE +22 -0
  3. data/README.md +72 -0
  4. data/lib/google4r/checkout.rb +34 -0
  5. data/lib/google4r/checkout/commands.rb +665 -0
  6. data/lib/google4r/checkout/frontend.rb +222 -0
  7. data/lib/google4r/checkout/merchant_calculation.rb +323 -0
  8. data/lib/google4r/checkout/notifications.rb +774 -0
  9. data/lib/google4r/checkout/shared.rb +1386 -0
  10. data/lib/google4r/checkout/utils.rb +94 -0
  11. data/lib/google4r/checkout/xml_generation.rb +1023 -0
  12. data/test/frontend_configuration_example.rb +13 -0
  13. data/test/integration/checkout_command_test.rb +261 -0
  14. data/test/test_helper.rb +105 -0
  15. data/test/unit/add_merchant_order_number_command_test.rb +65 -0
  16. data/test/unit/add_tracking_data_command_test.rb +68 -0
  17. data/test/unit/address_test.rb +131 -0
  18. data/test/unit/anonymous_address_test.rb +75 -0
  19. data/test/unit/archive_order_command_test.rb +63 -0
  20. data/test/unit/area_test.rb +44 -0
  21. data/test/unit/authorization_amount_notification_test.rb +69 -0
  22. data/test/unit/authorize_order_command_test.rb +63 -0
  23. data/test/unit/backorder_items_command_test.rb +69 -0
  24. data/test/unit/callback_handler_test.rb +83 -0
  25. data/test/unit/cancel_items_command_test.rb +76 -0
  26. data/test/unit/cancel_order_command_test.rb +74 -0
  27. data/test/unit/carrier_calculated_shipping_test.rb +57 -0
  28. data/test/unit/charge_amount_notification_test.rb +72 -0
  29. data/test/unit/charge_and_ship_order_command_test.rb +69 -0
  30. data/test/unit/charge_fee_test.rb +53 -0
  31. data/test/unit/charge_order_command_test.rb +69 -0
  32. data/test/unit/chargeback_amount_notification_test.rb +69 -0
  33. data/test/unit/checkout_command_test.rb +149 -0
  34. data/test/unit/checkout_command_xml_generator_test.rb +216 -0
  35. data/test/unit/command_test.rb +116 -0
  36. data/test/unit/deliver_order_command_test.rb +65 -0
  37. data/test/unit/delivery_method_test.rb +42 -0
  38. data/test/unit/digital_content_test.rb +105 -0
  39. data/test/unit/flat_rate_shipping_test.rb +133 -0
  40. data/test/unit/frontend_test.rb +144 -0
  41. data/test/unit/item_info_test.rb +69 -0
  42. data/test/unit/item_test.rb +171 -0
  43. data/test/unit/marketing_preferences_test.rb +65 -0
  44. data/test/unit/merchant_calculated_shipping_test.rb +173 -0
  45. data/test/unit/merchant_calculation_callback_test.rb +137 -0
  46. data/test/unit/merchant_calculation_result_test.rb +78 -0
  47. data/test/unit/merchant_calculation_results_test.rb +203 -0
  48. data/test/unit/merchant_code_result_test.rb +51 -0
  49. data/test/unit/merchant_code_test.rb +122 -0
  50. data/test/unit/new_order_notification_test.rb +115 -0
  51. data/test/unit/notification_acknowledgement_test.rb +67 -0
  52. data/test/unit/notification_handler_test.rb +113 -0
  53. data/test/unit/order_adjustment_test.rb +119 -0
  54. data/test/unit/order_report_command_test.rb +109 -0
  55. data/test/unit/order_state_change_notification_test.rb +158 -0
  56. data/test/unit/parameterized_url_test.rb +57 -0
  57. data/test/unit/pickup_shipping_test.rb +70 -0
  58. data/test/unit/postal_area_test.rb +71 -0
  59. data/test/unit/private_data_parser_test.rb +68 -0
  60. data/test/unit/refund_amount_notification_test.rb +67 -0
  61. data/test/unit/refund_order_command_test.rb +79 -0
  62. data/test/unit/reset_items_shipping_information_command_test.rb +69 -0
  63. data/test/unit/return_items_command_test.rb +69 -0
  64. data/test/unit/risk_information_notification_test.rb +98 -0
  65. data/test/unit/send_buyer_message_command_test.rb +68 -0
  66. data/test/unit/ship_items_command_test.rb +81 -0
  67. data/test/unit/shipping_adjustment_test.rb +100 -0
  68. data/test/unit/shopping_cart_test.rb +146 -0
  69. data/test/unit/tax_rule_test.rb +70 -0
  70. data/test/unit/tax_table_test.rb +88 -0
  71. data/test/unit/tracking_data_test.rb +54 -0
  72. data/test/unit/unarchive_order_command_test.rb +63 -0
  73. data/test/unit/url_parameter_test.rb +55 -0
  74. data/test/unit/us_country_area_test.rb +76 -0
  75. data/test/unit/us_state_area_test.rb +70 -0
  76. data/test/unit/us_zip_area_test.rb +66 -0
  77. data/test/unit/world_area_test.rb +48 -0
  78. data/var/cacert.pem +7815 -0
  79. metadata +230 -0
@@ -0,0 +1,131 @@
1
+ #--
2
+ # Project: google_checkout4r
3
+ # File: test/unit/address_test.rb
4
+ # Author: Manuel Holtgrewe <purestorm at ggnore dot net>
5
+ # Copyright: (c) 2007 by Manuel Holtgrewe
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
+ # Test for the class Address.
35
+ class Google4R::Checkout::AddressTest < Test::Unit::TestCase
36
+ include Google4R::Checkout
37
+
38
+ def setup
39
+ @data =
40
+ {
41
+ :contact_name => 'John Smith',
42
+ :email => 'johnsmith@example.com',
43
+ :fax => '+01123456789',
44
+ :phone => '+01123456789',
45
+ :address1 => '10 Example Road',
46
+ :address2 => 'Bar',
47
+ :city => 'Sampleville',
48
+ :company_name => 'Company Name',
49
+ :region => 'CA',
50
+ :postal_code => '94141',
51
+ :country_code => 'US',
52
+ }
53
+
54
+ @optional_fields = [ :fax, :phone, :address2, :company_name, :contact_name ]
55
+
56
+ @xml_str = %q{<?xml version="1.0" encoding="UTF-8" ?>
57
+ <root>
58
+ <some-address>
59
+ <contact-name>%s</contact-name>
60
+ <email>%s</email>
61
+ <fax>%s</fax>
62
+ <phone>%s</phone>
63
+ <address1>%s</address1>
64
+ <address2>%s</address2>
65
+ <city>%s</city>
66
+ <company-name>%s</company-name>
67
+ <region>%s</region>
68
+ <postal-code>%s</postal-code>
69
+ <country-code>%s</country-code>
70
+ </some-address>
71
+ </root>}
72
+ end
73
+
74
+ def test_responds_correctly
75
+ @address = Address.new
76
+
77
+ @data.each do |key, value|
78
+ assert_respond_to @address, key, "key == #{key}"
79
+ assert_respond_to @address, "#{key}=".to_sym, "key == #{key}"
80
+ end
81
+ end
82
+
83
+ def test_creating_address_with_full_fields_works
84
+ xml_str = @xml_str %
85
+ [
86
+ @data[:contact_name], @data[:email], @data[:fax], @data[:phone], @data[:address1],
87
+ @data[:address2], @data[:city], @data[:company_name], @data[:region],
88
+ @data[:postal_code], @data[:country_code]
89
+ ]
90
+
91
+ document = REXML::Document.new(xml_str)
92
+
93
+ the_element = document.elements['/root/some-address']
94
+
95
+ address = Address.create_from_element(the_element)
96
+
97
+ @data.each do |key, value|
98
+ assert_equal value, address.send(key)
99
+ end
100
+ end
101
+
102
+ def test_creating_address_works_when_removing_optional_fields
103
+ @optional_fields.power.each do |optional_symbols|
104
+ xml_str = @xml_str %
105
+ [
106
+ @data[:contact_name], @data[:email], @data[:fax], @data[:phone], @data[:address1],
107
+ @data[:address2], @data[:city], @data[:company_name], @data[:region],
108
+ @data[:postal_code], @data[:country_code]
109
+ ]
110
+
111
+ # Remove all optional symbols in this run.
112
+ optional_symbols.each do |symbol|
113
+ xml_str = xml_str.gsub(%r{<#{symbol.to_s.gsub('_', '-')}>.*?</#{symbol.to_s.gsub('_', '-')}>}, '')
114
+ end
115
+
116
+ document = REXML::Document.new(xml_str)
117
+
118
+ the_element = document.elements['/root/some-address']
119
+
120
+ address = Address.create_from_element(the_element)
121
+
122
+ @data.each do |key, value|
123
+ if optional_symbols.include?(key) then
124
+ assert_nil address.send(key)
125
+ else
126
+ assert_equal value, address.send(key)
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,75 @@
1
+ #--
2
+ # Project: google_checkout4r
3
+ # File: test/unit/anonymous_address_test.rb
4
+ # Author: Tony Chan <api dot 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
+ # Test for the class Address.
35
+ class Google4R::Checkout::AnonymousAddressTest < Test::Unit::TestCase
36
+ include Google4R::Checkout
37
+
38
+ def setup
39
+
40
+ @xml_str = %q{<?xml version="1.0" encoding="UTF-8" ?>
41
+ <anonymous-address id="739030698069958">
42
+ <country-code>US</country-code>
43
+ <city>Mountain View</city>
44
+ <region>CA</region>
45
+ <postal-code>94043</postal-code>
46
+ </anonymous-address>}
47
+
48
+ end
49
+
50
+ def test_responds_correctly
51
+ address = Address.new
52
+
53
+ [ :address_id, :address_id=,
54
+ :country_code, :country_code=,
55
+ :city, :city=, :region, :region=,
56
+ :postal_code, :postal_code=
57
+ ].each do |symbol|
58
+ assert_respond_to address, symbol
59
+ end
60
+ end
61
+
62
+ def test_creating_anonymous_address
63
+
64
+ document = REXML::Document.new(@xml_str)
65
+
66
+ anonymous_address = AnonymousAddress.create_from_element(document.elements['/anonymous-address'])
67
+
68
+ assert_equal '739030698069958', anonymous_address.address_id
69
+ assert_equal 'US', anonymous_address.country_code
70
+ assert_equal 'Mountain View', anonymous_address.city
71
+ assert_equal 'CA', anonymous_address.region
72
+ assert_equal '94043', anonymous_address.postal_code
73
+
74
+ end
75
+ end
@@ -0,0 +1,63 @@
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
+ end
44
+
45
+ def test_behaves_correctly
46
+ [ :google_order_number ].each do |symbol|
47
+ assert_respond_to @command, symbol
48
+ end
49
+ end
50
+
51
+ def test_xml
52
+ assert_element_exists(command_selector(@command), @command.to_xml)
53
+ end
54
+
55
+ def test_accessors
56
+ assert_equal('841171949013218', @command.google_order_number)
57
+ end
58
+
59
+ def test_to_xml_does_not_raise_exception
60
+ assert_nothing_raised { @command.to_xml }
61
+ end
62
+
63
+ end
@@ -0,0 +1,44 @@
1
+ require 'google4r/checkout'
2
+
3
+ require 'test/frontend_configuration'
4
+ #--
5
+ # Project: google_checkout4r
6
+ # File: test/unit/area_test.rb
7
+ # Author: Manuel Holtgrewe <purestorm at ggnore dot net>
8
+ # Copyright: (c) 2007 by Manuel Holtgrewe
9
+ # License: MIT License as follows:
10
+ #
11
+ # Permission is hereby granted, free of charge, to any person obtaining
12
+ # a copy of this software and associated documentation files (the
13
+ # "Software"), to deal in the Software without restriction, including
14
+ # without limitation the rights to use, copy, modify, merge, publish,
15
+ # distribute, sublicense, and/or sell copies of the Software, and to permit
16
+ # persons to whom the Software is furnished to do so, subject to the
17
+ # following conditions:
18
+ #
19
+ # The above copyright notice and this permission notice shall be included
20
+ # in all copies or substantial portions of the Software.
21
+ #
22
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23
+ # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25
+ # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26
+ # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27
+ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
28
+ # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+ #++
30
+
31
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
32
+
33
+ require 'google4r/checkout'
34
+
35
+ require 'test/frontend_configuration'
36
+
37
+ # Test for the class Area.
38
+ class Google4R::Checkout::AreaTest < Test::Unit::TestCase
39
+ include Google4R::Checkout
40
+
41
+ def test_instanciating_area_raises_runtime_error
42
+ assert_raises(RuntimeError) { Area.new }
43
+ end
44
+ end
@@ -0,0 +1,69 @@
1
+ #--
2
+ # Project: google_checkout4r
3
+ # File: test/unit/authorization_amount_notification_test.rb
4
+ # Author: Tony Chan <api.htchan AT gmail.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
+ require 'rexml/document'
32
+ require 'test/frontend_configuration'
33
+
34
+ # Test for the class AuthorizationAmountNotification
35
+ class Google4R::Checkout::AuthorizationAmountNotificationTest < Test::Unit::TestCase
36
+ include Google4R::Checkout
37
+
38
+ def setup
39
+ @frontend = Frontend.new(FRONTEND_CONFIGURATION)
40
+ @frontend.tax_table_factory = TestTaxTableFactory.new
41
+
42
+ @example_xml = %q{
43
+ <?xml version="1.0" encoding="UTF-8"?>
44
+ <authorization-amount-notification xmlns="http://checkout.google.com/schema/2"
45
+ serial-number="bea6bc1b-e1e2-44fe-80ff-2391b25c2510">
46
+ <google-order-number>841171949013218</google-order-number>
47
+ <authorization-amount currency="GBP">226.06</authorization-amount>
48
+ <authorization-expiration-date>2006-03-18T20:25:31</authorization-expiration-date>
49
+ <avs-response>Y</avs-response>
50
+ <cvn-response>Y</cvn-response>
51
+ <timestamp>2006-03-18T20:25:31</timestamp>
52
+ </authorization-amount-notification>
53
+ }
54
+ end
55
+
56
+ def test_create_from_element_works_correctly
57
+ root = REXML::Document.new(@example_xml).root
58
+
59
+ notification = AuthorizationAmountNotification.create_from_element(root, @frontend)
60
+
61
+ assert_equal 'bea6bc1b-e1e2-44fe-80ff-2391b25c2510', notification.serial_number
62
+ assert_equal '841171949013218', notification.google_order_number
63
+ assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
64
+ assert_equal Time.parse('2006-03-18T20:25:31'), notification.authorization_expiration_date
65
+ assert_equal(Money.new(22606, 'GBP'), notification.authorization_amount)
66
+ assert_equal 'Y', notification.avs_response
67
+ assert_equal 'Y', notification.cvn_response
68
+ end
69
+ end
@@ -0,0 +1,63 @@
1
+ #--
2
+ # Project: google_checkout4r
3
+ # File: test/unit/authorize_order_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 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
+ end
44
+
45
+ def test_behaves_correctly
46
+ [ :google_order_number ].each do |symbol|
47
+ assert_respond_to @command, symbol
48
+ end
49
+ end
50
+
51
+ def test_xml
52
+ assert_element_exists(command_selector(@command), @command.to_xml)
53
+ end
54
+
55
+ def test_accessors
56
+ assert_equal('841171949013218', @command.google_order_number)
57
+ end
58
+
59
+ def test_to_xml_does_not_raise_exception
60
+ assert_nothing_raised { @command.to_xml }
61
+ end
62
+
63
+ end