| Line 131... |
Line 131... |
| 131 |
print "------- date end ------ "
|
131 |
print "------- date end ------ "
|
| 132 |
req = urllib2.Request(forwardApi, data)
|
132 |
req = urllib2.Request(forwardApi, data)
|
| 133 |
response = urllib2.urlopen(req)
|
133 |
response = urllib2.urlopen(req)
|
| 134 |
the_page = response.read()
|
134 |
the_page = response.read()
|
| 135 |
jsonResponse = json.loads(the_page)
|
135 |
jsonResponse = json.loads(the_page)
|
| - |
|
136 |
print
|
| 136 |
return jsonResponse[0]['success']
|
137 |
return jsonResponse['shipments'][0]['success']
|
| 137 |
except:
|
138 |
except:
|
| 138 |
traceback.print_exc()
|
139 |
traceback.print_exc()
|
| 139 |
return False
|
140 |
return False
|
| 140 |
|
141 |
|
| 141 |
def _forwardMap(airwaybill_no, orders):
|
142 |
def _forwardMap(airwaybill_no, orders):
|
| Line 197... |
Line 198... |
| 197 |
shipment[F_DG_SHIPMENT] = 'false'
|
198 |
shipment[F_DG_SHIPMENT] = 'false'
|
| 198 |
shipment[F_ADDITIONAL_INFORMATION] = {"MULTI_SELLER_INFORMATION": _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj)}
|
199 |
shipment[F_ADDITIONAL_INFORMATION] = {"MULTI_SELLER_INFORMATION": _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj)}
|
| 199 |
return shipment
|
200 |
return shipment
|
| 200 |
|
201 |
|
| 201 |
def _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj):
|
202 |
def _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj):
|
| 202 |
itemIds = []
|
- |
|
| 203 |
inventory_client = InventoryClient().get_client()
|
- |
|
| 204 |
warehouse = inventory_client.getWarehouse(orders[0].warehouse_id)
|
- |
|
| 205 |
|
- |
|
| 206 |
if sellerInfo.stateId == warehouse.stateId:
|
- |
|
| 207 |
taxRate = cc.getStateTaxRate(itemIds, sellerInfo.stateId)
|
- |
|
| 208 |
else:
|
- |
|
| 209 |
taxRate = cc.getStateTaxRate(itemIds, -1)
|
- |
|
| 210 |
|
- |
|
| 211 |
for order in orders:
|
- |
|
| 212 |
lineitem = order.lineitems[0]
|
- |
|
| 213 |
for order in orders:
|
203 |
for order in orders:
|
| 214 |
lineitem = order.lineitems[0]
|
204 |
lineitem = order.lineitems[0]
|
| 215 |
cc = CatalogClient().get_client()
|
- |
|
| 216 |
totalTaxRate = lineitem.sgstRate + lineitem.cgstRate + lineitem.igstRate
|
205 |
totalTaxRate = lineitem.sgstRate + lineitem.cgstRate + lineitem.igstRate
|
| 217 |
stateMaster = fetchStateMaster()
|
206 |
stateMaster = fetchStateMaster()
|
| 218 |
return {
|
207 |
return {
|
| 219 |
"ITEM_DESCRIPTION": " ".join(filter(None, [lineitem.brand, lineitem.model_name, lineitem.model_number])),
|
208 |
"ITEM_DESCRIPTION": " ".join(filter(None, [lineitem.brand, lineitem.model_name, lineitem.model_number])),
|
| 220 |
"ITEM_VALUE": lineitem.unit_price,
|
209 |
"ITEM_VALUE": lineitem.unit_price,
|
| Line 229... |
Line 218... |
| 229 |
"ESUGAM_NUMBER": "",
|
218 |
"ESUGAM_NUMBER": "",
|
| 230 |
"SELLER_GSTIN": sellerInfo.gstin,
|
219 |
"SELLER_GSTIN": sellerInfo.gstin,
|
| 231 |
"GST_HSN": lineitem.hsnCode,
|
220 |
"GST_HSN": lineitem.hsnCode,
|
| 232 |
"GST_TAX_BASE": lineitem.unit_price,
|
221 |
"GST_TAX_BASE": lineitem.unit_price,
|
| 233 |
"DISCOUNT": 0.0,
|
222 |
"DISCOUNT": 0.0,
|
| 234 |
"GST_TAX_RATE_CGSTN": taxRate.cgstRate,
|
223 |
"GST_TAX_RATE_CGSTN": lineitem.cgstRate,
|
| 235 |
"GST_TAX_RATE_SGSTN": taxRate.sgstRate,
|
224 |
"GST_TAX_RATE_SGSTN": lineitem.sgstRate,
|
| 236 |
"GST_TAX_RATE_IGSTN": taxRate.igstRate,
|
225 |
"GST_TAX_RATE_IGSTN": lineitem.igstRate,
|
| 237 |
"GST_TAX_TOTAL": lineitem.unit_price - lineitem.unit_price / (1 + (totalTaxRate/100)),
|
226 |
"GST_TAX_TOTAL": lineitem.unit_price - lineitem.unit_price / (1 + (totalTaxRate/100)),
|
| 238 |
"GST_TAX_CGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.cgstRate/100)),
|
227 |
"GST_TAX_CGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.cgstRate/100)),
|
| 239 |
"GST_TAX_SGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.sgstRate/100)),
|
228 |
"GST_TAX_SGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.sgstRate/100)),
|
| 240 |
"GST_TAX_IGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.igstRate/100)),
|
229 |
"GST_TAX_IGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.igstRate/100)),
|
| 241 |
}
|
230 |
}
|