Openbravo Issue Tracking System - Retail Modules | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0056894 | Retail Modules | Gift cards and gift vouchers | public | 2024-10-24 18:09 | 2024-11-05 23:32 |
Reporter | sofidossant | ||||
Assigned To | sreehari | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | pi | ||||
Target Version | Fixed in Version | ||||
Merge Request Status | |||||
Review Assigned To | |||||
OBNetwork customer | |||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0056894: API Consume Gift cards | ||||
Description | Error when using the API https://livebuilds.openbravo.com/context/retail_pos2_modules_pgsql/ws/org.openbravo.retail.api.giftcards.ImportService/ConsumeGiftCard [^] When you consume the points partially, you can consume more than the value of the gift card, that is, if I have one that is worth 50, I can make 2 consumptions of 40 and this is an ERROR. The response of the api is 10 (in the second time I consume it), but the transaction that is created is of 40 | ||||
Steps To Reproduce | 1- Creation of the GIFTCARD With this https://livebuilds.openbravo.com/context/retail_pos2_modules_pgsql/ws/org.openbravo.api.ImportService/GiftCard [^] { "client":"The White Valley Group", "organization":"The White Valley Group", "searchKey": "TEST-SOFISSA", "active": true, "dateOrdered": "2024-10-22", "businessPartner": "VBS/C0001", "product": "GC/001", "amount": 50, "currentAmount": 50, "type": "BasedOnCreditNote", "expirationDate": "2025-09-23" } I attached the image 2- And then I try to consume: https://livebuilds.openbravo.com/context/retail_pos2_modules_pgsql/ws/org.openbravo.retail.api.giftcards.ImportService/ConsumeGiftCard [^] { "client": "The White Valley Group", "organization": "The White Valley Group", "giftCardIdentifier": "TEST-SOFISSA", "amount": 40, } Response { "data": { "id": "9BF85FA64B114A16A9C1185D0E3BF9EE", "amount": 40, "gcnvGiftcardInst": "E16782A0E46D4BB69131B7B139F3CA70" }, "links": null } And then again consume: https://livebuilds.openbravo.com/context/retail_pos2_modules_pgsql/ws/org.openbravo.retail.api.giftcards.ImportService/ConsumeGiftCard [^] { "client": "The White Valley Group", "organization": "The White Valley Group", "giftCardIdentifier": "TEST-SOFISSA", "amount": 40, } { "data": { "id": "40041B28F59345DCA056C315E8780077", "amount": 10, "gcnvGiftcardInst": "E16782A0E46D4BB69131B7B139F3CA70" }, "links": null } But if you see the transaction is for 40, I attached the images IMPORTANT when you login, use a default one organization with currency | ||||
Proposed Solution | The error is in this JAVA src/org/openbravo/retail/giftcards/ConsumeGiftCardAmount.java BigDecimal realamount = amount; if (!isReturn && amount.compareTo(BigDecimal.ZERO) > 0) { if (giftcard.getCurrentamount().compareTo(amount) < 0) { realamount = giftcard.getCurrentamount(); } } String newTrxId; try { newTrxId = jsonsent.getString("newTransactionId"); } catch (Exception e) { newTrxId = SequenceIdData.getUUID(); } final boolean isCancelled = jsonsent.optBoolean("reimburseGiftCard", false); String transactionId = jsonsent.has("transaction") ? jsonsent.getString("transaction") : null; GiftCardTrans transaction = model.consumeAmountGiftCard(newTrxId, giftcard, new Date(), OBDal.getInstance().get(Order.class, jsonsent.optString("order")), OBDal.getInstance().get(OrderLine.class, jsonsent.optString("orderline")), amount, isReturn, transactionId == null || "null".equals(transactionId) ? null : transactionId, jsonsent.has("hasPaymentMethod") ? jsonsent.getBoolean("hasPaymentMethod") : false, isCancelled); When it generates the transaction, it doesn't do it with the realamount, but with the amount and that's why it can consume more. | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | Captura de pantalla -2024-10-24 13-10-24.png (133,010) 2024-10-24 18:10 https://issues.openbravo.com/file_download.php?file_id=20374&type=bug Captura de pantalla -2024-10-23 15-25-43.png (153,301) 2024-10-24 18:10 https://issues.openbravo.com/file_download.php?file_id=20375&type=bug | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2024-10-24 18:09 | sofidossant | New Issue | |||
2024-10-24 18:09 | sofidossant | Assigned To | => Retail | ||
2024-10-24 18:09 | sofidossant | Triggers an Emergency Pack | => No | ||
2024-10-24 18:10 | sofidossant | File Added: Captura de pantalla -2024-10-24 13-10-24.png | |||
2024-10-24 18:10 | sofidossant | File Added: Captura de pantalla -2024-10-23 15-25-43.png | |||
2024-10-24 18:20 | sofidossant | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=28669#r28669 | ||
2024-10-25 06:21 | guillermogil | Assigned To | Retail => guilleaer | ||
2024-10-25 14:22 | Practics | Issue Monitored: Practics | |||
2024-10-29 08:16 | guilleaer | Status | new => acknowledged | ||
2024-11-02 05:54 | sreehari | Assigned To | guilleaer => sreehari | ||
2024-11-02 05:54 | sreehari | Status | acknowledged => scheduled | ||
2024-11-05 05:47 | hgbot | Note Added: 0171356 | |||
2024-11-05 23:32 | hgbot | Note Added: 0171459 | |||
2024-11-05 23:32 | hgbot | Resolution | open => fixed | ||
2024-11-05 23:32 | hgbot | Status | scheduled => closed | ||
2024-11-05 23:32 | hgbot | Note Added: 0171460 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|