Openbravo Issue Tracking System - POS2
View Issue Details
0055589POS2Fashionpublic2024-05-24 18:552024-08-26 10:33
ivazquez 
sreehari 
normalminoralways
closedfixed 
5
pi 
 
pi
No
0055589: Error when trying to add loyalty points if you have not set the payment method “Gift Certificate”.
If you do not have the “Gift Certificate” payment method configured in the terminal you are using, when you try to add loyalty points to the business partner you will get the following error:

Cannot read properties of undefined (reading 'paymentMethod')

This is because of the following line of code:

https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/blob/master/web-jspack/org.openbravo.retail.loyalty.burn.giftcertificate/src/utilities/utils.js?ref_type=heads#L89 [^]

Reproduced in the following livebuild:

https://livebuilds.openbravo.com/context/retail_pos2_modules_pgsql/web/pos/?terminal=VBS-2 [^]
First, we have to ensure that we have configured “Loyalty Program” and “Loyalty Reason” in the back office.

-After confirming this, go to POS2 using a terminal that does not have the “Gift Certificate” payment method configured (there is a Grouped Gift Certificate method which is not the same, it has to be specifically the “Gift Certificate” method).

-Find a Business Partner who is a loyalty program member or add a loyalty subscription to a business partner.

-Click on the business partner and in the drop-down menu click on “View Loyalty”.

-At the bottom left, click “Add Loyalty Points”.

-Set a “Reason”, put a point, and then click on “Add Points”.

It will show you the error at the bottom left.

Attached is a video reproducing the error
If it is necessary to have this payment method configured for the Loyalty integration to work, it will show you a corresponding error message informing the customer to be set up to be able to add loyalty points.


Adding information to the issue, even though a change has already been made, and that is that it does not exactly search for the “Gift Certificate” payment method, even though that is the name of the function that searches for it:

https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/blob/master/web-jspack/org.openbravo.retail.loyalty.burn.giftcertificate/src/utilities/utils.js?ref_type=heads#L67 [^]

If not, it searches for the payment method “Gift Card”, as you can see in this line of code where the constant is instantiated with the kind of this payment method:

https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/blob/master/web-jspack/org.openbravo.retail.loyalty.burn.giftcertificate/src/utilities/utils.js?ref_type=heads#L15 [^] [^]

So it would seem to me good that you also fix this code, giving a more descriptive and intuitive name to this function or, in case this payment method is wrong to be searched, that the instantiation of the constant is changed by setting the corresponding kind.
No tags attached.
? loyaltyGiftcardCertificateProblem.mp4 (2,043,670) 2024-05-24 18:55
https://issues.openbravo.com/file_download.php?file_id=19819&type=bug
Issue History
2024-05-24 18:55ivazquezNew Issue
2024-05-24 18:55ivazquezAssigned To => Retail
2024-05-24 18:55ivazquezFile Added: loyaltyGiftcardCertificateProblem.mp4
2024-05-24 18:55ivazquezRegression introduced in release => pi
2024-05-24 18:55ivazquezTriggers an Emergency Pack => No
2024-05-24 18:56ivazquezProposed Solution updated
2024-05-29 09:46aaroncaleroNote Added: 0165252
2024-05-29 09:46aaroncaleroStatusnew => acknowledged
2024-05-29 10:04sreehariAssigned ToRetail => sreehari
2024-05-29 10:04sreehariStatusacknowledged => scheduled
2024-05-30 08:36hgbotNote Added: 0165286
2024-05-30 15:37ivazquezNote Added: 0165339
2024-05-30 15:38ivazquezProposed Solution updated
2024-06-25 08:40egoitzSeveritymajor => minor
2024-06-25 18:20ivazquezProposed Solution updated
2024-06-25 18:21ivazquezNote Edited: 0165339bug_revision_view_page.php?bugnote_id=0165339#r28149
2024-08-26 10:32hgbotResolutionopen => fixed
2024-08-26 10:32hgbotStatusscheduled => closed
2024-08-26 10:32hgbotNote Added: 0168448
2024-08-26 10:32hgbotNote Added: 0168449
2024-08-26 10:33aaroncaleroNote Added: 0168450

Notes
(0165252)
aaroncalero   
2024-05-29 09:46   
Developer note: in order to fix this, this hook [1] should check if the gift certificate payment method exists before calling setPaymentButtonLabel
This can be done using the existing getGiftCertificatePaymentMethod method.


[1]https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/blob/master/web-jspack/org.openbravo.retail.loyalty.burn.giftcertificate/src/model/loyalty/user-actions/AddLoyaltyPointsActionPostHook.js?ref_type=heads [^]
(0165286)
hgbot   
2024-05-30 08:36   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/merge_requests/23 [^]
(0165339)
ivazquez   
2024-05-30 15:37   
(edited on: 2024-06-25 18:21)
Hello team,

They added a note to the issue, even though a change has already been made, and that is that it does not exactly search for the “Gift Certificate” payment method, even though that is the name of the function that searches for it:

https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/blob/master/web-jspack/org.openbravo.retail.loyalty.burn.giftcertificate/src/utilities/utils.js?ref_type=heads#L67 [^]

If not, it searches for the payment method “Gift Card”, as you can see in this line of code where the constant is instantiated with the kind of this payment method:

https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/blob/master/web-jspack/org.openbravo.retail.loyalty.burn.giftcertificate/src/utilities/utils.js?ref_type=heads#L15 [^]

So it would seem good that you also fix this code, giving a more descriptive and intuitive name to this function or, in case this payment method is wrong to be searched, that the instantiation of the constant is changed by setting the corresponding kind.

(0168448)
hgbot   
2024-08-26 10:32   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate [^]
Changeset: c2c36ed23eb975122325e073ef7ce2d8a6602d81
Author: Sreehari Venkataraman <sreehari.venkataraman.ext@openbravo.com>
Date: 26-08-2024 10:01:15
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/commit/c2c36ed23eb975122325e073ef7ce2d8a6602d81 [^]

Fixes ISSUE-55589: Added getGiftCertificatePaymentMethod condition
*now setPaymentButtonLabel function is executed when we have giftcertificate payment

---
M web-jspack/org.openbravo.retail.loyalty.burn.giftcertificate/src/model/loyalty/user-actions/AddLoyaltyPointsActionPostHook.js
---
(0168449)
hgbot   
2024-08-26 10:32   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.loyalty.burn.giftcertificate/-/merge_requests/23 [^]
(0168450)
aaroncalero   
2024-08-26 10:33   
Steps to validate:
In an environment with a Loyalty Program configured, with a manual earn rule set up (including the points reason), and the org.openbravo.retail.loyalty.burn.giftcertificate installed (but no payment method configured).
In POS, assign a customer subscribed to the loyalty program. Using the View Loyalty menu entry, add some points manually.
Close the loyalty popup, add some products to the ticket and complete the transaction.
Verify that no errors are raised during the process.