Subversion Repositories SmartDukaan

Rev

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

Rev 11633 Rev 11654
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
        
5324
        wallet = WalletForCompany.get_by(companyId=store.companyId).with_lockmode("update").one()
5325
        wallet = WalletForCompany.query.filter(WalletForCompany.companyId==store.companyId).with_lockmode("update").one()
5325
        wh = WalletHistoryForCompany()
5326
        wh = WalletHistoryForCompany()
5326
        wh.walletId = wallet.id
5327
        wh.walletId = wallet.id
5327
        wh.amount = rechargeTransaction.amount
5328
        wh.amount = rechargeTransaction.amount
5328
        wh.transactionTime = rechargeTransaction.responseTime
5329
        wh.transactionTime = rechargeTransaction.responseTime
5329
        wh.openingBal = wallet.amount
5330
        wh.openingBal = wallet.amount
Line 5368... Line 5369...
5368
    rechargeTransaction.payMethod = t_recharge.payMethod
5369
    rechargeTransaction.payMethod = t_recharge.payMethod
5369
    
5370
    
5370
    store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5371
    store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5371
    if not rechargeTransaction.circleId:
5372
    if not rechargeTransaction.circleId:
5372
        rechargeTransaction.circleId = store.circleId
5373
        rechargeTransaction.circleId = store.circleId
5373
 
5374
            
5374
    wallet = WalletForCompany.get_by(companyId=store.companyId).with_lockmode("update").one()
5375
    wallet = WalletForCompany.query.filter(WalletForCompany.companyId==store.companyId).with_lockmode("update").one()
5375
    if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
5376
    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.")
5377
        raise TransactionServiceException(898, "Either wallet amount for company or available limit for store is less than recharge amount.")
5377
    
5378
    
5378
    wh = WalletHistoryForCompany()
5379
    wh = WalletHistoryForCompany()
5379
    wh.walletId = wallet.id
5380
    wh.walletId = wallet.id
Line 5417... Line 5418...
5417
            rechargeTransaction.description = "Customer Exceeded Daily Limit"
5418
            rechargeTransaction.description = "Customer Exceeded Daily Limit"
5418
        elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
5419
        elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
5419
            rechargeTransaction.description = "Invalid Device Number"
5420
            rechargeTransaction.description = "Invalid Device Number"
5420
 
5421
 
5421
        store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5422
        store = HotspotStore.get_by(id=rechargeTransaction.storeId)
5422
        wallet = WalletForCompany.get_by(companyId=store.companyId).with_lockmode("update").one()
5423
        wallet = WalletForCompany.query.filter(WalletForCompany.companyId==store.companyId).with_lockmode("update").one()
5423
        wh = WalletHistoryForCompany()
5424
        wh = WalletHistoryForCompany()
5424
        wh.walletId = wallet.id
5425
        wh.walletId = wallet.id
5425
        wh.amount = rechargeTransaction.amount
5426
        wh.amount = rechargeTransaction.amount
5426
        wh.transactionTime = rechargeTransaction.responseTime
5427
        wh.transactionTime = rechargeTransaction.responseTime
5427
        wh.openingBal = wallet.amount
5428
        wh.openingBal = wallet.amount