Skip to content

Conversation

@prateekj117
Copy link
Member

@prateekj117 prateekj117 commented Jul 4, 2019

Fixes #6034

Short description of what this resolves:

It adds a check to restrict an unverified user from placing free order.

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@prateekj117
Copy link
Member Author

@iamareebjamal Please review.

@codecov
Copy link

codecov bot commented Jul 4, 2019

Codecov Report

Merging #6140 into development will decrease coverage by 0.02%.
The diff coverage is 54.54%.

Impacted file tree graph

@@              Coverage Diff               @@
##           development   #6140      +/-   ##
==============================================
- Coverage        66.13%   66.1%   -0.03%     
==============================================
  Files              288     288              
  Lines            14479   14484       +5     
==============================================
  Hits              9575    9575              
- Misses            4904    4909       +5
Impacted Files Coverage Δ
app/api/attendees.py 37.22% <100%> (ø) ⬆️
app/api/orders.py 30.46% <50%> (-0.56%) ⬇️

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 0a5f6cd...a809c04. Read the comment docs.

Copy link
Member

@kushthedude kushthedude left a comment

Choose a reason for hiding this comment

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

@prateekj117 Please add validation to check if there is a discount code or not, If there is then don't throw 422

raise UnprocessableEntity(
{'pointer': '/data/relationships/ticket'},
{'pointer': '/data/relationships/order'},
"Unverified user cannot buy free tickets"
Copy link
Member

Choose a reason for hiding this comment

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

Unverified user cant place free orders @prateekj117

@prateekj117
Copy link
Member Author

@kushthedude This check is before the discount code is applied.

@kushthedude
Copy link
Member

@kushthedude This check is before the discount code is applied.

Nope, I can't place free order with the discount code, Please check again .

@kushthedude
Copy link
Member

Short description of what this resolves:

@prateekj117 Please fill the template and if not at least fill the issue number it fixes, Makes it easy to automatically close the issue

Copy link
Member

@iamareebjamal iamareebjamal left a comment

Choose a reason for hiding this comment

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

Each and every change in this PR is wrong

Copy link
Member

@mrsaicharan1 mrsaicharan1 left a comment

Choose a reason for hiding this comment

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

Try to re-iterate this PR. maybe that would help in solving this in a better way.

@prateekj117
Copy link
Member Author

@iamareebjamal Please review.

@prateekj117
Copy link
Member Author

@iamareebjamal Please review.

@fossasia fossasia deleted a comment Jul 6, 2019

ticket = db.session.query(Ticket).filter_by(
id=int(ticket_holder_object.ticket_id), deleted_at=None
).first()
Copy link
Member

Choose a reason for hiding this comment

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

What about an order with free & paid tickets for unverified users? They should be blocked as well too right?

@kushthedude
Copy link
Member

kushthedude commented Jul 9, 2019 via email

@prateekj117
Copy link
Member Author

prateekj117 commented Jul 11, 2019

:return:
"""

free_ticket_quantity = 0
Copy link
Member

Choose a reason for hiding this comment

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

Why is this variable declared so far from its use?

@iamareebjamal
Copy link
Member

Looks fine to me, ask peers to review. Taking 8 days for a PR this trivial is not expected

@prateekj117
Copy link
Member Author

@shreyanshdwivedi @uds5501 @mrsaicharan1 Please review.

@iamareebjamal iamareebjamal merged commit 832c755 into fossasia:development Jul 12, 2019
Copy link
Member

@shreyanshdwivedi shreyanshdwivedi left a comment

Choose a reason for hiding this comment

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

Logic looks fine!!

iamareebjamal pushed a commit to iamareebjamal/open-event-server that referenced this pull request Aug 2, 2019
* Restrict unverified user from making free orders.

* Check ticket-type rather than payment-mode

* No need to revert the old PR

* Check if order contains all free tickets.

* Required changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't allow unverified users to place free orders

6 participants