| Line 436... |
Line 436... |
| 436 |
sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
|
436 |
sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
|
| 437 |
if order.total_amount >= sourcePricing.minPrice:
|
437 |
if order.total_amount >= sourcePricing.minPrice:
|
| 438 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
438 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
| 439 |
order.statusDescription = "Order Accepted"
|
439 |
order.statusDescription = "Order Accepted"
|
| 440 |
session.commit()
|
440 |
session.commit()
|
| - |
|
441 |
sod = StoreOrderDetail.get_by(orderId = order.id)
|
| 441 |
__push_store_collection_to_hotspot(order, "advance", order.advanceAmount)
|
442 |
__push_store_collection_to_hotspot(order, "advance", sod.cashAmount, sod.cardAmount)
|
| 442 |
|
443 |
|
| 443 |
else:
|
444 |
else:
|
| 444 |
order.status = OrderStatus.COD_VERIFICATION_PENDING
|
445 |
order.status = OrderStatus.COD_VERIFICATION_PENDING
|
| 445 |
order.statusDescription = "Approval Pending"
|
446 |
order.statusDescription = "Approval Pending"
|
| 446 |
content = "<html><body>"
|
447 |
content = "<html><body>"
|
| Line 1168... |
Line 1169... |
| 1168 |
if order.status == OrderStatus.COD_VERIFICATION_PENDING:
|
1169 |
if order.status == OrderStatus.COD_VERIFICATION_PENDING:
|
| 1169 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
1170 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
| 1170 |
order.statusDescription = "Submitted for processing"
|
1171 |
order.statusDescription = "Submitted for processing"
|
| 1171 |
order.verification_timestamp = datetime.datetime.now()
|
1172 |
order.verification_timestamp = datetime.datetime.now()
|
| 1172 |
session.commit()
|
1173 |
session.commit()
|
| - |
|
1174 |
|
| 1173 |
if order.source == OrderSource.STORE:
|
1175 |
if order.source == OrderSource.STORE:
|
| - |
|
1176 |
sod = StoreOrderDetail.get_by(orderId = order.id)
|
| 1174 |
__push_store_collection_to_hotspot(order, 'advance', order.advanceAmount)
|
1177 |
__push_store_collection_to_hotspot(order, "advance", sod.cashAmount, sod.cardAmount)
|
| 1175 |
logging.info("Successfully verified order no: " + str(orderId))
|
1178 |
logging.info("Successfully verified order no: " + str(orderId))
|
| 1176 |
return True
|
1179 |
return True
|
| 1177 |
else:
|
1180 |
else:
|
| 1178 |
logging.warning("Verify called for order no." + str(orderId) +" which is not in verification pending state");
|
1181 |
logging.warning("Verify called for order no." + str(orderId) +" which is not in verification pending state");
|
| 1179 |
return False
|
1182 |
return False
|
| Line 2599... |
Line 2602... |
| 2599 |
warehouseClient.scanForOursExternalSaleReturn(order.id, lineitem.transfer_price)
|
2602 |
warehouseClient.scanForOursExternalSaleReturn(order.id, lineitem.transfer_price)
|
| 2600 |
|
2603 |
|
| 2601 |
if order.source == 2 and order.status in (OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.ACCEPTED, OrderStatus.INVENTORY_LOW, OrderStatus.CANCEL_REQUEST_CONFIRMED):
|
2604 |
if order.source == 2 and order.status in (OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.ACCEPTED, OrderStatus.INVENTORY_LOW, OrderStatus.CANCEL_REQUEST_CONFIRMED):
|
| 2602 |
storeOrderDetail = StoreOrderDetail.query.filter(StoreOrderDetail.orderId == order.id).filter(StoreOrderDetail.storeId == order.storeId).first()
|
2605 |
storeOrderDetail = StoreOrderDetail.query.filter(StoreOrderDetail.orderId == order.id).filter(StoreOrderDetail.storeId == order.storeId).first()
|
| 2603 |
if order.created_timestamp.date() == datetime.datetime.now().date():
|
2606 |
if order.created_timestamp.date() == datetime.datetime.now().date():
|
| 2604 |
__push_store_collection_to_hotspot(order, "RefundFromStore", -(storeOrderDetail.cashRefundAmount + storeOrderDetail.cardRefundAmount))
|
2607 |
__push_store_collection_to_hotspot(order, "RefundFromStore", -storeOrderDetail.cashRefundAmount, -storeOrderDetail.cardRefundAmount)
|
| 2605 |
storeOrderDetail.payStatus = StorePaymentStatus.ADV_REFUNDED
|
2608 |
storeOrderDetail.payStatus = StorePaymentStatus.ADV_REFUNDED
|
| 2606 |
else:
|
2609 |
else:
|
| 2607 |
__push_store_collection_to_hotspot(order, "RefundFromStore", -(storeOrderDetail.cashRefundAmount))
|
- |
|
| 2608 |
if storeOrderDetail.cardRefundAmount > 0:
|
2610 |
if order.advanceAmount - storeOrderDetail.cashRefundAmount == 0:
|
| 2609 |
storeOrderDetail.payStatus = StorePaymentStatus.REFUND_PENDING
|
- |
|
| 2610 |
else:
|
- |
|
| 2611 |
storeOrderDetail.payStatus = StorePaymentStatus.ADV_REFUNDED
|
2611 |
storeOrderDetail.payStatus = StorePaymentStatus.ADV_REFUNDED
|
| - |
|
2612 |
else:
|
| - |
|
2613 |
storeOrderDetail.payStatus = StorePaymentStatus.REFUND_REQUESTED
|
| - |
|
2614 |
|
| - |
|
2615 |
if storeOrderDetail.cashRefundAmount > 0:
|
| - |
|
2616 |
__push_store_collection_to_hotspot(order, "RefundFromStore", -storeOrderDetail.cashRefundAmount, 0)
|
| - |
|
2617 |
|
| 2612 |
order.status = status_transition[order.status]
|
2618 |
order.status = status_transition[order.status]
|
| 2613 |
order.refund_timestamp = datetime.datetime.now()
|
2619 |
order.refund_timestamp = datetime.datetime.now()
|
| 2614 |
order.refunded_by = refunded_by
|
2620 |
order.refunded_by = refunded_by
|
| 2615 |
order.refund_reason = reason
|
2621 |
order.refund_reason = reason
|
| 2616 |
session.commit()
|
2622 |
session.commit()
|
| Line 2790... |
Line 2796... |
| 2790 |
pdf.drawText(order_text)
|
2796 |
pdf.drawText(order_text)
|
| 2791 |
pdf.showPage()
|
2797 |
pdf.showPage()
|
| 2792 |
pdf.save()
|
2798 |
pdf.save()
|
| 2793 |
return filename
|
2799 |
return filename
|
| 2794 |
|
2800 |
|
| 2795 |
def __push_store_collection_to_hotspot(order, ctype, amount):
|
2801 |
def __push_store_collection_to_hotspot(order, ctype, cashamount, cardamount):
|
| 2796 |
ts = datetime.datetime.now()
|
2802 |
ts = datetime.datetime.now()
|
| 2797 |
store = get_hotspot_store(order.storeId, "")
|
2803 |
store = get_hotspot_store(order.storeId, "")
|
| 2798 |
|
2804 |
|
| 2799 |
soc = StoreOrderCollection()
|
2805 |
soc = StoreOrderCollection()
|
| 2800 |
soc.hotspotId = store.hotspotId
|
2806 |
soc.hotspotId = store.hotspotId
|
| 2801 |
soc.orderId = order.id
|
2807 |
soc.orderId = order.id
|
| 2802 |
soc.collectionType = ctype
|
2808 |
soc.collectionType = ctype
|
| 2803 |
soc.advanceAmount = int(amount)
|
2809 |
soc.advanceAmount = int(cashamount + cardamount)
|
| 2804 |
soc.productName = str(order.lineitems[0])
|
2810 |
soc.productName = str(order.lineitems[0])
|
| 2805 |
soc.addedAt = ts
|
2811 |
soc.addedAt = ts
|
| 2806 |
soc.pushedToOcr = False
|
2812 |
soc.pushedToOcr = False
|
| 2807 |
soc.cash = int(amount)
|
2813 |
soc.cash = int(cashamount)
|
| 2808 |
soc.card = 0
|
2814 |
soc.card = int(cardamount)
|
| 2809 |
session.commit()
|
2815 |
session.commit()
|
| 2810 |
|
2816 |
|
| 2811 |
try:
|
2817 |
try:
|
| 2812 |
rcs = StoreOrderCollection.query.filter(StoreOrderCollection.pushedToOcr == False).all()
|
2818 |
rcs = StoreOrderCollection.query.filter(StoreOrderCollection.pushedToOcr == False).all()
|
| 2813 |
for cs in rcs:
|
2819 |
for cs in rcs:
|
| Line 5539... |
Line 5545... |
| 5539 |
ds_storeOrderDetail.storeId = thrift_storeOrderDetail.storeId
|
5545 |
ds_storeOrderDetail.storeId = thrift_storeOrderDetail.storeId
|
| 5540 |
ds_storeOrderDetail.payStatus = thrift_storeOrderDetail.payStatus
|
5546 |
ds_storeOrderDetail.payStatus = thrift_storeOrderDetail.payStatus
|
| 5541 |
ds_storeOrderDetail.cardRefundAmount = thrift_storeOrderDetail.cardRefundAmount
|
5547 |
ds_storeOrderDetail.cardRefundAmount = thrift_storeOrderDetail.cardRefundAmount
|
| 5542 |
ds_storeOrderDetail.cashRefundAmount = thrift_storeOrderDetail.cashRefundAmount
|
5548 |
ds_storeOrderDetail.cashRefundAmount = thrift_storeOrderDetail.cashRefundAmount
|
| 5543 |
ds_storeOrderDetail.edcBank = thrift_storeOrderDetail.edcBank
|
5549 |
ds_storeOrderDetail.edcBank = thrift_storeOrderDetail.edcBank
|
| - |
|
5550 |
ds_storeOrderDetail.approvalCode = thrift_storeOrderDetail.approvalCode
|
| 5544 |
session.commit()
|
5551 |
session.commit()
|
| 5545 |
return True
|
5552 |
return True
|
| 5546 |
|
5553 |
|
| 5547 |
def get_store_order_detail(orderId, storeId):
|
5554 |
def get_store_order_detail(orderId, storeId):
|
| 5548 |
storeOrderDetail = StoreOrderDetail.query.filter(StoreOrderDetail.orderId == orderId).filter(StoreOrderDetail.storeId == storeId).first()
|
5555 |
storeOrderDetail = StoreOrderDetail.query.filter(StoreOrderDetail.orderId == orderId).filter(StoreOrderDetail.storeId == storeId).first()
|