Skip to content

Commit

Permalink
Adding notification types
Browse files Browse the repository at this point in the history
  • Loading branch information
benhutton committed Jul 9, 2012
1 parent c81056a commit ef3f820
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/google4r/checkout/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def to_xml
# google to the notification callback URL
class NotificationHistoryRequestCommand < Command

attr_reader :serial_number, :start_time, :end_time
attr_reader :serial_number, :start_time, :end_time, :notification_types

def initialize(frontend, args)
super frontend
Expand All @@ -727,6 +727,7 @@ def initialize(frontend, args)
@serial_number = args[:serial_number]
@start_time = args[:start_time]
@end_time = args[:end_time]
@notification_types = args[:notification_types]
else
@serial_number = args
end
Expand Down
21 changes: 15 additions & 6 deletions lib/google4r/checkout/xml_generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1033,19 +1033,28 @@ def process_command(command)
root = super

if command.serial_number
sn_element = root.add_element('serial-number')
sn_element.text = command.serial_number
element = root.add_element('serial-number')
element.text = command.serial_number
end

if command.start_time
sn_element = root.add_element('start-time')
sn_element.text = command.start_time.xmlschema
element = root.add_element('start-time')
element.text = command.start_time.xmlschema
end

if command.end_time
sn_element = root.add_element('end-time')
sn_element.text = command.end_time.xmlschema
element = root.add_element('end-time')
element.text = command.end_time.xmlschema
end

if command.notification_types.present?
nt_element = root.add_element('notification-types')
command.notification_types.each do |notification_type|
element = nt_element.add_element('notification-type')
element.text = notification_type
end
end

end
end
end
Expand Down

0 comments on commit ef3f820

Please sign in to comment.