[FIX] pos_paytm: resolved issue of not receiving expected Paytm Error

Before this commit:
While using Paytm Terminal the expected behavior is to get an error
message from Paytm on payment failure but unexpectedly the cashier is getting
TypeError: this.env._t is not a function

After this commit:
The issue has been fixed, and the cashier will now receive the correct error
message from Paytm on payment failure

closes odoo/odoo#135258

Signed-off-by: Harsh Modi (hamo) <hamo@odoo.com>
This commit is contained in:
Harsh Modi
2023-09-13 09:39:05 +00:00
parent 0b2ec2a39b
commit 6a22ce9bde
@@ -1,5 +1,6 @@
/** @odoo-module */
import { _t } from "@web/core/l10n/translation";
import { PaymentInterface } from "@point_of_sale/app/payment/payment_interface";
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
@@ -84,7 +85,7 @@ export class PaymentPaytm extends PaymentInterface {
}
let resultCode = data?.resultCode;
if (resultCode === 'S' && data?.merchantReferenceNo != referenceId){
throw this.env._t("Reference number mismatched");
throw _t("Reference number mismatched");
} else if (resultCode === 'S') {
paymentLine.paytm_authcode = data?.authCode;
paymentLine.paytm_issuer_card_no = data?.issuerMaskCardNo;
@@ -151,9 +152,8 @@ export class PaymentPaytm extends PaymentInterface {
localStorage.setItem(uid, ++retry);
}
_showError(error_msg, title) {
var self = this;
self.env.services.popup.add(ErrorPopup, {
title: title || self.env._t('PayTM Error'),
this.env.services.popup.add(ErrorPopup, {
title: title || _t('PayTM Error'),
body: error_msg,
});
}