vizjerai-google-checkout 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/google-checkout/cart.rb +13 -12
- data/spec/google-checkout/cart_spec.rb +13 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/google-checkout/cart.rb
CHANGED
@@ -68,6 +68,7 @@ module GoogleCheckout
|
|
68
68
|
attr_accessor :continue_shopping_url
|
69
69
|
|
70
70
|
attr_accessor :merchant_calculations_url
|
71
|
+
attr_accessor :parameterized_urls
|
71
72
|
|
72
73
|
attr_accessor :shipping_methods
|
73
74
|
|
@@ -255,7 +256,7 @@ module GoogleCheckout
|
|
255
256
|
}
|
256
257
|
}
|
257
258
|
}
|
258
|
-
unless @merchant_private_data.
|
259
|
+
unless @merchant_private_data.blank?
|
259
260
|
xml.tag!("merchant-private-data") {
|
260
261
|
@merchant_private_data.each do |key, value|
|
261
262
|
xml.tag!(key, value)
|
@@ -275,19 +276,19 @@ module GoogleCheckout
|
|
275
276
|
} if @merchant_calculations_url
|
276
277
|
|
277
278
|
# TODO tax-tables
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
xml.tag!(
|
286
|
-
|
279
|
+
|
280
|
+
xml.tag!('parameterized-urls') {
|
281
|
+
@parameterized_urls.each do |param_url|
|
282
|
+
xml.tag!('parameterized-url', :url => param_url[:url]) {
|
283
|
+
next if param_url[:parameters].blank?
|
284
|
+
xml.tag!('parameters') {
|
285
|
+
param_url[:parameters].each do |parameter|
|
286
|
+
xml.tag!('url-parameter', :name => parameter[:name], :type => parameter[:type]) {}
|
287
|
+
end
|
287
288
|
}
|
288
289
|
}
|
289
|
-
|
290
|
-
}
|
290
|
+
end
|
291
|
+
} unless @parameterized_urls.blank?
|
291
292
|
|
292
293
|
xml.tag!('shipping-methods') {
|
293
294
|
@shipping_methods.each do |shipping_method|
|
@@ -103,6 +103,19 @@ describe GoogleCheckout, "Cart Post" do
|
|
103
103
|
@cart.to_xml.should_not match(%r{<merchant-calculations-url>})
|
104
104
|
end
|
105
105
|
|
106
|
+
it "should include the merchant parameterized urls in the generated xml" do
|
107
|
+
@cart.parameterized_urls = [{
|
108
|
+
:url => "http://www.someapi.com",
|
109
|
+
:parameters => [
|
110
|
+
{:name => 'order', :type => 'order-id'},
|
111
|
+
{:name => 'rev', :type => 'order-total'}]}]
|
112
|
+
@cart.to_xml.should match(%r{<parameterized-urls><parameterized-url url="http://www.someapi.com"><parameters><url-parameter type="order-id" name="order"></url-parameter><url-parameter type="order-total" name="rev"></url-parameter></parameters></parameterized-url></parameterized-urls>})
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should not include the merchant parameterized urls if it's not set" do
|
116
|
+
@cart.to_xml.should_not match(%r{<parameterized-urls>})
|
117
|
+
end
|
118
|
+
|
106
119
|
it "should generate XML"
|
107
120
|
|
108
121
|
it "should receive error when placing false request"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vizjerai-google-checkout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter Elmore
|