| Line 8229... |
Line 8229... |
| 8229 |
order.billing_timestamp = datetime.datetime.now()
|
8229 |
order.billing_timestamp = datetime.datetime.now()
|
| 8230 |
order.billed_by = billed_by
|
8230 |
order.billed_by = billed_by
|
| 8231 |
|
8231 |
|
| 8232 |
# Letting the billing process fail in cases where we are unable to
|
8232 |
# Letting the billing process fail in cases where we are unable to
|
| 8233 |
# fill in transfer price
|
8233 |
# fill in transfer price
|
| - |
|
8234 |
if order.productCondition == ProductCondition.BAD:
|
| 8234 |
try:
|
8235 |
try:
|
| 8235 |
if not inventory_client.isAlive():
|
8236 |
if not inventory_client.isAlive():
|
| 8236 |
inventory_client = InventoryClient().get_client()
|
8237 |
inventory_client = InventoryClient().get_client()
|
| 8237 |
warehouse = inventory_client.getWarehouse(order.fulfilmentWarehouseId)
|
8238 |
warehouse = inventory_client.getWarehouse(order.fulfilmentWarehouseId)
|
| 8238 |
item_pricing = inventory_client.getItemPricing(item_id, warehouse.vendor.id)
|
8239 |
item_pricing = inventory_client.getItemPricing(item_id, warehouse.vendor.id)
|
| 8239 |
lineitem.transfer_price = item_pricing.transferPrice
|
8240 |
lineitem.transfer_price = item_pricing.transferPrice
|
| 8240 |
lineitem.nlc = item_pricing.nlc
|
8241 |
lineitem.nlc = item_pricing.nlc
|
| 8241 |
if order.taxType == TaxType.CFORM:
|
8242 |
if order.taxType == TaxType.CFORM:
|
| 8242 |
lineitem.vatRate = 2
|
8243 |
lineitem.vatRate = 2
|
| 8243 |
else:
|
- |
|
| 8244 |
if not catalog_client.isAlive():
|
- |
|
| 8245 |
catalog_client = CatalogClient().get_client()
|
- |
|
| 8246 |
if fetchStateMaster()[warehouse.stateId].vatType==VatType.MRP:
|
- |
|
| 8247 |
lineitem.vatRate = catalog_client.getVatPercentageForItem(lineitem.item_id, warehouse.stateId, lineitem.mrp)
|
- |
|
| 8248 |
else:
|
8244 |
else:
|
| - |
|
8245 |
if not catalog_client.isAlive():
|
| - |
|
8246 |
catalog_client = CatalogClient().get_client()
|
| - |
|
8247 |
if fetchStateMaster()[warehouse.stateId].vatType==VatType.MRP:
|
| - |
|
8248 |
lineitem.vatRate = catalog_client.getVatPercentageForItem(lineitem.item_id, warehouse.stateId, lineitem.mrp)
|
| - |
|
8249 |
else:
|
| 8249 |
lineitem.vatRate = catalog_client.getVatPercentageForItem(lineitem.item_id, warehouse.stateId, lineitem.unit_price)
|
8250 |
lineitem.vatRate = catalog_client.getVatPercentageForItem(lineitem.item_id, warehouse.stateId, lineitem.unit_price)
|
| 8250 |
order.vendorId = warehouse.vendor.id
|
8251 |
order.vendorId = warehouse.vendor.id
|
| 8251 |
whStateId = warehouse.stateId
|
8252 |
whStateId = warehouse.stateId
|
| 8252 |
except InventoryServiceException as e:
|
8253 |
except InventoryServiceException as e:
|
| 8253 |
print sys.exc_info()[0]
|
8254 |
print sys.exc_info()[0]
|
| 8254 |
print e.message
|
8255 |
print e.message
|
| 8255 |
if warehouseDbConnection.open:
|
8256 |
if warehouseDbConnection.open:
|
| 8256 |
warehouseDbConnection.close()
|
8257 |
warehouseDbConnection.close()
|
| 8257 |
raise TransactionServiceException(110, 'Transfer price missing for itemId: ' + str(item_id) + ' and vendor: ' + str(warehouse.vendor.id))
|
8258 |
raise TransactionServiceException(110, 'Transfer price missing for itemId: ' + str(item_id) + ' and vendor: ' + str(warehouse.vendor.id))
|
| 8258 |
|
8259 |
|
| 8259 |
if order.orderType == OrderType.B2B:
|
8260 |
if order.orderType == OrderType.B2B:
|
| 8260 |
tinNumber = Attribute.query.filter(Attribute.orderId == order.id).filter(Attribute.name == "tinNumber").first()
|
8261 |
tinNumber = Attribute.query.filter(Attribute.orderId == order.id).filter(Attribute.name == "tinNumber").first()
|
| 8261 |
if tinNumber is None:
|
8262 |
if tinNumber is None:
|
| 8262 |
if warehouseDbConnection.open:
|
8263 |
if warehouseDbConnection.open:
|