| Line 382... |
Line 382... |
| 382 |
order.otg = False
|
382 |
order.otg = False
|
| 383 |
else:
|
383 |
else:
|
| 384 |
logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.COD, pickUp)
|
384 |
logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.COD, pickUp)
|
| 385 |
order.otg = logistics_info.otgAvailable
|
385 |
order.otg = logistics_info.otgAvailable
|
| 386 |
|
386 |
|
| 387 |
if order.source == OrderSource.STORE:
|
- |
|
| 388 |
catalog_client = CatalogClient().get_client()
|
- |
|
| 389 |
sourcePricing = catalog_client.getStorePricing(item_id)
|
- |
|
| 390 |
if order.total_amount > sourcePricing.maxPrice:
|
- |
|
| 391 |
raise TransactionServiceException(199, "Order amount exceeded max price for item")
|
- |
|
| 392 |
elif order.total_amount > sourcePricing.minPrice:
|
- |
|
| 393 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
- |
|
| 394 |
|
- |
|
| 395 |
current_time = datetime.datetime.now()
|
387 |
current_time = datetime.datetime.now()
|
| 396 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
388 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
| 397 |
logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
|
389 |
logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
|
| 398 |
logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
|
390 |
logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
|
| 399 |
|
391 |
|
| Line 434... |
Line 426... |
| 434 |
elif new_status == TransactionStatus.FLAGGED:
|
426 |
elif new_status == TransactionStatus.FLAGGED:
|
| 435 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
427 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
| 436 |
transaction_requiring_extra_processing.category = 'PAYMENT_FLAGGED'
|
428 |
transaction_requiring_extra_processing.category = 'PAYMENT_FLAGGED'
|
| 437 |
transaction_requiring_extra_processing.transaction_id = transaction_id
|
429 |
transaction_requiring_extra_processing.transaction_id = transaction_id
|
| 438 |
session.commit()
|
430 |
session.commit()
|
| 439 |
elif order.source == OrderSource.STORE and order.status == OrderStatus.COD_VERIFICATION_PENDING:
|
431 |
elif order.source == OrderSource.STORE:
|
| 440 |
catalog_client = CatalogClient().get_client()
|
432 |
catalog_client = CatalogClient().get_client()
|
| 441 |
sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
|
433 |
sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
|
| - |
|
434 |
if order.total_amount >= sourcePricing.minPrice:
|
| - |
|
435 |
order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
|
| - |
|
436 |
else:
|
| - |
|
437 |
order.status = OrderStatus.COD_VERIFICATION_PENDING
|
| 442 |
content = "<html><body>"
|
438 |
content = "<html><body>"
|
| - |
|
439 |
content += "<h2>Order Id: " + str(order.id) + "</h2>"
|
| 443 |
content += "<h2>Product: " + str(order.lineitems[0]) + "</h2>"
|
440 |
content += "<h2>Product: " + str(order.lineitems[0]) + "</h2>"
|
| 444 |
content += "<h2>Min Price: " + str(sourcePricing.minPrice) + "</h2>"
|
441 |
content += "<h2>Min Price: " + str(sourcePricing.minPrice) + "</h2>"
|
| 445 |
content += "<h2>Max Price: " + str(sourcePricing.maxPrice) + "</h2>"
|
442 |
content += "<h2>Max Price: " + str(sourcePricing.maxPrice) + "</h2>"
|
| 446 |
content += "<h2>Recommended Price: " + str(sourcePricing.recommendedPrice) + "</h2>"
|
443 |
content += "<h2>Recommended Price: " + str(sourcePricing.recommendedPrice) + "</h2>"
|
| 447 |
content += "<h2>Approval Requested for Price: " + str(order.total_amount) + "</h2>"
|
444 |
content += "<h2>Approval Requested for Price: " + str(order.total_amount) + "</h2>"
|
| 448 |
content += "<h3>Please click on link below to approve the order</h3>"
|
445 |
content += "<h3>Please click on link below to approve the order</h3>"
|
| 449 |
content += "<a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id)) + "'>Click here for Approval</a>"
|
446 |
content += "<a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id)) + "'>Click here for Approval</a>"
|
| 450 |
content += "<br><br></body></html>"
|
447 |
content += "<br><br></body></html>"
|
| 451 |
store = get_hotspot_store(order.storeId, "")
|
448 |
store = get_hotspot_store(order.storeId, "")
|
| 452 |
helper_client = HelperClient().get_client()
|
449 |
helper_client = HelperClient().get_client()
|
| 453 |
helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), "", "Price approval requested for " + str(order.lineitems[0]) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [])
|
450 |
helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), "", "Price approval requested for " + str(order.lineitems[0]) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [])
|
| 454 |
|
451 |
session.commit()
|
| 455 |
except Exception as e:
|
452 |
except Exception as e:
|
| 456 |
print "Error inserting transaction Id: " + str(transaction_id) + " due to " + str(e)
|
453 |
print "Error inserting transaction Id: " + str(transaction_id) + " due to " + str(e)
|
| 457 |
|
454 |
|
| 458 |
return True
|
455 |
return True
|
| 459 |
|
456 |
|