Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0053919 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Retail Modules] Discounts and Promotions | major | always | 2023-11-13 13:33 | 2023-12-15 11:22 | |||
Reporter | sofidossant | View Status | public | |||||
Assigned To | ramprakash | |||||||
Priority | high | Resolution | unable to reproduce | Fixed in Version | ||||
Status | closed | Fix in branch | Fixed in SCM revision | |||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | ||||||||
Review Assigned To | ||||||||
OBNetwork customer | Gold | |||||||
Support ticket | 79269 | |||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0053919: Error with the API - in NORAUTO | |||||||
Description | Error when using the API, and we apply a manual discount, and a Price Adjustment by product type discount should also be applied, but if we use "discountsFromUser" with the manual, the price adjustment by product type is not applied. If applicable, if any other type of discount. I was debugging and the strange thing is that it works with any type of discount, that is, if I change the discount type of the first case to Price Adjustment, it works, it gives me both discounts. The bug is only with the Price Adjustment by Product discount type. I was also able to identify where the error occurred, but I could not debug the code. In the JAVA GraalDiscountsExecutor.java Value discountFunction = context.eval(applyDiscountsFunction); tr = System.currentTimeMillis(); Value applicableRules = jsonUtils.jsonToGraal(rules); Value applicableBPSets = jsonUtils.jsonToGraal(bpSets); Value graalTicket = jsonUtils.jsonToGraal(ticket.toJSON()); t0 = System.currentTimeMillis(); Value discounts = discountFunction.execute(graalTicket, applicableRules, applicableBPSets); The rules are sent well (the manual discount and Price Adjustment by Product rules), but when the apply discount function is executed it only brings the manual one. | |||||||
Steps To Reproduce | Norauto is in version PR20Q3.5. The cases are the following: if we use this json: { "ticket": { "organization": { "searchKey": "9902" }, "businessPartner": { "referenceNo": "" }, "orderDate": "2023-10-31T11:54:21", "priceIncludesTax": true, "discountsFromUser": {}, "lines": [ { "id": "1", "product": { "searchKey": "666964" }, "qty": 2, "baseGrossUnitPrice": 15.99 } ] } } The result is { "ticket": { "id": "", "discountengine": { "lines": [ { "id": "1", "grossUnitAmount": 22.38, "grossUnitPrice": 11.19, "discounts": [ { "ruleId": "B81EF458CFA5470E84723091B44533D1", "discountType": "98C687D2404F454F91B5DD26C67112D9", "name": "008393", "applyNext": true, "incompatibleDiscounts": [], "amt": 9.6, "qtyOffer": 2, "discountTypeName": "Price Adjustment by Product" } ], "totalDiscounts": 9.6, "totalDiscountsWithoutVouchers": 9.6, "totalDiscountsVouchers": 0 } ], "totalDiscounts": 9.6, "totalDiscountsWithoutVouchers": 9.6, "totalDiscountsVouchers": 0 } } } As we see, the Price Adjustment by Product discount is applied, now if we use the following JSON, it only changes that we add discounts discountFromUser { "ticket": { "organization": { "searchKey": "9902" }, "businessPartner": { "referenceNo": "" }, "orderDate": "2023-10-31T11:54:21", "priceIncludesTax": true, "discountsFromUser": { "bytotalManualPromotions": [ { "applyNext": true, "disctTotalamountdisc": 2, "discountType": "00535FB65D9941AE9575546FBAF11B95", "name": "LOYALTYFR", "products": [], "productCategories": [], "productCharacteristics": [] } ] }, "lines": [ { "id": "1", "product": { "searchKey": "666964 " }, "qty": 1, "baseGrossUnitPrice": 15.99 } ] } } Basically you should add the discount that is seen in the json and then the one that we saw in the first example, since the two discounts have the apply next discount. But the following error occurs: { "ticket": { "id": "", "discountengine": { "lines": [ { "id": "1", "grossUnitAmount": 13.99, "grossUnitPrice": 13.99, "discounts": [ { "ruleId": "3657531F1CAD478382ED34B4C7D22C37", "discountType": "00535FB65D9941AE9575546FBAF11B95", "name": "LOYALTYFR", "applyNext": true, "amt": 2, "qtyOffer": 1, "printedName": "LOYALTYFR", "description": "LOYALTYFR", "discountTypeName": "Variable Discount per Total Amount" } ], "totalDiscounts": 2, "totalDiscountsWithoutVouchers": 2, "totalDiscountsVouchers": 0 } ], "totalDiscounts": 2, "totalDiscountsWithoutVouchers": 2, "totalDiscountsVouchers": 0 } } } As we see, only the manual is applied and not the Price Adjustment by product. | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
![]() |
|
![]() |
|
(0157841) sofidossant (viewer) 2023-11-30 11:32 |
any news? |
(0157937) sofidossant (viewer) 2023-12-04 12:25 |
any news? |
(0158259) ramprakash (viewer) 2023-12-15 11:22 |
The Manual Discount ID was missing in the Input Json so Discount is not applied After Including ID and on Checking with correct Json the Output is Fine and the API works Perfect. |
![]() |
|||
Date Modified | Username | Field | Change |
2023-11-13 13:33 | sofidossant | New Issue | |
2023-11-13 13:33 | sofidossant | Assigned To | => Retail |
2023-11-13 13:33 | sofidossant | OBNetwork customer | => Gold |
2023-11-13 13:33 | sofidossant | Support ticket | => 79269 |
2023-11-13 13:33 | sofidossant | Triggers an Emergency Pack | => No |
2023-11-27 17:29 | aaroncalero | Assigned To | Retail => Triage Omni OMS |
2023-11-30 11:32 | sofidossant | Note Added: 0157841 | |
2023-12-04 12:25 | sofidossant | Note Added: 0157937 | |
2023-12-05 11:50 | aferraz | Assigned To | Triage Omni OMS => ramprakash |
2023-12-15 11:22 | ramprakash | Note Added: 0158259 | |
2023-12-15 11:22 | ramprakash | Status | new => closed |
2023-12-15 11:22 | ramprakash | Resolution | open => unable to reproduce |
Copyright © 2000 - 2009 MantisBT Group |