-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Addition and Updation of billing related fields #6447
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
Conversation
|
@iamareebjamal Please Review |
|
@iamareebjamal I can't debug the issue with |
|
|
The build didn't stop due to this error - #5988 |
Codecov Report
@@ Coverage Diff @@
## development #6447 +/- ##
===============================================
+ Coverage 65.02% 65.03% +<.01%
===============================================
Files 296 296
Lines 15250 15248 -2
===============================================
Hits 9917 9917
+ Misses 5333 5331 -2
Continue to review full report at Codecov.
|
app/api/orders.py
Outdated
| if data.get('is_billing_enabled') and not (data.get('company') and data.get('address') | ||
| and data.get('city') and data.get('zipcode') and data.get('country')): | ||
| raise UnprocessableEntity({'pointer': '/data/attributes/is_billing_enabled'}, | ||
| "Billing information is incomplete.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line over-indented for visual indent
indentation contains mixed spaces and tabs
app/api/orders.py
Outdated
|
|
||
| def check_billing_info(data, order): | ||
| if data.get('is_billing_enabled') and not (data.get('company') and data.get('address') | ||
| and data.get('city') and data.get('zipcode') and data.get('country')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs
|
@iamareebjamal Please Review |
|
Is it ready for merging now? |
Yes it is working now |
app/api/orders.py
Outdated
| :return: | ||
| """ | ||
| if data.get('amount') or data.get('is_billing_enabled'): | ||
| if data.get('amount') or data.get('is_billing_enabled') or order.event.is_billing_info_mandatory: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a problem, this will require billing info on any paid order, whereas it is explicitly stated in the issue to make it optional unless is_billing_info_mandatory is True.
Skipping this PR for now, will add in minor version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging it after release would be better I guess too.
app/api/orders.py
Outdated
| :return: | ||
| """ | ||
| if data.get('amount') or data.get('is_billing_enabled'): | ||
| if data.get('amount') and (data.get('is_billing_enabled') or order.event.is_billing_info_mandatory) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace before ':'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't mark hound violations as resolved
|
@iamareebjamal Updated the PR and tested with making orders and requests too. Also Frontend PR is done too fossasia/open-event-frontend#3654 |
app/api/orders.py
Outdated
| :return: | ||
| """ | ||
| if data.get('amount') or data.get('is_billing_enabled'): | ||
| if data.get('amount') and (data.get('is_billing_enabled') or order.event.is_billing_info_mandatory) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will again, require billing info even if the organizer has asked not to. Please read the issue again. I don't think you understand what the goal is.
Can you tell me what is the goal of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR goal is, If a order is paid and organiser has made billing mandatory , user has to fill it.
And if its not mandatory then user has option to fill or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also Billing information is only needed for paid order hence a condition for data.get(amount)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what
If organiser has not asked for billing info, Then it wont require as I have used and over there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, and this is going to require billing info even when organizer has set event.is_billing_info_mandatory = False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) Only make billing info required if the organizer chose "Require billing info.." (in Wizard). If billing > info is required always show the fields. If the organizer did not require it, show it as an option > > > using a tick box. -> So, if the organizer does not require it, the user can still add the
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, and this is going to require billing info even when organizer has set
event.is_billing_info_mandatory= False
It will billing info only then when the user wants to enter it
iamareebjamal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understand the issue first
Please see the comments. Its working as expected |
What's the use of |
If billing is not mandatory, then its dependent upon the user to enter or not. |
|
|
It's not necessary that the user will set |
If user sets it as true when |
app/api/orders.py
Outdated
| data.get('zipcode') and data.get('country')): | ||
| "Billing information is mandatory for this order.") | ||
| if data.get('is_billing_enabled') and not (data.get('company') and data.get('address') | ||
| and data.get('city') and data.get('zipcode') and data.get('country')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this please. The previous format was according to PEP8
app/api/orders.py
Outdated
| "Billing information is mandatory for paid orders") | ||
| if data.get('is_billing_enabled') and not (data.get('company') and data.get('address') and data.get('city') and | ||
| data.get('zipcode') and data.get('country')): | ||
| "Billing information is mandatory for this order.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove period from the end
app/api/orders.py
Outdated
| and data.get('city') and data.get('zipcode') and data.get('country')): | ||
| raise UnprocessableEntity({'pointer': '/data/attributes/is_billing_enabled'}, | ||
| "Billing information incomplete") | ||
| "Billing information is incomplete.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the period from the end
For now, it is fine. But this may happen - a user enters billing info and does not set is_billing_enabled as true, then incomplete and inconsistent data may be stored in the DB. But, that can be handled later |
@iamareebjamal Made the requested changes. |
|
Complexity increasing per file
==============================
- app/api/orders.py 1
See the complete overview on Codacy |
Fixes #6444