| Line 427... |
Line 427... |
| 427 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
427 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
| 428 |
transaction_requiring_extra_processing.category = 'PAYMENT_FLAGGED'
|
428 |
transaction_requiring_extra_processing.category = 'PAYMENT_FLAGGED'
|
| 429 |
transaction_requiring_extra_processing.transaction_id = transaction_id
|
429 |
transaction_requiring_extra_processing.transaction_id = transaction_id
|
| 430 |
session.commit()
|
430 |
session.commit()
|
| 431 |
elif order.source == OrderSource.STORE:
|
431 |
elif order.source == OrderSource.STORE:
|
| - |
|
432 |
attribute = Attribute()
|
| - |
|
433 |
attribute.orderId = order.id
|
| - |
|
434 |
attribute.name = "PAYMENT_MODE"
|
| - |
|
435 |
attribute.value = "Cash"
|
| - |
|
436 |
session.commit()
|
| - |
|
437 |
|
| 432 |
catalog_client = CatalogClient().get_client()
|
438 |
catalog_client = CatalogClient().get_client()
|
| 433 |
sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
|
439 |
sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
|
| 434 |
if order.total_amount >= sourcePricing.minPrice:
|
440 |
if order.total_amount >= sourcePricing.minPrice:
|
| 435 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
441 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
| - |
|
442 |
session.commit()
|
| - |
|
443 |
__push_collection_to_hotspot(order, "SALE", True)
|
| - |
|
444 |
|
| 436 |
else:
|
445 |
else:
|
| 437 |
order.status = OrderStatus.COD_VERIFICATION_PENDING
|
446 |
order.status = OrderStatus.COD_VERIFICATION_PENDING
|
| 438 |
content = "<html><body>"
|
447 |
content = "<html><body>"
|
| 439 |
content += "<h2>Order Id: " + str(order.id) + "</h2>"
|
448 |
content += "<h2>Order Id: " + str(order.id) + "</h2>"
|
| 440 |
content += "<h2>Product: " + str(order.lineitems[0]) + "</h2>"
|
449 |
content += "<h2>Product: " + str(order.lineitems[0]) + "</h2>"
|
| Line 446... |
Line 455... |
| 446 |
content += "<a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id)) + "'>Click here for Approval</a>"
|
455 |
content += "<a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id)) + "'>Click here for Approval</a>"
|
| 447 |
content += "<br><br></body></html>"
|
456 |
content += "<br><br></body></html>"
|
| 448 |
store = get_hotspot_store(order.storeId, "")
|
457 |
store = get_hotspot_store(order.storeId, "")
|
| 449 |
helper_client = HelperClient().get_client()
|
458 |
helper_client = HelperClient().get_client()
|
| 450 |
helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), "", "Price approval requested for " + str(order.lineitems[0]) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [])
|
459 |
helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), "", "Price approval requested for " + str(order.lineitems[0]) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [])
|
| 451 |
session.commit()
|
460 |
session.commit()
|
| 452 |
except Exception as e:
|
461 |
except Exception as e:
|
| 453 |
print "Error inserting transaction Id: " + str(transaction_id) + " due to " + str(e)
|
462 |
print "Error inserting transaction Id: " + str(transaction_id) + " due to " + str(e)
|
| 454 |
|
463 |
|
| 455 |
return True
|
464 |
return True
|
| 456 |
|
465 |
|
| Line 1160... |
Line 1169... |
| 1160 |
if order.status == OrderStatus.COD_VERIFICATION_PENDING:
|
1169 |
if order.status == OrderStatus.COD_VERIFICATION_PENDING:
|
| 1161 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
1170 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
| 1162 |
order.statusDescription = "Submitted for processing"
|
1171 |
order.statusDescription = "Submitted for processing"
|
| 1163 |
order.verification_timestamp = datetime.datetime.now()
|
1172 |
order.verification_timestamp = datetime.datetime.now()
|
| 1164 |
session.commit()
|
1173 |
session.commit()
|
| - |
|
1174 |
if order.source == OrderSource.STORE:
|
| - |
|
1175 |
__push_collection_to_hotspot(order, "SALE", True)
|
| 1165 |
logging.info("Successfully verified order no: " + str(orderId))
|
1176 |
logging.info("Successfully verified order no: " + str(orderId))
|
| 1166 |
return True
|
1177 |
return True
|
| 1167 |
else:
|
1178 |
else:
|
| 1168 |
logging.warning("Verify called for order no." + str(orderId) +" which is not in verification pending state");
|
1179 |
logging.warning("Verify called for order no." + str(orderId) +" which is not in verification pending state");
|
| 1169 |
return False
|
1180 |
return False
|
| Line 2766... |
Line 2777... |
| 2766 |
pdf.drawText(order_text)
|
2777 |
pdf.drawText(order_text)
|
| 2767 |
pdf.showPage()
|
2778 |
pdf.showPage()
|
| 2768 |
pdf.save()
|
2779 |
pdf.save()
|
| 2769 |
return filename
|
2780 |
return filename
|
| 2770 |
|
2781 |
|
| 2771 |
def __push_collection_to_hotspot(order, type):
|
2782 |
def __push_collection_to_hotspot(order, type, storeOrder = False):
|
| 2772 |
try:
|
2783 |
try:
|
| - |
|
2784 |
storeName = '109'
|
| - |
|
2785 |
if storeOrder:
|
| - |
|
2786 |
store = get_hotspot_store(order.storeId, "")
|
| - |
|
2787 |
storeName = store.hotspotId
|
| - |
|
2788 |
storeName = '109'
|
| - |
|
2789 |
else:
|
| 2773 |
logistics_client = LogisticsClient().get_client()
|
2790 |
logistics_client = LogisticsClient().get_client()
|
| 2774 |
store = logistics_client.getPickupStore(order.pickupStoreId)
|
2791 |
store = logistics_client.getPickupStore(order.pickupStoreId)
|
| - |
|
2792 |
storeName = store.hotspotId
|
| 2775 |
store_string = "<store>" + store.hotspotId + "</store>"
|
2793 |
store_string = "<store>" + storeName + "</store>"
|
| 2776 |
order_string = "<orderno>" + str(order.id) + "</orderno>"
|
2794 |
order_string = "<orderno>" + str(order.id) + "</orderno>"
|
| 2777 |
collection_type = "<Type>" + type + "</Type>"
|
2795 |
collection_type = "<Type>" + type + "</Type>"
|
| 2778 |
payment_mode = get_order_attribute_value(order.id, "PAYMENT_MODE")
|
2796 |
payment_mode = get_order_attribute_value(order.id, "PAYMENT_MODE")
|
| 2779 |
if type == "SALE":
|
2797 |
if type == "SALE":
|
| - |
|
2798 |
if storeOrder:
|
| - |
|
2799 |
amount = order.advanceAmount
|
| - |
|
2800 |
else:
|
| 2780 |
amount = int(order.total_amount-order.gvAmount)
|
2801 |
amount = int(order.total_amount-order.gvAmount)
|
| 2781 |
ts = order.delivery_timestamp
|
2802 |
ts = order.delivery_timestamp
|
| 2782 |
if type == "SALE RETURN":
|
2803 |
if type == "SALE RETURN":
|
| - |
|
2804 |
if storeOrder:
|
| - |
|
2805 |
amount = -order.advanceAmount
|
| - |
|
2806 |
else:
|
| 2783 |
amount = -int(order.total_amount-order.gvAmount)
|
2807 |
amount = -int(order.total_amount-order.gvAmount)
|
| 2784 |
ts = order.refund_timestamp
|
2808 |
ts = order.refund_timestamp
|
| 2785 |
if payment_mode == "Cash":
|
2809 |
if payment_mode == "Cash":
|
| 2786 |
cash_string = "<cash>" + str(amount) + "</cash>"
|
2810 |
cash_string = "<cash>" + str(amount) + "</cash>"
|
| 2787 |
card_string = "<hdfc>0</hdfc>"
|
2811 |
card_string = "<hdfc>0</hdfc>"
|
| 2788 |
if payment_mode == "Card":
|
2812 |
if payment_mode == "Card":
|