diff --git a/myfatoorah_payment_gateway/controllers/__init__.py b/myfatoorah_payment_gateway/controllers/__init__.py
index 79daee396..ffdc3ccc4 100644
--- a/myfatoorah_payment_gateway/controllers/__init__.py
+++ b/myfatoorah_payment_gateway/controllers/__init__.py
@@ -19,6 +19,4 @@
# If not, see .
#
#############################################################################
-
-
from . import main
diff --git a/myfatoorah_payment_gateway/controllers/main.py b/myfatoorah_payment_gateway/controllers/main.py
index 6b9ba38e8..056db7ffb 100644
--- a/myfatoorah_payment_gateway/controllers/main.py
+++ b/myfatoorah_payment_gateway/controllers/main.py
@@ -38,11 +38,11 @@ class PaymentMyFatoorahController(http.Controller):
@http.route('/payment/myfatoorah/response', type='http', auth='public',
website=True, methods=['POST'], csrf=False, save_session=False)
def myfatoorah_payment_response(self, **data):
+ """Function to get the payment response"""
payment_data = ast.literal_eval(data["data"])
vals = {
'customer': payment_data["CustomerName"],
'currency': payment_data["DisplayCurrencyIso"],
- # 'country_code': payment_data["MobileCountryCode"],
'mobile': payment_data["CustomerMobile"],
'invoice_amount': payment_data["InvoiceValue"],
'address': payment_data["CustomerAddress"]["Address"],
@@ -54,6 +54,7 @@ class PaymentMyFatoorahController(http.Controller):
@http.route(_return_url, type='http', auth='public',
methods=['GET'])
def myfatoorah_checkout(self, **data):
+ """ Function to redirect to the payment checkout"""
_logger.info("Received MyFatoorah return data:\n%s",
pprint.pformat(data))
tx_sudo = request.env[
@@ -64,7 +65,7 @@ class PaymentMyFatoorahController(http.Controller):
@http.route('/payment/myfatoorah/failed', type='http', auth='user',
website=True, )
- def payment_failed(self, redirect=None, **data):
- # self.myfatoorah_checkout(data = data)
+ def payment_failed(self, redirect=None, **data):
+ """ Function to render the payment failed cases"""
return request.render(
"myfatoorah_payment_gateway.myfatoorah_payment_gateway_failed_form")
diff --git a/myfatoorah_payment_gateway/doc/RELEASE_NOTES.md b/myfatoorah_payment_gateway/doc/RELEASE_NOTES.md
index 373fee121..a71318137 100644
--- a/myfatoorah_payment_gateway/doc/RELEASE_NOTES.md
+++ b/myfatoorah_payment_gateway/doc/RELEASE_NOTES.md
@@ -5,3 +5,7 @@
#### ADD
Initial Commit
+#### 18.10.2023
+#### Version 16.0.1.0.1
+#### ADD
+The payment fail issue is fixed
\ No newline at end of file
diff --git a/myfatoorah_payment_gateway/models/__init__.py b/myfatoorah_payment_gateway/models/__init__.py
index 362545670..441c23648 100644
--- a/myfatoorah_payment_gateway/models/__init__.py
+++ b/myfatoorah_payment_gateway/models/__init__.py
@@ -19,9 +19,5 @@
# If not, see .
#
#############################################################################
-
-
from . import payment_provider
from . import payment_transaction
-
-
diff --git a/myfatoorah_payment_gateway/models/payment_provider.py b/myfatoorah_payment_gateway/models/payment_provider.py
index 4fc86fa07..aff9a272f 100644
--- a/myfatoorah_payment_gateway/models/payment_provider.py
+++ b/myfatoorah_payment_gateway/models/payment_provider.py
@@ -19,8 +19,6 @@
# If not, see .
#
#############################################################################
-
-
from odoo import fields, models, api, _
diff --git a/myfatoorah_payment_gateway/models/payment_transaction.py b/myfatoorah_payment_gateway/models/payment_transaction.py
index b15a64990..add8ea767 100644
--- a/myfatoorah_payment_gateway/models/payment_transaction.py
+++ b/myfatoorah_payment_gateway/models/payment_transaction.py
@@ -32,6 +32,7 @@ class PaymentTransaction(models.Model):
_inherit = 'payment.transaction'
def _get_specific_rendering_values(self, processing_values):
+ """ Function to fetch the values of the payment gateway"""
res = super()._get_specific_rendering_values(processing_values)
if self.provider_code != 'myfatoorah':
return res
@@ -59,17 +60,17 @@ class PaymentTransaction(models.Model):
}
for rec in order_line
]
- if len(self.partner_phone.replace('-', "").rsplit(' ', 1)[1]) > 11:
- raise ValidationError(
- _("Phone number must not be greater than 11 characters"))
+ MobileCountryCode = self.partner_id.country_id.phone_code
+ phone_number = self.partner_phone
+ phone_number = phone_number.replace(str(MobileCountryCode), '')
+ if phone_number.startswith('+'):
+ phone_number = phone_number[1:]
payment_details = {
"PaymentMethodId": 6,
"CustomerName": self.partner_name,
"DisplayCurrencyIso": self.currency_id.name,
- # "MobileCountryCode": "964",
- # "CustomerMobile": "78589587458",
- "CustomerMobile":
- self.partner_phone.replace('-', "").rsplit(' ', 1)[1],
+ "MobileCountryCode": MobileCountryCode,
+ "CustomerMobile": phone_number,
"CustomerEmail": self.partner_email,
"InvoiceValue": (self.amount - sale_order.amount_tax),
"CallBackUrl": f"{odoo_base_url}/payment/myfatoorah/_return_url",
@@ -78,7 +79,6 @@ class PaymentTransaction(models.Model):
"CustomerReference": self.reference,
"CustomerAddress": {
"Address": f'{self.partner_address} ,{self.partner_city} {self.partner_zip} ,{self.partner_state_id.name} ,{self.partner_country_id.name}',
-
},
"InvoiceItems":
invoice_items
@@ -129,7 +129,7 @@ class PaymentTransaction(models.Model):
reference = ""
if response_data["Data"]["CustomerReference"]:
reference = response_data["Data"]["CustomerReference"]
- domain.append(reference)
+ domain.append(('reference', '=', str(reference)))
if tx := self.search(domain):
return tx
else:
@@ -140,6 +140,7 @@ class PaymentTransaction(models.Model):
)
def _handle_notification_data(self, provider_code, notification_data):
+ """Function to handle the notification data """
tx = self._get_tx_from_notification_data(provider_code,
notification_data)
tx._process_notification_data(notification_data)
@@ -147,6 +148,7 @@ class PaymentTransaction(models.Model):
return tx
def _process_notification_data(self, notification_data):
+ """ Function to process the notification data"""
super()._process_notification_data(notification_data)
if self.provider_code != 'myfatoorah':
return
diff --git a/myfatoorah_payment_gateway/static/description/index.html b/myfatoorah_payment_gateway/static/description/index.html
index 317bbcd7d..2402a2801 100644
--- a/myfatoorah_payment_gateway/static/description/index.html
+++ b/myfatoorah_payment_gateway/static/description/index.html
@@ -97,7 +97,11 @@
-
This module allows us to add and enable MyFatoorah payment acquirer on our website.
+
This module allows us to add and enable MyFatoorah payment acquirer on our website.
+ Please ensure that your system is configured to use HTTPS instead of localhost to maintain a secure connection
+ and protect sensitive information during interactions with the module.In case you are utilizing localhost for
+ testing purposes, please use http://127.0.0.1/
instead of 'localhost' to access the module.
+