| Line 1676... |
Line 1676... |
| 1676 |
|
1676 |
|
| 1677 |
logistics_client = LogisticsClient().get_client()
|
1677 |
logistics_client = LogisticsClient().get_client()
|
| 1678 |
provider = logistics_client.getProvider(order.logistics_provider_id)
|
1678 |
provider = logistics_client.getProvider(order.logistics_provider_id)
|
| 1679 |
providerLimits = logistics_client.getProviderLimitDetailsForPincode(provider.id, order.customer_pincode)
|
1679 |
providerLimits = logistics_client.getProviderLimitDetailsForPincode(provider.id, order.customer_pincode)
|
| 1680 |
|
1680 |
|
| - |
|
1681 |
if order.total_weight is None or order.total_weight == 0:
|
| - |
|
1682 |
raise TransactionServiceException(210, "Weight not defined for this order:- "+str(order.id)+". Contact Category Team")
|
| - |
|
1683 |
|
| 1681 |
if order.total_weight > provider.bundleWeightLimit:
|
1684 |
if order.total_weight > provider.bundleWeightLimit:
|
| 1682 |
raise TransactionServiceException(210, "Logistics Partner "+provider.name+ " Group Shipment Weight Limit Violated i.e. "+str(provider.bundleWeightLimit)+" Suggestion: Split Order!!!")
|
1685 |
raise TransactionServiceException(210, "Logistics Partner "+provider.name+ " Group Shipment Weight Limit Violated i.e. "+str(provider.bundleWeightLimit)+" Suggestion: Split Order!!!")
|
| 1683 |
|
1686 |
|
| 1684 |
if order.cod:
|
1687 |
if order.cod:
|
| 1685 |
if order.total_amount > provider.maxCodLimit:
|
1688 |
if order.total_amount > provider.maxCodLimit:
|
| Line 4525... |
Line 4528... |
| 4525 |
"""
|
4528 |
"""
|
| 4526 |
order = get_order(orderId)
|
4529 |
order = get_order(orderId)
|
| 4527 |
order.status = OrderStatus.CANCEL_REQUEST_CONFIRMED
|
4530 |
order.status = OrderStatus.CANCEL_REQUEST_CONFIRMED
|
| 4528 |
order.statusDescription = "Cancellation request confirmed"
|
4531 |
order.statusDescription = "Cancellation request confirmed"
|
| 4529 |
session.commit()
|
4532 |
session.commit()
|
| - |
|
4533 |
refund_order(order.id, "crm-team", "As per Customer's Request")
|
| 4530 |
|
4534 |
|
| 4531 |
def accept_orders_for_item_id(itemId, inventory):
|
4535 |
def accept_orders_for_item_id(itemId, inventory):
|
| 4532 |
"""
|
4536 |
"""
|
| 4533 |
Marks the orders as ACCEPTED for the given itemId and inventory. It also updates the accepted timestamp. If the
|
4537 |
Marks the orders as ACCEPTED for the given itemId and inventory. It also updates the accepted timestamp. If the
|
| 4534 |
given order is not a COD order, it also captures the payment if the same has not been captured.
|
4538 |
given order is not a COD order, it also captures the payment if the same has not been captured.
|
| Line 8048... |
Line 8052... |
| 8048 |
|
8052 |
|
| 8049 |
'''
|
8053 |
'''
|
| 8050 |
Check For Pre Conditions
|
8054 |
Check For Pre Conditions
|
| 8051 |
'''
|
8055 |
'''
|
| 8052 |
for order in ordersList:
|
8056 |
for order in ordersList:
|
| - |
|
8057 |
if order.total_weight is None or order.total_weight ==0:
|
| - |
|
8058 |
raise TransactionServiceException(208, "Weight Value Not Defined for order:- "+ str(order.id)+". Contact Category Team.")
|
| 8053 |
totalWeight = totalWeight + order.total_weight
|
8059 |
totalWeight = totalWeight + order.total_weight
|
| 8054 |
#if order.cod:
|
8060 |
#if order.cod:
|
| 8055 |
totalOrdersAmount = totalOrdersAmount + order.total_amount
|
8061 |
totalOrdersAmount = totalOrdersAmount + order.total_amount
|
| 8056 |
|
8062 |
|
| 8057 |
if order.cod:
|
8063 |
if order.cod:
|
| Line 8069... |
Line 8075... |
| 8069 |
if totalOrdersAmount > provider.maxCodLimit:
|
8075 |
if totalOrdersAmount > provider.maxCodLimit:
|
| 8070 |
raise TransactionServiceException(210, "Logistics Partner "+provider.name+ " Max Cod Amount Collection Limit Violated i.e. "+ str(provider.maxCodLimit))
|
8076 |
raise TransactionServiceException(210, "Logistics Partner "+provider.name+ " Max Cod Amount Collection Limit Violated i.e. "+ str(provider.maxCodLimit))
|
| 8071 |
|
8077 |
|
| 8072 |
if order.logistics_provider_id!=4:
|
8078 |
if order.logistics_provider_id!=4:
|
| 8073 |
|
8079 |
|
| 8074 |
providerCodLimit = float(providerLimits.get("websiteCodLimit"))
|
8080 |
providerCodLimit = float(providerLimits.get("providerCodLimit"))
|
| 8075 |
providerPrepaidLimit = float(providerLimits.get("providerPrepaidLimit"))
|
8081 |
providerPrepaidLimit = float(providerLimits.get("providerPrepaidLimit"))
|
| 8076 |
|
8082 |
|
| 8077 |
if order.cod:
|
8083 |
if order.cod:
|
| 8078 |
if totalOrdersAmount > providerCodLimit:
|
8084 |
if totalOrdersAmount > providerCodLimit:
|
| 8079 |
raise TransactionServiceException(212, "Provider Maximum COD Limit Violated for Customer Pincode i.e. "+str(providerCodLimit))
|
8085 |
raise TransactionServiceException(212, "Provider Maximum COD Limit Violated for Customer Pincode i.e. "+str(providerCodLimit))
|
| Line 8919... |
Line 8925... |
| 8919 |
else:
|
8925 |
else:
|
| 8920 |
return False
|
8926 |
return False
|
| 8921 |
|
8927 |
|
| 8922 |
def split_bulk_order(order_id, split_order_quantity):
|
8928 |
def split_bulk_order(order_id, split_order_quantity):
|
| 8923 |
order = get_order(order_id)
|
8929 |
order = get_order(order_id)
|
| 8924 |
order = get_order(order_id)
|
- |
|
| 8925 |
if split_order_quantity >=order.lineitems[0].quantity:
|
8930 |
if split_order_quantity >=order.lineitems[0].quantity:
|
| 8926 |
raise TransactionServiceException(115, "Split Quantity is greater than or equal to order quantity")
|
8931 |
raise TransactionServiceException(115, "Split Quantity is greater than or equal to order quantity")
|
| 8927 |
if order.status not in [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, OrderStatus.CAPTURE_IN_PROCESS, OrderStatus.REJECTED, OrderStatus.ACCEPTED]:
|
8932 |
if order.status not in [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, OrderStatus.CAPTURE_IN_PROCESS, OrderStatus.REJECTED, OrderStatus.ACCEPTED]:
|
| 8928 |
raise TransactionServiceException(115, "Order not allowed to be split")
|
8933 |
raise TransactionServiceException(115, "Order not allowed to be split")
|
| 8929 |
|
8934 |
|