Skip to content
This repository has been archived by the owner on Sep 26, 2018. It is now read-only.

Subscriber adjust credit - DO NOT MERGE #40

Conversation

shivkumarsah
Copy link
Contributor

Please review subscriber adjust credit enhancement which add the below validation:

  • Credit amount must fall in denomination range defined.
  • Credit amount must be less than max credit limit set
  • Update credit update to client
  • Change user status to 'active' after successful recharge if user is deactivated.

@facebook-github-bot
Copy link

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 [email protected]. 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 [email protected] if you have any questions.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Contributor

@kkroo kkroo left a comment

Choose a reason for hiding this comment

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

Move computations out of PendingCreditUpdate and add expiry field to Subscriber model

@@ -978,6 +979,9 @@ class Network(models.Model):
# Network environments let you specify things like "prod", "test", "dev",
# 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does these fields need to be in the PendingCreditUpdate or can we query it from the associated Network ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is depended on PR #38 and part of parent PR

# Get subscriber's 1st number from some admin number.
num = Number.objects.filter(
subscriber__imsi=update.subscriber.imsi)[0:1].get()
if num.valid_through is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. This field doesn't exist it seems in Number. Probably better to put it under Subscriber since Numbers can be recycled
  2. None validation should be done by the model to ensure its never None

bts.mark_active()
bts.save()
with transaction.atomic():
expiry_date = update.valid_through
Copy link
Contributor

Choose a reason for hiding this comment

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

This expiry date can be computed here using a denomination lookup and current subscriber balance expiry date rather than storing it in the PendingCreditUpdate

@facebook-github-bot
Copy link

@shivkumarsah updated the pull request - view changes

@facebook-github-bot
Copy link

@shivkumarsah updated the pull request - view changes

- if  amount 10 in exist in 2 denomination, recharge with larger denomination
@facebook-github-bot
Copy link

@shivkumarsah updated the pull request - view changes

@shivkumarsah
Copy link
Contributor Author

Check for denomination and network limit in adjust credit from web is not required now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants