| Line 4562... |
Line 4562... |
| 4562 |
|
4562 |
|
| 4563 |
|
4563 |
|
| 4564 |
|
4564 |
|
| 4565 |
def update_recharge_transaction_status(id, status, refundTime):
|
4565 |
def update_recharge_transaction_status(id, status, refundTime):
|
| 4566 |
rechargeTransaction = RechargeTransaction.get_by(id=id)
|
4566 |
rechargeTransaction = RechargeTransaction.get_by(id=id)
|
| 4567 |
if status == RechargeOrderStatus.RECHARGE_FAILED_REFUNDED:
|
4567 |
if status in (RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.RECHARGE_FAILED):
|
| - |
|
4568 |
rechargeTransaction.status = status
|
| 4568 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_FAILED_REFUNDED
|
4569 |
if status == RechargeOrderStatus.RECHARGE_FAILED_REFUNDED:
|
| 4569 |
rechargeTransaction.responseTime = refundTime
|
4570 |
rechargeTransaction.responseTime = refundTime
|
| 4570 |
|
4571 |
|
| 4571 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
4572 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
| 4572 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
4573 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
| 4573 |
wh = WalletHistoryForCompany()
|
4574 |
wh = WalletHistoryForCompany()
|
| 4574 |
wh.walletId = wallet.id
|
4575 |
wh.walletId = wallet.id
|
| Line 4581... |
Line 4582... |
| 4581 |
|
4582 |
|
| 4582 |
wallet.amount = wallet.amount + rechargeTransaction.amount
|
4583 |
wallet.amount = wallet.amount + rechargeTransaction.amount
|
| 4583 |
store.availableLimit = store.availableLimit + rechargeTransaction.amount
|
4584 |
store.availableLimit = store.availableLimit + rechargeTransaction.amount
|
| 4584 |
store.collectedAmount = store.collectedAmount - rechargeTransaction.amount + rechargeTransaction.discount
|
4585 |
store.collectedAmount = store.collectedAmount - rechargeTransaction.amount + rechargeTransaction.discount
|
| 4585 |
session.commit()
|
4586 |
session.commit()
|
| - |
|
4587 |
|
| - |
|
4588 |
if status == RechargeOrderStatus.RECHARGE_SUCCESSFUL:
|
| - |
|
4589 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_SUCCESSFUL
|
| - |
|
4590 |
rechargeTransaction.invoiceNumber = get_next_invoice_number(OrderType.RCH4HOTSPOT)
|
| - |
|
4591 |
session.commit()
|
| - |
|
4592 |
|
| 4586 |
|
4593 |
|
| 4587 |
def create_recharge_transaction(t_recharge):
|
4594 |
def create_recharge_transaction(t_recharge):
|
| - |
|
4595 |
dt = datetime.datetime.now() - datetime.timedelta(minutes=10)
|
| - |
|
4596 |
txns = RechargeTransaction.query.filter(RechargeTransaction.deviceNum == t_recharge.deviceNum).filter(RechargeTransaction.transactionTime > dt).all()
|
| - |
|
4597 |
if txns:
|
| - |
|
4598 |
raise TransactionServiceException(898, "In last 10 minutes you had already recharged this mobile number. Please try after sometime.")
|
| 4588 |
rechargeTransaction = RechargeTransaction()
|
4599 |
rechargeTransaction = RechargeTransaction()
|
| 4589 |
rechargeTransaction.amount = t_recharge.amount
|
4600 |
rechargeTransaction.amount = t_recharge.amount
|
| 4590 |
rechargeTransaction.circleId = t_recharge.circleId
|
4601 |
rechargeTransaction.circleId = t_recharge.circleId
|
| 4591 |
rechargeTransaction.deviceNum = t_recharge.deviceNum
|
4602 |
rechargeTransaction.deviceNum = t_recharge.deviceNum
|
| 4592 |
rechargeTransaction.deviceType = t_recharge.deviceType
|
4603 |
rechargeTransaction.deviceType = t_recharge.deviceType
|