Subversion Repositories SmartDukaan

Rev

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

Rev 13951 Rev 13952
Line 185... Line 185...
185
        if refundToWallet(batchId, userAmountMap):
185
        if refundToWallet(batchId, userAmountMap):
186
            client.Dtr.merchantOrder.update({'subOrders.cashBackStatus':Store.CB_CREDIT_IN_PROCESS},{'$set':{'subOrders.$.cashBackStatus':Store.CB_CREDITED, 'subOrders.$.batchId':batchId}}, multi=True)
186
            client.Dtr.merchantOrder.update({'subOrders.cashBackStatus':Store.CB_CREDIT_IN_PROCESS},{'$set':{'subOrders.$.cashBackStatus':Store.CB_CREDITED, 'subOrders.$.batchId':batchId}}, multi=True)
187
            for key, value in userAmountMap.iteritems():
187
            for key, value in userAmountMap.iteritems():
188
                client.Dtr.refund.insert({"userId": key, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S")})
188
                client.Dtr.refund.insert({"userId": key, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S")})
189
                client.Dtr.user.update({"userId":key}, {'$inc': { "credited": value}}, upsert=True)
189
                client.Dtr.user.update({"userId":key}, {'$inc': { "credited": value}}, upsert=True)
-
 
190
            tprint("PayBack Settled")
190
        else:
191
        else:
191
            tprint("Error Occurred while running batch. Rolling Back")
192
            tprint("Error Occurred while running batch. Rolling Back")
192
            client.Dtr.merchantOrder.update({'subOrders.cashBackStatus':Store.CB_CREDIT_IN_PROCESS},{'$set':{'subOrders.$.cashBackStatus':Store.CB_APPROVED}}, multi=True)    
193
            client.Dtr.merchantOrder.update({'subOrders.cashBackStatus':Store.CB_CREDIT_IN_PROCESS},{'$set':{'subOrders.$.cashBackStatus':Store.CB_APPROVED}}, multi=True)    
193
    
194
    
194
def refundToWallet(batchId, userAmountMap):
195
def refundToWallet(batchId, userAmountMap):