Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039780Retail ModulesGift cards and gift voucherspublic2018-12-11 15:462019-01-04 00:16
aaroncalero 
ranjith_qualiantech_com 
urgentmajoralways
closedfixed 
5
 
RR19Q2 
guilleaer
Coding ( Testing )
2018-10-16
pi
https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/rev/7e8784db93445ce848d86fa2766e0f6922664476 [^]
No
0039780: Giftcards are not consumed in a reimburse until the related cash management is finally processed in the server
Whenever a giftcard is used from WebPOS (a payment is added, or the giftcard is returned), a giftcard transaction is created in the backend database to prevent using the giftcard more times than it is intended.

When a giftcard is reimbursed, however, this is no longer the case, and the giftcard is not closed until the reimburse cash management is finally processed by the server. If, by any reason, the cash management is not immediately processed, it would be possible to consume the giftcard or do another reimburse.
1. Login in webpos in an instance with giftcards installed (i.e. livebuilds modules environment)
2. Create a gift certificate:
*Menu > Create Gift Certificate
*Select 'Refund the Difference' as Category.
*Fill rest of fields as required
*Click on Apply
3. Click on Menu > Cash Management
4. Click on Reimburse
5. Select the created Gift Certificate and click on Apply
6. Add an amount to reimburse
7. Select the payment method to reimburse
8. In the server code, set a breakpoint in the ProcessCashMgmt class, inside the saveRecord method.
8. Finally click on Done
Verify that the giftcard will remain open/not consumed until the breakpoint is removed.
In the commit which introduced the issue [1] the payment list is iterated (OB.MobileApp.model.get('payments')) and each element's id is compared with an id from the cash management model. The problem is that the elements inside OB.MobileApp.model.get('payments') don't have an id, it is needed to go into the payment inside the element to get the correct id. Basically:
Change from:
 return payment.id === dropsdeps.at(index).get('paymentMethodId')
To
 return payment.payment.id === dropsdeps.at(index).get('paymentMethodId')

[1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/rev/7e8784db93445ce848d86fa2766e0f6922664476 [^]
No tags attached.
related to defect 0039684 closed ranjith_qualiantech_com check Gift Card Instance || Gift Card Transaction || Cancelled must be Yes for partial reimbursement 
related to defect 0039704 closed ranjith_qualiantech_com Modify the payment description for a gift card reimbursement 
related to defect 0038771 closed ranjith_qualiantech_com Test ReimburseCard is failing, not clear if failure of the test or failure in the pos 
Issue History
2018-12-11 15:46aaroncaleroNew Issue
2018-12-11 15:46aaroncaleroAssigned To => Retail
2018-12-11 15:46aaroncaleroResolution time => 1545692400
2018-12-11 15:46aaroncaleroRegression level => Coding ( Testing )
2018-12-11 15:46aaroncaleroRegression date => 2018-10-16
2018-12-11 15:46aaroncaleroRegression introduced in release => pi
2018-12-11 15:46aaroncaleroRegression introduced by commit => https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/rev/7e8784db93445ce848d86fa2766e0f6922664476 [^]
2018-12-11 15:46aaroncaleroTriggers an Emergency Pack => No
2018-12-11 16:02aaroncaleroNote Added: 0108399
2018-12-11 17:31ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2018-12-11 17:31ranjith_qualiantech_comStatusnew => scheduled
2018-12-12 11:13hgbotCheckin
2018-12-12 11:13hgbotNote Added: 0108545
2018-12-12 13:27ranjith_qualiantech_comStatusscheduled => resolved
2018-12-12 13:27ranjith_qualiantech_comResolutionopen => fixed
2018-12-12 13:31aaroncaleroNote Edited: 0108399bug_revision_view_page.php?bugnote_id=0108399#r18027
2018-12-12 13:35ranjith_qualiantech_comRelationship addedrelated to 0039684
2018-12-12 13:35ranjith_qualiantech_comRelationship addedrelated to 0039704
2018-12-24 13:05marvintmReview Assigned To => marvintm
2018-12-24 13:05marvintmStatusresolved => closed
2018-12-24 13:05marvintmFixed in Version => RR19Q1
2019-01-03 07:56ranjith_qualiantech_comNote Added: 0108799
2019-01-03 07:56ranjith_qualiantech_comStatusclosed => new
2019-01-03 07:56ranjith_qualiantech_comResolutionfixed => open
2019-01-03 07:56ranjith_qualiantech_comFixed in VersionRR19Q1 =>
2019-01-03 07:56ranjith_qualiantech_comStatusnew => scheduled
2019-01-03 09:55hgbotCheckin
2019-01-03 09:55hgbotNote Added: 0108808
2019-01-03 12:20hgbotCheckin
2019-01-03 12:20hgbotNote Added: 0108812
2019-01-03 14:49ranjith_qualiantech_comStatusscheduled => resolved
2019-01-03 14:49ranjith_qualiantech_comResolutionopen => fixed
2019-01-04 00:16guilleaerReview Assigned Tomarvintm => guilleaer
2019-01-04 00:16guilleaerStatusresolved => closed
2019-01-04 00:16guilleaerFixed in Version => RR19Q2
2019-01-04 07:52ranjith_qualiantech_comRelationship addedrelated to 0038771

Notes
(0108399)
aaroncalero   
2018-12-11 16:02   
(edited on: 2018-12-12 13:31)
There is another consequence of this issue.
When the partial reimburse/reimburse in different payment methods was implemented, it was done assuming the code was working correctly, and it was implemented assuming that the ProcessCashMgmtHookGiftCard[1] class didn't receive a transactionId (which is generated when the giftcard is consumed preemtively). When this issue is fixed, it will be required to check that the partial reimburse continues working correctly.

Moreover, at least two issues were fixed for the reimburse, 0039684 and 0039704, so it will be required to check that they continue working after fixing this issue.

[1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/file/tip/src/org/openbravo/retail/giftcards/hooks/ProcessCashMgmtHookGiftCard.java#l120 [^]

(0108545)
hgbot   
2018-12-12 11:13   
Repository: erp/pmods/org.openbravo.retail.giftcards
Changeset: 59511e2e5d450a53dbc5942830b36189d7454a07
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Dec 12 15:43:34 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/rev/59511e2e5d450a53dbc5942830b36189d7454a07 [^]

Related to issue 39780 : Gift Card transaction must be Cancelled while reimbursing it in Cash managament

* Gift Car must be consumed/closed before CashMgmt Process.
  In CashMgmt Process, it will update payment transaction with gift card transaction

---
M src/org/openbravo/retail/giftcards/GiftCardModel.java
M src/org/openbravo/retail/giftcards/hooks/ProcessCashMgmtHookGiftCard.java
M src/org/openbravo/retail/giftcards/process/GiftCardGLItemUtils.java
M web/org.openbravo.retail.giftcards/js/hooks/preSaveCashManagementsHook.js
---
(0108799)
ranjith_qualiantech_com   
2019-01-03 07:56   
Changes in GiftCardModel.java should be reverted
https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/rev/59511e2e5d450a53dbc5942830b36189d7454a07#l1.2 [^]

While completing the receipt using Gift Certificate (Refund the difference), then transaction should not be in cancelled status
While reimburse the Gift Certificate (Refund the difference) partially or fully through cash management, then transaction should be in cancelled status

Currently, transaction is updated as cancelled for receipt payments
(0108808)
hgbot   
2019-01-03 09:55   
Repository: erp/pmods/org.openbravo.retail.giftcards
Changeset: 9b080894ba2e18a7edfd33aaaab5650430eba8b9
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Jan 03 14:24:55 2019 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/rev/9b080894ba2e18a7edfd33aaaab5650430eba8b9 [^]

Related to issue 39780 : Gift Card transaction should not be Cancelled when it is paid for receipt

* For Reimbursed Gift certificate, transaction status should be false when Gift certificate is paid for receipt
* While completing the receipt using Gift Certificate (Refund the difference), then transaction should not be in cancelled status
  While reimburse the Gift Certificate (Refund the difference) partially or fully through cash management, then transaction should be in cancelled status

---
M src/org/openbravo/retail/giftcards/ConsumeGiftCardAmount.java
M src/org/openbravo/retail/giftcards/GiftCardModel.java
M web/org.openbravo.retail.giftcards/js/hooks/preSaveCashManagementsHook.js
---
(0108812)
hgbot   
2019-01-03 12:20   
Repository: tools/automation/pi-mobile
Changeset: fe2a28963ef0ea352e4d9e36f2aa44ee526c66e5
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Jan 03 16:50:33 2019 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/fe2a28963ef0ea352e4d9e36f2aa44ee526c66e5 [^]

Verifies issue 39780 : Added Automated Test 'I39780_VerifyReimurseGiftTransaction'

---
A src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/giftcards/I39780_VerifyReimurseGiftTransaction.java
---