| Line 273... |
Line 273... |
| 273 |
|
273 |
|
| 274 |
for discount in line.discounts:
|
274 |
for discount in line.discounts:
|
| 275 |
i = 0
|
275 |
i = 0
|
| 276 |
while i < discount.quantity:
|
276 |
while i < discount.quantity:
|
| 277 |
t_line_item = create_line_item(line.item_id, line.actual_price if isGv else (line.actual_price - discount.discount))
|
277 |
t_line_item = create_line_item(line.item_id, line.actual_price if isGv else (line.actual_price - discount.discount))
|
| 278 |
t_order = create_order(userId, cart.address_id, t_line_item, cart.pickupStoreId, discount.discount if isGv else 0, line.insurer, (line.insuranceAmount/line.quantity), insuranceDetails,line.dataProtectionInsurer,(line.dataProtectionAmount)/line.quantity, orderSource)
|
278 |
t_order = create_order(userId, cart.address_id, t_line_item, cart.pickupStoreId, discount.discount if isGv else 0, line.insurer, (line.insuranceAmount/line.quantity), insuranceDetails,line.dataProtectionInsurer,(line.dataProtectionAmount)/line.quantity, orderSource, line.freebieId)
|
| 279 |
orders.append(t_order)
|
279 |
orders.append(t_order)
|
| 280 |
i += 1
|
280 |
i += 1
|
| 281 |
quantity_remaining_for_order -= discount.quantity
|
281 |
quantity_remaining_for_order -= discount.quantity
|
| 282 |
|
282 |
|
| 283 |
i = 0
|
283 |
i = 0
|
| 284 |
while i < quantity_remaining_for_order:
|
284 |
while i < quantity_remaining_for_order:
|
| 285 |
t_line_item = create_line_item(line.item_id, line.actual_price)
|
285 |
t_line_item = create_line_item(line.item_id, line.actual_price)
|
| 286 |
t_order = create_order(userId, cart.address_id, t_line_item, cart.pickupStoreId, 0, line.insurer, (line.insuranceAmount/line.quantity), insuranceDetails, line.dataProtectionInsurer,(line.dataProtectionAmount)/line.quantity, orderSource)
|
286 |
t_order = create_order(userId, cart.address_id, t_line_item, cart.pickupStoreId, 0, line.insurer, (line.insuranceAmount/line.quantity), insuranceDetails, line.dataProtectionInsurer,(line.dataProtectionAmount)/line.quantity, orderSource, line.freebieId)
|
| 287 |
orders.append(t_order)
|
287 |
orders.append(t_order)
|
| 288 |
i += 1
|
288 |
i += 1
|
| 289 |
return orders
|
289 |
return orders
|
| 290 |
|
290 |
|
| 291 |
def create_order(userId, address_id, t_line_item, pickupStoreId, gvAmount, insurer, insuranceAmount, insuranceDetails, dataProtectionInsurer, dataProtectionAmount, orderSource):
|
291 |
def create_order(userId, address_id, t_line_item, pickupStoreId, gvAmount, insurer, insuranceAmount, insuranceDetails, dataProtectionInsurer, dataProtectionAmount, orderSource, freebieId):
|
| 292 |
user = User.get_by(id=userId)
|
292 |
user = User.get_by(id=userId)
|
| 293 |
address = Address.get_by(id=address_id)
|
293 |
address = Address.get_by(id=address_id)
|
| 294 |
t_order = TOrder()
|
294 |
t_order = TOrder()
|
| 295 |
|
295 |
|
| 296 |
t_order.customer_id = user.id
|
296 |
t_order.customer_id = user.id
|
| Line 320... |
Line 320... |
| 320 |
if insuranceDetails:
|
320 |
if insuranceDetails:
|
| 321 |
t_order.dob = insuranceDetails.dob
|
321 |
t_order.dob = insuranceDetails.dob
|
| 322 |
t_order.guardianName = insuranceDetails.guardianName
|
322 |
t_order.guardianName = insuranceDetails.guardianName
|
| 323 |
|
323 |
|
| 324 |
catalog_client = CatalogClient().get_client()
|
324 |
catalog_client = CatalogClient().get_client()
|
| - |
|
325 |
|
| - |
|
326 |
if freebieId is None:
|
| 325 |
freebie_item_id = catalog_client.getFreebieForItem(t_line_item.item_id)
|
327 |
freebie_item_id = catalog_client.getFreebieForItem(t_line_item.item_id)
|
| 326 |
if freebie_item_id:
|
328 |
if freebie_item_id:
|
| 327 |
t_order.freebieItemId = freebie_item_id
|
329 |
t_order.freebieItemId = freebie_item_id
|
| - |
|
330 |
else:
|
| - |
|
331 |
freebie_item_id = None if freebieId == 0 else freebieId
|
| 328 |
t_order.source = orderSource
|
332 |
t_order.source = orderSource
|
| 329 |
t_order.dataProtectionInsurer = dataProtectionInsurer
|
333 |
t_order.dataProtectionInsurer = dataProtectionInsurer
|
| 330 |
t_order.dataProtectionAmount = dataProtectionAmount
|
334 |
t_order.dataProtectionAmount = dataProtectionAmount
|
| 331 |
return t_order
|
335 |
return t_order
|
| 332 |
|
336 |
|