google4r-checkout 1.1.2 → 1.1.3

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  =google4r-checkout Changelog
2
2
 
3
+ == 1.1.3 (2012-07-11)
4
+
5
+ * More complete Notification History API support, contributed by Ben Hutton
6
+
3
7
  == 1.1.2 (2012-05-31)
4
8
 
5
9
  * Added support for donation processing, contributed by Paul Schreiber
@@ -168,6 +168,27 @@ module Google4R #:nodoc:
168
168
  return RefundAmountNotification.create_from_element xml_doc.root, @frontend
169
169
  when 'chargeback-amount-notification'
170
170
  return ChargebackAmountNotification.create_from_element xml_doc.root, @frontend
171
+ when 'notification-history-response'
172
+ next_page_token = xml_doc.root.elements['next-page-token'].try(:value)
173
+ notifications = xml_doc.root.elements['notifications'].elements.map do |element|
174
+ case element.name
175
+ when 'new-order-notification'
176
+ NewOrderNotification.create_from_element element, @frontend
177
+ when 'risk-information-notification'
178
+ RiskInformationNotification.create_from_element element, @frontend
179
+ when 'order-state-change-notification'
180
+ OrderStateChangeNotification.create_from_element element, @frontend
181
+ when 'charge-amount-notification'
182
+ ChargeAmountNotification.create_from_element element, @frontend
183
+ when 'authorization-amount-notification'
184
+ AuthorizationAmountNotification.create_from_element element, @frontend
185
+ when 'refund-amount-notification'
186
+ RefundAmountNotification.create_from_element element, @frontend
187
+ when 'chargeback-amount-notification'
188
+ ChargebackAmountNotification.create_from_element element, @frontend
189
+ end
190
+ end
191
+ { :notifications => notifications, :next_page_token => next_page_token }
171
192
  else
172
193
  raise "Unknown response:\n--\n#{xml_doc.to_s}\n--"
173
194
  end
@@ -699,12 +720,21 @@ module Google4R #:nodoc:
699
720
  # google to the notification callback URL
700
721
  class NotificationHistoryRequestCommand < Command
701
722
 
702
- attr_reader :serial_number
723
+ attr_reader :serial_number, :start_time, :end_time, :notification_types, :order_numbers, :next_page_token
703
724
 
704
- def initialize(frontend, serial_number)
725
+ def initialize(frontend, args)
705
726
  super frontend
706
-
707
- @serial_number = serial_number
727
+
728
+ if args.is_a? Hash
729
+ @serial_number = args[:serial_number]
730
+ @start_time = args[:start_time]
731
+ @end_time = args[:end_time]
732
+ @notification_types = args[:notification_types]
733
+ @order_numbers = args[:order_numbers]
734
+ @next_page_token = args[:next_page_token]
735
+ else
736
+ @serial_number = args
737
+ end
708
738
  end
709
739
 
710
740
  def to_xml
@@ -1020,22 +1020,55 @@ module Google4R #:nodoc:
1020
1020
  end
1021
1021
  end
1022
1022
  end
1023
-
1023
+
1024
1024
  class NotificationHistoryReportCommandXmlGenerator < CommandXmlGenerator
1025
-
1025
+
1026
1026
  def initialize(command)
1027
1027
  @command = command
1028
1028
  end
1029
-
1029
+
1030
1030
  protected
1031
-
1031
+
1032
1032
  def process_command(command)
1033
1033
  root = super
