| Line 430... |
Line 430... |
| 430 |
if classkey is not None and hasattr(obj, "__class__"):
|
430 |
if classkey is not None and hasattr(obj, "__class__"):
|
| 431 |
data[classkey] = obj.__class__.__name__
|
431 |
data[classkey] = obj.__class__.__name__
|
| 432 |
return data
|
432 |
return data
|
| 433 |
else:
|
433 |
else:
|
| 434 |
return obj
|
434 |
return obj
|
| - |
|
435 |
|
| - |
|
436 |
def manualCredit(runtype='dry'):
|
| - |
|
437 |
#userAmountMap = {19964:8,7144:9,20274:12,25978:24,29914:24,28026:48,6409:48,2482:49,21852:52,2261:56,8109:57,23372:57,5772:82,29467:82,19612:82,7447:125,15898:126,11701:136,29483:138,20001:162,7070:164,11628:166,5222:250,14074:363,17378:369,7764:684,30153:996}
|
| - |
|
438 |
userAmountMap={}
|
| - |
|
439 |
for key,val in userAmountMap.iteritems():
|
| - |
|
440 |
print "%s\t%s"%(key,val)
|
| - |
|
441 |
if (runtype=='live'):
|
| - |
|
442 |
datetimeNow = datetime.now()
|
| - |
|
443 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
| - |
|
444 |
if refundToWallet(batchId, userAmountMap):
|
| - |
|
445 |
sum=0
|
| - |
|
446 |
creditedSubOrders=0
|
| - |
|
447 |
message = []
|
| - |
|
448 |
for key, value in userAmountMap.iteritems():
|
| - |
|
449 |
sum += value
|
| - |
|
450 |
creditedSubOrders += 1
|
| - |
|
451 |
client.Dtr.refund.insert({"userId": key, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S"), "type":utils.CREDIT_TYPE_ORDER})
|
| - |
|
452 |
client.Dtr.user.update({"userId":key}, {"$inc": { "credited": value, utils.CREDIT_TYPE_ORDER:value}}, upsert=True)
|
| - |
|
453 |
message.append("<b>Batch Id - %d</b><br><b>Total Amount Credited - %d</b><br><b>Total SubOrders Credited- %d</b>"%(batchId,sum, creditedSubOrders))
|
| - |
|
454 |
utils.sendmail(['amit.gupta@shop2020.in', 'rajneesh.arora@saholic.com','khushal.bhatia@saholic.com'], "".join(message), 'Cashback for Order Credited Successfully')
|
| - |
|
455 |
tprint("PayBack Settled")
|
| - |
|
456 |
else:
|
| - |
|
457 |
tprint("Error Occurred while running batch. Rolling Back")
|
| 435 |
|
458 |
|
| 436 |
def ungzipResponse(r):
|
459 |
def ungzipResponse(r):
|
| 437 |
headers = r.info()
|
460 |
headers = r.info()
|
| 438 |
if headers.get('Content-Encoding')=='gzip':
|
461 |
if headers.get('Content-Encoding')=='gzip':
|
| 439 |
import gzip
|
462 |
import gzip
|