| Line 280... |
Line 280... |
| 280 |
// Check for price mismatch between cart and current TagListing
|
280 |
// Check for price mismatch between cart and current TagListing
|
| 281 |
TagListing currentTagListing = tagListingsMap.get(itemId);
|
281 |
TagListing currentTagListing = tagListingsMap.get(itemId);
|
| 282 |
if (currentTagListing != null) {
|
282 |
if (currentTagListing != null) {
|
| 283 |
float cartPrice = cartLine.getActualPrice();
|
283 |
float cartPrice = cartLine.getActualPrice();
|
| 284 |
float currentPrice = currentTagListing.getSellingPrice();
|
284 |
float currentPrice = currentTagListing.getSellingPrice();
|
| - |
|
285 |
|
| - |
|
286 |
// If cart price is 0 or unset, silently update to current price (client bug)
|
| - |
|
287 |
if (cartPrice < 0.01f) {
|
| - |
|
288 |
logger.info("Cart price was 0/unset for itemId {}, setting to current price {}",
|
| - |
|
289 |
itemId, currentPrice);
|
| - |
|
290 |
cartLine.setActualPrice(currentPrice);
|
| - |
|
291 |
}
|
| - |
|
292 |
// Use tolerance comparison to avoid float precision false positives
|
| 285 |
if (Float.compare(cartPrice, currentPrice) != 0) {
|
293 |
else if (Math.abs(cartPrice - currentPrice) > 0.01f) {
|
| 286 |
cartMessageChanged += 1;
|
294 |
cartMessageChanged += 1;
|
| 287 |
String priceChangeMsg = String.format("Price updated for %s: Rs. %.2f to Rs. %.2f",
|
295 |
String priceChangeMsg = String.format("Price updated for %s: Rs. %.2f to Rs. %.2f",
|
| 288 |
item.getItemDescriptionNoColor(), cartPrice, currentPrice);
|
296 |
item.getItemDescriptionNoColor(), cartPrice, currentPrice);
|
| 289 |
CartMessage cartMessage = new CartMessage();
|
297 |
CartMessage cartMessage = new CartMessage();
|
| 290 |
cartMessage.setMessageText(priceChangeMsg);
|
298 |
cartMessage.setMessageText(priceChangeMsg);
|