Open WillBDaniels opened 7 years ago
Using UTC is a good call as long as the PaySimple API uses UTC, if not then conversion would have to be done before the final request is submitted to the API. Then again, if you are only doing things on a date basis I'm not sure UTC would really help the matter.
The Paysimple API definitely uses UTC under the hood. I can only think of situations where we would compare days with the currently exposed functionality, so the only issue with it currently (if we switched everything to checking days like it should) would be in the following scenario:
I submit a new recurring payment for DateTime.Now, which happens to be, say, 11:00 P.M. MST Under the hood, the system does a comparison to DateTime.UTCNow, which would then say 'oh, it's actually tomorrow', which would then cause the check for '>= today' to fail, and the validation would fail out. This would create an effective 'dead zone' of DateTime.Now for 5-8 hours before midnight where recurring payments that are set to start on the current day would fail.
In my mind, there are 3 solutions:
my vote for ease of implementation would just be #1, but I could be convinced other ways also
Currently, for all of our recurring payments, we validate the recurring payment input parameters as such:
This is suboptimal, as if someone wants a payment to start on the day it is made using DateTime.Now, this will fail, as the initial call to DateTime.Now will have been evaluated some number of milliseconds+ before this check, causing it to fail. Instead, anywhere we do this sort of check, we should be checking that the start date is not an entire day in the past. This also brings up UTC considerations that should be investigated... do we have the user set a global TimeZone across the SDK, which is then used in all date math, or do we force UTC across the board? I'm inclined to force UTC to avoid bugs, but I could be swayed.