Network balance limit (Client dependent)#38
Network balance limit (Client dependent)#38shivkumarsah wants to merge 9 commits intofacebookarchive:masterfrom
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
@shivkumarsah updated the pull request - view changes |
kkroo
left a comment
There was a problem hiding this comment.
Thanks! Some small changes.
| """Crispy form to set Network balance limit and transaction. | ||
| set min_value =0.01 so that it will not accept 0 value""" | ||
|
|
||
| limit = forms.CharField(required=False, label="Maximum Balance Limit", |
There was a problem hiding this comment.
More clear name like max_balalance?
There was a problem hiding this comment.
comments incorporated in commit id :1e5832b491ca904b5fd002d9d61f3d1fca09cbcf
|
|
||
| limit = forms.CharField(required=False, label="Maximum Balance Limit", | ||
| max_length=10) | ||
| transaction = forms.CharField(required=False, max_length=3, |
There was a problem hiding this comment.
max_transfer_attempts or max_unsuccessful_transfers?
There was a problem hiding this comment.
comments incorporated in commit id :1e5832b491ca904b5fd002d9d61f3d1fca09cbcf
cloud/endagaweb/models.py
Outdated
| # etc so they can be filtered out of alerts. For internal use. | ||
| environment = models.TextField(default="default") | ||
| # Added for Network Balance Limit | ||
| max_account_limit = models.BigIntegerField(default=10000) |
There was a problem hiding this comment.
this should mention balance max_balance maybe?
There was a problem hiding this comment.
comments incorporated in commit id :1e5832b491ca904b5fd002d9d61f3d1fca09cbcf
cloud/endagaweb/models.py
Outdated
| environment = models.TextField(default="default") | ||
| # Added for Network Balance Limit | ||
| max_account_limit = models.BigIntegerField(default=10000) | ||
| max_failure_transaction = models.IntegerField(default=3) |
There was a problem hiding this comment.
is this specific to all transactions or transfers?
There was a problem hiding this comment.
yes this network max balance limit applied to network.If any transaction happen for subscriber of same network this is applied on them
| {% block js %} | ||
|
|
||
| <script type="text/javascript" | ||
| src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script> |
There was a problem hiding this comment.
Check your jquery version matches the rest of the site. Try to use the same CDN if possible
There was a problem hiding this comment.
please keep changes local to the PR. This will result in merge conflicts
cloud/endagaweb/views/dashboard.py
Outdated
| if abs(amount) > 2147483647: | ||
| raise ValueError(error_text) | ||
| if sub.balance + amount > network.max_account_limit: | ||
| error_text = 'Error : Crossed Credit Limit.' |
There was a problem hiding this comment.
Print out the max limit in the error message? Also check your units. I am pretty sure sub.balance is actually in millicents/pesos depending on the currency selected. Testing this in USD is a good idea. Also can we write tests for this?
cloud/endagaweb/views/network.py
Outdated
| CURRENCIES[currency]).amount_raw | ||
| validity_days = int(request.POST.get('validity_days')) or 0 | ||
| if validity_days > 10000: | ||
| validity_days = 10000 |
There was a problem hiding this comment.
NIT: Raise an error rather than forcing a maximum?
There was a problem hiding this comment.
please incorporate the change into this review
| return redirect(urlresolvers.reverse('network-denominations')) | ||
|
|
||
| user_profile = models.UserProfile.objects.get(user=request.user) | ||
| with transaction.atomic(): |
cloud/endagaweb/views/network.py
Outdated
|
|
||
| if request.POST.get('transaction') == "" and request.POST.get( | ||
| 'limit') == "": | ||
| error_text = 'Error : please provide value.' |
There was a problem hiding this comment.
Just saying you can do a lot of these checks in subclasses of forms.Form and raise forms.ValidationError
cloud/endagaweb/models.py
Outdated
|
|
||
| def __unicode__(self): | ||
| return "Amount %s - %d for %s(days)" % ( | ||
| self.start_amount, self.end_amount, self.validity_days) |
There was a problem hiding this comment.
NIT: humanize_credits on this?
There was a problem hiding this comment.
please dont open new PRs for fixes to existing PRs its difficult to keep track of changes this way
|
Careful to split out reviews. I think this also contained #39 |
|
@shivkumarsah updated the pull request - view changes |
|
@shivkumarsah updated the pull request - view changes |
|
@shivkumarsah updated the pull request - view changes |
|
is this ready for review? |
|
yes , please review.As suggested comments are incorporated. |
| {% block js %} | ||
|
|
||
| <script type="text/javascript" | ||
| src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script> |
There was a problem hiding this comment.
please keep changes local to the PR. This will result in merge conflicts
cloud/endagaweb/views/dashboard.py
Outdated
| currency_value = str(humanize_credits(network.max_balance, CURRENCIES[currency])) | ||
| if abs(amount) > 2147483647: | ||
| raise ValueError(error_text) | ||
| if (sub.balance + amount) > network.max_balance: |
There was a problem hiding this comment.
I believe we wanted to disable this check of the operator UI
There was a problem hiding this comment.
We will implement this on the client
cloud/endagaweb/views/network.py
Outdated
| CURRENCIES[currency]).amount_raw | ||
| validity_days = int(request.POST.get('validity_days')) or 0 | ||
| if validity_days > 10000: | ||
| validity_days = 10000 |
There was a problem hiding this comment.
please incorporate the change into this review
| <a href=" | ||
| {% if active_tab == 'limit' %} # | ||
| #{% else %}{% url 'network_balance_limit' %} | ||
| {% endif %}">Limit</a> |
There was a problem hiding this comment.
Rename this to Security/Safety
| @@ -0,0 +1,305 @@ | |||
| {% extends "dashboard/layout.html" %} | |||
There was a problem hiding this comment.
As per our phone call, lets make the denominations a continuous range?
There was a problem hiding this comment.
this will be fixed as part of sprint 5
…nce limit,Unsuccessful transactions and denomination brackets,disable max balance check of the operator UI and made denomination changes
|
@shivkumarsah updated the pull request - view changes |
|
@shivkumarsah updated the pull request - view changes |
|
@9muir has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
@shivkumarsah updated the pull request - view changes - changes since last import |
|
@9muir has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |


Please review network/subscriber credit limit implementation which include the below features: