| Line 47... |
Line 47... |
| 47 |
AmazonFbaOrderReturns, FlipkartAdvantageOrder, InvoiceCounterGenerator, \
|
47 |
AmazonFbaOrderReturns, FlipkartAdvantageOrder, InvoiceCounterGenerator, \
|
| 48 |
TransactionShipmentSequence, HsOrder, Creditor, UserSanction, CreditHistory, \
|
48 |
TransactionShipmentSequence, HsOrder, Creditor, UserSanction, CreditHistory, \
|
| 49 |
LoanHistory, ShipmentLogisticsCostDetail, ReturnOrderInfo, ReturnTransaction, \
|
49 |
LoanHistory, ShipmentLogisticsCostDetail, ReturnOrderInfo, ReturnTransaction, \
|
| 50 |
ReturnPickupRequest, SellerWarehouse, Seller, Organisation, \
|
50 |
ReturnPickupRequest, SellerWarehouse, Seller, Organisation, \
|
| 51 |
WarehouseAddressMapping, WarehouseAddressMaster, PMSA, PMSA_Agents, \
|
51 |
WarehouseAddressMapping, WarehouseAddressMaster, PMSA, PMSA_Agents, \
|
| 52 |
AdvancePayments
|
52 |
AdvancePayments, CodCourierPaymentRemittance
|
| 53 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
53 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
| 54 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
54 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
| 55 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
55 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
| 56 |
MobileRechargeOrder
|
56 |
MobileRechargeOrder
|
| 57 |
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
|
57 |
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
|
| Line 4727... |
Line 4727... |
| 4727 |
#Order has not been delivered yet. No way we can receive the payment.
|
4727 |
#Order has not been delivered yet. No way we can receive the payment.
|
| 4728 |
unprocessed_awbs[awb] = "Payment has been received for order: " + str(order.id) + " before delivery reconciliation"
|
4728 |
unprocessed_awbs[awb] = "Payment has been received for order: " + str(order.id) + " before delivery reconciliation"
|
| 4729 |
continue
|
4729 |
continue
|
| 4730 |
|
4730 |
|
| 4731 |
##As per ticket #743 if amount difference less than 0.5 we should reconcile
|
4731 |
##As per ticket #743 if amount difference less than 0.5 we should reconcile
|
| 4732 |
if abs(amount - (order.total_amount + order.shippingCost - order.gvAmount)) > 0.5:
|
4732 |
if abs(amount - order.net_payable_amount) > 0.5:
|
| 4733 |
#Received amount is less than or more than the order amount. Mustn't let the user proceed.
|
4733 |
#Received amount is less than or more than the order amount. Mustn't let the user proceed.
|
| 4734 |
unprocessed_awbs[awb] = "Payment of Rs. " + str(amount) + " has been received against the total value of Rs. " + str(order.total_amount + order.shippingCost -order.gvAmount) + " for order: " + str(order.id)
|
4734 |
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)
|
| 4735 |
continue
|
4735 |
continue
|
| 4736 |
|
4736 |
|
| 4737 |
try:
|
4737 |
try:
|
| 4738 |
payment_client = PaymentClient().get_client()
|
4738 |
payment_client = PaymentClient().get_client()
|
| 4739 |
payment_client.partiallyCapturePayment(order.transaction.id, amount, xferBy, xferTxnId, xferDate)
|
4739 |
payment_client.partiallyCapturePayment(order.transaction.id, amount, xferBy, xferTxnId, xferDate)
|
| 4740 |
except Exception:
|
4740 |
except Exception:
|
| 4741 |
unprocessed_awbs[awb] = "We were unable to partially capture payment for order id " + str(order.id) + ", AWB: " + awb
|
4741 |
unprocessed_awbs[awb] = "We were unable to partially capture payment for order id " + str(order.id) + ", AWB: " + awb
|
| 4742 |
continue
|
4742 |
continue
|
| 4743 |
|
4743 |
|
| 4744 |
#Payment has been recorded now. We can update the order peacefully.
|
4744 |
#Payment has been recorded now. We can update the order peacefully.
|
| - |
|
4745 |
remittance = CodCourierPaymentRemittance()
|
| - |
|
4746 |
remittance.airwayBillNo = awb
|
| - |
|
4747 |
remittance.collectionReference = xferTxnId
|
| - |
|
4748 |
remittance.amount = amount
|
| - |
|
4749 |
remittance.settledAt = datetime.datetime.strptime(xferDate, "%Y/%m/%d")
|
| - |
|
4750 |
remittance.provider_id = order.logistics_provider_id
|
| 4745 |
order.cod_reconciliation_timestamp = datetime.datetime.now()
|
4751 |
order.cod_reconciliation_timestamp = datetime.datetime.now()
|
| 4746 |
session.commit()
|
4752 |
session.commit()
|
| 4747 |
|
4753 |
|
| 4748 |
if len(orders) > 1:
|
4754 |
if len(orders) > 1:
|
| 4749 |
totalOrdersAmount = 0
|
4755 |
totalOrdersAmount = 0
|
| Line 4765... |
Line 4771... |
| 4765 |
unprocessed_awbs[awb] = "We were unable to partially capture payment for master order id " + orders[0].logisticsTransactionId + ", AWB: " + awb
|
4771 |
unprocessed_awbs[awb] = "We were unable to partially capture payment for master order id " + orders[0].logisticsTransactionId + ", AWB: " + awb
|
| 4766 |
continue
|
4772 |
continue
|
| 4767 |
|
4773 |
|
| 4768 |
for order in orders:
|
4774 |
for order in orders:
|
| 4769 |
order.cod_reconciliation_timestamp = datetime.datetime.now()
|
4775 |
order.cod_reconciliation_timestamp = datetime.datetime.now()
|
| - |
|
4776 |
remittance = CodCourierPaymentRemittance()
|
| - |
|
4777 |
remittance.airwayBillNo = awb
|
| - |
|
4778 |
remittance.collectionReference = xferTxnId
|
| - |
|
4779 |
remittance.amount = amount
|
| - |
|
4780 |
remittance.settledAt = datetime.datetime.strptime(xferDate, "%Y/%m/%d")
|
| - |
|
4781 |
remittance.provider_id = order.logistics_provider_id
|
| 4770 |
session.commit()
|
4782 |
session.commit()
|
| 4771 |
else:
|
4783 |
else:
|
| 4772 |
unprocessed_awbs[awb] = "Multiple orders were found for the given AWB:" + awb
|
4784 |
unprocessed_awbs[awb] = "Multiple orders were found for the given AWB:" + awb
|
| 4773 |
continue
|
4785 |
continue
|
| 4774 |
|
4786 |
|