| Line 485... |
Line 485... |
| 485 |
def change_transaction_status(transaction_id, new_status, description, pickUp, orderType, source):
|
485 |
def change_transaction_status(transaction_id, new_status, description, pickUp, orderType, source):
|
| 486 |
logging.info("########change transaction status called")
|
486 |
logging.info("########change transaction status called")
|
| 487 |
transaction = get_transaction(transaction_id)
|
487 |
transaction = get_transaction(transaction_id)
|
| 488 |
|
488 |
|
| 489 |
if new_status in (TransactionStatus.AUTHORIZED, TransactionStatus.FLAGGED, TransactionStatus.COD_IN_PROCESS):
|
489 |
if new_status in (TransactionStatus.AUTHORIZED, TransactionStatus.FLAGGED, TransactionStatus.COD_IN_PROCESS):
|
| - |
|
490 |
|
| - |
|
491 |
|
| 490 |
wallet_amount_used = 0.0
|
492 |
wallet_amount_used = 0.0
|
| 491 |
for order in transaction.orders:
|
493 |
for order in transaction.orders:
|
| 492 |
wallet_amount_used = wallet_amount_used + order.wallet_amount
|
494 |
wallet_amount_used = wallet_amount_used + order.wallet_amount
|
| 493 |
if wallet_amount_used > 0:
|
495 |
if wallet_amount_used > 0:
|
| 494 |
user_wallet = get_user_wallet(transaction.orders[0].customer_id)
|
496 |
user_wallet = get_user_wallet(transaction.orders[0].customer_id)
|
| Line 525... |
Line 527... |
| 525 |
if new_status == TransactionStatus.FAILED:
|
527 |
if new_status == TransactionStatus.FAILED:
|
| 526 |
for order in transaction.orders:
|
528 |
for order in transaction.orders:
|
| 527 |
order.status = OrderStatus.PAYMENT_FAILED
|
529 |
order.status = OrderStatus.PAYMENT_FAILED
|
| 528 |
order.statusDescription = "Payment Failed"
|
530 |
order.statusDescription = "Payment Failed"
|
| 529 |
elif new_status == TransactionStatus.AUTHORIZED or new_status == TransactionStatus.FLAGGED:
|
531 |
elif new_status == TransactionStatus.AUTHORIZED or new_status == TransactionStatus.FLAGGED:
|
| - |
|
532 |
user_client = UserClient().get_client()
|
| - |
|
533 |
catalog_client = CatalogClient().get_client()
|
| - |
|
534 |
|
| - |
|
535 |
pdu = user_client.getPrivateDealUser(transaction.orders[0].customer_id)
|
| - |
|
536 |
if pdu.isFofo:
|
| - |
|
537 |
fofoDealMap = catalog_client.getAllFofoDeals([order.lineitems[0].item_id], [4,7])
|
| - |
|
538 |
if fofoDealMap:
|
| - |
|
539 |
itemIds = []
|
| - |
|
540 |
for order in transaction.orders:
|
| - |
|
541 |
itemIds.append(order.lineitems[0].item_id)
|
| - |
|
542 |
inventory_client = InventoryClient().get_client()
|
| - |
|
543 |
fofoWarehousesMap = inventory_client.getFofoFulFillmentWarehouseMap(itemIds)
|
| - |
|
544 |
|
| - |
|
545 |
|
| 530 |
expectedDelayMap = {}
|
546 |
expectedDelayMap = {}
|
| 531 |
billingWarehouseIdMap = {}
|
547 |
billingWarehouseIdMap = {}
|
| 532 |
billingWarehouseTxnMap = {}
|
548 |
billingWarehouseTxnMap = {}
|
| 533 |
subOrderAmountsMap = {}
|
549 |
subOrderAmountsMap = {}
|
| 534 |
for order in transaction.orders:
|
550 |
for order in transaction.orders:
|
| Line 561... |
Line 577... |
| 561 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
577 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 562 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
578 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 563 |
order.promised_shipping_time = order.expected_shipping_time
|
579 |
order.promised_shipping_time = order.expected_shipping_time
|
| 564 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
580 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 565 |
order.promised_delivery_time = order.expected_delivery_time
|
581 |
order.promised_delivery_time = order.expected_delivery_time
|
| 566 |
|
582 |
|
| 567 |
inventory_client = InventoryClient().get_client()
|
583 |
inventory_client = InventoryClient().get_client()
|
| - |
|
584 |
if fofoWarehousesMap:
|
| - |
|
585 |
order.fulfilmentWarehouseId = fofoWarehousesMap.get(item_id).id
|
| - |
|
586 |
order.warehouse_id = fofoWarehousesMap.get(item_id).billingWarehouseId
|
| - |
|
587 |
|
| 568 |
# if OrderType.B2B == order.orderType:
|
588 |
# if OrderType.B2B == order.orderType:
|
| 569 |
# #get state
|
589 |
# #get state
|
| 570 |
# stateMaster = fetchStateMaster()
|
590 |
# stateMaster = fetchStateMaster()
|
| 571 |
# stateId = -1
|
591 |
# stateId = -1
|
| 572 |
# for k, v in stateMaster.iteritems():
|
592 |
# for k, v in stateMaster.iteritems():
|