Subversion Repositories SmartDukaan

Rev

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

Rev 7163 Rev 7166
Line 119... Line 119...
119
                    update_recharge_order_status(order.id, RechargeOrderStatus.RECHARGE_FAILED)
119
                    update_recharge_order_status(order.id, RechargeOrderStatus.RECHARGE_FAILED)
120
        except:
120
        except:
121
            print "Do Nothing"
121
            print "Do Nothing"
122
 
122
 
123
    ## For store transactions
123
    ## For store transactions
124
    orders = RechargeTransaction.get_by(status = RechargeOrderStatus.RECHARGE_UNKNOWN)
124
    rorders = RechargeTransaction.query.filter_by(status = RechargeOrderStatus.RECHARGE_UNKNOWN).all()
125
    for order in orders:
125
    for order in rorders:
126
        try:
126
        try:
127
            if order.transactionTime + datetime.timedelta(minutes=10) < datetime.datetime.now():
127
            if order.transactionTime + datetime.timedelta(minutes=10) < datetime.datetime.now():
128
                status, description = checkTransactionStatus('', str(order.id))
128
                status, description = checkTransactionStatus('', str(order.id))
129
                print status, description
129
                print status, description
130
                if status:
130
                if status:
Line 181... Line 181...
181
    push_recharge_collection_to_ocr(storeData, todate)
181
    push_recharge_collection_to_ocr(storeData, todate)
182
    
182
    
183
    dt = session.query(func.sum(RechargeTransaction.amount)).filter(RechargeTransaction.status.in_([RechargeOrderStatus.RECHARGE_SUCCESSFUL])).filter(RechargeTransaction.transactionTime >= todate).filter(RechargeTransaction.transactionTime < tomorrow).one()
183
    dt = session.query(func.sum(RechargeTransaction.amount)).filter(RechargeTransaction.status.in_([RechargeOrderStatus.RECHARGE_SUCCESSFUL])).filter(RechargeTransaction.transactionTime >= todate).filter(RechargeTransaction.transactionTime < tomorrow).one()
184
    wallet = WalletForCompany.query.filter(WalletForCompany.id == 1).one()
184
    wallet = WalletForCompany.query.filter(WalletForCompany.id == 1).one()
185
    if int(dt[0]) != wallet.amount:
185
    if int(dt[0]) != wallet.amount:
186
        mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in"], "Wallet amount: " + wallet.amount + " does not match with transaction amount: " + str(int(dt[0])) , "", [], [], [])    
186
        mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in"], "Wallet amount: " + str(wallet.amount) + " does not match with transaction amount: " + str(int(dt[0])) , "", [], [], [])    
187
             
187
             
188
def push_recharge_collection_to_ocr(storeData, todate):
188
def push_recharge_collection_to_ocr(storeData, todate):
189
    
189
    
190
    for storeId in storeData.keys():
190
    for storeId in storeData.keys():
191
        store = HotspotStore.get_by(id = storeId)
191
        store = HotspotStore.get_by(id = storeId)
Line 244... Line 244...
244
    wh.referenceNumber =  get_next_invoice_number(5)
244
    wh.referenceNumber =  get_next_invoice_number(5)
245
    wh.description = "Wallet Credited"
245
    wh.description = "Wallet Credited"
246
    
246
    
247
    wallet.amount += amount
247
    wallet.amount += amount
248
    session.commit()
248
    session.commit()
249
    mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Wallet topped up by " +  amount + "rupees.", "", [], [], [])
249
    mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Wallet topped up by " +  str(amount) + "rupees.", "", [], [], [])
250
    
250
    
251
if __name__ == '__main__':
251
if __name__ == '__main__':
252
    main()
252
    main()
253
253