Glench / ExtPay

The JavaScript library for ExtensionPay.com — payments for your browser extensions, no server needed.
https://extensionpay.com
Other
483 stars 62 forks source link

Inconsistencies between user.trialStartedAt value formats #141

Closed marioaburto10 closed 1 year ago

marioaburto10 commented 1 year ago

Issue I noticed that the property user.trialStartedAt has a timestamp value (for example 2023-05-26T04:21:42.296Z) when the user object is being returned within the onTrialStarted listener. When the user object is being returned from the getUser() method, the value is a Date() object (for example Thu May 25 2023 21:21:42 GMT-0700 (Pacific Daylight Time)). The docs say that the values for the property user.trialStartedAt can either be null or a Date() object without mentioning the timestamp type.

Suggested fix Is this an easy code fix that can be implemented so that a Date() object is returned for the property user.trialStartedAt instead of a timestamp value within the onTrialStarted listener? Otherwise an update to the docs would be good. Thank you.

Glench commented 1 year ago

I can't reproduce this. Both values are datetimes in the minimal test case I created. Please create an extension that minimally demonstrates the bug you're describing.

marioaburto10 commented 1 year ago

@Glench before I put something together, can you confirm that you've ran through the use case where you've used a valid email other than a test email in a test use case? I see different behavior when I go through a test trial case vs when I use a different email as an actual user signing up for a trial.

Glench commented 1 year ago

I tried with a real email. You'll need to create a minimal test case and walk me through exactly the steps to reproduce. I'm kind of skeptical the bug you mention is even possible because if you look at the code the same exact function is used in all cases, for onPaid and onTrialStarted listeners.

Glench commented 1 year ago

Any update on this?

marioaburto10 commented 1 year ago

I haven't had the time to create a minimal extension. I'll circle back to this this weekend.

marioaburto10 commented 1 year ago

But I have a workaround in place so I don't see a need to troubleshoot this further. Thank you @Glench