Subversion Repositories SmartDukaan

Rev

Rev 7125 | Rev 7139 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7125 Rev 7127
Line 4522... Line 4522...
4522
 
4522
 
4523
def get_recharge_transactions(storeId):
4523
def get_recharge_transactions(storeId):
4524
    query = RechargeTransaction.query.filter(RechargeTransaction.storeId == storeId)
4524
    query = RechargeTransaction.query.filter(RechargeTransaction.storeId == storeId)
4525
    return query.all()
4525
    return query.all()
4526
 
4526
 
-
 
4527
def update_recharge_transaction_status(id, status, refundTime):
-
 
4528
    rechargeTransaction = RechargeTransaction.get_by(id=id)
-
 
4529
    if status == RechargeOrderStatus.RECHARGE_FAILED_REFUNDED:
-
 
4530
        rechargeTransaction.status = RechargeOrderStatus.RECHARGE_FAILED_REFUNDED
-
 
4531
        rechargeTransaction.responseTime = refundTime 
-
 
4532
        
-
 
4533
        store = HotspotStore.get_by(id=rechargeTransaction.storeId)
-
 
4534
        wallet = WalletForCompany.get_by(companyId=store.companyId)
-
 
4535
        wh = WalletHistoryForCompany()
-
 
4536
        wh.walletId = wallet.id
-
 
4537
        wh.amount = rechargeTransaction.amount
-
 
4538
        wh.transactionTime = rechargeTransaction.responseTime
-
 
4539
        wh.openingBal = wallet.amount
-
 
4540
        wh.closingBal = wallet.amount + wh.amount
-
 
4541
        wh.referenceNumber = rechargeTransaction.id 
-
 
4542
        wh.description = "Credited amount"
-
 
4543
        
-
 
4544
        wallet.amount = wallet.amount + rechargeTransaction.amount
-
 
4545
        store.availableLimit = store.availableLimit + rechargeTransaction.amount
-
 
4546
        store.collectedAmount = store.collectedAmount - rechargeTransaction.amount + rechargeTransaction.discount
-
 
4547
        session.commit()
-
 
4548
    
4527
def create_recharge_transaction(t_recharge):
4549
def create_recharge_transaction(t_recharge):
4528
    rechargeTransaction = RechargeTransaction()
4550
    rechargeTransaction = RechargeTransaction()
4529
    rechargeTransaction.amount = t_recharge.amount
4551
    rechargeTransaction.amount = t_recharge.amount
4530
    rechargeTransaction.circleId = t_recharge.circleId
4552
    rechargeTransaction.circleId = t_recharge.circleId
4531
    rechargeTransaction.deviceNum = t_recharge.deviceNum
4553
    rechargeTransaction.deviceNum = t_recharge.deviceNum