| Line 232... |
Line 232... |
| 232 |
order.lineitems[0].transfer_price = item_pricing.transferPrice
|
232 |
order.lineitems[0].transfer_price = item_pricing.transferPrice
|
| 233 |
except:
|
233 |
except:
|
| 234 |
print "Not able to get transfer price. Skipping"
|
234 |
print "Not able to get transfer price. Skipping"
|
| 235 |
elif new_status == TransactionStatus.COD_IN_PROCESS:
|
235 |
elif new_status == TransactionStatus.COD_IN_PROCESS:
|
| 236 |
for order in transaction.orders:
|
236 |
for order in transaction.orders:
|
| 237 |
order.status = OrderStatus.INIT
|
237 |
order.status = OrderStatus.COD_VERIFICATION_PENDING
|
| 238 |
order.statusDescription = "Verification Pending"
|
238 |
order.statusDescription = "Verification Pending"
|
| 239 |
order.cod = True
|
239 |
order.cod = True
|
| 240 |
#After we got payment success, we will set logistics info also
|
240 |
#After we got payment success, we will set logistics info also
|
| 241 |
logistics_client = LogisticsClient().get_client()
|
241 |
logistics_client = LogisticsClient().get_client()
|
| 242 |
#FIXME line item is only one now. If multiple will come, need to fix.
|
242 |
#FIXME line item is only one now. If multiple will come, need to fix.
|
| Line 562... |
Line 562... |
| 562 |
return True
|
562 |
return True
|
| 563 |
|
563 |
|
| 564 |
def verify_order(self, orderId):
|
564 |
def verify_order(self, orderId):
|
| 565 |
logging.info("Verifying order no: " + str(orderId))
|
565 |
logging.info("Verifying order no: " + str(orderId))
|
| 566 |
order = get_order(orderId)
|
566 |
order = get_order(orderId)
|
| 567 |
if order.status == OrderStatus.INIT:
|
567 |
if order.status == OrderStatus.COD_VERIFICATION_PENDING:
|
| 568 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
568 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
| 569 |
order.statusDescription = "Submitted for processing"
|
569 |
order.statusDescription = "Submitted for processing"
|
| 570 |
order.verification_timestamp = datetime.datetime.now()
|
570 |
order.verification_timestamp = datetime.datetime.now()
|
| 571 |
session.commit()
|
571 |
session.commit()
|
| 572 |
logging.info("Successfully verified order no: " + str(orderId))
|
572 |
logging.info("Successfully verified order no: " + str(orderId))
|
| Line 871... |
Line 871... |
| 871 |
limit if it's passed as 0. Raises an excpetion if the supplied limit is
|
871 |
limit if it's passed as 0. Raises an excpetion if the supplied limit is
|
| 872 |
less than 0.
|
872 |
less than 0.
|
| 873 |
'''
|
873 |
'''
|
| 874 |
if limit < 0:
|
874 |
if limit < 0:
|
| 875 |
raise TransactionServiceException(101, "Invalid argument limit " + limit)
|
875 |
raise TransactionServiceException(101, "Invalid argument limit " + limit)
|
| 876 |
query = Order.query.filter(Order.status >= OrderStatus.INIT)
|
876 |
query = Order.query.filter(Order.status >= OrderStatus.COD_VERIFICATION_PENDING)
|
| 877 |
query = query.order_by(desc(Order.created_timestamp))
|
877 |
query = query.order_by(desc(Order.created_timestamp))
|
| 878 |
if limit != 0:
|
878 |
if limit != 0:
|
| 879 |
query = query.limit(limit)
|
879 |
query = query.limit(limit)
|
| 880 |
return query.all()
|
880 |
return query.all()
|
| 881 |
|
881 |
|
| Line 1218... |
Line 1218... |
| 1218 |
elif order.status == OrderStatus.RTO_LOST_IN_TRANSIT:
|
1218 |
elif order.status == OrderStatus.RTO_LOST_IN_TRANSIT:
|
| 1219 |
new_order = __clone_order(order, False, order.cod)
|
1219 |
new_order = __clone_order(order, False, order.cod)
|
| 1220 |
order.status = OrderStatus.RTO_LOST_IN_TRANSIT_RESHIPPED
|
1220 |
order.status = OrderStatus.RTO_LOST_IN_TRANSIT_RESHIPPED
|
| 1221 |
order.statusDescription = "Order Reshipped Lost In Transit"
|
1221 |
order.statusDescription = "Order Reshipped Lost In Transit"
|
| 1222 |
session.commit()
|
1222 |
session.commit()
|
| - |
|
1223 |
elif order.status == OrderStatus.LOST_IN_TRANSIT:
|
| - |
|
1224 |
new_order = __clone_order(order, False, order.cod)
|
| - |
|
1225 |
order.status = OrderStatus.LOST_IN_TRANSIT_RESHIPPED
|
| - |
|
1226 |
order.statusDescription = "Order Reshipped Lost In Transit"
|
| - |
|
1227 |
session.commit()
|
| 1223 |
elif order.status == OrderStatus.DOA_CERT_INVALID:
|
1228 |
elif order.status == OrderStatus.DOA_CERT_INVALID:
|
| 1224 |
new_order = __clone_order(order, True, False)
|
1229 |
new_order = __clone_order(order, True, False)
|
| 1225 |
order.status = OrderStatus.DOA_INVALID_RESHIPPED
|
1230 |
order.status = OrderStatus.DOA_INVALID_RESHIPPED
|
| 1226 |
order.statusDescription = "Order Reshipped"
|
1231 |
order.statusDescription = "Order Reshipped"
|
| 1227 |
session.commit()
|
1232 |
session.commit()
|
| Line 1305... |
Line 1310... |
| 1305 |
|
1310 |
|
| 1306 |
|
1311 |
|
| 1307 |
|
1312 |
|
| 1308 |
if order.cod:
|
1313 |
if order.cod:
|
| 1309 |
logging.info("Refunding COD order with status " + str(order.status))
|
1314 |
logging.info("Refunding COD order with status " + str(order.status))
|
| - |
|
1315 |
status_transition = { OrderStatus.LOST_IN_TRANSIT : OrderStatus.LOST_IN_TRANSIT_REFUNDED,
|
| 1310 |
status_transition = {OrderStatus.RTO_RECEIVED_PRESTINE : OrderStatus.RTO_REFUNDED,
|
1316 |
OrderStatus.RTO_RECEIVED_PRESTINE : OrderStatus.RTO_REFUNDED,
|
| 1311 |
OrderStatus.RTO_RECEIVED_DAMAGED : OrderStatus.RTO_DAMAGED_REFUNDED,
|
1317 |
OrderStatus.RTO_RECEIVED_DAMAGED : OrderStatus.RTO_DAMAGED_REFUNDED,
|
| 1312 |
OrderStatus.RTO_LOST_IN_TRANSIT : OrderStatus.RTO_LOST_IN_TRANSIT_REFUNDED,
|
1318 |
OrderStatus.RTO_LOST_IN_TRANSIT : OrderStatus.RTO_LOST_IN_TRANSIT_REFUNDED,
|
| 1313 |
OrderStatus.DOA_CERT_INVALID : OrderStatus.DOA_INVALID_REFUNDED,
|
1319 |
OrderStatus.DOA_CERT_INVALID : OrderStatus.DOA_INVALID_REFUNDED,
|
| 1314 |
OrderStatus.DOA_CERT_VALID : OrderStatus.DOA_VALID_REFUNDED,
|
1320 |
OrderStatus.DOA_CERT_VALID : OrderStatus.DOA_VALID_REFUNDED,
|
| 1315 |
OrderStatus.DOA_RECEIVED_DAMAGED : OrderStatus.DOA_REFUNDED_RCVD_DAMAGED,
|
1321 |
OrderStatus.DOA_RECEIVED_DAMAGED : OrderStatus.DOA_REFUNDED_RCVD_DAMAGED,
|
| 1316 |
OrderStatus.DOA_LOST_IN_TRANSIT : OrderStatus.DOA_REFUNDED_LOST_IN_TRANSIT,
|
1322 |
OrderStatus.DOA_LOST_IN_TRANSIT : OrderStatus.DOA_REFUNDED_LOST_IN_TRANSIT,
|
| 1317 |
OrderStatus.RET_PRODUCT_UNUSABLE : OrderStatus.RET_PRODUCT_UNUSABLE_REFUNDED,
|
1323 |
OrderStatus.RET_PRODUCT_UNUSABLE : OrderStatus.RET_PRODUCT_UNUSABLE_REFUNDED,
|
| 1318 |
OrderStatus.RET_PRODUCT_USABLE : OrderStatus.RET_PRODUCT_USABLE_REFUNDED,
|
1324 |
OrderStatus.RET_PRODUCT_USABLE : OrderStatus.RET_PRODUCT_USABLE_REFUNDED,
|
| 1319 |
OrderStatus.RET_RECEIVED_DAMAGED : OrderStatus.RET_REFUNDED_RCVD_DAMAGED,
|
1325 |
OrderStatus.RET_RECEIVED_DAMAGED : OrderStatus.RET_REFUNDED_RCVD_DAMAGED,
|
| 1320 |
OrderStatus.RET_LOST_IN_TRANSIT : OrderStatus.RET_REFUNDED_LOST_IN_TRANSIT,
|
1326 |
OrderStatus.RET_LOST_IN_TRANSIT : OrderStatus.RET_REFUNDED_LOST_IN_TRANSIT,
|
| 1321 |
OrderStatus.INIT : OrderStatus.CANCELED,
|
1327 |
OrderStatus.COD_VERIFICATION_PENDING : OrderStatus.CANCELED,
|
| 1322 |
OrderStatus.SUBMITTED_FOR_PROCESSING : OrderStatus.CANCELED,
|
1328 |
OrderStatus.SUBMITTED_FOR_PROCESSING : OrderStatus.CANCELED,
|
| 1323 |
OrderStatus.INVENTORY_LOW : OrderStatus.CANCELED,
|
1329 |
OrderStatus.INVENTORY_LOW : OrderStatus.CANCELED,
|
| 1324 |
OrderStatus.LOW_INV_PO_RAISED : OrderStatus.CANCELED,
|
1330 |
OrderStatus.LOW_INV_PO_RAISED : OrderStatus.CANCELED,
|
| 1325 |
OrderStatus.LOW_INV_REVERSAL_IN_PROCESS : OrderStatus.CANCELED,
|
1331 |
OrderStatus.LOW_INV_REVERSAL_IN_PROCESS : OrderStatus.CANCELED,
|
| 1326 |
OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT : OrderStatus.CANCELED,
|
1332 |
OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT : OrderStatus.CANCELED,
|
| Line 1338... |
Line 1344... |
| 1338 |
__create_return_order(order)
|
1344 |
__create_return_order(order)
|
| 1339 |
order.statusDescription = "Order Cancelled"
|
1345 |
order.statusDescription = "Order Cancelled"
|
| 1340 |
elif order.status in [OrderStatus.RTO_RECEIVED_PRESTINE, OrderStatus.RTO_RECEIVED_DAMAGED, OrderStatus.RTO_LOST_IN_TRANSIT]:
|
1346 |
elif order.status in [OrderStatus.RTO_RECEIVED_PRESTINE, OrderStatus.RTO_RECEIVED_DAMAGED, OrderStatus.RTO_LOST_IN_TRANSIT]:
|
| 1341 |
__create_return_order(order)
|
1347 |
__create_return_order(order)
|
| 1342 |
order.statusDescription = "RTO Refunded"
|
1348 |
order.statusDescription = "RTO Refunded"
|
| - |
|
1349 |
elif order.status in [OrderStatus.LOST_IN_TRANSIT]:
|
| - |
|
1350 |
__create_return_order(order)
|
| - |
|
1351 |
order.statusDescription = "Lost in Transit Refunded"
|
| 1343 |
elif order.status in [OrderStatus.DOA_CERT_INVALID, OrderStatus.DOA_CERT_VALID, OrderStatus.DOA_RECEIVED_DAMAGED, OrderStatus.DOA_LOST_IN_TRANSIT] :
|
1352 |
elif order.status in [OrderStatus.DOA_CERT_INVALID, OrderStatus.DOA_CERT_VALID, OrderStatus.DOA_RECEIVED_DAMAGED, OrderStatus.DOA_LOST_IN_TRANSIT] :
|
| 1344 |
__create_return_order(order)
|
1353 |
__create_return_order(order)
|
| 1345 |
__create_refund(order)
|
1354 |
__create_refund(order)
|
| 1346 |
order.statusDescription = "DOA Refunded"
|
1355 |
order.statusDescription = "DOA Refunded"
|
| 1347 |
elif order.status in [OrderStatus.RET_PRODUCT_UNUSABLE, OrderStatus.RET_PRODUCT_USABLE, OrderStatus.RET_RECEIVED_DAMAGED, OrderStatus.RET_LOST_IN_TRANSIT] :
|
1356 |
elif order.status in [OrderStatus.RET_PRODUCT_UNUSABLE, OrderStatus.RET_PRODUCT_USABLE, OrderStatus.RET_RECEIVED_DAMAGED, OrderStatus.RET_LOST_IN_TRANSIT] :
|
| Line 1354... |
Line 1363... |
| 1354 |
order.statusDescription = "Order Cancelled on customer request"
|
1363 |
order.statusDescription = "Order Cancelled on customer request"
|
| 1355 |
elif order.previousStatus == OrderStatus.BILLED:
|
1364 |
elif order.previousStatus == OrderStatus.BILLED:
|
| 1356 |
__create_return_order(order)
|
1365 |
__create_return_order(order)
|
| 1357 |
order.statusDescription = "Order Cancelled on customer request"
|
1366 |
order.statusDescription = "Order Cancelled on customer request"
|
| 1358 |
else:
|
1367 |
else:
|
| - |
|
1368 |
status_transition = {OrderStatus.LOST_IN_TRANSIT : OrderStatus.LOST_IN_TRANSIT_REFUNDED,
|
| 1359 |
status_transition = {OrderStatus.RTO_RECEIVED_PRESTINE : OrderStatus.RTO_REFUNDED,
|
1369 |
OrderStatus.RTO_RECEIVED_PRESTINE : OrderStatus.RTO_REFUNDED,
|
| 1360 |
OrderStatus.RTO_RECEIVED_DAMAGED : OrderStatus.RTO_DAMAGED_REFUNDED,
|
1370 |
OrderStatus.RTO_RECEIVED_DAMAGED : OrderStatus.RTO_DAMAGED_REFUNDED,
|
| 1361 |
OrderStatus.RTO_LOST_IN_TRANSIT : OrderStatus.RTO_LOST_IN_TRANSIT_REFUNDED,
|
1371 |
OrderStatus.RTO_LOST_IN_TRANSIT : OrderStatus.RTO_LOST_IN_TRANSIT_REFUNDED,
|
| 1362 |
OrderStatus.DOA_CERT_INVALID : OrderStatus.DOA_INVALID_REFUNDED,
|
1372 |
OrderStatus.DOA_CERT_INVALID : OrderStatus.DOA_INVALID_REFUNDED,
|
| 1363 |
OrderStatus.DOA_CERT_VALID : OrderStatus.DOA_VALID_REFUNDED,
|
1373 |
OrderStatus.DOA_CERT_VALID : OrderStatus.DOA_VALID_REFUNDED,
|
| 1364 |
OrderStatus.DOA_RECEIVED_DAMAGED : OrderStatus.DOA_REFUNDED_RCVD_DAMAGED,
|
1374 |
OrderStatus.DOA_RECEIVED_DAMAGED : OrderStatus.DOA_REFUNDED_RCVD_DAMAGED,
|
| Line 1382... |
Line 1392... |
| 1382 |
|
1392 |
|
| 1383 |
if order.status in [OrderStatus.RTO_RECEIVED_PRESTINE, OrderStatus.RTO_RECEIVED_DAMAGED, OrderStatus.RTO_LOST_IN_TRANSIT] :
|
1393 |
if order.status in [OrderStatus.RTO_RECEIVED_PRESTINE, OrderStatus.RTO_RECEIVED_DAMAGED, OrderStatus.RTO_LOST_IN_TRANSIT] :
|
| 1384 |
__create_return_order(order)
|
1394 |
__create_return_order(order)
|
| 1385 |
__create_refund(order)
|
1395 |
__create_refund(order)
|
| 1386 |
order.statusDescription = "RTO Refunded"
|
1396 |
order.statusDescription = "RTO Refunded"
|
| - |
|
1397 |
elif order.status in [OrderStatus.LOST_IN_TRANSIT]:
|
| - |
|
1398 |
__create_return_order(order)
|
| - |
|
1399 |
__create_refund(order)
|
| - |
|
1400 |
order.statusDescription = "Lost in Transit Refunded"
|
| 1387 |
elif order.status in [OrderStatus.DOA_CERT_INVALID, OrderStatus.DOA_CERT_VALID, OrderStatus.DOA_RECEIVED_DAMAGED, OrderStatus.DOA_LOST_IN_TRANSIT] :
|
1401 |
elif order.status in [OrderStatus.DOA_CERT_INVALID, OrderStatus.DOA_CERT_VALID, OrderStatus.DOA_RECEIVED_DAMAGED, OrderStatus.DOA_LOST_IN_TRANSIT] :
|
| 1388 |
__create_return_order(order)
|
1402 |
__create_return_order(order)
|
| 1389 |
__create_refund(order)
|
1403 |
__create_refund(order)
|
| 1390 |
order.statusDescription = "DOA Refunded"
|
1404 |
order.statusDescription = "DOA Refunded"
|
| 1391 |
elif order.status in [OrderStatus.RET_PRODUCT_UNUSABLE, OrderStatus.RET_PRODUCT_USABLE, OrderStatus.RET_RECEIVED_DAMAGED, OrderStatus.RET_LOST_IN_TRANSIT] :
|
1405 |
elif order.status in [OrderStatus.RET_PRODUCT_UNUSABLE, OrderStatus.RET_PRODUCT_USABLE, OrderStatus.RET_RECEIVED_DAMAGED, OrderStatus.RET_LOST_IN_TRANSIT] :
|
| Line 1672... |
Line 1686... |
| 1672 |
def change_product(order_id, item_id):
|
1686 |
def change_product(order_id, item_id):
|
| 1673 |
'''
|
1687 |
'''
|
| 1674 |
Ship a product of a different color to the customer.
|
1688 |
Ship a product of a different color to the customer.
|
| 1675 |
'''
|
1689 |
'''
|
| 1676 |
order = get_order(order_id)
|
1690 |
order = get_order(order_id)
|
| 1677 |
if order.status not in [OrderStatus.INIT, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT]:
|
1691 |
if order.status not in [OrderStatus.COD_VERIFICATION_PENDING, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT]:
|
| 1678 |
raise TransactionServiceException(120, "This order has already been processed. Please seek help from engineering.")
|
1692 |
raise TransactionServiceException(120, "This order has already been processed. Please seek help from engineering.")
|
| 1679 |
|
1693 |
|
| 1680 |
lineitem = order.lineitems[0]
|
1694 |
lineitem = order.lineitems[0]
|
| 1681 |
|
1695 |
|
| 1682 |
catalog_client = CatalogClient().get_client()
|
1696 |
catalog_client = CatalogClient().get_client()
|
| Line 1701... |
Line 1715... |
| 1701 |
def change_warehouse(order_id, warehouse_id):
|
1715 |
def change_warehouse(order_id, warehouse_id):
|
| 1702 |
'''
|
1716 |
'''
|
| 1703 |
Update the warehouse which will be used to fulfil this order.
|
1717 |
Update the warehouse which will be used to fulfil this order.
|
| 1704 |
'''
|
1718 |
'''
|
| 1705 |
order = get_order(order_id)
|
1719 |
order = get_order(order_id)
|
| 1706 |
if order.status not in [OrderStatus.INIT, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT]:
|
1720 |
if order.status not in [OrderStatus.COD_VERIFICATION_PENDING, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT]:
|
| 1707 |
raise TransactionServiceException(117, "This order has already been processed. Please seek help from engineering.")
|
1721 |
raise TransactionServiceException(117, "This order has already been processed. Please seek help from engineering.")
|
| 1708 |
|
1722 |
|
| 1709 |
if warehouse_id == order.warehouse_id:
|
1723 |
if warehouse_id == order.warehouse_id:
|
| 1710 |
raise TransactionServiceException(118, "You have selected the current warehouse again. Nothing to do")
|
1724 |
raise TransactionServiceException(118, "You have selected the current warehouse again. Nothing to do")
|
| 1711 |
|
1725 |
|
| Line 1897... |
Line 1911... |
| 1897 |
back to that status if cancellation request is denied.
|
1911 |
back to that status if cancellation request is denied.
|
| 1898 |
|
1912 |
|
| 1899 |
Parameters:
|
1913 |
Parameters:
|
| 1900 |
- orderId
|
1914 |
- orderId
|
| 1901 |
"""
|
1915 |
"""
|
| 1902 |
status_transition = {OrderStatus.INIT : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1916 |
status_transition = {OrderStatus.COD_VERIFICATION_PENDING : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1903 |
OrderStatus.SUBMITTED_FOR_PROCESSING : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1917 |
OrderStatus.SUBMITTED_FOR_PROCESSING : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1904 |
OrderStatus.INVENTORY_LOW : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1918 |
OrderStatus.INVENTORY_LOW : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1905 |
OrderStatus.LOW_INV_PO_RAISED : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1919 |
OrderStatus.LOW_INV_PO_RAISED : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1906 |
OrderStatus.LOW_INV_REVERSAL_IN_PROCESS : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1920 |
OrderStatus.LOW_INV_REVERSAL_IN_PROCESS : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1907 |
OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1921 |
OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1908 |
OrderStatus.ACCEPTED : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1922 |
OrderStatus.ACCEPTED : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1909 |
OrderStatus.BILLED : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
1923 |
OrderStatus.BILLED : OrderStatus.CANCEL_REQUEST_RECEIVED,
|
| 1910 |
OrderStatus.PAYMENT_FLAGGED : OrderStatus.CANCEL_REQUEST_RECEIVED
|
1924 |
OrderStatus.PAYMENT_FLAGGED : OrderStatus.CANCEL_REQUEST_RECEIVED
|
| 1911 |
}
|
1925 |
}
|
| - |
|
1926 |
|
| - |
|
1927 |
order = get_order(orderId)
|
| 1912 |
if order.status not in status_transition.keys():
|
1928 |
if order.status not in status_transition.keys():
|
| 1913 |
raise TransactionServiceException(114, "This order can't be considered for cancellation")
|
1929 |
raise TransactionServiceException(114, "This order can't be considered for cancellation")
|
| 1914 |
|
1930 |
|
| 1915 |
order = get_order(orderId)
|
1931 |
|
| 1916 |
order.previousStatus = order.status
|
1932 |
order.previousStatus = order.status
|
| 1917 |
order.status = OrderStatus.CANCEL_REQUEST_RECEIVED
|
1933 |
order.status = OrderStatus.CANCEL_REQUEST_RECEIVED
|
| 1918 |
order.statusDescription = "Cancellation request received from user"
|
1934 |
order.statusDescription = "Cancellation request received from user"
|
| 1919 |
session.commit()
|
1935 |
session.commit()
|
| 1920 |
|
1936 |
|
| - |
|
1937 |
def mark_order_as_lost_in_transit(orderId):
|
| - |
|
1938 |
"""
|
| - |
|
1939 |
Parameters:
|
| - |
|
1940 |
- orderId
|
| - |
|
1941 |
"""
|
| - |
|
1942 |
order = get_order(orderId)
|
| - |
|
1943 |
if order.status not in [OrderStatus.SHIPPED_FROM_WH, OrderStatus.SHIPPED_TO_LOGST]:
|
| - |
|
1944 |
raise TransactionServiceException(115, "This order can't be marked as lost in transit")
|
| - |
|
1945 |
order.status = OrderStatus.LOST_IN_TRANSIT
|
| - |
|
1946 |
order.statusDescription = "Lost in Transit"
|
| - |
|
1947 |
session.commit()
|
| - |
|
1948 |
|
| 1921 |
def mark_transaction_as_payment_flag_removed(transactionId):
|
1949 |
def mark_transaction_as_payment_flag_removed(transactionId):
|
| 1922 |
"""
|
1950 |
"""
|
| 1923 |
If we and/or payment gateway has decided to accept the payment, this method needs to be called.
|
1951 |
If we and/or payment gateway has decided to accept the payment, this method needs to be called.
|
| 1924 |
Changed transaction and all orders status to payment accepted.
|
1952 |
Changed transaction and all orders status to payment accepted.
|
| 1925 |
|
1953 |
|
| Line 1995... |
Line 2023... |
| 1995 |
else:
|
2023 |
else:
|
| 1996 |
order_outofstock(order.id)
|
2024 |
order_outofstock(order.id)
|
| 1997 |
return
|
2025 |
return
|
| 1998 |
|
2026 |
|
| 1999 |
def get_slipped_sipping_date_orders():
|
2027 |
def get_slipped_sipping_date_orders():
|
| 2000 |
return Order.query.filter(Order.status.in_(tuple([OrderStatus.INIT, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.ACCEPTED, OrderStatus.BILLED]))).filter(Order.promised_shipping_time <= datetime.datetime.now()).order_by(Order.promised_shipping_time).all()
|
2028 |
return Order.query.filter(Order.status.in_(tuple([OrderStatus.COD_VERIFICATION_PENDING, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.ACCEPTED, OrderStatus.BILLED]))).filter(Order.promised_shipping_time <= datetime.datetime.now()).order_by(Order.promised_shipping_time).all()
|
| 2001 |
|
2029 |
|
| 2002 |
def mark_orders_as_po_raised(vendorId, itemId, quantity, estimate, isReminder):
|
2030 |
def mark_orders_as_po_raised(vendorId, itemId, quantity, estimate, isReminder):
|
| 2003 |
if isReminder:
|
2031 |
if isReminder:
|
| 2004 |
statuses = tuple([OrderStatus.LOW_INV_PO_RAISED_TIMEOUT, OrderStatus.LOW_INV_REVERSAL_TIMEOUT])
|
2032 |
statuses = tuple([OrderStatus.LOW_INV_PO_RAISED_TIMEOUT, OrderStatus.LOW_INV_REVERSAL_TIMEOUT])
|
| 2005 |
else:
|
2033 |
else:
|