My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 33: Patch to add support for Notification History API
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by jjc1138, Mar 29, 2009
The attached patch adds support to gchecky for the new Notification History
API:
http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Notification_History_API.html
gchecky-notificationhistory.patch
8.3 KB   Download
Comment 1 by etaras...@gmail.com, Mar 29, 2009
Thank you for the patch! Nice work.

The only difficult place to understand for me was:

+    def get_history(self, order_numbers=None,
+                    start_time=None, end_time=None,
+                    notification_types=None, all_pages=True):
+        if order_numbers is None and start_time is None:
+            start_time = datetime.datetime.utcnow() - \
+                datetime.timedelta(days=450) + datetime.timedelta(minutes=1)
+        if end_time is None and start_time is not None:
+            # I occasionally got an error when only subtracting 30 minutes
+            end_time = datetime.datetime.utcnow() - datetime.timedelta(minutes=30,
seconds=5)

IIUC start_time should be a fixed date something close to the launch of Google
Checkout (june or july 2006).

AFAICS the logic is:
no order_numbers => fill start_time with a dummy value (and then also fill end_time)
start_time is present => end_time has to be present

but the following is not handled:
end_time is present => start_time has to be present

I'll apply the patch and test it during this week.

Again thank you for the good work!

Keep it coming. ;-)

PS: send me a word if you want to continue contributing to gchecky for the read-write
access to svn
Comment 2 by jjc1138, Mar 29, 2009
The default start_time uses 450 days ago because that's the earliest that is allowed
by the API (see the "Understanding the API Request Format" section of the docs).

You're right about the missing "end_time is present => start_time has to be present"
case. I've attached an updated patch that adds an extra condition to use the default
start_time in that case.

I don't have plans for any other patches, (the library is working very well for my
needs!), so I don't need write-access at the moment.

Thank you for the great library!
gchecky-notificationhistory-2.patch
8.3 KB   Download
Comment 3 by etaras...@gmail.com, Mar 30, 2009
Hello jjc1138,

> The default start_time uses 450 days ago because that's the earliest that=
 is
> allowed
> by the API (see the "Understanding the API Request Format" section of the
> docs).

I've missed this part -- thanks for the link.

Thank you again for your contribution!
Comment 4 by jjc1138, Nov 28, 2009
I wanted to use this in another project that needed control over the paging, so I've
added that to the patch. Now it returns the next_page_token if Checkout gives one and
accepts it as a parameter to get_history. The attached patch is to be applied after
the gchecky-notificationhistory-2.patch above.
gchecky-notificationhistorypaging.patch
2.5 KB   Download
Sign in to add a comment

Hosted by Google Code