| Line 2940... |
Line 2940... |
| 2940 |
address_text.textLine("PIN " + warehouse.pincode)
|
2940 |
address_text.textLine("PIN " + warehouse.pincode)
|
| 2941 |
pdf.drawText(address_text)
|
2941 |
pdf.drawText(address_text)
|
| 2942 |
|
2942 |
|
| 2943 |
pdf.setFont('Times-Roman',12)
|
2943 |
pdf.setFont('Times-Roman',12)
|
| 2944 |
order_text = pdf.beginText(inch, PAGE_HEIGHT - 4 * inch)
|
2944 |
order_text = pdf.beginText(inch, PAGE_HEIGHT - 4 * inch)
|
| - |
|
2945 |
for detail in provider.details:
|
| - |
|
2946 |
if detail.type == DeliveryType.PREPAID and detail.logisticLocation == warehouse.logisticsLocation :
|
| 2945 |
order_text.textLine("Pickup CODE: " + provider.details[DeliveryType.PREPAID].accountNo)
|
2947 |
order_text.textLine("Pickup CODE: " + detail.accountNo)
|
| 2946 |
lineitem = order.lineitems[0]
|
2948 |
lineitem = order.lineitems[0]
|
| 2947 |
order_text.textLine("Content : " + lineitem.brand + " " + str(lineitem.model_number) + " " + str(lineitem.color))
|
2949 |
order_text.textLine("Content : " + lineitem.brand + " " + str(lineitem.model_number) + " " + str(lineitem.color))
|
| 2948 |
order_text.textLine("Declared Value: Rs. " + str(order.total_amount))
|
2950 |
order_text.textLine("Declared Value: Rs. " + str(order.total_amount))
|
| 2949 |
order_text.textLine("Order ID : " + str(order.id))
|
2951 |
order_text.textLine("Order ID : " + str(order.id))
|
| 2950 |
pdf.drawText(order_text)
|
2952 |
pdf.drawText(order_text)
|
| Line 3463... |
Line 3465... |
| 3463 |
deliveryType = DeliveryType.COD
|
3465 |
deliveryType = DeliveryType.COD
|
| 3464 |
|
3466 |
|
| 3465 |
|
3467 |
|
| 3466 |
logistics_client = LogisticsClient().get_client()
|
3468 |
logistics_client = LogisticsClient().get_client()
|
| 3467 |
logistics_info = logistics_client.getLogisticsEstimation(order.lineitems[0].item_id, order.customer_pincode, deliveryType)
|
3469 |
logistics_info = logistics_client.getLogisticsEstimation(order.lineitems[0].item_id, order.customer_pincode, deliveryType)
|
| - |
|
3470 |
print "******"
|
| - |
|
3471 |
print "got provider : " + str(logistics_info.providerId)
|
| - |
|
3472 |
print "order provider : " + str(order.logistics_provider_id)
|
| - |
|
3473 |
print "delivery time : " + str(logistics_info.deliveryTime)
|
| - |
|
3474 |
print "codAllowed : " + str(logistics_info.codAllowed)
|
| - |
|
3475 |
print "******"
|
| 3468 |
|
3476 |
|
| 3469 |
# Check for new estimate. Raise exception if new address is not serviceable
|
3477 |
# Check for new estimate. Raise exception if new address is not serviceable
|
| 3470 |
if logistics_info.deliveryTime == -1:
|
3478 |
if logistics_info.deliveryTime == -1:
|
| 3471 |
raise TransactionServiceException(1, 'Location not serviceable')
|
3479 |
raise TransactionServiceException(1, 'Location not serviceable')
|
| 3472 |
|
3480 |
|
| Line 4267... |
Line 4275... |
| 4267 |
for provider in providers:
|
4275 |
for provider in providers:
|
| 4268 |
serviceProviders[provider.id] = provider.name
|
4276 |
serviceProviders[provider.id] = provider.name
|
| 4269 |
return serviceProviders
|
4277 |
return serviceProviders
|
| 4270 |
|
4278 |
|
| 4271 |
def get_service_provider_for_device(rechargeType, deviceNumber):
|
4279 |
def get_service_provider_for_device(rechargeType, deviceNumber):
|
| - |
|
4280 |
#FIXME : This method does not take care of MNP cases.
|
| 4272 |
if rechargeType == RechargeType.MOBILE:
|
4281 |
if rechargeType == RechargeType.MOBILE:
|
| 4273 |
serviceType = 'MTP'
|
4282 |
serviceType = 'MTP'
|
| 4274 |
if rechargeType == RechargeType.DTH:
|
4283 |
if rechargeType == RechargeType.DTH:
|
| 4275 |
serviceType = 'RCH'
|
4284 |
serviceType = 'RCH'
|
| 4276 |
|
4285 |
|
| Line 4331... |
Line 4340... |
| 4331 |
deniedIpAddress.deviceNumber = deviceNumber
|
4340 |
deniedIpAddress.deviceNumber = deviceNumber
|
| 4332 |
deniedIpAddress.rechargeType = rechargeType
|
4341 |
deniedIpAddress.rechargeType = rechargeType
|
| 4333 |
session.commit()
|
4342 |
session.commit()
|
| 4334 |
return "Oops! There seems to be a problem. Please try after some time."
|
4343 |
return "Oops! There seems to be a problem. Please try after some time."
|
| 4335 |
|
4344 |
|
| 4336 |
|
4345 |
#FIXME : MNP cases are not being handled.
|
| 4337 |
deviceNumberInfo = get_service_provider_for_device(rechargeType, deviceNumber)
|
4346 |
deviceNumberInfo = get_service_provider_for_device(rechargeType, deviceNumber)
|
| 4338 |
if deviceNumberInfo.operatorId == -1:
|
4347 |
if deviceNumberInfo.operatorId == -1:
|
| 4339 |
return "Oops! There seems to be a problem. Please try after some time."
|
4348 |
return "Oops! There seems to be a problem. Please try after some time."
|
| 4340 |
circle = TelecomCircle.query.filter_by(code = deviceNumberInfo.circleCode).first()
|
4349 |
circle = TelecomCircle.query.filter_by(code = deviceNumberInfo.circleCode).first()
|
| 4341 |
if circle:
|
4350 |
if circle:
|