| Line 11540... |
Line 11540... |
| 11540 |
l3 = session.query(PMSA.id).filter(PMSA.l1_id == a.id).filter(PMSA.level == "L3").count()
|
11540 |
l3 = session.query(PMSA.id).filter(PMSA.l1_id == a.id).filter(PMSA.level == "L3").count()
|
| 11541 |
not_activated = session.query(PMSA.id).filter(PMSA.l1_id == a.id).filter(PMSA.activated == False).count()
|
11541 |
not_activated = session.query(PMSA.id).filter(PMSA.l1_id == a.id).filter(PMSA.activated == False).count()
|
| 11542 |
total = session.query(PMSA.id).filter(PMSA.l1_id == a.id).count()
|
11542 |
total = session.query(PMSA.id).filter(PMSA.l1_id == a.id).count()
|
| 11543 |
return [l2,l3,total,not_activated,total-not_activated]
|
11543 |
return [l2,l3,total,not_activated,total-not_activated]
|
| 11544 |
|
11544 |
|
| 11545 |
def credit_user_wallet(userId, amount):
|
11545 |
def credit_user_wallet(userId, amount, cash_back):
|
| 11546 |
user_client = UserClient().get_client()
|
11546 |
user_client = UserClient().get_client()
|
| 11547 |
t_user = user_client.getUserById(userId)
|
11547 |
t_user = user_client.getUserById(userId)
|
| 11548 |
if t_user.userId == -1 or amount <=0:
|
11548 |
if t_user.userId == -1 or amount <=0:
|
| 11549 |
raise
|
11549 |
raise
|
| 11550 |
ap = AdvancePayments()
|
11550 |
ap = AdvancePayments()
|
| 11551 |
ap.userId = userId
|
11551 |
ap.userId = userId
|
| 11552 |
ap.amount = amount
|
11552 |
ap.amount = amount
|
| 11553 |
ap.cash_back = 1
|
11553 |
ap.cash_back = cash_back
|
| 11554 |
ap.cash_back_type = "PERCENTAGE"
|
11554 |
ap.cash_back_type = "PERCENTAGE"
|
| 11555 |
ap.cash_back_amount = int(math.floor(amount * .01))
|
11555 |
ap.cash_back_amount = int(math.floor(amount * (cash_back/100)))
|
| 11556 |
session.commit()
|
11556 |
session.commit()
|
| 11557 |
add_amount_in_wallet(userId, ap.amount + ap.cash_back_amount, ap.id, WalletReferenceType.ADVANCE_AMOUNT, True, True)
|
11557 |
add_amount_in_wallet(userId, ap.amount + ap.cash_back_amount, ap.id, WalletReferenceType.ADVANCE_AMOUNT, True, True)
|
| 11558 |
return True
|
11558 |
return True
|
| 11559 |
|
11559 |
|
| 11560 |
#refund complete shipping if type is list else as per map
|
11560 |
#refund complete shipping if type is list else as per map
|