| Line 4614... |
Line 4614... |
| 4614 |
try:
|
4614 |
try:
|
| 4615 |
orders = Order.query.filter_by(airwaybill_no=awb).all()
|
4615 |
orders = Order.query.filter_by(airwaybill_no=awb).all()
|
| 4616 |
except NoResultFound:
|
4616 |
except NoResultFound:
|
| 4617 |
unprocessed_awbs[awb] = "No order was found for the given AWB: " + awb
|
4617 |
unprocessed_awbs[awb] = "No order was found for the given AWB: " + awb
|
| 4618 |
continue
|
4618 |
continue
|
| 4619 |
'''
|
- |
|
| 4620 |
except MultipleResultsFound:
|
- |
|
| 4621 |
unprocessed_awbs[awb] = "Multiple orders were found for the given AWB:" + awb
|
- |
|
| 4622 |
continue
|
- |
|
| 4623 |
'''
|
- |
|
| 4624 |
order = orders[0]
|
4619 |
order = orders[0]
|
| - |
|
4620 |
|
| - |
|
4621 |
totalOrdersAmount = 0
|
| - |
|
4622 |
for order in orders:
|
| - |
|
4623 |
totalOrdersAmount = totalOrdersAmount + order.net_payable_amount
|
| 4625 |
|
4624 |
|
| 4626 |
if order.cod_reconciliation_timestamp:
|
4625 |
if order.cod_reconciliation_timestamp:
|
| 4627 |
#This order has been processed already! This may be a re-run. Let's allow other orders to be processed.
|
4626 |
#This order has been processed already! This may be a re-run. Let's allow other orders to be processed.
|
| 4628 |
continue
|
4627 |
continue
|
| 4629 |
|
4628 |
|
| Line 4631... |
Line 4630... |
| 4631 |
#Order has not been delivered yet. No way we can receive the payment.
|
4630 |
#Order has not been delivered yet. No way we can receive the payment.
|
| 4632 |
unprocessed_awbs[awb] = "Payment has been received for order: " + str(order.id) + " before it has been delivered"
|
4631 |
unprocessed_awbs[awb] = "Payment has been received for order: " + str(order.id) + " before it has been delivered"
|
| 4633 |
continue
|
4632 |
continue
|
| 4634 |
|
4633 |
|
| 4635 |
##As per ticket #743 if amount difference less than 0.5 we should reconcile
|
4634 |
##As per ticket #743 if amount difference less than 0.5 we should reconcile
|
| 4636 |
if abs(amount - order.net_payable_amount) > 0.5:
|
4635 |
if abs(amount - totalOrdersAmount) > 0.5:
|
| 4637 |
#Received amount is less than or more than the order amount. Mustn't let the user proceed.
|
4636 |
#Received amount is less than or more than the order amount. Mustn't let the user proceed.
|
| 4638 |
unprocessed_awbs[awb] = "Payment of Rs. " + str(amount) + " has been received against the total value of Rs. " + str(order.net_payable_amount) + " for order: " + str(order.id)
|
4637 |
unprocessed_awbs[awb] = "Payment of Rs. " + str(amount) + " has been received against the total value of Rs. " + str(totalOrdersAmount)
|
| 4639 |
continue
|
4638 |
continue
|
| 4640 |
|
4639 |
|
| 4641 |
try:
|
4640 |
try:
|
| 4642 |
payment_client = PaymentClient().get_client()
|
4641 |
payment_client = PaymentClient().get_client()
|
| 4643 |
payment_client.partiallyCapturePayment(order.transaction.id, amount, xferBy, xferTxnId, xferDate)
|
4642 |
payment_client.partiallyCapturePayment(order.transaction.id, amount, xferBy, xferTxnId, xferDate)
|