| Line 4697... |
Line 4697... |
| 4697 |
rechargeTransaction.operatorId = t_recharge.operatorId
|
4697 |
rechargeTransaction.operatorId = t_recharge.operatorId
|
| 4698 |
rechargeTransaction.plan = t_recharge.plan
|
4698 |
rechargeTransaction.plan = t_recharge.plan
|
| 4699 |
rechargeTransaction.ipAddress = t_recharge.ipAddress
|
4699 |
rechargeTransaction.ipAddress = t_recharge.ipAddress
|
| 4700 |
rechargeTransaction.paymentAmount = t_recharge.paymentAmount
|
4700 |
rechargeTransaction.paymentAmount = t_recharge.paymentAmount
|
| 4701 |
rechargeTransaction.payMethod = t_recharge.payMethod
|
4701 |
rechargeTransaction.payMethod = t_recharge.payMethod
|
| 4702 |
session.commit()
|
- |
|
| 4703 |
|
4702 |
|
| 4704 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
4703 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
| 4705 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
4704 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
| 4706 |
if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
|
4705 |
if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
|
| 4707 |
raise TransactionServiceException(898, "Either wallet amount for company or available limit for store is less than recharge amount.")
|
4706 |
raise TransactionServiceException(898, "Either wallet amount for company or available limit for store is less than recharge amount.")
|
| - |
|
4707 |
|
| 4708 |
wh = WalletHistoryForCompany()
|
4708 |
wh = WalletHistoryForCompany()
|
| 4709 |
wh.walletId = wallet.id
|
4709 |
wh.walletId = wallet.id
|
| 4710 |
wh.amount = -rechargeTransaction.amount
|
4710 |
wh.amount = -rechargeTransaction.amount
|
| 4711 |
wh.transactionTime = rechargeTransaction.transactionTime
|
4711 |
wh.transactionTime = rechargeTransaction.transactionTime
|
| 4712 |
wh.openingBal = wallet.amount
|
4712 |
wh.openingBal = wallet.amount
|
| 4713 |
wh.closingBal = wallet.amount + wh.amount
|
4713 |
wh.closingBal = wallet.amount + wh.amount
|
| 4714 |
wh.referenceNumber = rechargeTransaction.id
|
- |
|
| 4715 |
wh.description = "Debited amount"
|
4714 |
wh.description = "Debited amount"
|
| 4716 |
|
4715 |
|
| 4717 |
wallet.amount = wallet.amount - rechargeTransaction.amount
|
4716 |
wallet.amount = wallet.amount - rechargeTransaction.amount
|
| 4718 |
store.availableLimit = store.availableLimit - rechargeTransaction.amount
|
4717 |
store.availableLimit = store.availableLimit - rechargeTransaction.amount
|
| 4719 |
store.collectedAmount = store.collectedAmount + rechargeTransaction.amount - rechargeTransaction.discount
|
4718 |
store.collectedAmount = store.collectedAmount + rechargeTransaction.amount - rechargeTransaction.discount
|
| 4720 |
session.commit()
|
4719 |
session.commit()
|
| 4721 |
|
4720 |
|
| - |
|
4721 |
wh.referenceNumber = rechargeTransaction.id
|
| - |
|
4722 |
session.commit()
|
| - |
|
4723 |
|
| - |
|
4724 |
|
| 4722 |
strProviderCode = get_provider_code(rechargeTransaction.operatorId)
|
4725 |
strProviderCode = get_provider_code(rechargeTransaction.operatorId)
|
| 4723 |
if rechargeTransaction.deviceType == 1:
|
4726 |
if rechargeTransaction.deviceType == 1:
|
| 4724 |
rtype = 'MTP'
|
4727 |
rtype = 'MTP'
|
| 4725 |
else:
|
4728 |
else:
|
| 4726 |
rtype = 'RCH'
|
4729 |
rtype = 'RCH'
|