Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: in subscriptions.create, trial_days using timezone naive utcnow() and add test #576

Merged
merged 2 commits into from
Nov 26, 2021

Conversation

miaoz2001
Copy link

Bugfix: in subscriptions.create, trial_days using timezone naive utcnow() and add test

Fixes #573

What's this PR do?

Bugfix: in subscriptions.create, trial_days using timezone naive utcnow() and add test

Any background context you want to provide?

Issue #573

What ticket or issue # does this fix?

Issue #573
Closes #573

Definition of Done (check if considered and/or addressed):

  • Are all backwards incompatible changes documented in this PR?
  • Have all new dependencies been documented in this PR?
  • Has the appropriate documentation been updated (if applicable)?
  • Have you written tests to prove this change works (if applicable)?

@codecov
Copy link

codecov bot commented Jul 13, 2018

Codecov Report

Merging #576 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #576   +/-   ##
=======================================
  Coverage   99.21%   99.21%           
=======================================
  Files          33       33           
  Lines        1917     1917           
  Branches      175      175           
=======================================
  Hits         1902     1902           
  Misses          7        7           
  Partials        8        8
Flag Coverage Δ
#py27dj110 98.9% <100%> (ø) ⬆️
#py27dj111 98.9% <100%> (ø) ⬆️
#py27dj18 99.16% <100%> (ø) ⬆️
#py34dj110 98.9% <100%> (ø) ⬆️
#py34dj111 98.9% <100%> (ø) ⬆️
#py34dj18 99.16% <100%> (ø) ⬆️
#py34dj20 98.9% <100%> (ø) ⬆️
#py35dj110 98.9% <100%> (ø) ⬆️
#py35dj111 98.9% <100%> (ø) ⬆️
#py35dj18 99.16% <100%> (ø) ⬆️
#py35dj20 98.9% <100%> (ø) ⬆️
#py36dj111 98.9% <100%> (ø) ⬆️
#py36dj20 98.9% <100%> (ø) ⬆️
#py36dj20psql 98.9% <100%> (ø) ⬆️
Impacted Files Coverage Δ
pinax/stripe/actions/subscriptions.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 893572e...c987308. Read the comment docs.

@@ -48,7 +48,7 @@ def create(customer, plan, quantity=None, trial_days=None, token=None, coupon=No

subscription_params = {}
if trial_days:
subscription_params["trial_end"] = datetime.datetime.utcnow() + datetime.timedelta(days=trial_days)
subscription_params["trial_end"] = datetime.datetime.now(tz=timezone.utc) + datetime.timedelta(days=trial_days)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using django.utils.timezone.now()?
It seems to be used in other places.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed another occurrence in #577 for consistency.

…ow()

- Changed to timezone.now()
- Add test
Fixed pinax#573
@miaoz2001 miaoz2001 force-pushed the 573-zhuangmiao-trial_end-days branch from de9dcfb to c987308 Compare July 16, 2018 00:43
@miaoz2001
Copy link
Author

@blueyed yeah, i agree it's better and I have changed the code accordingly.
The branch is updated and squashed into one commit

@paltman paltman changed the base branch from master to 4.x November 26, 2021 16:05
@paltman paltman merged commit 4bc2904 into pinax:4.x Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: in subscriptions.create, trial_days using timezone naive utcnow()
3 participants