| Line 11... |
Line 11... |
| 11 |
from elixir import *
|
11 |
from elixir import *
|
| 12 |
from math import ceil
|
12 |
from math import ceil
|
| 13 |
from random import randrange
|
13 |
from random import randrange
|
| 14 |
from reportlab.lib.enums import TA_CENTER, TA_JUSTIFY
|
14 |
from reportlab.lib.enums import TA_CENTER, TA_JUSTIFY
|
| 15 |
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
|
15 |
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
|
| 16 |
from reportlab.lib.units import inch
|
16 |
from reportlab.lib.units import inch, mm
|
| 17 |
from reportlab.pdfgen.canvas import Canvas
|
17 |
from reportlab.pdfgen.canvas import Canvas
|
| 18 |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image, \
|
18 |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image, \
|
| 19 |
BaseDocTemplate, Frame, PageTemplate
|
19 |
BaseDocTemplate, Frame, PageTemplate
|
| 20 |
from reportlab.rl_config import defaultPageSize
|
20 |
from reportlab.rl_config import defaultPageSize
|
| - |
|
21 |
from reportlab.lib import colors
|
| - |
|
22 |
from reportlab.platypus import Table, TableStyle
|
| 21 |
from shop2020.clients.AlertClient import AlertClient
|
23 |
from shop2020.clients.AlertClient import AlertClient
|
| 22 |
from shop2020.clients.CRMClient import CRMClient
|
24 |
from shop2020.clients.CRMClient import CRMClient
|
| 23 |
from shop2020.clients.CatalogClient import CatalogClient
|
25 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 24 |
from shop2020.clients.HelperClient import HelperClient
|
26 |
from shop2020.clients.HelperClient import HelperClient
|
| 25 |
from shop2020.clients.InventoryClient import InventoryClient
|
27 |
from shop2020.clients.InventoryClient import InventoryClient
|
| Line 41... |
Line 43... |
| 41 |
FRC, OperatorSeries, SourceDetail, Company, EbayOrder, AmazonFbaSalesSnapshot, \
|
43 |
FRC, OperatorSeries, SourceDetail, Company, EbayOrder, AmazonFbaSalesSnapshot, \
|
| 42 |
AmazonOrder, StoreOrderDetail, EdcBank, StoreOrderCollection, \
|
44 |
AmazonOrder, StoreOrderDetail, EdcBank, StoreOrderCollection, \
|
| 43 |
HotspotServiceMatrix, SnapdealOrder, FlipkartOrder, DataInsuranceDetailForOrder, \
|
45 |
HotspotServiceMatrix, SnapdealOrder, FlipkartOrder, DataInsuranceDetailForOrder, \
|
| 44 |
AmazonFbaOrderReturns, FlipkartAdvantageOrder, InvoiceCounterGenerator, \
|
46 |
AmazonFbaOrderReturns, FlipkartAdvantageOrder, InvoiceCounterGenerator, \
|
| 45 |
TransactionShipmentSequence, HsOrder, Creditor, UserSanction, CreditHistory, LoanHistory, \
|
47 |
TransactionShipmentSequence, HsOrder, Creditor, UserSanction, CreditHistory, LoanHistory, \
|
| 46 |
ShipmentLogisticsCostDetail
|
48 |
ShipmentLogisticsCostDetail, ReturnOrderInfo, ReturnTransaction , ReturnPickupRequest
|
| 47 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
49 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
| 48 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
50 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
| 49 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
51 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
| 50 |
MobileRechargeOrder
|
52 |
MobileRechargeOrder
|
| 51 |
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
|
53 |
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
|
| Line 70... |
Line 72... |
| 70 |
TransactionStatus, OrderStatus, DelayReason, ExtraTransactionProcessingType, \
|
72 |
TransactionStatus, OrderStatus, DelayReason, ExtraTransactionProcessingType, \
|
| 71 |
HotspotAction, TimeoutSummary, OrderStatusGroups, OrderType, RechargeOrderStatus, \
|
73 |
HotspotAction, TimeoutSummary, OrderStatusGroups, OrderType, RechargeOrderStatus, \
|
| 72 |
RechargeType, RechargeStatistics, DeviceNumberInfo, EmiChargeType, PayMethod, \
|
74 |
RechargeType, RechargeStatistics, DeviceNumberInfo, EmiChargeType, PayMethod, \
|
| 73 |
OrderSource, StorePaymentStatus, ProductCondition, TaxType, \
|
75 |
OrderSource, StorePaymentStatus, ProductCondition, TaxType, \
|
| 74 |
AmazonFCWarehouseLocation, RechargeMode, CreditTxnType, CreditHistory as TCreditHistory, \
|
76 |
AmazonFCWarehouseLocation, RechargeMode, CreditTxnType, CreditHistory as TCreditHistory, \
|
| 75 |
LoanHistory as TLoanHistory, ShipmentLogisticsCostDetail as TShipmentLogisticsCostDetail
|
77 |
LoanHistory as TLoanHistory, ShipmentLogisticsCostDetail as TShipmentLogisticsCostDetail, \
|
| - |
|
78 |
ReturnTransactionStatus, ReturnAction, ReturnTxnResolutionStatus, ReplacementShippingType, \
|
| - |
|
79 |
ReturnTxnPickupStatus, ReceivedReturnType, ReturnPickupType
|
| 76 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType, CouponCategory, \
|
80 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType, CouponCategory, \
|
| 77 |
User, Sex
|
81 |
User, Sex
|
| 78 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
82 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
| 79 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
83 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
| 80 |
from shop2020.thriftpy.warehouse.ttypes import ScanType, \
|
84 |
from shop2020.thriftpy.warehouse.ttypes import ScanType, \
|
| Line 4186... |
Line 4190... |
| 4186 |
pdf.drawText(order_text)
|
4190 |
pdf.drawText(order_text)
|
| 4187 |
pdf.showPage()
|
4191 |
pdf.showPage()
|
| 4188 |
pdf.save()
|
4192 |
pdf.save()
|
| 4189 |
return filename
|
4193 |
return filename
|
| 4190 |
|
4194 |
|
| - |
|
4195 |
def __coord(self, x, y, unit=1):
|
| - |
|
4196 |
"""
|
| - |
|
4197 |
# http://stackoverflow.com/questions/4726011/wrap-text-in-a-table-reportlab
|
| - |
|
4198 |
Helper class to help position flowables in Canvas objects
|
| - |
|
4199 |
"""
|
| - |
|
4200 |
x, y = x * unit, PAGE_HEIGHT - y * unit
|
| - |
|
4201 |
return x, y
|
| - |
|
4202 |
|
| - |
|
4203 |
def __generate_return_transaction_invoice(returnOrders, warehouse, provider, filename):
|
| - |
|
4204 |
ReturnPickupRequest
|
| - |
|
4205 |
if warehouse.id == 7:
|
| - |
|
4206 |
executive = 'Varun Patiyal'
|
| - |
|
4207 |
else:
|
| - |
|
4208 |
executive = 'Deepak Kumar'
|
| - |
|
4209 |
pdf = Canvas(filename)
|
| - |
|
4210 |
styles = getSampleStyleSheet()
|
| - |
|
4211 |
address = """ <font size="9">
|
| - |
|
4212 |
To<br/>
|
| - |
|
4213 |
<br/>
|
| - |
|
4214 |
%s<br/>"""%(executive)
|
| - |
|
4215 |
for line in warehouse.location.split("\n"):
|
| - |
|
4216 |
address = address +"""%s<br/>"""%(line)
|
| - |
|
4217 |
address = address +"""PIN %s<br>"""%(warehouse.pincode)
|
| - |
|
4218 |
address = address +"""</font>"""
|
| - |
|
4219 |
p = Paragraph(address, styles["Normal"])
|
| - |
|
4220 |
p.wrapOn(pdf, PAGE_WIDTH, PAGE_HEIGHT)
|
| - |
|
4221 |
p.drawOn(pdf, *__coord(18, 40, mm))
|
| - |
|
4222 |
returnPickupReq = ReturnPickupRequest.get_by(id=returnOrders[0].logisticsRequestId)
|
| - |
|
4223 |
|
| - |
|
4224 |
order_number = '<font size="14"><b>Return Pickup Request No:- %s </b></font>' % returnPickupReq.pickupRequestNo
|
| - |
|
4225 |
p = Paragraph(order_number, styles["Normal"])
|
| - |
|
4226 |
p.wrapOn(pdf, PAGE_WIDTH, PAGE_HEIGHT)
|
| - |
|
4227 |
p.drawOn(pdf, *__coord(18, 50, mm))
|
| - |
|
4228 |
|
| - |
|
4229 |
data = []
|
| - |
|
4230 |
data.append(["Content", "Quantity", "Declared Value: Rs.", "Order ID", "Return Ticket Id"])
|
| - |
|
4231 |
for returnOrder in returnOrders:
|
| - |
|
4232 |
lineitem = returnOrder.lineitem
|
| - |
|
4233 |
row = []
|
| - |
|
4234 |
row.append(str(lineitem))
|
| - |
|
4235 |
row.append(returnOrder.returnQuantity)
|
| - |
|
4236 |
row.append(returnOrder.returnQuantity*lineitem.unit_price)
|
| - |
|
4237 |
row.append(returnOrder.orderId)
|
| - |
|
4238 |
row.append(returnOrder.returnTransaction.id)
|
| - |
|
4239 |
data.append(row)
|
| - |
|
4240 |
|
| - |
|
4241 |
t = Table(data, 1.5 * inch)
|
| - |
|
4242 |
t.setStyle(TableStyle([
|
| - |
|
4243 |
('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
|
| - |
|
4244 |
('BOX', (0,0), (-1,-1), 0.25, colors.black)
|
| - |
|
4245 |
]))
|
| - |
|
4246 |
t.wrapOn(pdf, PAGE_WIDTH, PAGE_HEIGHT)
|
| - |
|
4247 |
t.drawOn(pdf, *__coord(18, 85, mm))
|
| - |
|
4248 |
|
| - |
|
4249 |
pdf.showPage()
|
| - |
|
4250 |
pdf.save()
|
| - |
|
4251 |
return filename
|
| - |
|
4252 |
|
| 4191 |
def __push_store_collection_to_hotspot(order, ctype, cashamount, cardamount):
|
4253 |
def __push_store_collection_to_hotspot(order, ctype, cashamount, cardamount):
|
| 4192 |
ts = datetime.datetime.now()
|
4254 |
ts = datetime.datetime.now()
|
| 4193 |
store = get_hotspot_store(order.storeId, "")
|
4255 |
store = get_hotspot_store(order.storeId, "")
|
| 4194 |
|
4256 |
|
| 4195 |
soc = StoreOrderCollection()
|
4257 |
soc = StoreOrderCollection()
|
| Line 9885... |
Line 9947... |
| 9885 |
ordersList[0].lineitems[0].logisticsCost = ordersList[0].lineitems[0].logisticsCost + (round(logisticsCost,2)-logisticsCostInOrders)
|
9947 |
ordersList[0].lineitems[0].logisticsCost = ordersList[0].lineitems[0].logisticsCost + (round(logisticsCost,2)-logisticsCostInOrders)
|
| 9886 |
if codCollectionCharges>0:
|
9948 |
if codCollectionCharges>0:
|
| 9887 |
ordersList[0].lineitems[0].codCollectionCharges = ordersList[0].lineitems[0].codCollectionCharges + (round(codCollectionCharges,2)-codCollectionChargesInOrders)
|
9949 |
ordersList[0].lineitems[0].codCollectionCharges = ordersList[0].lineitems[0].codCollectionCharges + (round(codCollectionCharges,2)-codCollectionChargesInOrders)
|
| 9888 |
session.commit()
|
9950 |
session.commit()
|
| 9889 |
|
9951 |
|
| 9890 |
return ordersList
|
9952 |
return ordersList
|
| - |
|
9953 |
|
| - |
|
9954 |
def __create_return_order_info(order, status, quantity=0):
|
| - |
|
9955 |
returnOrderInfo = ReturnOrderInfo()
|
| - |
|
9956 |
returnOrderInfo.orderId = order.id
|
| - |
|
9957 |
returnOrderInfo.lineItemId = order.lineitems[0].id
|
| - |
|
9958 |
if quantity>0:
|
| - |
|
9959 |
returnOrderInfo.returnQuantity = quantity
|
| - |
|
9960 |
else:
|
| - |
|
9961 |
returnOrderInfo.returnQuantity = order.lineitems[0].quantity
|
| - |
|
9962 |
returnOrderInfo.createdAt = datetime.datetime.now()
|
| - |
|
9963 |
returnOrderInfo.returnStatus = status
|
| - |
|
9964 |
returnOrderInfo.masterOrderId = order.logisticsTransactionId
|
| - |
|
9965 |
returnOrderInfo.warehouse_id = order.warehouse_id
|
| - |
|
9966 |
session.commit()
|
| - |
|
9967 |
|
| - |
|
9968 |
return returnOrderInfo
|
| - |
|
9969 |
|
| - |
|
9970 |
def create_return_order_info(returnInfo):
|
| - |
|
9971 |
returnOrderInfo = ReturnOrderInfo()
|
| - |
|
9972 |
returnOrderInfo.orderId = returnInfo.orderId
|
| - |
|
9973 |
returnOrderInfo.lineItemId = returnInfo.lineItemId
|
| - |
|
9974 |
returnOrderInfo.returnQuantity = returnInfo.returnQuantity
|
| - |
|
9975 |
returnOrderInfo.createdAt = datetime.datetime.now()
|
| - |
|
9976 |
returnOrderInfo.returnStatus = returnInfo.returnStatus
|
| - |
|
9977 |
returnOrderInfo.masterOrderId = returnInfo.masterOrderId
|
| - |
|
9978 |
returnOrderInfo.warehouse_id = returnInfo.warehouse_id
|
| - |
|
9979 |
returnOrderInfo.returnAction = ReturnAction._VALUES_TO_NAMES[returnInfo.returnAction]
|
| - |
|
9980 |
returnOrderInfo.shippingType = ReplacementShippingType._VALUES_TO_NAMES[returnInfo.shippingType]
|
| - |
|
9981 |
returnOrderInfo.freebieItemId = returnInfo.freebieItemId
|
| - |
|
9982 |
returnOrderInfo.returnAction = returnOrderInfo.returnAction
|
| - |
|
9983 |
returnOrderInfo.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.PENDING]
|
| - |
|
9984 |
session.commit()
|
| - |
|
9985 |
|
| - |
|
9986 |
return returnOrderInfo
|
| - |
|
9987 |
|
| - |
|
9988 |
def get_return_order_info(returnOrderId):
|
| - |
|
9989 |
returnOrder = ReturnOrderInfo.get_by(id=returnOrderId)
|
| - |
|
9990 |
if not returnOrder:
|
| - |
|
9991 |
return None
|
| - |
|
9992 |
return order
|
| - |
|
9993 |
|
| - |
|
9994 |
def get_return_orders_info_map(order_ids=None, statuses=None):
|
| - |
|
9995 |
returnOrdersInfoQuery = ReturnOrderInfo.query
|
| - |
|
9996 |
if order_ids is not None and len(order_ids)>0:
|
| - |
|
9997 |
returnOrdersInfoQuery = returnOrdersInfoQuery.filter(ReturnOrderInfo.orderId.in_(tuple(order_ids)))
|
| - |
|
9998 |
if statuses is not None:
|
| - |
|
9999 |
returnOrdersInfoQuery = returnOrdersInfoQuery.filter(ReturnOrderInfo.returnStatus.in_(tuple(statuses)))
|
| - |
|
10000 |
allReturnOrdersList = returnOrdersInfoQuery.all()
|
| - |
|
10001 |
returnOrdersInfoMap = {}
|
| - |
|
10002 |
for returnOrder in allReturnOrdersList:
|
| - |
|
10003 |
if returnOrdersInfoMap.has_key(returnOrder.orderId):
|
| - |
|
10004 |
returnList = returnOrdersInfoMap.get(returnOrder.orderId)
|
| - |
|
10005 |
returnList.append(returnOrder)
|
| - |
|
10006 |
returnOrdersInfoMap[returnOrder.orderId] = returnList
|
| - |
|
10007 |
else:
|
| - |
|
10008 |
returnList = []
|
| - |
|
10009 |
returnList.append(returnOrder)
|
| - |
|
10010 |
returnOrdersInfoMap[returnOrder.orderId] = returnList
|
| - |
|
10011 |
|
| - |
|
10012 |
return returnOrdersInfoMap
|
| - |
|
10013 |
|
| - |
|
10014 |
def update_return_order_info(returnInfo):
|
| - |
|
10015 |
try:
|
| - |
|
10016 |
returnOrderInfo = get_return_order_info(returnInfo.id)
|
| - |
|
10017 |
returnOrderInfo.returnStatus = returnInfo.returnStatus
|
| - |
|
10018 |
if returnInfo.processedAt:
|
| - |
|
10019 |
returnOrderInfo.processedAt = to_py_date(returnInfo.processedAt)
|
| - |
|
10020 |
if returnInfo.reshippedAt:
|
| - |
|
10021 |
returnOrderInfo.reshippedAt = to_py_date(returnInfo.reshippedAt)
|
| - |
|
10022 |
if returnInfo.receivedAt:
|
| - |
|
10023 |
returnOrderInfo.receivedAt = to_py_date(returnInfo.receivedAt)
|
| - |
|
10024 |
if returnInfo.authorizedAt:
|
| - |
|
10025 |
returnOrderInfo.authorizedAt = to_py_date(returnInfo.authorizedAt)
|
| - |
|
10026 |
if returnInfo.refundAmount:
|
| - |
|
10027 |
returnOrderInfo.refundAmount = returnInfo.refundAmount
|
| - |
|
10028 |
if returnInfo.refundReason:
|
| - |
|
10029 |
returnOrderInfo.refundReason = returnInfo.refundReason
|
| - |
|
10030 |
if returnInfo.refundedAt:
|
| - |
|
10031 |
returnOrderInfo.refundedAt = to_py_date(returnInfo.refundedAt)
|
| - |
|
10032 |
if returnInfo.refundedBy:
|
| - |
|
10033 |
returnOrderInfo.refundedBy = returnInfo.refundedBy
|
| - |
|
10034 |
if returnInfo.refundType:
|
| - |
|
10035 |
returnOrderInfo.refundType = returnInfo.refundType
|
| - |
|
10036 |
if returnInfo.refundDescription:
|
| - |
|
10037 |
returnOrderInfo.refundDescription = returnInfo.refundDescription
|
| - |
|
10038 |
if returnInfo.logisticsRequestId:
|
| - |
|
10039 |
returnOrderInfo.logisticsRequestId = returnInfo.logisticsRequestId
|
| - |
|
10040 |
if returnOrderInfo.shippingType != returnInfo.shippingType:
|
| - |
|
10041 |
returnOrderInfo.shippingType = returnInfo.shippingType
|
| - |
|
10042 |
if returnOrderInfo.replacementOrderId and returnInfo.shippingType:
|
| - |
|
10043 |
replacementorder = get_order(returnOrderInfo.replacementOrderId)
|
| - |
|
10044 |
replacementorder.promised_shipping_time = None
|
| - |
|
10045 |
replacementorder.promised_delivery_time = None
|
| - |
|
10046 |
replacementorder.transaction = None
|
| - |
|
10047 |
replacementorder.expected_delivery_time = None
|
| - |
|
10048 |
replacementorder.expected_shipping_time = None
|
| - |
|
10049 |
if returnInfo.replacementOrderId:
|
| - |
|
10050 |
returnOrderInfo.replacementOrderId = returnInfo.replacementOrderId
|
| - |
|
10051 |
if returnOrderInfo.returnPickupType != returnInfo.returnPickupType:
|
| - |
|
10052 |
if returnOrderInfo.logisticsRequestId:
|
| - |
|
10053 |
returnpickupRequest = ReturnPickupRequest.get_by(id=returnOrderInfo.logisticsRequestId)
|
| - |
|
10054 |
if returnpickupRequest.pickupStatus in ['PICKUP_REQUESTED','PENDING']:
|
| - |
|
10055 |
returnOrderInfo.returnPickupType = returnInfo.returnPickupType
|
| - |
|
10056 |
else:
|
| - |
|
10057 |
returnOrderInfo.returnPickupType = returnInfo.returnPickupType
|
| - |
|
10058 |
else:
|
| - |
|
10059 |
return False
|
| - |
|
10060 |
if returnOrderInfo.returnAction != returnInfo.returnAction:
|
| - |
|
10061 |
returnOrderInfo.returnAction = returnInfo.returnAction
|
| - |
|
10062 |
session.commit()
|
| - |
|
10063 |
return True
|
| - |
|
10064 |
except:
|
| - |
|
10065 |
return False
|
| - |
|
10066 |
|
| - |
|
10067 |
def bulk_update_return_order_info(orderReturnInfosMap):
|
| - |
|
10068 |
responseMap = {}
|
| - |
|
10069 |
for orderId, returnOrdersList in orderReturnInfosMap.items():
|
| - |
|
10070 |
for returnOrder in returnOrdersList:
|
| - |
|
10071 |
response = update_return_order_info(returnOrder)
|
| - |
|
10072 |
responseMap[orderId] = response
|
| - |
|
10073 |
return responseMap
|
| - |
|
10074 |
|
| - |
|
10075 |
def get_return_orders_as_per_warehouse(warehouseId):
|
| - |
|
10076 |
all_return_orders_as_per_warehouse = ReturnOrderInfo.query.filter(ReturnOrderInfo.processedAt==None).filter(ReturnOrderInfo.warehouse_id <= warehouseId).all()
|
| - |
|
10077 |
if all_return_orders_as_per_warehouse is None:
|
| - |
|
10078 |
all_return_orders_as_per_warehouse = []
|
| - |
|
10079 |
return all_return_orders_as_per_warehouse
|
| - |
|
10080 |
|
| - |
|
10081 |
def create_return_transaction(returnTransaction):
|
| - |
|
10082 |
t_orders = returnTransaction.returnOrders
|
| - |
|
10083 |
if not t_orders:
|
| - |
|
10084 |
raise TransactionServiceException(101, "Return Orders missing from the transaction")
|
| - |
|
10085 |
|
| - |
|
10086 |
returnTxn = ReturnTransaction()
|
| - |
|
10087 |
returnTxn.customer_id = returnTransaction.customer_id
|
| - |
|
10088 |
returnTxn.status = ReturnTransactionStatus._VALUES_TO_NAMES[ReturnTransactionStatus.INITIATED]
|
| - |
|
10089 |
returnTxn.customer_email = returnTransaction.customer_email
|
| - |
|
10090 |
returnTxn.customer_name = returnTransaction.customer_name
|
| - |
|
10091 |
returnTxn.customer_id = returnTransaction.customer_id
|
| - |
|
10092 |
returnTxn.createdAt = datetime.datetime.now()
|
| - |
|
10093 |
returnTxn.address_id = returnTransaction.address_id
|
| - |
|
10094 |
returnTxn.ticketId = returnTransaction.ticketId
|
| - |
|
10095 |
returnTxn.customerAddress = returnTransaction.customerAddress
|
| - |
|
10096 |
returnTxn.customerCity = returnTransaction.customerCity
|
| - |
|
10097 |
returnTxn.customerPhone = returnTransaction.customerPhone
|
| - |
|
10098 |
returnTxn.customerState = returnTransaction.customerState
|
| - |
|
10099 |
returnTxn.pincode = returnTransaction.pincode
|
| - |
|
10100 |
for t_order in t_orders:
|
| - |
|
10101 |
returnOrder = create_return_order_info(t_order)
|
| - |
|
10102 |
returnOrder.returnTransaction = returnTxn
|
| - |
|
10103 |
order = get_order(returnOrder.orderId)
|
| - |
|
10104 |
lineitem = order.lineitems[0]
|
| - |
|
10105 |
lineitem.returnQty = lineitem.returnQty + returnOrder.returnQuantity
|
| - |
|
10106 |
order.status = OrderStatus.PARTIAL_RETURN_IN_PROCESS
|
| - |
|
10107 |
order.statusDescription = "Partial Return In Process"
|
| - |
|
10108 |
session.commit()
|
| - |
|
10109 |
|
| - |
|
10110 |
try:
|
| - |
|
10111 |
crmServiceClient = CRMClient().get_client()
|
| - |
|
10112 |
ticket =Ticket()
|
| - |
|
10113 |
activity = Activity()
|
| - |
|
10114 |
|
| - |
|
10115 |
description = "Creating Ticket for return requested by customer:- " + str(returnTransaction.customer_name) + " Return Transaction Id:- "+ str(returnTxn.id)
|
| - |
|
10116 |
ticket.creatorId = 1
|
| - |
|
10117 |
ticket.assigneeId = 34
|
| - |
|
10118 |
ticket.category = TicketCategory.RETURN_FORM
|
| - |
|
10119 |
ticket.priority = TicketPriority.HIGH
|
| - |
|
10120 |
ticket.status = TicketStatus.OPEN
|
| - |
|
10121 |
ticket.description = description
|
| - |
|
10122 |
ticket.orderId = order.id
|
| - |
|
10123 |
|
| - |
|
10124 |
activity.creatorId = 1
|
| - |
|
10125 |
activity.ticketAssigneeId = ticket.assigneeId
|
| - |
|
10126 |
activity.type = ActivityType.OTHER
|
| - |
|
10127 |
activity.description = description
|
| - |
|
10128 |
activity.ticketCategory = ticket.category
|
| - |
|
10129 |
activity.ticketDescription = ticket.description
|
| - |
|
10130 |
activity.ticketPriority = ticket.priority
|
| - |
|
10131 |
activity.ticketStatus = ticket.status
|
| - |
|
10132 |
|
| - |
|
10133 |
ticket.customerId= returnTransaction.customer_id
|
| - |
|
10134 |
ticket.customerEmailId = returnTransaction.customer_email
|
| - |
|
10135 |
ticket.customerMobileNumber = returnTransaction.customerPhone
|
| - |
|
10136 |
ticket.customerName = returnTransaction.customer_name
|
| - |
|
10137 |
activity.customerId = ticket.customerId
|
| - |
|
10138 |
activity.customerEmailId = returnTransaction.customer_email
|
| - |
|
10139 |
activity.customerMobileNumber = returnTransaction.customerPhone
|
| - |
|
10140 |
activity.customerName = returnTransaction.customer_name
|
| - |
|
10141 |
|
| - |
|
10142 |
crmServiceClient.insertTicket(ticket, activity)
|
| - |
|
10143 |
|
| - |
|
10144 |
except:
|
| - |
|
10145 |
print "Ticket for RTO Refund is not created."
|
| - |
|
10146 |
return returnTxn.id
|
| - |
|
10147 |
|
| - |
|
10148 |
def get_return_transactions_for_customer(statusList, customerMobile, customerEmail, returnTransactionId, customer_id):
|
| - |
|
10149 |
query = ReturnTransaction.query
|
| - |
|
10150 |
if statusList is not None and len(statusList) >0:
|
| - |
|
10151 |
statuses = []
|
| - |
|
10152 |
for status in statusList:
|
| - |
|
10153 |
statuses.append(ReturnTransactionStatus._VALUES_TO_NAMES[status])
|
| - |
|
10154 |
query = query.filter(ReturnTransaction.status.in_(tuple(statuses)))
|
| - |
|
10155 |
if customer_id:
|
| - |
|
10156 |
query = query.filter(ReturnTransaction.customer_id == customer_id)
|
| - |
|
10157 |
if customerMobile:
|
| - |
|
10158 |
query = query.filter(ReturnTransaction.customerPhone == customerMobile)
|
| - |
|
10159 |
if customerEmail:
|
| - |
|
10160 |
query = query.filter(ReturnTransaction.customer_email == customerEmail)
|
| - |
|
10161 |
return query.all()
|
| - |
|
10162 |
|
| - |
|
10163 |
def get_return_transaction(transaction_id):
|
| - |
|
10164 |
transaction = ReturnTransaction.get_by(id=transaction_id)
|
| - |
|
10165 |
if not transaction:
|
| - |
|
10166 |
raise TransactionServiceException(108, "no such transaction")
|
| - |
|
10167 |
|
| - |
|
10168 |
return transaction
|
| - |
|
10169 |
|
| - |
|
10170 |
def get_return_orders_for_return_transaction(returnTransactionId):
|
| - |
|
10171 |
returnOrders = ReturnOrderInfo.query.filter_by(returnTransactionId=returnTransactionId).all()
|
| - |
|
10172 |
|
| - |
|
10173 |
if not returnOrders:
|
| - |
|
10174 |
raise TransactionServiceException(101, "No return order for the transaction")
|
| - |
|
10175 |
return returnOrders
|
| - |
|
10176 |
|
| - |
|
10177 |
def __process_return_order(returnOrder, returnOrderAttrMap):
|
| - |
|
10178 |
if returnOrder.returnAction:
|
| - |
|
10179 |
if returnOrder.refundedAt:
|
| - |
|
10180 |
raise TransactionServiceException(145, "Refund already in Process for this return order")
|
| - |
|
10181 |
refundReason = returnOrderAttrMap.get('RefundReason')
|
| - |
|
10182 |
refundType = returnOrderAttrMap.get('RefundType')
|
| - |
|
10183 |
refundedBy = returnOrderAttrMap.get('RefundedBy')
|
| - |
|
10184 |
refundAmount = returnOrderAttrMap.get('RefundAmount')
|
| - |
|
10185 |
order = get_order(returnOrder.orderId)
|
| - |
|
10186 |
status_transition = {}
|
| - |
|
10187 |
if order.cod:
|
| - |
|
10188 |
logging.info("Refunding COD order with status " + str(returnOrder.returnStatus))
|
| - |
|
10189 |
|
| - |
|
10190 |
else:
|
| - |
|
10191 |
logging.info("Refunding Prepaid order with status " + str(returnOrder.returnStatus))
|
| - |
|
10192 |
status_transition = {"LOST_IN_TRANSIT" : "LOST_IN_TRANSIT_REFUNDED",
|
| - |
|
10193 |
"DOA_CERT_INVALID" : "DOA_INVALID_REFUNDED",
|
| - |
|
10194 |
"DOA_CERT_VALID" : "DOA_VALID_REFUNDED",
|
| - |
|
10195 |
"DOA_RECEIVED_DAMAGED" : "DOA_REFUNDED_RCVD_DAMAGED",
|
| - |
|
10196 |
"DOA_LOST_IN_TRANSIT" : "DOA_REFUNDED_LOST_IN_TRANSIT",
|
| - |
|
10197 |
"RET_PRODUCT_UNUSABLE" : "RET_PRODUCT_UNUSABLE_REFUNDED",
|
| - |
|
10198 |
"RET_PRODUCT_USABLE" : "RET_PRODUCT_USABLE_REFUNDED",
|
| - |
|
10199 |
"RET_RECEIVED_DAMAGED" : "RET_REFUNDED_RCVD_DAMAGED",
|
| - |
|
10200 |
"RET_LOST_IN_TRANSIT" : "RET_REFUNDED_LOST_IN_TRANSIT"
|
| - |
|
10201 |
}
|
| - |
|
10202 |
|
| - |
|
10203 |
if returnOrder.returnStatus in status_transition.keys():
|
| - |
|
10204 |
returnOrder.returnStatus = status_transition[returnOrder.returnStatus]
|
| - |
|
10205 |
elif returnOrder.returnPickupType in [ReturnPickupType.LATER, ReturnPickupType.NOT_REQUIRED]:
|
| - |
|
10206 |
if returnOrder.returnPickupType == ReturnPickupType.LATER:
|
| - |
|
10207 |
returnOrder.refundDescription = "Pickup will be processed Later. Refund in Process. It takes 7-10 working days to be in actual credit."
|
| - |
|
10208 |
else:
|
| - |
|
10209 |
returnOrder.refundDescription = "No Pickup Required for this item. Refund in Process. It takes 7-10 working days to be in actual credit."
|
| - |
|
10210 |
else:
|
| - |
|
10211 |
raise TransactionServiceException(114, "This order can't be refunded")
|
| - |
|
10212 |
|
| - |
|
10213 |
__create_refund(order, returnOrder)
|
| - |
|
10214 |
|
| - |
|
10215 |
returnOrder.refundedAt = datetime.datetime.now()
|
| - |
|
10216 |
returnOrder.refundedBy = refundedBy
|
| - |
|
10217 |
returnOrder.refundReason = refundReason
|
| - |
|
10218 |
returnOrder.refundAmount = refundAmount
|
| - |
|
10219 |
returnOrder.refundType = refundType
|
| - |
|
10220 |
session.commit()
|
| - |
|
10221 |
return True
|
| - |
|
10222 |
|
| - |
|
10223 |
else:
|
| - |
|
10224 |
alreadyReshipped = False
|
| - |
|
10225 |
if returnOrder.replacementOrderId:
|
| - |
|
10226 |
alreadyReshipped = True
|
| - |
|
10227 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.LOST_IN_TRANSIT]:
|
| - |
|
10228 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.LOST_IN_TRANSIT_RESHIPPED]
|
| - |
|
10229 |
if not alreadyReshipped:
|
| - |
|
10230 |
order = get_order(returnOrder.orderId)
|
| - |
|
10231 |
new_order = __clone_order(order, False, order.cod)
|
| - |
|
10232 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_CERT_INVALID]:
|
| - |
|
10233 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_INVALID_RESHIPPED]
|
| - |
|
10234 |
if not alreadyReshipped:
|
| - |
|
10235 |
order = get_order(returnOrder.orderId)
|
| - |
|
10236 |
new_order = __clone_order(order, True, False)
|
| - |
|
10237 |
__scan_for_reship_order(returnOrder.orderId, new_order, returnOrder)
|
| - |
|
10238 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_CERT_VALID]:
|
| - |
|
10239 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_VALID_RESHIPPED]
|
| - |
|
10240 |
if not alreadyReshipped:
|
| - |
|
10241 |
order = get_order(returnOrder.orderId)
|
| - |
|
10242 |
new_order = __clone_order(order, False, False)
|
| - |
|
10243 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_RECEIVED_DAMAGED]:
|
| - |
|
10244 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_RESHIPPED_RCVD_DAMAGED]
|
| - |
|
10245 |
if not alreadyReshipped:
|
| - |
|
10246 |
order = get_order(returnOrder.orderId)
|
| - |
|
10247 |
new_order = __clone_order(order, False, False)
|
| - |
|
10248 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_LOST_IN_TRANSIT]:
|
| - |
|
10249 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_RESHIPPED_LOST_IN_TRANSIT]
|
| - |
|
10250 |
if not alreadyReshipped:
|
| - |
|
10251 |
order = get_order(returnOrder.orderId)
|
| - |
|
10252 |
new_order = __clone_order(order, False, False)
|
| - |
|
10253 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PRODUCT_USABLE]:
|
| - |
|
10254 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PRODUCT_USABLE_RESHIPPED]
|
| - |
|
10255 |
if not alreadyReshipped:
|
| - |
|
10256 |
order = get_order(returnOrder.orderId)
|
| - |
|
10257 |
new_order = __clone_order(order, False, False)
|
| - |
|
10258 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PRODUCT_UNUSABLE]:
|
| - |
|
10259 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PRODUCT_UNUSABLE_RESHIPPED]
|
| - |
|
10260 |
if not alreadyReshipped:
|
| - |
|
10261 |
order = get_order(returnOrder.orderId)
|
| - |
|
10262 |
new_order = __clone_order(order, False, False)
|
| - |
|
10263 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_RECEIVED_DAMAGED]:
|
| - |
|
10264 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_RESHIPPED_RCVD_DAMAGED]
|
| - |
|
10265 |
if not alreadyReshipped:
|
| - |
|
10266 |
order = get_order(returnOrder.orderId)
|
| - |
|
10267 |
new_order = __clone_order(order, False, False)
|
| - |
|
10268 |
elif returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_LOST_IN_TRANSIT]:
|
| - |
|
10269 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_RESHIPPED_LOST_IN_TRANSIT]
|
| - |
|
10270 |
if not alreadyReshipped:
|
| - |
|
10271 |
order = get_order(returnOrder.orderId)
|
| - |
|
10272 |
new_order = __clone_order(order, False, False)
|
| - |
|
10273 |
elif returnOrder.returnPickupType in [ReturnPickupType.LATER, ReturnPickupType.NOT_REQUIRED]:
|
| - |
|
10274 |
if not alreadyReshipped:
|
| - |
|
10275 |
order = get_order(returnOrder.orderId)
|
| - |
|
10276 |
new_order = __clone_order(order, False, False)
|
| - |
|
10277 |
returnOrder.refundDescription = "Replacement Order has been created."
|
| - |
|
10278 |
else:
|
| - |
|
10279 |
return False
|
| - |
|
10280 |
|
| - |
|
10281 |
if not alreadyReshipped:
|
| - |
|
10282 |
returnOrder.replacementOrderId = new_order.id
|
| - |
|
10283 |
returnOrder.reshippedAt = datetime.datetime.now()
|
| - |
|
10284 |
orderQty = returnOrder.returnQuantity
|
| - |
|
10285 |
if returnOrder.returnPickupType not in [ReturnPickupType.LATER, ReturnPickupType.NOT_REQUIRED]:
|
| - |
|
10286 |
orderQty = returnOrder.receivedQuantity
|
| - |
|
10287 |
new_order.lineitems[0].quantity = orderQty
|
| - |
|
10288 |
new_order.lineitems[0].total_price = new_order.lineitems[0].unit_price * orderQty
|
| - |
|
10289 |
new_order.lineitems[0].total_weight = new_order.lineitems[0].unit_weight * orderQty
|
| - |
|
10290 |
new_order.total_amount = new_order.lineitems[0].unit_price * orderQty
|
| - |
|
10291 |
new_order.total_weight = new_order.lineitems[0].unit_weight * orderQty
|
| - |
|
10292 |
if returnOrder.shippingType:
|
| - |
|
10293 |
new_order.transaction = None
|
| - |
|
10294 |
new_order.promised_shipping_time = None
|
| - |
|
10295 |
new_order.expected_shipping_time = None
|
| - |
|
10296 |
new_order.promised_delivery_time = None
|
| - |
|
10297 |
new_order.expected_delivery_time = None
|
| - |
|
10298 |
|
| - |
|
10299 |
session.commit()
|
| - |
|
10300 |
return True
|
| - |
|
10301 |
else:
|
| - |
|
10302 |
session.commit()
|
| - |
|
10303 |
return True
|
| - |
|
10304 |
|
| - |
|
10305 |
def communicate_pickup_details_to_customer(returnPickupRequest):
|
| - |
|
10306 |
returnOrders = ReturnOrderInfo.query.filter(ReturnOrderInfo.logisticsRequestId==returnPickupRequest.id).all()
|
| - |
|
10307 |
subject = 'Pickup details'
|
| - |
|
10308 |
filename = "/PickupDetails/" + str(returnPickupRequest.pickupRequestNo) +".pdf"
|
| - |
|
10309 |
|
| - |
|
10310 |
try:
|
| - |
|
10311 |
inventory_client = InventoryClient().get_client()
|
| - |
|
10312 |
warehouse = inventory_client.getWarehouse(returnOrders[0].warehouse_id)
|
| - |
|
10313 |
|
| - |
|
10314 |
logistics_client = LogisticsClient().get_client()
|
| - |
|
10315 |
provider = logistics_client.getProvider(returnPickupRequest.logisticsProviderId)
|
| - |
|
10316 |
provider_name = provider.name
|
| - |
|
10317 |
|
| - |
|
10318 |
returnTxn = returnOrders[0].returnTransaction
|
| - |
|
10319 |
to_addr = returnTxn.customer_email
|
| - |
|
10320 |
promised_pickup_time = returnPickupRequest.promised_pickup_timestamp.date().strftime("%d-%B-%Y (%A)")
|
| - |
|
10321 |
customer_address = returnTxn.customer_name +"\n" + returnTxn.customerAddress +"\n"
|
| - |
|
10322 |
customer_address = customer_address + returnTxn.customerCity + "\n"
|
| - |
|
10323 |
customer_address = customer_address + returnTxn.customerState + "\n"
|
| - |
|
10324 |
customer_address = customer_address + "PIN: "+returnTxn.pincode + "\n"
|
| - |
|
10325 |
customer_address = customer_address + "Phone: "+returnTxn.customerPhone
|
| - |
|
10326 |
|
| - |
|
10327 |
raw_message = '''
|
| - |
|
10328 |
Dear %(customer_name)s,
|
| - |
|
10329 |
|
| - |
|
10330 |
Would like to inform you that we have instructed %(provider_name)s to pick up the material from the below mentioned address on or before %(date)s. %(provider_name)s pickup request number is %(pickup_request_no)s.'
|
| - |
|
10331 |
|
| - |
|
10332 |
Take a printout of the attachment in this mail which contains the delivery address and paste it on the packed parcel. Kindly keep the parcel ready.
|
| - |
|
10333 |
|
| - |
|
10334 |
Pickup will happen from the below mentioned address:-
|
| - |
|
10335 |
|
| - |
|
10336 |
%(customer_address)s
|
| - |
|
10337 |
|
| - |
|
10338 |
Do let us know in case of any concerns
|
| - |
|
10339 |
|
| - |
|
10340 |
Thanks & Regards
|
| - |
|
10341 |
%(source_name)s Team
|
| - |
|
10342 |
'''
|
| - |
|
10343 |
message = dedent(raw_message) % {'customer_name' : returnTxn.customer_name,
|
| - |
|
10344 |
'order_id' : returnTxn.id,
|
| - |
|
10345 |
'provider_name' : provider_name,
|
| - |
|
10346 |
'date': promised_pickup_time,
|
| - |
|
10347 |
'pickup_request_no' : returnPickupRequest.pickupRequestNo,
|
| - |
|
10348 |
'customer_address' : customer_address,
|
| - |
|
10349 |
'source_name' : source_name}
|
| - |
|
10350 |
print message
|
| - |
|
10351 |
__generate_return_transaction_invoice(returnOrders, warehouse, provider, filename)
|
| - |
|
10352 |
mail(help_user, help_password, [to_addr], subject, message, [get_attachment_part(filename)])
|
| - |
|
10353 |
session.commit()
|
| - |
|
10354 |
return True
|
| - |
|
10355 |
except Exception as e:
|
| - |
|
10356 |
print sys.exc_info()
|
| - |
|
10357 |
traceback.print_tb(sys.exc_info()[2])
|
| - |
|
10358 |
return False
|
| - |
|
10359 |
finally:
|
| - |
|
10360 |
if os.path.exists(filename):
|
| - |
|
10361 |
os.remove(filename)
|
| - |
|
10362 |
|
| - |
|
10363 |
def __communicate_customer_for_closed_transaction(returnTransaction):
|
| - |
|
10364 |
pass
|
| - |
|
10365 |
|
| - |
|
10366 |
def change_return_transaction_status(returnTransactionId, new_status, returnOrdersIds=None, returnOrdersAttrMap=None):
|
| - |
|
10367 |
returnTransaction = ReturnTransaction.get_by(id=returnTransactionId)
|
| - |
|
10368 |
if returnTransaction is None:
|
| - |
|
10369 |
raise TransactionServiceException(101, "No Return Transaction Found")
|
| - |
|
10370 |
if new_status == ReturnTransactionStatus.AUTHORIZED:
|
| - |
|
10371 |
returnTransaction.authorizedAt = datetime.datetime.now()
|
| - |
|
10372 |
for returnOrder in returnTransaction.returnOrders:
|
| - |
|
10373 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_REQUEST_RECEIVED]:
|
| - |
|
10374 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_REQUEST_AUTHORIZED]
|
| - |
|
10375 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_REQUEST_RECEIVED]:
|
| - |
|
10376 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_REQUEST_AUTHORIZED]
|
| - |
|
10377 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[new_status]
|
| - |
|
10378 |
elif new_status == ReturnTransactionStatus.INPROCESS:
|
| - |
|
10379 |
for returnOrder in returnTransaction.returnOrders:
|
| - |
|
10380 |
returnOrder.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.AWAITING_PICKUP]
|
| - |
|
10381 |
if returnOrder.returnPickupType == ReturnPickupType.NOT_REQUIRED:
|
| - |
|
10382 |
pass
|
| - |
|
10383 |
else:
|
| - |
|
10384 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_REQUEST_AUTHORIZED]:
|
| - |
|
10385 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PICKUP_REQUEST_RAISED]
|
| - |
|
10386 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_REQUEST_AUTHORIZED]:
|
| - |
|
10387 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_PICKUP_REQUEST_RAISED]
|
| - |
|
10388 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[new_status]
|
| - |
|
10389 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[new_status]
|
| - |
|
10390 |
elif new_status == ReturnTransactionStatus.REJECTED:
|
| - |
|
10391 |
returnTransaction.processedAt = datetime.datetime.now()
|
| - |
|
10392 |
for returnOrder in returnTransaction.returnOrders:
|
| - |
|
10393 |
returnOrder.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.CLOSED]
|
| - |
|
10394 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_REQUEST_RECEIVED]:
|
| - |
|
10395 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.REJECTED]
|
| - |
|
10396 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_REQUEST_RECEIVED]:
|
| - |
|
10397 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.REJECTED]
|
| - |
|
10398 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[new_status]
|
| - |
|
10399 |
elif new_status == ReturnTransactionStatus.PROCESSED:
|
| - |
|
10400 |
if returnOrdersIds and len(returnOrdersIds)>0:
|
| - |
|
10401 |
unprocessedOrders = []
|
| - |
|
10402 |
for retOrder in returnTransaction.returnOrders:
|
| - |
|
10403 |
if retOrder.reshippedAt is None and retOrder.refundedAt is None:
|
| - |
|
10404 |
unprocessedOrders.append(retOrder)
|
| - |
|
10405 |
if len(returnOrdersIds) < len(returnTransaction.returnOrders):
|
| - |
|
10406 |
if len(returnOrdersIds) == len(unprocessedOrders):
|
| - |
|
10407 |
for ret_Order in unprocessedOrders:
|
| - |
|
10408 |
if ret_Order.returnAction == ReturnAction.REFUND:
|
| - |
|
10409 |
ret_Order.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.REFUND_IN_PROCESS]
|
| - |
|
10410 |
else:
|
| - |
|
10411 |
ret_Order.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.REPLACEMENT_ORDER_CREATED]
|
| - |
|
10412 |
returnTransaction.processedAt = datetime.datetime.now()
|
| - |
|
10413 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[new_status]
|
| - |
|
10414 |
else:
|
| - |
|
10415 |
for ret_Order in returnTransaction.returnOrders:
|
| - |
|
10416 |
if ret_Order.returnAction == ReturnAction.REFUND:
|
| - |
|
10417 |
ret_Order.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.REFUND_IN_PROCESS]
|
| - |
|
10418 |
else:
|
| - |
|
10419 |
ret_Order.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.REPLACEMENT_ORDER_CREATED]
|
| - |
|
10420 |
returnTransaction.processedAt = datetime.datetime.now()
|
| - |
|
10421 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[new_status]
|
| - |
|
10422 |
for returnOrderId in returnOrdersIds:
|
| - |
|
10423 |
__process_return_order(get_return_order_info(returnOrderId), returnOrdersAttrMap.get(returnOrderId))
|
| - |
|
10424 |
elif new_status == ReturnTransactionStatus.CLOSED:
|
| - |
|
10425 |
returnTransaction.closedAt = datetime.datetime.now()
|
| - |
|
10426 |
for ret_Order in returnTransaction.returnOrders:
|
| - |
|
10427 |
ret_Order.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.CLOSED]
|
| - |
|
10428 |
__communicate_customer_for_closed_transaction(returnTransaction)
|
| - |
|
10429 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[new_status]
|
| - |
|
10430 |
|
| - |
|
10431 |
session.commit()
|
| - |
|
10432 |
return True
|
| - |
|
10433 |
|
| - |
|
10434 |
def create_return_pickup_request(returnOrderIds, providerId):
|
| - |
|
10435 |
returnPickupRequest = ReturnPickupRequest()
|
| - |
|
10436 |
returnPickupRequest.logisticsProviderId = providerId
|
| - |
|
10437 |
returnPickupRequest.pickupStatus = ReturnTxnPickupStatus._VALUES_TO_NAMES[ReturnTxnPickupStatus.PICKUP_REQUESTED]
|
| - |
|
10438 |
session.commit()
|
| - |
|
10439 |
|
| - |
|
10440 |
for returnOrderId in returnOrderIds:
|
| - |
|
10441 |
returnOrder = get_return_order_info(returnOrderId)
|
| - |
|
10442 |
returnOrder.logisticsRequestId = returnPickupRequest.id
|
| - |
|
10443 |
session.commit()
|
| - |
|
10444 |
|
| - |
|
10445 |
return True
|
| - |
|
10446 |
|
| - |
|
10447 |
def update_return_pickup_request(returnPickupRequest):
|
| - |
|
10448 |
try:
|
| - |
|
10449 |
returnPickupReq = ReturnPickupRequest.get_by(id=returnPickupRequest.id)
|
| - |
|
10450 |
if returnPickupRequest.pickupRequestNo:
|
| - |
|
10451 |
returnPickupReq.pickupRequestNo = returnPickupRequest.pickupRequestNo
|
| - |
|
10452 |
returnPickupReq.confirmedAt = datetime.datetime.now()
|
| - |
|
10453 |
returnPickupReq.pickupStatus = ReturnTxnPickupStatus._VALUES_TO_NAMES[ReturnTxnPickupStatus.PICKUP_CONFIRMED]
|
| - |
|
10454 |
for returnOrder in ReturnOrderInfo.query.filter(ReturnOrderInfo.logisticsRequestId==returnPickupRequest.id).all():
|
| - |
|
10455 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_PICKUP_REQUEST_RAISED]:
|
| - |
|
10456 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_PICKUP_CONFIRMED]
|
| - |
|
10457 |
else:
|
| - |
|
10458 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PICKUP_CONFIRMED]
|
| - |
|
10459 |
if returnPickupRequest.pickupStatus == ReturnTxnPickupStatus.PICKUP_SCHEDULED:
|
| - |
|
10460 |
returnPickupReq.pickupStatus = ReturnTxnPickupStatus._VALUES_TO_NAMES[returnPickupRequest.pickupStatus]
|
| - |
|
10461 |
returnPickupReq.promised_pickup_timestamp = datetime.datetime.now()+timedelta(days=2)
|
| - |
|
10462 |
try:
|
| - |
|
10463 |
communicate_pickup_details_to_customer(returnPickupReq)
|
| - |
|
10464 |
except:
|
| - |
|
10465 |
print "Customer Communication Failed for the pickup Information"
|
| - |
|
10466 |
if returnPickupRequest.pickedUpAt:
|
| - |
|
10467 |
returnPickupReq.pickedUpAt = to_py_date(returnPickupRequest.pickedUpAt)
|
| - |
|
10468 |
returnPickupReq.pickupStatus = ReturnTxnPickupStatus._VALUES_TO_NAMES[ReturnTxnPickupStatus.PICKUP_IN_TRANSIT]
|
| - |
|
10469 |
for returnOrder in ReturnOrderInfo.query.filter(ReturnOrderInfo.logisticsRequestId==returnPickupRequest.id).all():
|
| - |
|
10470 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_PICKUP_CONFIRMED]:
|
| - |
|
10471 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_RETURN_IN_TRANSIT]
|
| - |
|
10472 |
else:
|
| - |
|
10473 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_RETURN_IN_TRANSIT]
|
| - |
|
10474 |
session.commit()
|
| - |
|
10475 |
return True
|
| - |
|
10476 |
except:
|
| - |
|
10477 |
return False
|
| - |
|
10478 |
|
| - |
|
10479 |
def receive_return_pickup(returnOrdersMap, req_id):
|
| - |
|
10480 |
returnPickupReq = ReturnPickupRequest.get_by(id=req_id)
|
| - |
|
10481 |
returnOrders = ReturnOrderInfo.query.filter(ReturnOrderInfo.logisticsRequestId==req_id).all()
|
| - |
|
10482 |
if len(returnOrders)!=len(returnOrdersMap.keys()):
|
| - |
|
10483 |
raise TransactionServiceException(101, "All Returns Orders Information Missing. Please Fill All Orders Info")
|
| - |
|
10484 |
for returnOrder in returnOrders:
|
| - |
|
10485 |
returnOrderDetails = returnOrdersMap.get(returnOrder.id)
|
| - |
|
10486 |
receiveCondition = ReceivedReturnType._NAMES_TO_VALUES[returnOrderDetails.get('ReceiveCondition')]
|
| - |
|
10487 |
quantity = int(returnOrderDetails.get('Quantity'))
|
| - |
|
10488 |
|
| - |
|
10489 |
if returnOrder.returnStatus in [OrderStatus._NAMES_TO_VALUES[OrderStatus.DOA_PICKUP_CONFIRMED], OrderStatus._NAMES_TO_VALUES[OrderStatus.DOA_RETURN_IN_TRANSIT]]:
|
| - |
|
10490 |
if receiveCondition == ReceivedReturnType.PRESTINE:
|
| - |
|
10491 |
returnOrder.returnStatus = OrderStatus._NAMES_TO_VALUES[OrderStatus.DOA_RECEIVED_PRESTINE]
|
| - |
|
10492 |
elif receiveCondition == ReceivedReturnType.DAMAGED:
|
| - |
|
10493 |
returnOrder.returnStatus = OrderStatus._NAMES_TO_VALUES[OrderStatus.DOA_RECEIVED_DAMAGED]
|
| - |
|
10494 |
elif receiveCondition == ReceivedReturnType.LOST_IN_TRANSIT:
|
| - |
|
10495 |
returnOrder.returnStatus = OrderStatus._NAMES_TO_VALUES[OrderStatus.DOA_LOST_IN_TRANSIT]
|
| - |
|
10496 |
returnOrder.receivedAt = datetime.datetime.now()
|
| - |
|
10497 |
returnOrder.receivedQuantity = quantity
|
| - |
|
10498 |
elif returnOrder.returnStatus in [OrderStatus._NAMES_TO_VALUES[OrderStatus.RET_PICKUP_CONFIRMED], OrderStatus._NAMES_TO_VALUES[OrderStatus.RET_RETURN_IN_TRANSIT]]:
|
| - |
|
10499 |
if receiveCondition == ReceivedReturnType.PRESTINE:
|
| - |
|
10500 |
returnOrder.returnStatus = OrderStatus._NAMES_TO_VALUES[OrderStatus.RET_RECEIVED_PRESTINE]
|
| - |
|
10501 |
elif receiveCondition == ReceivedReturnType.DAMAGED:
|
| - |
|
10502 |
returnOrder.returnStatus = OrderStatus._NAMES_TO_VALUES[OrderStatus.RET_RECEIVED_DAMAGED]
|
| - |
|
10503 |
elif receiveCondition == ReceivedReturnType.LOST_IN_TRANSIT:
|
| - |
|
10504 |
returnOrder.returnStatus = OrderStatus._NAMES_TO_VALUES[OrderStatus.RET_LOST_IN_TRANSIT]
|
| - |
|
10505 |
returnOrder.receivedAt = datetime.datetime.now()
|
| - |
|
10506 |
returnOrder.receivedQuantity = quantity
|
| - |
|
10507 |
else:
|
| - |
|
10508 |
return False
|
| - |
|
10509 |
|
| - |
|
10510 |
scanMap = {
|
| - |
|
10511 |
"RET_RECEIVED_PRESTINE" : ScanType.SALE_RET,
|
| - |
|
10512 |
"RET_RECEIVED_DAMAGED" : ScanType.SALE_RET_UNUSABLE,
|
| - |
|
10513 |
"RET_LOST_IN_TRANSIT" : ScanType.LOST_IN_TRANSIT,
|
| - |
|
10514 |
"DOA_RECEIVED_PRESTINE" : ScanType.DOA_IN,
|
| - |
|
10515 |
"DOA_RECEIVED_DAMAGED" : ScanType.DOA_IN,
|
| - |
|
10516 |
"DOA_LOST_IN_TRANSI" : ScanType.LOST_IN_TRANSIT
|
| - |
|
10517 |
}
|
| - |
|
10518 |
inventoryClient = InventoryClient().get_client()
|
| - |
|
10519 |
warehouse = inventoryClient.getWarehouse(returnOrders[0].warehouse_id)
|
| - |
|
10520 |
warehouseClient = WarehouseClient().get_client()
|
| - |
|
10521 |
|
| - |
|
10522 |
for returnOrder in returnOrders:
|
| - |
|
10523 |
warehouse = None
|
| - |
|
10524 |
|
| - |
|
10525 |
serialNumbers = []
|
| - |
|
10526 |
if returnOrderDetails.has_key('SerialNumbers'):
|
| - |
|
10527 |
serialNumbers = returnOrderDetails.get('SerialNumbers').split(',')
|
| - |
|
10528 |
|
| - |
|
10529 |
scanFreebie = False
|
| - |
|
10530 |
if returnOrderDetails.has_key('ScanFreebie') and returnOrderDetails.get('ScanFreebie')=='yes':
|
| - |
|
10531 |
scanFreebie = True
|
| - |
|
10532 |
quantity = int(returnOrderDetails.get('Quantity'))
|
| - |
|
10533 |
|
| - |
|
10534 |
if warehouse is not None and warehouse.billingType == BillingType.OURS or warehouse.billingType == BillingType.OURS_EXTERNAL:
|
| - |
|
10535 |
if scanMap.has_key(returnOrder.returnStatus):
|
| - |
|
10536 |
scanType = scanMap[returnOrder.returnStatus]
|
| - |
|
10537 |
lineitem = returnOrder.lineitem
|
| - |
|
10538 |
return_qty = lineitem.returnQty - returnOrder.returnQuantity + quantity
|
| - |
|
10539 |
lineitem.returnQty = lineitem.returnQty - returnOrder.returnQuantity + quantity
|
| - |
|
10540 |
order = get_order(returnOrder.orderId)
|
| - |
|
10541 |
if return_qty < order.lineitems[0].quantity:
|
| - |
|
10542 |
order.status = OrderStatus.PARTIAL_RETURN
|
| - |
|
10543 |
if return_qty == order.lineitems[0].quantity:
|
| - |
|
10544 |
order.status = OrderStatus.COMPLETE_RETURN
|
| - |
|
10545 |
if warehouse.billingType == BillingType.OURS or scanType != ScanType.SALE_RET:
|
| - |
|
10546 |
if lineitem.serial_number is not None:
|
| - |
|
10547 |
if serialNumbers is None or len(serialNumbers)==0 or len(serialNumbers)<quantity:
|
| - |
|
10548 |
return False
|
| - |
|
10549 |
else:
|
| - |
|
10550 |
for serialNumber in serialNumbers:
|
| - |
|
10551 |
try:
|
| - |
|
10552 |
warehouseClient.scanSerializedItemForOrder(serialNumber, scanType, order.id, order.fulfilmentWarehouseId, 1, order.warehouse_id)
|
| - |
|
10553 |
except:
|
| - |
|
10554 |
warehouseClient = WarehouseClient().get_client()
|
| - |
|
10555 |
warehouseClient.scanSerializedItemForOrder(serialNumber, scanType, order.id, order.fulfilmentWarehouseId, 1, order.warehouse_id)
|
| - |
|
10556 |
else:
|
| - |
|
10557 |
try:
|
| - |
|
10558 |
warehouseClient.scanForOrder(None, scanType, quantity, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
| - |
|
10559 |
except:
|
| - |
|
10560 |
warehouseClient = WarehouseClient().get_client()
|
| - |
|
10561 |
warehouseClient.scanForOrder(None, scanType, quantity, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
| - |
|
10562 |
if warehouse.billingType == BillingType.OURS_EXTERNAL and scanType == ScanType.SALE_RET:
|
| - |
|
10563 |
try:
|
| - |
|
10564 |
warehouseClient.scanForOursExternalSaleReturn(order.id, lineitem.transfer_price)
|
| - |
|
10565 |
except:
|
| - |
|
10566 |
warehouseClient = WarehouseClient().get_client()
|
| - |
|
10567 |
warehouseClient.scanForOursExternalSaleReturn(order.id, lineitem.transfer_price)
|
| - |
|
10568 |
if scanFreebie:
|
| - |
|
10569 |
try:
|
| - |
|
10570 |
warehouseClient.scanfreebie(order.id, order.freebieItemId, 0, scanType)
|
| - |
|
10571 |
except:
|
| - |
|
10572 |
warehouseClient = WarehouseClient().get_client()
|
| - |
|
10573 |
warehouseClient.scanfreebie(order.id, order.freebieItemId, 0, scanType)
|
| - |
|
10574 |
|
| - |
|
10575 |
returnPickupReq.pickupStatus = ReturnTxnPickupStatus._VALUES_TO_NAMES[ReturnTxnPickupStatus.PICKUP_RECEIVED]
|
| - |
|
10576 |
session.commit()
|
| - |
|
10577 |
return True
|
| - |
|
10578 |
|
| - |
|
10579 |
def validate_return_pickup(returnPickupId, returnOrdersMap):
|
| - |
|
10580 |
returnOrders = ReturnOrderInfo.query.filter(ReturnOrderInfo.logisticsRequestId==returnPickupId).all()
|
| - |
|
10581 |
if len(returnOrders)!=len(returnOrdersMap.keys()):
|
| - |
|
10582 |
raise TransactionServiceException(101, "All Returns Orders Information Missing. Please Fill All Orders Info")
|
| - |
|
10583 |
|
| - |
|
10584 |
for returnOrder in returnOrders:
|
| - |
|
10585 |
if returnOrder.returnStatus != OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_RECEIVED_PRESTINE] and returnOrder.returnStatus != OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_RECEIVED_PRESTINE]:
|
| - |
|
10586 |
return False
|
| - |
|
10587 |
|
| - |
|
10588 |
for returnOrder in returnOrders:
|
| - |
|
10589 |
isValid = returnOrdersMap.get(returnOrder.id)
|
| - |
|
10590 |
if returnOrder.returnStatus == OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_RECEIVED_PRESTINE]:
|
| - |
|
10591 |
if isValid:
|
| - |
|
10592 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_CERT_VALID]
|
| - |
|
10593 |
else:
|
| - |
|
10594 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.DOA_CERT_INVALID]
|
| - |
|
10595 |
else:
|
| - |
|
10596 |
if isValid:
|
| - |
|
10597 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PRODUCT_USABLE]
|
| - |
|
10598 |
else:
|
| - |
|
10599 |
returnOrder.returnStatus = OrderStatus._VALUES_TO_NAMES[OrderStatus.RET_PRODUCT_UNUSABLE]
|
| - |
|
10600 |
session.commit()
|
| - |
|
10601 |
|
| - |
|
10602 |
return True
|
| - |
|
10603 |
|
| - |
|
10604 |
def process_return_pickup(returnPickupId, returnOrdersMap):
|
| - |
|
10605 |
returnOrders = ReturnOrderInfo.query.filter(ReturnOrderInfo.logisticsRequestId==returnPickupId).all()
|
| - |
|
10606 |
returnTxnIdOrdersMap = {}
|
| - |
|
10607 |
if len(returnOrders)!=len(returnOrdersMap.keys()):
|
| - |
|
10608 |
raise TransactionServiceException(101, "All Returns Orders Information Missing. Please Fill All Orders Info")
|
| - |
|
10609 |
|
| - |
|
10610 |
for returnOrder in returnOrders:
|
| - |
|
10611 |
if returnTxnIdOrdersMap.has_key(returnOrder.returnTransaction.id):
|
| - |
|
10612 |
ordersList = returnTxnIdOrdersMap.get(returnOrder.returnTransaction.id)
|
| - |
|
10613 |
ordersList.append(returnOrder.id)
|
| - |
|
10614 |
returnTxnIdOrdersMap[returnOrder.returnTransaction.id] = ordersList
|
| - |
|
10615 |
else:
|
| - |
|
10616 |
ordersList = []
|
| - |
|
10617 |
ordersList.append(returnOrder.id)
|
| - |
|
10618 |
returnTxnIdOrdersMap[returnOrder.returnTransaction.id] = ordersList
|
| - |
|
10619 |
|
| - |
|
10620 |
for returnTransactionId, returnOrdersIds in returnTxnIdOrdersMap.items():
|
| - |
|
10621 |
change_return_transaction_status(returnTransactionId, ReturnTransactionStatus.PROCESSED, returnOrdersIds, returnOrdersMap)
|
| - |
|
10622 |
|
| - |
|
10623 |
session.commit()
|
| - |
|
10624 |
return True
|
| - |
|
10625 |
|
| - |
|
10626 |
def mark_return_transaction_complete(returnTransactionId):
|
| - |
|
10627 |
returnTransaction = get_return_transaction(returnTransactionId)
|
| - |
|
10628 |
if returnTransaction.status == ReturnTransactionStatus._VALUES_TO_NAMES[ReturnTransactionStatus.COMPLETED]:
|
| - |
|
10629 |
raise TransactionServiceException(101, "Transaction Already completed")
|
| - |
|
10630 |
|
| - |
|
10631 |
returnString = ''
|
| - |
|
10632 |
for returnOrder in returnTransaction.returnOrders:
|
| - |
|
10633 |
if returnOrder.processedAt is None:
|
| - |
|
10634 |
returnString = returnString + str(returnOrder.id)+":"+str(returnOrder.lineitem)+"|"
|
| - |
|
10635 |
|
| - |
|
10636 |
if len(returnString) >0 :
|
| - |
|
10637 |
raise TransactionServiceException(140, "Unprocessed orders are: "+returnString)
|
| - |
|
10638 |
|
| - |
|
10639 |
returnTransaction.status = ReturnTransactionStatus._VALUES_TO_NAMES[ReturnTransactionStatus.COMPLETED]
|
| - |
|
10640 |
|
| - |
|
10641 |
session.commit()
|
| - |
|
10642 |
return True
|
| - |
|
10643 |
|
| - |
|
10644 |
def refund_return_transaction_payment(returnOrdersMap, returnTransactionId):
|
| - |
|
10645 |
for returnOrderId, returnOrderAttrMap in returnOrdersMap.items():
|
| - |
|
10646 |
returnOrder = get_return_order_info(returnOrderId)
|
| - |
|
10647 |
if returnOrder.returnAction:
|
| - |
|
10648 |
returnOrder.processedAt = datetime.datetime.now()
|
| - |
|
10649 |
returnOrder.refundDescription = returnOrder.refundDescription + returnOrderAttrMap.get("RefundInfo")
|
| - |
|
10650 |
returnOrder.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.REFUND_DONE]
|
| - |
|
10651 |
else:
|
| - |
|
10652 |
returnOrder.processedAt = datetime.datetime.now()
|
| - |
|
10653 |
returnOrder.refundDescription = str(returnOrder.replacementOrderId) + " has been delivered now"
|
| - |
|
10654 |
returnOrder.returnTxnResolutionStatus = ReturnTxnResolutionStatus._VALUES_TO_NAMES[ReturnTxnResolutionStatus.REPLACEMENT_DONE]
|
| - |
|
10655 |
session.commit()
|
| 9891 |
|
10656 |
|
| 9892 |
if __name__ == '__main__':
|
10657 |
if __name__ == '__main__':
|
| 9893 |
print get_orders_by_mobile_number("9650889334")
|
10658 |
print get_orders_by_mobile_number("9650889334")
|