1034
-
1035
- sn_element = root.add_element('serial-number')
1036
- sn_element.text = command.serial_number
1034
+
1035
+ if command.serial_number
1036
+ element = root.add_element('serial-number')
1037
+ element.text = command.serial_number
1038
+ end
1039
+
1040
+ if command.start_time
1041
+ element = root.add_element('start-time')
1042
+ element.text = command.start_time.xmlschema
1043
+ end
1044
+
1045
+ if command.end_time
1046
+ element = root.add_element('end-time')
1047
+ element.text = command.end_time.xmlschema
1048
+ end
1049
+
1050
+ if command.notification_types.present?
1051
+ nt_element = root.add_element('notification-types')
1052
+ command.notification_types.each do |notification_type|
1053
+ element = nt_element.add_element('notification-type')
1054
+ element.text = notification_type
1055
+ end
1056
+ end
1057
+
1058
+ if command.order_numbers.present?
1059
+ on_element = root.add_element('order-numbers')
1060
+ command.order_numbers.each do |order_number|
1061
+ element = on_element.add_element('google-order-number')
1062
+ element.text = order_number
1063
+ end
1064
+ end
1065
+
1066
+ if command.next_page_token
1067
+ element = root.add_element('next-page-token')
1068
+ element.text = command.next_page_token
1069
+ end
1070
+
1037
1071
  end
1038
1072
  end
1039
-
1040
1073
  end
1041
1074
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google4r-checkout
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,14 +14,15 @@ authors:
14
14
  - Chris Parrish
15
15
  - Larry Salibra
16
16
  - Paul Schreiber
17
+ - Ben Hutton
17
18
  autorequire:
18
19
  bindir: bin
19
20
  cert_chain: []
20
- date: 2012-05-31 00:00:00.000000000 Z
21
+ date: 2012-07-11 00:00:00.000000000 Z
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
24
  name: money
24
- requirement: &70193619970700 !ruby/object:Gem::Requirement
25
+ requirement: !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
28
  - - ! '>='
@@ -29,10 +30,15 @@ dependencies:
29
30
  version: 2.3.0
30
31
  type: :runtime
31
32
  prerelease: false
32
- version_requirements: *70193619970700
33
+ version_requirements: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 2.3.0
33
39
  - !ruby/object:Gem::Dependency
34
40
  name: mocha
35
- requirement: &70193619970280 !ruby/object:Gem::Requirement
41
+ requirement: !ruby/object:Gem::Requirement
36
42
  none: false
37
43
  requirements:
38
44
  - - ! '>='
@@ -40,10 +46,15 @@ dependencies:
40
46
  version: '0'
41
47
  type: :development
42
48
  prerelease: false
43
- version_requirements: *70193619970280
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
44
55
  - !ruby/object:Gem::Dependency
45
56
  name: nokogiri
46
- requirement: &70193619969820 !ruby/object:Gem::Requirement
57
+ requirement: !ruby/object:Gem::Requirement
47
58
  none: false
48
59
  requirements:
49
60
  - - ! '>='
@@ -51,10 +62,15 @@ dependencies:
51
62
  version: '0'
52
63
  type: :development
53
64
  prerelease: false
54
- version_requirements: *70193619969820
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
55
71
  - !ruby/object:Gem::Dependency
56
72
  name: rake
57
- requirement: &70193619969380 !ruby/object:Gem::Requirement
73
+ requirement: !ruby/object:Gem::Requirement
58
74
  none: false
59
75
  requirements:
60
76
  - - ! '>='
@@ -62,7 +78,12 @@ dependencies:
62
78
  version: '0'
63
79
  type: :development
64
80
  prerelease: false
65
- version_requirements: *70193619969380
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
66
87
  description: ! " google4r-checkout is a lightweight, framework-agnostic Ruby library
67
88
  to access the Google Checkout service and implement \n notification handlers. It
68
89
  exposes object-oriented wrappers for all of Google Checkout's API commands and notifications.\n"
@@ -171,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
192
  version: '0'
172
193
  requirements: []
173
194
  rubyforge_project:
174
- rubygems_version: 1.8.11
195
+ rubygems_version: 1.8.23
175
196
  signing_key:
176
197
  specification_version: 3
177
198
  summary: Full-featured Google Checkout library for Ruby
@@ -241,4 +262,3 @@ test_files:
241
262
  - test/unit/us_zip_area_test.rb
242
263
  - test/unit/world_area_test.rb
243
264
  - test/test_helper.rb
244
- has_rdoc: