google4r-checkout 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +16 -0
- data/lib/google4r/checkout/commands.rb +101 -61
- data/lib/google4r/checkout/frontend.rb +30 -0
- data/lib/google4r/checkout/merchant_calculation.rb +4 -0
- data/lib/google4r/checkout/notifications.rb +53 -129
- data/lib/google4r/checkout/shared.rb +382 -7
- data/lib/google4r/checkout/utils.rb +94 -0
- data/lib/google4r/checkout/xml_generation.rb +229 -17
- data/test/integration/checkout_command_test.rb +72 -11
- data/test/unit/backorder_items_command_test.rb +83 -0
- data/test/unit/cancel_items_command_test.rb +89 -0
- data/test/unit/carrier_calculated_shipping_test.rb +57 -0
- data/test/unit/checkout_command_test.rb +6 -1
- data/test/unit/checkout_command_xml_generator_test.rb +1 -0
- data/test/unit/command_test.rb +3 -2
- data/test/unit/digital_content_test.rb +105 -0
- data/test/unit/frontend_test.rb +70 -10
- data/test/unit/item_info_test.rb +69 -0
- data/test/unit/item_test.rb +13 -1
- data/test/unit/merchant_calculated_shipping_test.rb +39 -3
- data/test/unit/notification_acknowledgement_test.rb +25 -1
- data/test/unit/reset_items_shipping_information_command_test.rb +83 -0
- data/test/unit/return_items_command_test.rb +83 -0
- data/test/unit/ship_items_command_test.rb +101 -0
- data/test/unit/tracking_data_test.rb +54 -0
- metadata +13 -3
data/CHANGES
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
=google4r-checkout Changelog
|
2
2
|
|
3
|
+
== 1.0.3 (2008-08-08)
|
4
|
+
|
5
|
+
* Added analytics_data support. Thanks to Will Schwenk!
|
6
|
+
* Added create_address_filters_allowed_area and create_address_filters_excluded_area method to the MerchantCalculatedShipping class.
|
7
|
+
* Created two aliases create_shipping_restrictions_allowed_area and create_shipping_restrictions_excluded_area to facilitate deprecation of create_allowed_area and create_excluded_area.
|
8
|
+
* country_code in PostalArea class is now optional in the initialize method so it can be called properly in the create_area method in shared.rb.
|
9
|
+
* Added line-item shipping support.
|
10
|
+
* Refactor notifications to extract a base notification class that has the front_end, serial_number, google_order_number and timestamp.
|
11
|
+
* Added notification handshake support (i.e. serial-number) for notifciation-acknowledgement.
|
12
|
+
* Added digital delivery support. Thanks to Andy Kim and Matthew Moore!
|
13
|
+
* Added Carrier Calculated Shipping support.
|
14
|
+
* Added unit tests - carrier_calculated_shipping_test.rb, digital_content_test.rb, *_items_*commands.rb
|
15
|
+
* Updated unit tests - item_test.rb, merchant_calculated_shipping_test.rb, notification_acknowledgement_test.rb
|
16
|
+
* Updated integration test - checkout_command_test.rb
|
17
|
+
* Added HTML Form API Signature support. It is included in utils.rb.
|
18
|
+
|
3
19
|
== 1.0.2 (2007-08-18)
|
4
20
|
|
5
21
|
* Moved Address from notifications.rb to shared.rb
|
@@ -40,17 +40,15 @@ module Google4R #:nodoc:
|
|
40
40
|
class Command
|
41
41
|
# The URL to use for requests to the sandboxed API. The merchant id is to be
|
42
42
|
# put in via String#%.
|
43
|
-
|
44
|
-
# TODO: Move this into a class variable (e.g. via cattr) so it is adaptable.
|
45
|
-
#++
|
46
|
-
SANDBOX_URL = "https://sandbox.google.com/checkout/cws/v2/Merchant/%s/request"
|
43
|
+
SANDBOX_URL_PREFIX = 'https://sandbox.google.com/checkout/'
|
47
44
|
|
48
45
|
# The URL to use for real requests to the Google Checkout API. The merchant id
|
49
46
|
# is to be put in via String#%.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
PRODUCTION_URL_PREFIX = 'https://checkout.google.com/'
|
48
|
+
|
49
|
+
CHECKOUT_API_URL = 'api/checkout/v2/merchantCheckout/Merchant/%s'
|
50
|
+
|
51
|
+
ORDER_PROCESSING_API_URL = 'api/checkout/v2/request/Merchant/%s'
|
54
52
|
|
55
53
|
# The Frontent class that was used to create this CheckoutCommand and whose
|
56
54
|
# configuration will be used.
|
@@ -64,6 +62,9 @@ module Google4R #:nodoc:
|
|
64
62
|
|
65
63
|
# Initialize the frontend attribute with the value of the frontend parameter.
|
66
64
|
def initialize(frontend)
|
65
|
+
if self.instance_of?(Command) || self.instance_of?(ItemsCommand)
|
66
|
+
raise 'Cannot instantiate abstract class ' + self.class.to_s
|
67
|
+
end
|
67
68
|
@frontend = frontend
|
68
69
|
end
|
69
70
|
|
@@ -81,10 +82,17 @@ module Google4R #:nodoc:
|
|
81
82
|
# Create HTTP(S) POST command and set up Basic Authentication.
|
82
83
|
url_str =
|
83
84
|
if frontend.configuration[:use_sandbox] then
|
84
|
-
|
85
|
+
SANDBOX_URL_PREFIX
|
86
|
+
else
|
87
|
+
PRODUCTION_URL_PREFIX
|
88
|
+
end
|
89
|
+
url_str +=
|
90
|
+
if self.class == CheckoutCommand then
|
91
|
+
CHECKOUT_API_URL
|
85
92
|
else
|
86
|
-
|
93
|
+
ORDER_PROCESSING_API_URL
|
87
94
|
end
|
95
|
+
url_str = url_str % frontend.configuration[:merchant_id]
|
88
96
|
url = URI.parse(url_str)
|
89
97
|
|
90
98
|
request = Net::HTTP::Post.new(url.path)
|
@@ -138,12 +146,8 @@ module Google4R #:nodoc:
|
|
138
146
|
|
139
147
|
# Class method to return the command's XML representation.
|
140
148
|
def to_xml
|
141
|
-
|
142
|
-
|
143
|
-
else
|
144
|
-
generator_class = Google4R::Command.get_const("#{self.class}XmlGenerator")
|
145
|
-
return generator_class.new(self).generate
|
146
|
-
end
|
149
|
+
generator_class = Google4R::Command.get_const("#{self.class}XmlGenerator")
|
150
|
+
return generator_class.new(self).generate
|
147
151
|
end
|
148
152
|
|
149
153
|
protected
|
@@ -219,6 +223,13 @@ module Google4R #:nodoc:
|
|
219
223
|
|
220
224
|
# A Google Checkout merchant ID that identifies the eCommerce provider.
|
221
225
|
attr_accessor :platform_id
|
226
|
+
|
227
|
+
# Setting this allows Google Analytics to track purchases that use Checkout
|
228
|
+
# The value should be as set by the analytics javascript in the hidden form
|
229
|
+
# element names "analyticsdata" on the page with the checkout button.
|
230
|
+
# If left unset then the element will not be generated.
|
231
|
+
# see: http://code.google.com/apis/checkout/developer/checkout_analytics_integration.html
|
232
|
+
attr_accessor :analytics_data
|
222
233
|
|
223
234
|
# Generates the XML for this CheckoutCommand.
|
224
235
|
def to_xml
|
@@ -249,7 +260,9 @@ module Google4R #:nodoc:
|
|
249
260
|
#
|
250
261
|
# Raises a ArgumentError if the parameter clazz is invalid.
|
251
262
|
def create_shipping_method(clazz, &block)
|
252
|
-
if not [ PickupShipping, FlatRateShipping,
|
263
|
+
if not [ PickupShipping, FlatRateShipping,
|
264
|
+
MerchantCalculatedShipping, CarrierCalculatedShipping
|
265
|
+
].include?(clazz) then
|
253
266
|
raise ArgumentError, "Unknown shipping method: #{clazz.inspect}."
|
254
267
|
end
|
255
268
|
|
@@ -278,6 +291,10 @@ module Google4R #:nodoc:
|
|
278
291
|
@serial_number = serial_number
|
279
292
|
@redirect_url = redirect_url
|
280
293
|
end
|
294
|
+
|
295
|
+
def to_s
|
296
|
+
return @redirect_url
|
297
|
+
end
|
281
298
|
end
|
282
299
|
|
283
300
|
#
|
@@ -288,11 +305,6 @@ module Google4R #:nodoc:
|
|
288
305
|
# The amount to charge, optional, Money
|
289
306
|
attr_accessor :amount
|
290
307
|
|
291
|
-
# frontend, required
|
292
|
-
def initialize(frontend)
|
293
|
-
super(frontend)
|
294
|
-
end
|
295
|
-
|
296
308
|
# Generates the XML for this ChargeOrderCommand
|
297
309
|
def to_xml
|
298
310
|
ChargeOrderCommandXmlGenerator.new(self).generate
|
@@ -310,10 +322,6 @@ module Google4R #:nodoc:
|
|
310
322
|
# A comment related to the refunded order, String of maximum 140 characters, optional
|
311
323
|
attr_accessor :comment
|
312
324
|
|
313
|
-
def initialize(frontend)
|
314
|
-
super(frontend)
|
315
|
-
end
|
316
|
-
|
317
325
|
def to_xml
|
318
326
|
RefundOrderCommandXmlGenerator.new(self).generate
|
319
327
|
end
|
@@ -327,10 +335,6 @@ module Google4R #:nodoc:
|
|
327
335
|
# A comment related to the cancelled order, String of maximum 140 characters, optional
|
328
336
|
attr_accessor :comment
|
329
337
|
|
330
|
-
def initialize(frontend)
|
331
|
-
super(frontend)
|
332
|
-
end
|
333
|
-
|
334
338
|
def to_xml
|
335
339
|
CancelOrderCommandXmlGenerator.new(self).generate
|
336
340
|
end
|
@@ -340,10 +344,6 @@ module Google4R #:nodoc:
|
|
340
344
|
# a customer's credit card for the uncharged balance of an order to verify that
|
341
345
|
# funds for the order are available
|
342
346
|
class AuthorizeOrderCommand < Command
|
343
|
-
def initialize(frontend)
|
344
|
-
super(frontend)
|
345
|
-
end
|
346
|
-
|
347
347
|
def to_xml
|
348
348
|
AuthorizeOrderCommandXmlGenerator.new(self).generate
|
349
349
|
end
|
@@ -352,10 +352,6 @@ module Google4R #:nodoc:
|
|
352
352
|
# The ProcessOrderCommand instructs Google Checkout to to update
|
353
353
|
# an order's fulfillment state from NEW to PROCESSING
|
354
354
|
class ProcessOrderCommand < Command
|
355
|
-
def initialize(frontend)
|
356
|
-
super(frontend)
|
357
|
-
end
|
358
|
-
|
359
355
|
def to_xml
|
360
356
|
ProcessOrderCommandXmlGenerator.new(self).generate
|
361
357
|
end
|
@@ -366,10 +362,6 @@ module Google4R #:nodoc:
|
|
366
362
|
class AddMerchantOrderNumberCommand < Command
|
367
363
|
# The merchant-assigned order number associated with an order
|
368
364
|
attr_accessor :merchant_order_number
|
369
|
-
|
370
|
-
def initialize(frontend)
|
371
|
-
super(frontend)
|
372
|
-
end
|
373
365
|
|
374
366
|
def to_xml
|
375
367
|
AddMerchantOrderNumberCommandXmlGenerator.new(self).generate
|
@@ -387,10 +379,6 @@ module Google4R #:nodoc:
|
|
387
379
|
|
388
380
|
# The shipper's tracking number that is associated with an order
|
389
381
|
attr_accessor :tracking_number
|
390
|
-
|
391
|
-
def initialize(frontend)
|
392
|
-
super(frontend)
|
393
|
-
end
|
394
382
|
|
395
383
|
def to_xml
|
396
384
|
DeliverOrderCommandXmlGenerator.new(self).generate
|
@@ -405,10 +393,6 @@ module Google4R #:nodoc:
|
|
405
393
|
|
406
394
|
# The shipper's tracking number that is associated with an order
|
407
395
|
attr_accessor :tracking_number
|
408
|
-
|
409
|
-
def initialize(frontend)
|
410
|
-
super(frontend)
|
411
|
-
end
|
412
396
|
|
413
397
|
def to_xml
|
414
398
|
AddTrackingDataCommandXmlGenerator.new(self).generate
|
@@ -420,12 +404,8 @@ module Google4R #:nodoc:
|
|
420
404
|
# The message to the customer
|
421
405
|
attr_accessor :message
|
422
406
|
|
423
|
-
# if google checkout should email buyer to
|
407
|
+
# if google checkout should email buyer to say order is dispatched
|
424
408
|
attr_accessor :send_email
|
425
|
-
|
426
|
-
def initialize(frontend)
|
427
|
-
super(frontend)
|
428
|
-
end
|
429
409
|
|
430
410
|
def to_xml
|
431
411
|
SendBuyerMessageCommandXmlGenerator.new(self).generate
|
@@ -434,10 +414,6 @@ module Google4R #:nodoc:
|
|
434
414
|
|
435
415
|
# The ArchiveOrderCommand instructs Google Checkout to remove an order from your Merchant Center Inbox.
|
436
416
|
class ArchiveOrderCommand < Command
|
437
|
-
def initialize(frontend)
|
438
|
-
super(frontend)
|
439
|
-
end
|
440
|
-
|
441
417
|
def to_xml
|
442
418
|
ArchiveOrderCommandXmlGenerator.new(self).generate
|
443
419
|
end
|
@@ -445,12 +421,76 @@ module Google4R #:nodoc:
|
|
445
421
|
|
446
422
|
# The UnarchiveOrderCommand instructs Google Checkout to return a previously archived order to your Merchant Center Inbox.
|
447
423
|
class UnarchiveOrderCommand < Command
|
424
|
+
def to_xml
|
425
|
+
UnarchiveOrderCommandXmlGenerator.new(self).generate
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
#
|
430
|
+
# XML API Commands for Line-item Shipping
|
431
|
+
#
|
432
|
+
|
433
|
+
# Abstract class for Line-item shipping commands
|
434
|
+
class ItemsCommand < Command
|
435
|
+
# An array of ItemInfo objects that you are marking as backordered,
|
436
|
+
# cancelled, returned or resetting shipping information
|
437
|
+
attr_accessor :item_info_arr
|
438
|
+
|
439
|
+
# if google checkout should email buyer to say order is dispatched
|
440
|
+
attr_accessor :send_email
|
441
|
+
|
448
442
|
def initialize(frontend)
|
449
|
-
super
|
443
|
+
super
|
444
|
+
@item_info_arr = []
|
445
|
+
@send_email = false
|
450
446
|
end
|
447
|
+
end
|
451
448
|
|
449
|
+
# The <ship-items> command specifies shipping information for one or
|
450
|
+
# more items in an order.
|
451
|
+
class ShipItemsCommand < ItemsCommand
|
452
452
|
def to_xml
|
453
|
-
|
453
|
+
ShipItemsCommandXmlGenerator.new(self).generate
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
# The <backorder-items> command lets you specify that one or more
|
458
|
+
# specific items in an order are out of stock.
|
459
|
+
class BackorderItemsCommand < ItemsCommand
|
460
|
+
def to_xml
|
461
|
+
BackorderItemsCommandXmlGenerator.new(self).generate
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
# The <cancel-items> command lets you specify that one or more
|
466
|
+
# specific items in an order have been cancelled, meaning they
|
467
|
+
# will not be delivered to the customer.
|
468
|
+
class CancelItemsCommand < ItemsCommand
|
469
|
+
|
470
|
+
# The reason that you are canceling one or more line items
|
471
|
+
attr_accessor :reason
|
472
|
+
|
473
|
+
# An optional comment related to one or more canceled line items
|
474
|
+
attr_accessor :comment
|
475
|
+
|
476
|
+
def to_xml
|
477
|
+
CancelItemsCommandXmlGenerator.new(self).generate
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
481
|
+
# The <return-items> command lets you specify that your customer
|
482
|
+
# returned one or more specific items in an order.
|
483
|
+
class ReturnItemsCommand < ItemsCommand
|
484
|
+
def to_xml
|
485
|
+
ReturnItemsCommandXmlGenerator.new(self).generate
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
# The <reset-items-shipping-information> command allows you to reset
|
490
|
+
# the shipping status for specific items in an order to "Not yet shipped".
|
491
|
+
class ResetItemsShippingInformationCommand < ItemsCommand
|
492
|
+
def to_xml
|
493
|
+
ResetItemsShippingInformationCommandXmlGenerator.new(self).generate
|
454
494
|
end
|
455
495
|
end
|
456
496
|
end
|
@@ -169,6 +169,36 @@ module Google4R #:nodoc:
|
|
169
169
|
def create_unarchive_order_command
|
170
170
|
return UnarchiveOrderCommand.new(self)
|
171
171
|
end
|
172
|
+
|
173
|
+
# Factory method to create a new ShipItemsCommand object. Use this method to create
|
174
|
+
# your ShipItemsCommand instances.
|
175
|
+
def create_ship_items_command
|
176
|
+
return ShipItemsCommand.new(self)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Factory method to create a new BackorderItemsCommand object. Use this method to create
|
180
|
+
# your BackorderItemsCommand instances.
|
181
|
+
def create_backorder_items_command
|
182
|
+
return BackorderItemsCommand.new(self)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Factory method to create a new ReturnItemsCommand object. Use this method to create
|
186
|
+
# your ReturnItemsCommand instances.
|
187
|
+
def create_return_items_command
|
188
|
+
return ReturnItemsCommand.new(self)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Factory method to create a new CancelItemsCommand object. Use this method to create
|
192
|
+
# your CancelItemsCommand instances.
|
193
|
+
def create_cancel_items_command
|
194
|
+
return CancelItemsCommand.new(self)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Factory method to create a new ResetItemsShippingInformationCommand object. Use this method to create
|
198
|
+
# your ResetItemsShippingInformationCommand instances.
|
199
|
+
def create_reset_items_shipping_information_command
|
200
|
+
return ResetItemsShippingInformationCommand.new(self)
|
201
|
+
end
|
172
202
|
end
|
173
203
|
end
|
174
204
|
end
|
@@ -123,12 +123,16 @@ module Google4R #:nodoc:
|
|
123
123
|
# An array of merchant codes
|
124
124
|
attr_reader :merchant_code_strings
|
125
125
|
|
126
|
+
# The tax tables for the items in the order notification.
|
127
|
+
attr_reader :tax_tables
|
128
|
+
|
126
129
|
# Sets the frontend attribute to the value of the frontend parameter.
|
127
130
|
def initialize(frontend)
|
128
131
|
@frontend = frontend
|
129
132
|
@anonymous_addresses = Array.new
|
130
133
|
@shipping_methods = Array.new
|
131
134
|
@merchant_code_strings = Array.new
|
135
|
+
@tax_tables = frontend.tax_table_factory.effective_tax_tables_at(Time.now)
|
132
136
|
end
|
133
137
|
|
134
138
|
# Factory method to create a new MerchantCalculationCallback object from
|
@@ -35,17 +35,32 @@ module Google4R #:nodoc:
|
|
35
35
|
class UnknownNotificationType < Exception
|
36
36
|
end
|
37
37
|
|
38
|
-
#
|
38
|
+
# Represents a notification acknowledgment to tell Google that the
|
39
|
+
# notification has been recieved and processed. Google guarantees not to
|
40
|
+
# resend any notification it has recieved an acknowledgment for.
|
41
|
+
#
|
42
|
+
# === For example, in a Rails app
|
39
43
|
#
|
40
|
-
#
|
44
|
+
# # Let Google Checkout know we handled this notification with handshake
|
45
|
+
# notification_acknowledgement = Google4R::Checkout::NotificationAcknowledgement.new(notification).to_xml
|
46
|
+
# render :text => notification_acknowledgement, :status => 200
|
41
47
|
#
|
42
|
-
#
|
43
|
-
|
44
|
-
#
|
45
|
-
|
46
|
-
|
48
|
+
# or
|
49
|
+
#
|
50
|
+
# # Without handshake
|
51
|
+
# notification_acknowledgement = Google4R::Checkout::NotificationAcknowledgement.new.to_xml
|
52
|
+
# render :text => notification_acknowledgement, :status => 200
|
53
|
+
#
|
54
|
+
class NotificationAcknowledgement
|
55
|
+
|
56
|
+
attr_reader :serial_number
|
57
|
+
|
58
|
+
def initialize(notification=nil)
|
59
|
+
@serial_number = notification.serial_number unless notification.nil?
|
60
|
+
end
|
61
|
+
|
47
62
|
def to_xml
|
48
|
-
|
63
|
+
NotificationAcknowledgementXmlGenerator.new(self).generate
|
49
64
|
end
|
50
65
|
end
|
51
66
|
|
@@ -123,10 +138,9 @@ module Google4R #:nodoc:
|
|
123
138
|
end
|
124
139
|
end
|
125
140
|
|
126
|
-
#
|
127
|
-
#
|
128
|
-
|
129
|
-
class NewOrderNotification
|
141
|
+
# Abstract class for all the notifications. It should not be instantiated
|
142
|
+
# directly.
|
143
|
+
class Notification
|
130
144
|
# The frontend this notification belongs to.
|
131
145
|
attr_accessor :frontend
|
132
146
|
|
@@ -136,6 +150,21 @@ module Google4R #:nodoc:
|
|
136
150
|
# The Google order number the new order notification belongs to (String).
|
137
151
|
attr_accessor :google_order_number
|
138
152
|
|
153
|
+
# The timestamp of the notification. Also see #timestamp=
|
154
|
+
attr_accessor :timestamp
|
155
|
+
|
156
|
+
# Initializes the RiskInformationNotification instance with the given Frontend instance.
|
157
|
+
def initialize(frontend)
|
158
|
+
@frontend = frontend
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
# Google Checkout sends <new-order-notification> messages to the web service when a new
|
164
|
+
# order has been successfully filed with Google Checkout. These messages will be parsed
|
165
|
+
# into NewOrderNotification instances.
|
166
|
+
class NewOrderNotification < Notification
|
167
|
+
|
139
168
|
# The buyer's billing address (Address).
|
140
169
|
attr_accessor :buyer_billing_address
|
141
170
|
|
@@ -166,8 +195,8 @@ module Google4R #:nodoc:
|
|
166
195
|
# The order's shopping cart (ShoppingCart)
|
167
196
|
attr_accessor :shopping_cart
|
168
197
|
|
169
|
-
# The
|
170
|
-
|
198
|
+
# The tax tables for the items in the order notification.
|
199
|
+
attr_reader :tax_tables
|
171
200
|
|
172
201
|
# Set the order's timestamp (Time). When the timestamp is set then the tax tables valid
|
173
202
|
# at the given point of time are set into the attribute tax tables from the frontend's
|
@@ -177,14 +206,6 @@ module Google4R #:nodoc:
|
|
177
206
|
@tax_tables = frontend.tax_table_factory.effective_tax_tables_at(time)
|
178
207
|
end
|
179
208
|
|
180
|
-
# The tax tables for the items in the order notification.
|
181
|
-
attr_reader :tax_tables
|
182
|
-
|
183
|
-
# Sets the frontend attribute to the value of the frontend parameter.
|
184
|
-
def initialize(frontend)
|
185
|
-
@frontend = frontend
|
186
|
-
end
|
187
|
-
|
188
209
|
# Factory method to create a new CheckoutNotification object from the REXML:Element object
|
189
210
|
#
|
190
211
|
# Raises NoMethodError and RuntimeError exceptions if the given element misses required
|
@@ -216,15 +237,7 @@ module Google4R #:nodoc:
|
|
216
237
|
|
217
238
|
# GoogleCheckout sends <order-change-notification> messages to the web service when the
|
218
239
|
# order's state changes. They will get parsed into OrderStateChangeNotification objects.
|
219
|
-
class OrderStateChangeNotification
|
220
|
-
# The frontend this notification belongs to.
|
221
|
-
attr_accessor :frontend
|
222
|
-
|
223
|
-
# The serial number of the notification (String).
|
224
|
-
attr_accessor :serial_number
|
225
|
-
|
226
|
-
# The order number in Google's database (String).
|
227
|
-
attr_accessor :google_order_number
|
240
|
+
class OrderStateChangeNotification < Notification
|
228
241
|
|
229
242
|
# The previous financial state of the order (String, one of FinancialOrderState::*).
|
230
243
|
attr_accessor :previous_financial_order_state
|
@@ -240,9 +253,9 @@ module Google4R #:nodoc:
|
|
240
253
|
|
241
254
|
# The reason for the change (String, can be nil).
|
242
255
|
attr_accessor :reason
|
243
|
-
|
244
|
-
# The
|
245
|
-
|
256
|
+
|
257
|
+
# The tax tables for the items in the order notification.
|
258
|
+
attr_reader :tax_tables
|
246
259
|
|
247
260
|
# Set the order's timestamp (Time). When the timestamp is set then the tax tables valid
|
248
261
|
# at the given point of time are set into the attribute tax tables from the frontend's
|
@@ -252,14 +265,6 @@ module Google4R #:nodoc:
|
|
252
265
|
@tax_tables = frontend.tax_table_factory.effective_tax_tables_at(time)
|
253
266
|
end
|
254
267
|
|
255
|
-
# The tax tables for the items in the order notification.
|
256
|
-
attr_reader :tax_tables
|
257
|
-
|
258
|
-
# Sets the frontend attribute to the value of the frontend parameter.
|
259
|
-
def initialize(frontend)
|
260
|
-
@frontend = frontend
|
261
|
-
end
|
262
|
-
|
263
268
|
# Factory method that creates a new OrderStateChangeNotification from an REXML::Element instance.
|
264
269
|
# Use this to create instances of OrderStateChangeNotification.
|
265
270
|
#
|
@@ -283,16 +288,7 @@ module Google4R #:nodoc:
|
|
283
288
|
|
284
289
|
# Google Checkout sends <charge-amount-notification> messages to the web service when the
|
285
290
|
# to confirm that the charge was successfully executed.
|
286
|
-
class ChargeAmountNotification
|
287
|
-
|
288
|
-
# The serial number of the notification (String).
|
289
|
-
attr_accessor :serial_number
|
290
|
-
|
291
|
-
# The order number in Google's database (String).
|
292
|
-
attr_accessor :google_order_number
|
293
|
-
|
294
|
-
# The timestamp of the notification
|
295
|
-
attr_accessor :timestamp
|
291
|
+
class ChargeAmountNotification < Notification
|
296
292
|
|
297
293
|
# The amount most recently charged for an order (Money)
|
298
294
|
attr_accessor :latest_charge_amount
|
@@ -300,14 +296,6 @@ module Google4R #:nodoc:
|
|
300
296
|
# The total amount charged for an order (Money)
|
301
297
|
attr_accessor :total_charge_amount
|
302
298
|
|
303
|
-
# The Frontend instance for this Notification
|
304
|
-
attr_accessor :frontend
|
305
|
-
|
306
|
-
# Initializes the ChargeAmountNotification instance with the given Frontend instance.
|
307
|
-
def initialize(frontend)
|
308
|
-
@frontend = frontend
|
309
|
-
end
|
310
|
-
|
311
299
|
# Factory method that creates a new ChargeAmountNotification from an REXML::Element instance.
|
312
300
|
# Use this to create instances of ChargeAmountNotification.
|
313
301
|
#
|
@@ -336,15 +324,7 @@ module Google4R #:nodoc:
|
|
336
324
|
# Google Checkout sends a <refund-amount-notification> after successfully executing
|
337
325
|
# a <refund-order> order processing command. See the Google Checkout documentation for more details:
|
338
326
|
# http://code.google.com/apis/checkout/developer/index.html#refund_amount_notification
|
339
|
-
class RefundAmountNotification
|
340
|
-
# The serial number of the notification (String).
|
341
|
-
attr_accessor :serial_number
|
342
|
-
|
343
|
-
# The order number in Google's database (String).
|
344
|
-
attr_accessor :google_order_number
|
345
|
-
|
346
|
-
# The timestamp of the notification
|
347
|
-
attr_accessor :timestamp
|
327
|
+
class RefundAmountNotification < Notification
|
348
328
|
|
349
329
|
# The amount most recently refunded for an order (Money)
|
350
330
|
attr_accessor :latest_refund_amount
|
@@ -352,14 +332,6 @@ module Google4R #:nodoc:
|
|
352
332
|
# The total amount refunded for an order (Money)
|
353
333
|
attr_accessor :total_refund_amount
|
354
334
|
|
355
|
-
# The Frontend instance for this Notification
|
356
|
-
attr_accessor :frontend
|
357
|
-
|
358
|
-
# Initializes the RefundAmountNotification instance with the given Frontend instance.
|
359
|
-
def initialize(frontend)
|
360
|
-
@frontend = frontend
|
361
|
-
end
|
362
|
-
|
363
335
|
# Factory method that creates a new RefundAmountNotification from an REXML::Element instance.
|
364
336
|
# Use this to create instances of RefundAmountNotification.
|
365
337
|
#
|
@@ -389,15 +361,7 @@ module Google4R #:nodoc:
|
|
389
361
|
# chargeback against the order and Google approves the chargeback.
|
390
362
|
# See the Google Checkout documentation for more details:
|
391
363
|
# http://code.google.com/apis/checkout/developer/index.html#chargeback_amount_notification
|
392
|
-
class ChargebackAmountNotification
|
393
|
-
# The serial number of the notification (String).
|
394
|
-
attr_accessor :serial_number
|
395
|
-
|
396
|
-
# The order number in Google's database (String).
|
397
|
-
attr_accessor :google_order_number
|
398
|
-
|
399
|
-
# The timestamp of the notification
|
400
|
-
attr_accessor :timestamp
|
364
|
+
class ChargebackAmountNotification < Notification
|
401
365
|
|
402
366
|
# The amount most recently charged back for an order (Money)
|
403
367
|
attr_accessor :latest_chargeback_amount
|
@@ -405,14 +369,6 @@ module Google4R #:nodoc:
|
|
405
369
|
# The total amount charged back for an order (Money)
|
406
370
|
attr_accessor :total_chargeback_amount
|
407
371
|
|
408
|
-
# The Frontend instance for this Notification
|
409
|
-
attr_accessor :frontend
|
410
|
-
|
411
|
-
# Initializes the ChargebackAmountNotification instance with the given Frontend instance.
|
412
|
-
def initialize(frontend)
|
413
|
-
@frontend = frontend
|
414
|
-
end
|
415
|
-
|
416
372
|
# Factory method that creates a new ChargebackAmountNotification from an REXML::Element instance.
|
417
373
|
# Use this to create instances of ChargebackAmountNotification.
|
418
374
|
#
|
@@ -442,15 +398,7 @@ module Google4R #:nodoc:
|
|
442
398
|
# request for an explicit credit card reauthorization.
|
443
399
|
# See the Google Checkout documentation for more details:
|
444
400
|
# http://code.google.com/apis/checkout/developer/index.html#authorization_amount_notification
|
445
|
-
class AuthorizationAmountNotification
|
446
|
-
# The serial number of the notification (String).
|
447
|
-
attr_accessor :serial_number
|
448
|
-
|
449
|
-
# The order number in Google's database (String).
|
450
|
-
attr_accessor :google_order_number
|
451
|
-
|
452
|
-
# The timestamp of the notification
|
453
|
-
attr_accessor :timestamp
|
401
|
+
class AuthorizationAmountNotification < Notification
|
454
402
|
|
455
403
|
# The amount that is reauthorized to be charged to the customer's credit card (Money)
|
456
404
|
attr_accessor :authorization_amount
|
@@ -463,14 +411,6 @@ module Google4R #:nodoc:
|
|
463
411
|
|
464
412
|
# Credit verification value for the order (String)
|
465
413
|
attr_accessor :cvn_response
|
466
|
-
|
467
|
-
# The Frontend instance for this Notification
|
468
|
-
attr_accessor :frontend
|
469
|
-
|
470
|
-
# Initializes the AuthorizationAmountNotification instance with the given Frontend instance.
|
471
|
-
def initialize(frontend)
|
472
|
-
@frontend = frontend
|
473
|
-
end
|
474
414
|
|
475
415
|
# Factory method that creates a new AuthorizationAmountNotification from an REXML::Element instance.
|
476
416
|
# Use this to create instances of AuthorizationAmountNotification.
|
@@ -501,12 +441,7 @@ module Google4R #:nodoc:
|
|
501
441
|
# Google Checkout sends out <risk-information-notification> messages for fraud detection
|
502
442
|
# related information. See the Google Checkout documentation for more details:
|
503
443
|
# http://code.google.com/apis/checkout/developer/index.html#risk_information_notification
|
504
|
-
class RiskInformationNotification
|
505
|
-
# The serial number of the notification (String).
|
506
|
-
attr_accessor :serial_number
|
507
|
-
|
508
|
-
# The order number in Google's database (String).
|
509
|
-
attr_accessor :google_order_number
|
444
|
+
class RiskInformationNotification < Notification
|
510
445
|
|
511
446
|
# Is the order eligible for Google Checkout's payment guarantee policy (boolean).
|
512
447
|
attr_accessor :eligible_for_protection
|
@@ -527,18 +462,7 @@ module Google4R #:nodoc:
|
|
527
462
|
attr_accessor :ip_address
|
528
463
|
|
529
464
|
# The age of the buyer's google checkout account in days
|
530
|
-
attr_accessor :buyer_account_age
|
531
|
-
|
532
|
-
# The timestamp of the notification
|
533
|
-
attr_accessor :timestamp
|
534
|
-
|
535
|
-
# The Frontend instance for this Notification
|
536
|
-
attr_accessor :frontend
|
537
|
-
|
538
|
-
# Initializes the RiskInformationNotification instance with the given Frontend instance.
|
539
|
-
def initialize(frontend)
|
540
|
-
@frontend = frontend
|
541
|
-
end
|
465
|
+
attr_accessor :buyer_account_age
|
542
466
|
|
543
467
|
# Factory method that creates a new RiskInformationNotification from an REXML::Element instance.
|
544
468
|
# Use this to create instances of RiskInformationNotification
|