Subversion Repositories SmartDukaan

Rev

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

Rev 11584 Rev 11633
Line 5319... Line 5319...
5319
    if status in (RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.RECHARGE_FAILED):
5319
    if status in (RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.RECHARGE_FAILED):
5320
        rechargeTransaction.status = status
5320
        rechargeTransaction.status = status
5321
        rechargeTransaction.responseTime = datetime.datetime.now() 
5321
        rechargeTransaction.responseTime = datetime.datetime.now() 
5322
        
5322
        
5323
        store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5323
        store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5324
        wallet = WalletForCompany.get_by(companyId=store.companyId)
5324
        wallet = WalletForCompany.get_by(companyId=store.companyId).with_lockmode("update").one()
5325
        wh = WalletHistoryForCompany()
5325
        wh = WalletHistoryForCompany()
5326
        wh.walletId = wallet.id
5326
        wh.walletId = wallet.id
5327
        wh.amount = rechargeTransaction.amount
5327
        wh.amount = rechargeTransaction.amount
5328
        wh.transactionTime = rechargeTransaction.responseTime
5328
        wh.transactionTime = rechargeTransaction.responseTime
5329
        wh.openingBal = wallet.amount
5329
        wh.openingBal = wallet.amount
Line 5369... Line 5369...
5369
    
5369
    
5370
    store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5370
    store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5371
    if not rechargeTransaction.circleId:
5371
    if not rechargeTransaction.circleId:
5372
        rechargeTransaction.circleId = store.circleId
5372
        rechargeTransaction.circleId = store.circleId
5373
 
5373
 
5374
    wallet = WalletForCompany.get_by(companyId=store.companyId)
5374
    wallet = WalletForCompany.get_by(companyId=store.companyId).with_lockmode("update").one()
5375
    if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
5375
    if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
5376
        raise TransactionServiceException(898, "Either wallet amount for company or available limit for store is less than recharge amount.")
5376
        raise TransactionServiceException(898, "Either wallet amount for company or available limit for store is less than recharge amount.")
5377
    
5377
    
5378
    wh = WalletHistoryForCompany()
5378
    wh = WalletHistoryForCompany()
5379
    wh.walletId = wallet.id
5379
    wh.walletId = wallet.id
Line 5417... Line 5417...
5417
            rechargeTransaction.description = "Customer Exceeded Daily Limit"
5417
            rechargeTransaction.description = "Customer Exceeded Daily Limit"
5418
        elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
5418
        elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
5419
            rechargeTransaction.description = "Invalid Device Number"
5419
            rechargeTransaction.description = "Invalid Device Number"
5420
 
5420
 
5421
        store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5421
        store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5422
        wallet = WalletForCompany.get_by(companyId=store.companyId)
5422
        wallet = WalletForCompany.get_by(companyId=store.companyId).with_lockmode("update").one()
5423
        wh = WalletHistoryForCompany()
5423
        wh = WalletHistoryForCompany()
5424
        wh.walletId = wallet.id
5424
        wh.walletId = wallet.id
5425
        wh.amount = rechargeTransaction.amount
5425
        wh.amount = rechargeTransaction.amount
5426
        wh.transactionTime = rechargeTransaction.responseTime
5426
        wh.transactionTime = rechargeTransaction.responseTime
5427
        wh.openingBal = wallet.amount
5427
        wh.openingBal = wallet.amount