Skip to content

fix: Adjust IPN timestamp handler to accomodate PST as well as PDT

stephen requested to merge ipn-timestamp-dst-fix into main

Among the many insufficiencies of the PayPal IPN documentation is a lack of detail regarding the timestamps sent out with IPN messages. One particular aspect of this demi-documentation is the repeated example of timestamps having the timezone specified via three-letter acronym - which, in that documentation, is described almost exclusively as being the string "PDT", or -0700. (The sole exception is for the auth_exp variable, whose example is given in PST.)

These documented examples do not mention any particularities about these timestamps one way or another, but the way in which the example timestamps are formatted suggests heavily that the PDT (or that one PST) are hardcoded.

However, PDT refers specifically to Pacific Daylight Time, and for half the year, in the USA, the west coast uses PST instead, which is -0800. And despite their documentation, PayPal IPNs, it turns out, send a timestamp whose specified timezone is dependent on whether Daylight Savings Time is currently active.

This PR adjusts tordonate.paypal.controller.ipn_time_to_datetime(), the method which converts PayPal's bespoke timestamps to datetime objects, to handle IPN timestamps whether they are listed in PDT or PST.

Merge request reports

Loading