Browse Source

Feb 17 : [RMV] Module Removed 'safer_pay'

pull/313/head
RisvanaCybro 1 year ago
parent
commit
83bf8dbf7c
  1. 52
      safer_pay/README.rst
  2. 34
      safer_pay/__init__.py
  3. 56
      safer_pay/__manifest__.py
  4. 6
      safer_pay/const.py
  5. 22
      safer_pay/controllers/__init__.py
  6. 104
      safer_pay/controllers/safer_pay.py
  7. 15
      safer_pay/data/payment_method_data.xml
  8. 21
      safer_pay/data/payment_provider_data.xml
  9. 6
      safer_pay/doc/RELEASE_NOTES.md
  10. 25
      safer_pay/models/__init__.py
  11. 64
      safer_pay/models/payment_provider.py
  12. 53
      safer_pay/models/payment_token.py
  13. 244
      safer_pay/models/payment_transaction.py
  14. 47
      safer_pay/models/sale_order.py
  15. BIN
      safer_pay/static/description/assets/icons/check.png
  16. BIN
      safer_pay/static/description/assets/icons/chevron.png
  17. BIN
      safer_pay/static/description/assets/icons/cogs.png
  18. BIN
      safer_pay/static/description/assets/icons/consultation.png
  19. BIN
      safer_pay/static/description/assets/icons/ecom-black.png
  20. BIN
      safer_pay/static/description/assets/icons/education-black.png
  21. BIN
      safer_pay/static/description/assets/icons/hotel-black.png
  22. BIN
      safer_pay/static/description/assets/icons/license.png
  23. BIN
      safer_pay/static/description/assets/icons/lifebuoy.png
  24. BIN
      safer_pay/static/description/assets/icons/manufacturing-black.png
  25. BIN
      safer_pay/static/description/assets/icons/pos-black.png
  26. BIN
      safer_pay/static/description/assets/icons/puzzle.png
  27. BIN
      safer_pay/static/description/assets/icons/restaurant-black.png
  28. BIN
      safer_pay/static/description/assets/icons/service-black.png
  29. BIN
      safer_pay/static/description/assets/icons/trading-black.png
  30. BIN
      safer_pay/static/description/assets/icons/training.png
  31. BIN
      safer_pay/static/description/assets/icons/update.png
  32. BIN
      safer_pay/static/description/assets/icons/user.png
  33. BIN
      safer_pay/static/description/assets/icons/wrench.png
  34. BIN
      safer_pay/static/description/assets/misc/categories.png
  35. BIN
      safer_pay/static/description/assets/misc/check-box.png
  36. BIN
      safer_pay/static/description/assets/misc/compass.png
  37. BIN
      safer_pay/static/description/assets/misc/corporate.png
  38. BIN
      safer_pay/static/description/assets/misc/customer-support.png
  39. BIN
      safer_pay/static/description/assets/misc/cybrosys-logo.png
  40. BIN
      safer_pay/static/description/assets/misc/features.png
  41. BIN
      safer_pay/static/description/assets/misc/logo.png
  42. BIN
      safer_pay/static/description/assets/misc/pictures.png
  43. BIN
      safer_pay/static/description/assets/misc/pie-chart.png
  44. BIN
      safer_pay/static/description/assets/misc/right-arrow.png
  45. BIN
      safer_pay/static/description/assets/misc/star.png
  46. BIN
      safer_pay/static/description/assets/misc/support.png
  47. BIN
      safer_pay/static/description/assets/misc/whatsapp.png
  48. BIN
      safer_pay/static/description/assets/modules/barcode.png
  49. BIN
      safer_pay/static/description/assets/modules/product_brand.png
  50. BIN
      safer_pay/static/description/assets/modules/website_cart.png
  51. BIN
      safer_pay/static/description/assets/modules/website_favourites_grid.jpg
  52. BIN
      safer_pay/static/description/assets/modules/website_repeat_sale.png
  53. BIN
      safer_pay/static/description/assets/modules/website_upload_files.jpg
  54. BIN
      safer_pay/static/description/assets/screenshots/1.png
  55. BIN
      safer_pay/static/description/assets/screenshots/2.png
  56. BIN
      safer_pay/static/description/assets/screenshots/3.png
  57. BIN
      safer_pay/static/description/assets/screenshots/4.png
  58. BIN
      safer_pay/static/description/assets/screenshots/5.png
  59. BIN
      safer_pay/static/description/assets/screenshots/6.png
  60. BIN
      safer_pay/static/description/assets/screenshots/7.png
  61. BIN
      safer_pay/static/description/assets/screenshots/8.png
  62. BIN
      safer_pay/static/description/assets/screenshots/9.png
  63. BIN
      safer_pay/static/description/assets/screenshots/hero.gif
  64. BIN
      safer_pay/static/description/banner.jpg
  65. BIN
      safer_pay/static/description/icon.png
  66. 828
      safer_pay/static/description/index.html
  67. 52
      safer_pay/static/src/js/payment_form.js
  68. 33
      safer_pay/static/src/js/payment_saferpay_mixin.js
  69. 25
      safer_pay/views/payment_provider_views.xml
  70. 135
      safer_pay/views/payment_safer_pay_templates.xml
  71. 17
      safer_pay/views/payment_token_views.xml
  72. 31
      safer_pay/views/payment_transaction_views.xml
  73. 14
      safer_pay/views/sale_order_views.xml

52
safer_pay/README.rst

@ -1,52 +0,0 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
Safer-pay Payment Gateway Integration
=====================================
Safer-pay is the modern and secure payment service provider.This Module helps
to integrate Safer-pay Payment Gateway with your eCommerce Website.Hence
Allow us to make payments via Safer-pay Payment Gateway
Configuration
=============
* Activate Payment provider in invoicing
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
License
-------
Lesser General Public License, Version 3 (LGPL v3).
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html)
Credits
-------
Developer:
(V15) Fathima Mazlin AM,
(V17) Jumana Haseen,
Contact: odoo@cybrosys.com
Contacts
--------
* Mail Contact : odoo@cybrosys.com
* Website : https://cybrosys.com
Bug Tracker
-----------
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
Maintainer
==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com
This module is maintained by Cybrosys Technologies.
For support and more information, please visit `Our Website <https://cybrosys.com/>`__
Further information
===================
HTML Description: `<static/description/index.html>`__

34
safer_pay/__init__.py

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
from . import models
from . import controllers
from odoo.addons.payment import setup_provider, reset_payment_provider
def post_init_hook(env):
"""Functions that will execute after the module installation."""
setup_provider(env, 'saferpay')
def uninstall_hook(env):
"""Record will be deleted while uninstalling the module"""
reset_payment_provider(env, 'saferpay')

56
safer_pay/__manifest__.py

@ -1,56 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
{
'name': "Safer-pay Payment Gateway Integration",
'version': '17.0.1.0.0',
'category': 'eCommerce',
'summary': 'Safer-pay is a payment provider that integrate with odoo',
'description': 'Safer-pay is a payment provider that integrate with odoo. '
'we can done payment through safer pay in ecommerce',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'depends': ['base', 'account', 'payment', 'website_sale'],
'data': [
'data/payment_method_data.xml',
'views/payment_safer_pay_templates.xml',
'data/payment_provider_data.xml',
'views/payment_provider_views.xml',
'views/sale_order_views.xml',
'views/payment_token_views.xml',
'views/payment_transaction_views.xml',
],
'assets': {
'web.assets_frontend': [
'safer_pay/static/src/js/payment_form.js',
'safer_pay/static/src/js/payment_saferpay_mixin.js',
],
},
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
}

6
safer_pay/const.py

@ -1,6 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# The codes of the payment methods to activate when Demo is activated.
DEFAULT_PAYMENT_METHOD_CODES = [
'saferpay',
]

22
safer_pay/controllers/__init__.py

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
from . import safer_pay

104
safer_pay/controllers/safer_pay.py

@ -1,104 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
import json
import requests
from odoo import _
from odoo.exceptions import UserError
import logging
from odoo import http
from odoo.http import request
_logger = logging.getLogger(__name__)
class SaferPay(http.Controller):
"""For connecting safer pay payment acquirer with odoo """
@http.route('/saferpay/payment', type='json', auth='public', website=True)
def saferpay_payment(self, reference):
""" Connect with safer pay payment gateway"""
base_url = request.env['ir.config_parameter'].sudo().get_param(
'web.base.url')
transaction = request.env['payment.transaction'].sudo().search(
[('reference', '=', reference)])
amount = int((transaction.amount * 0.011) * 100)
sequence = transaction.reference
order = request.env['sale.order'].sudo().search(
[('name', '=', sequence)])
provider_details = request.env.ref('safer_pay.payment_acquirer_data')
if provider_details.customer and provider_details.terminal:
url = "https://test.saferpay.com/api/Payment/v1/PaymentPage/Initialize"
payload = json.dumps({
"RequestHeader": {
"SpecVersion": "1.33",
"CustomerId": str(provider_details.customer),
"RequestId": "1",
"RetryIndicator": 0
},
"TerminalId": str(provider_details.terminal),
"Payment": {
"Amount": {
"Value": str(amount),
"CurrencyCode": "CHF"
},
"OrderId": str(order.id),
"Description": str(sequence)
},
"ReturnUrl": {
"Url": base_url + "/shop/confirmation",
}
})
headers = {
'Content-Type': 'application/json; charset=utf-8',
'Accept': 'application/json',
'SpecVersion': '1.33',
'RetryIndicator': '0',
'Authorization':
'Basic QVBJXzI3MjI0NF85Nzg0NTM3MzpKdW1hbmFIYXNlZW41NSoqKg==',
'Cookie': 'ASP.NET_SessionId=lr0an2dywf25itkugaam32pm; PREF=C=en'
}
response = requests.request("POST", url, headers=headers,
data=payload)
text = response.json()
website = request.env['website'].get_current_website()
sale_order = website.sale_get_order(force_create=True)
if sale_order.state != 'draft':
request.session['sale_order_id'] = None
sale_order = website.sale_get_order(
force_create=True)
sale_order.write({
'state': 'sale',
'payment': False
})
if text.get('RedirectUrl'):
sale_order.write({
'payment': False,
'sale_order': sale_order.id,
})
redirect_url = text['RedirectUrl']
return redirect_url
else:
sale_order.write({
'payment': True
})
return False
else:
raise UserError(_("Please set the credential."))

15
safer_pay/data/payment_method_data.xml

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Creating SaferPay payment method -->
<record id="payment_method_safer_pay" model="payment.method">
<field name="name">SaferPay</field>
<field name="code">saferpay</field>
<field name="sequence">2</field>
<field name="image"
type="base64"
file="safer_pay/static/description/icon.png"/>
<field name="support_tokenization">True</field>
<field name="support_express_checkout">False</field>
<field name="support_refund">partial</field>
</record>
</odoo>

21
safer_pay/data/payment_provider_data.xml

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Create a record for safer pay while installing the module-->
<record id="payment_acquirer_data" model="payment.provider">
<field name="name">SaferPay</field>
<field name="state">test</field>
<field name="code">saferpay</field>
<field name="redirect_form_view_id" ref="redirect_form"/>
<field name="inline_form_view_id" ref="inline_form"/>
<field name="token_inline_form_view_id" ref="token_inline_form"/>
<field name="express_checkout_form_view_id"
ref="express_checkout_form"/>
<field name="allow_tokenization">True</field>
<field name="allow_express_checkout">True</field>
<field name="image_128" type="base64"
file="safer_pay/static/description/icon.png"/>
<field name="payment_method_ids"
eval="[Command.set([ref('safer_pay.payment_method_safer_pay'),])]"
/>
</record>
</odoo>

6
safer_pay/doc/RELEASE_NOTES.md

@ -1,6 +0,0 @@
## Module <safer_pay>
#### 27.11.2023
#### Version 17.0.1.0.0
#### ADD
- Initial commit for Safer-pay Payment Gateway Integration

25
safer_pay/models/__init__.py

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
from . import payment_provider
from . import payment_token
from . import payment_transaction
from . import sale_order

64
safer_pay/models/payment_provider.py

@ -1,64 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class PaymentProvider(models.Model):
"""Create a new records for saferpay in payment provider """
_inherit = 'payment.provider'
code = fields.Selection(
selection_add=[('saferpay', "saferpay")],
ondelete={'saferpay': 'set default'}, required_if_provider='demo',
help="SaferPay code"
)
customer = fields.Char(string='Customer ID', help="Customer ID get from "
"Signup credential")
terminal = fields.Char(string="Terminal ID", help="Terminal Id get from "
"signup credential")
username = fields.Char(string="Username", help="Username of Safer-pay")
password = fields.Char(string="Password", help="Password of Safer-pay")
@api.depends('code', 'customer', 'terminal', 'username', 'password')
def _compute_view_configuration_fields(self):
""" Override of payment to hide the credentials page.
:return: None"""
super()._compute_view_configuration_fields()
self.filtered(lambda p: p.code == 'saferpay').show_credentials_page = \
True
def _compute_feature_support_fields(self):
""" Override of `payment` to enable additional features. """
super()._compute_feature_support_fields()
self.filtered(lambda p: p.code == 'saferpay').update({
'support_express_checkout': True,
'support_manual_capture': 'partial',
'support_refund': 'partial',
'support_tokenization': True,
})
@api.constrains('state', 'code')
def _check_provider_state(self):
if self.filtered(lambda p: p.code == 'saferpay' and p.state not in (
'test', 'disabled')):
raise UserError(_("saferpay providers should never be enabled."))

53
safer_pay/models/payment_token.py

@ -1,53 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import fields, models
class PaymentToken(models.Model):
"""Create a new records for saferpay in payment token """
_inherit = 'payment.token'
safer_pay_simulated_state = fields.Selection(
string="Simulated State",
help="The state in which transactions created from this token "
"should be set.",
selection=[
('pending', "Pending"),
('done', "Confirmed"),
('cancel', "Canceled"),
('error', "Error"),
],
)
def _build_display_name(self, *args, should_pad=True, **kwargs):
""" Override of `payment` to build the display name without padding.
Note: self.ensure_one()
:param list args: The arguments passed by QWeb when calling this method.
:param bool should_pad: Whether the token should be padded or not.
:param dict kwargs: Optional data.
:return: The demo token name.
:rtype: str
"""
if self.provider_code != 'saferpay':
return super()._build_display_name(*args, should_pad=should_pad,
**kwargs)
return super()._build_display_name(*args, should_pad=False, **kwargs)

244
safer_pay/models/payment_transaction.py

@ -1,244 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jumana Haseen (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
import logging
from odoo import fields, models, _
from odoo.exceptions import UserError, ValidationError
_logger = logging.getLogger(__name__)
class PaymentTransaction(models.Model):
"""Create a new records for safer_pay in payment transaction """
_inherit = 'payment.transaction'
capture_manually = fields.Boolean(related='provider_id.capture_manually')
# === ACTION METHODS ===#
def action_saferpay_set_done(self):
""" Set the state of the safer_pay transaction to 'done'.
Note: self.ensure_one()
:return: None
"""
self.ensure_one()
if self.provider_code != 'saferpay':
return
notification_data = {'reference': self.reference,
'simulated_state': 'done'}
self._handle_notification_data('saferpay', notification_data)
def action_saferpay_set_canceled(self):
""" Set the state of the saferpay transaction to 'cancel'.
Note: self.ensure_one()
:return: None
"""
self.ensure_one()
if self.provider_code != 'saferpay':
return
notification_data = {'reference': self.reference,
'simulated_state': 'cancel'}
self._handle_notification_data('saferpay', notification_data)
def action_saferpay_set_error(self):
""" Set the state of the demo transaction to 'error'.
Note: self.ensure_one()
:return: None
"""
self.ensure_one()
if self.provider_code != 'saferpay':
return
notification_data = {'reference': self.reference,
'simulated_state': 'error'}
self._handle_notification_data('saferpay', notification_data)
# === BUSINESS METHODS ===#
def _send_payment_request(self):
""" Override of payment to simulate a payment request.
Note: self.ensure_one()
:return: None
"""
super()._send_payment_request()
if self.provider_code != 'saferpay':
return
if not self.token_id:
raise UserError("saferpay: " + _("The transaction is not "
"linked to a token."))
simulated_state = self.token_id.saferpay_simulated_state
notification_data = {'reference': self.reference,
'simulated_state': simulated_state}
self._handle_notification_data('saferpay', notification_data)
def _send_refund_request(self, **kwargs):
""" Override of payment to simulate a refund.
Note: self.ensure_one()
:param dict kwargs: The keyword arguments.
:return: The refund transaction created to process the refund request.
:rtype: recordset of `payment.transaction`
"""
refund_tx = super()._send_refund_request(**kwargs)
if self.provider_code != 'saferpay':
return refund_tx
notification_data = {'reference': refund_tx.reference,
'simulated_state': 'done'}
refund_tx._handle_notification_data('saferpay', notification_data)
return refund_tx
def _send_capture_request(self, amount_to_capture=None):
""" Override of `payment` to simulate a capture request. """
child_capture_tx = super()._send_capture_request(amount_to_capture=
amount_to_capture)
if self.provider_code != 'saferpay':
return child_capture_tx
tx = child_capture_tx or self
notification_data = {
'reference': tx.reference,
'simulated_state': 'done',
'manual_capture': True, # Distinguish manual captures
# from regular one-step captures.
}
tx._handle_notification_data('saferpay', notification_data)
return child_capture_tx
def _send_void_request(self, amount_to_void=None):
""" Override of `payment` to simulate a void request. """
child_void_tx = super()._send_void_request(amount_to_void=
amount_to_void)
if self.provider_code != 'saferpay':
return child_void_tx
tx = child_void_tx or self
notification_data = {'reference': tx.reference,
'simulated_state': 'cancel'}
tx._handle_notification_data('saferpay', notification_data)
return child_void_tx
def _get_tx_from_notification_data(self, provider_code, notification_data):
""" Override of payment to find the transaction based on dummy data.
:param str provider_code: The code of the provider that handled the
transaction
:param dict notification_data: The dummy notification data
:return: The transaction if found
:rtype: recordset of `payment.transaction`
:raise: ValidationError if the data match no transaction
"""
tx = super()._get_tx_from_notification_data(provider_code,
notification_data)
if provider_code != 'saferpay' or len(tx) == 1:
return tx
reference = notification_data.get('reference')
tx = self.search([('reference', '=', reference), ('provider_code',
'=', 'saferpay')])
if not tx:
raise ValidationError(
"saferpay: " + _("No transaction found matching reference %s.",
reference)
)
return tx
def _process_notification_data(self, notification_data):
""" Override of payment to process the transaction based on dummy data.
Note: self.ensure_one()
:param dict notification_data: The dummy notification data
:return: None
:raise: ValidationError if inconsistent data were received
"""
super()._process_notification_data(notification_data)
if self.provider_code != 'saferpay':
return
# Update the provider reference.
self.provider_reference = f'saferpay-{self.reference}'
# Create the token.
if self.tokenize:
# The reasons why we immediately tokenize the transaction
# regardless of the state rather
# than waiting for the payment method to be validated
# ('authorized' or 'done') like the
# other payment providers do are:
# - To save the simulated state and payment details on the
# token while we have them.
# - To allow customers to create tokens whose transactions
# will always end up in the
# said simulated state.
self._saferpay_tokenize_from_notification_data(notification_data)
# Update the payment state.
state = notification_data['simulated_state']
if state == 'pending':
self._set_pending()
elif state == 'done':
if self.capture_manually and not notification_data.get(
'manual_capture'):
self._set_authorized()
else:
self._set_done()
# Immediately post-process the transaction if it is a refund,
# as the post-processing
# will not be triggered by a customer browsing the transaction
# from the portal.
if self.operation == 'refund':
self.env.ref(
'payment.cron_post_process_payment_tx')._trigger()
elif state == 'cancel':
self._set_canceled()
else: # Simulate an error state.
self._set_error(
_("You selected the following demo payment status: %s", state))
def _saferpay_tokenize_from_notification_data(self, notification_data):
""" Create a new token based on the notification data.
Note: self.ensure_one()
:param dict notification_data: The fake notification data to tokenize
from.
:return: None
"""
self.ensure_one()
state = notification_data['simulated_state']
token = self.env['payment.token'].create({
'provider_id': self.provider_id.id,
'payment_method_id': self.payment_method_id.id,
'payment_details': notification_data['payment_details'],
'partner_id': self.partner_id.id,
'provider_ref': 'fake provider reference',
'saferpay_simulated_state': state,
})
self.write({
'token_id': token,
'tokenize': False,
})
_logger.info(
"Created token with id %s for partner with id %s.",
token.id, self.partner_id.id
)

47
safer_pay/models/sale_order.py

@ -1,47 +0,0 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fathima Mazlin AM (odoo@cybrosys.com)
#
# This program is free software: you can modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import fields, models
class SaleOrder(models.Model):
"""For getting get_portal_last_transaction method in sale order"""
_inherit = 'sale.order'
payment = fields.Boolean(string="Payment", help="For payment details")
sale_order = fields.Integer(string="Sale order Number",
help="To get sale order")
def get_portal_last_transaction(self):
"""For updating the transaction"""
super().get_portal_last_transaction()
self.ensure_one()
if self.transaction_ids:
code = self.transaction_ids.provider_id.id
provider = self.env.ref('safer_pay.payment_acquirer_data').id
sale_order = self.env['sale.order'].search(
[('transaction_ids', 'in', self.transaction_ids.ids)])
if (sale_order.id == sale_order.sale_order and
not sale_order.payment and code == provider):
self.transaction_ids.write({
'state': 'done'
})
return self.transaction_ids._get_last()

BIN
safer_pay/static/description/assets/icons/check.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

BIN
safer_pay/static/description/assets/icons/chevron.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

BIN
safer_pay/static/description/assets/icons/cogs.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

BIN
safer_pay/static/description/assets/icons/consultation.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

BIN
safer_pay/static/description/assets/icons/ecom-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

BIN
safer_pay/static/description/assets/icons/education-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 733 B

BIN
safer_pay/static/description/assets/icons/hotel-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

BIN
safer_pay/static/description/assets/icons/license.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
safer_pay/static/description/assets/icons/lifebuoy.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

BIN
safer_pay/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

BIN
safer_pay/static/description/assets/icons/pos-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 B

BIN
safer_pay/static/description/assets/icons/puzzle.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

BIN
safer_pay/static/description/assets/icons/restaurant-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 905 B

BIN
safer_pay/static/description/assets/icons/service-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 839 B

BIN
safer_pay/static/description/assets/icons/trading-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

BIN
safer_pay/static/description/assets/icons/training.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

BIN
safer_pay/static/description/assets/icons/update.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

BIN
safer_pay/static/description/assets/icons/user.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

BIN
safer_pay/static/description/assets/icons/wrench.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

BIN
safer_pay/static/description/assets/misc/categories.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

BIN
safer_pay/static/description/assets/misc/check-box.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
safer_pay/static/description/assets/misc/compass.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

BIN
safer_pay/static/description/assets/misc/corporate.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
safer_pay/static/description/assets/misc/customer-support.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

BIN
safer_pay/static/description/assets/misc/cybrosys-logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

BIN
safer_pay/static/description/assets/misc/features.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

BIN
safer_pay/static/description/assets/misc/logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

BIN
safer_pay/static/description/assets/misc/pictures.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

BIN
safer_pay/static/description/assets/misc/pie-chart.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

BIN
safer_pay/static/description/assets/misc/right-arrow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 967 B

BIN
safer_pay/static/description/assets/misc/star.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

BIN
safer_pay/static/description/assets/misc/support.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

BIN
safer_pay/static/description/assets/misc/whatsapp.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

BIN
safer_pay/static/description/assets/modules/barcode.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
safer_pay/static/description/assets/modules/product_brand.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

BIN
safer_pay/static/description/assets/modules/website_cart.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
safer_pay/static/description/assets/modules/website_favourites_grid.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

BIN
safer_pay/static/description/assets/modules/website_repeat_sale.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

BIN
safer_pay/static/description/assets/modules/website_upload_files.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

BIN
safer_pay/static/description/assets/screenshots/1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

BIN
safer_pay/static/description/assets/screenshots/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

BIN
safer_pay/static/description/assets/screenshots/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

BIN
safer_pay/static/description/assets/screenshots/4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

BIN
safer_pay/static/description/assets/screenshots/5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

BIN
safer_pay/static/description/assets/screenshots/6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

BIN
safer_pay/static/description/assets/screenshots/7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

BIN
safer_pay/static/description/assets/screenshots/8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

BIN
safer_pay/static/description/assets/screenshots/9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

BIN
safer_pay/static/description/assets/screenshots/hero.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

BIN
safer_pay/static/description/banner.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

BIN
safer_pay/static/description/icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

828
safer_pay/static/description/index.html

@ -1,828 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Odoo App 3 Index</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap"
rel="stylesheet">
</head>
<body>
<section>
<div class="container"
style="font-family: 'Inter', sans-serif !important;background-color: #fff !important;">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 d-flex justify-content-between flex-wrap align-items-sm-center"
style="border-bottom:1px solid rgba(0, 0, 0, 0.22)">
<div class="my-3">
<img src="assets/misc/logo.png"
style="width:auto !important; height:40px !important">
</div>
<div class="my-3 d-flex align-items-center">
<div class="text-center"
style="background-color:#017E84 !important;font-size: 0.8rem !important; color:#fff !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important; min-width: 120px !important;">
Community
</div>
<div class="text-center"
style="background-color:#875A7B !important; color:#fff !important;font-size: 0.8rem !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important;min-width: 120px !important;">
Enterprise
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 text-center d-flex align-items-center flex-column"
style="margin: 80px 0px !important;">
<h1 style="font-size: 2.8rem;font-weight: 700; color:
#1A202C;">
Safer-pay Payment Gateway Integration</h1>
<p class="my-3 mb-4"
style="max-width: 80%; font-weight: 400 !important; line-height: 32px; color: #718096;">
Safer-pay is a payment provider that integrate with odoo
</p>
<div style="width: 80%; margin-top: 3rem;">
<img src="assets/screenshots/hero.gif"
class="img-responsive" width="100%" height="auto">
</div>
</div>
</div>
<div class="container mt-5 mb-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4">
<p class="m-0"
style="font-weight: 600; font-size: 24px; color:#714b67 !important">
Key Highlights
</p>
</div>
<div class="row py-4">
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
background: #FFF;
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); ">
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
display: flex; justify-content: center; align-items: center;
margin-right: 10px; flex-shrink: 0;">
<i class="fa-solid fa-star "
style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Module helps to integrate Safer-pay Payment
Gateway with your eCommerce Website.</p>
</div>
</div>
</div>
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
background: #FFF;
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); ">
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
display: flex; justify-content: center; align-items: center;
margin-right: 10px; flex-shrink: 0;">
<i class="fa-solid fa-star "
style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Payments via Safer-pay Payment Gateway.</p>
</div>
</div>
</div>
</div>
</div>
<div class="container rounded">
<ul class="nav nav-tabs d-flex"
style="width: fit-content;margin: 0 auto;gap: 1rem;">
<li class="col text-center py-2 text-nowrap "
style="color: #fff; background-color: #714B67;border-radius: 6px 6px 0px 0px;">
<a
class="active show" data-toggle="tab" href="#tab1"
style="color: #fff;font-weight: 500; background-color: #714B67; text-decoration: none;">
<i class="fa-regular fa-image pr-2"
style="color: #fff;"></i>
Screenshots</a></li>
<li class="col text-center py-2 text-nowrap "
style="color: #fff; background-color: #714B67;border-radius: 6px 6px 0px 0px;">
<a
data-toggle="tab" href="#tab2"
style="color: #fff;font-weight: 500; text-decoration: none;"><i
class="fa-solid fa-star pr-2"
style="color: #fff;"></i>Features</a></li>
<li class="col text-center py-2 text-nowrap "
style="color: #fff; background-color: #714B67;border-radius: 6px 6px 0px 0px;">
<a
data-toggle="tab" href="#tab3"
style="color: #fff;font-weight: 500; text-decoration: none; background-color: #714B67;"><i
class="fa-solid fa-book-open pr-2"
style="color: #fff;"></i>Released Notes</a></li>
</ul>
<div class="tab-content"
style="background-color: rgba(121, 113, 119, 0.04);">
<div id="tab1" class="tab-pane fade in active show">
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/1.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
After installation of the module a new
payment provider record(SaferPay) is
created.</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/2.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Using the required credential,configure the
SaferPay payment provider.</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/3.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Enable Allow Express Checkout and Allow
Saving Payment Methods to redirect to
checkout pages
</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/4.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Go to Configuration > Payment Methods</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
It shows the Available Payment Methods
</p>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"></p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/5.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Payment Method of Payment Provider
SaferPay</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
From the view,we can see the Provider as
SaferPay in test mode and give the icon for
image in Payment method inorder to avoid
errors
</p>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"></p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/6.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Go to Site > Homepage > Shop >checkout</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
After adding Products to cart, in the cart
page see the checkout button
on review order and redirected to payment
page
</p>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"></p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/7.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Payment on Confirming order</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
After clicking Checkout button redirected to
Payment page. In the Payment page, Choose
delivery
method,and Choose Payment Method SaferPay
and click Pay now button
</p>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"></p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/8.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
When we are clicking the pay now button it
redirect to Saferpay website.</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
</p>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"></p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/9.png"
class="img-thumbnail" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
After the transaction it redirects to
confirmation page of odoo from SaferPay
website.</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
</p>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"></p>
</div>
</div>
</div>
</div>
<div id="tab2" class="tab-pane fade">
<div class="col-mg-12" style="padding: 1rem 4rem;">
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;">
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Available in
Odoo 17.0 Community and Enterprise
</li>
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Payments via
Safer-pay Payment Gateway.
</li>
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Safer-pay
Payment Gateway Integration
<ul style="list-style: none;font-weight: 400; color:#718096">
<li>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important; line-height: 30px !important;">
Safer-pay is the modern and secure
payment service provider.This
Module helps to integrate Safer-pay
Payment
Gateway with your eCommerce
Website.Hence, Allow us to make
payments via
Safer-pay Payment Gateway
</p>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="tab3" class="tab-pane fade">
<div class="col-mg-12 active" style="padding: 1rem 4rem;">
<div class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3"
style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.0</span><span
class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:27th November 2023</span>
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial Commit for Safer-pay Payment Gateway
Integration</p>
</div>
</div>
</div>
</div>
</div>
<div class="container mt-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-5">
<p class="m-0"
style="font-weight: 600; font-size: 24px; color:#000 !important">
Related Products</p>
</div>
</div>
<div id="myCarousel" class="carousel slide py-3" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row p-4">
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/16.0/website_upload_files/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/1.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Multiple Attachments In eCommerce Order</p>
</div>
</a>
</div>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/16.0/website_cart_clear/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/2.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Website Clear Cart</p>
</div>
</a>
</div>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/16.0/website_repeat_sale/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/3.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Website Reorder
</p>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row p-4">
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/16.0/product_brand_ecommerce/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/4.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Product Brand in eCommerce</p>
</div>
</a>
</div>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/16.0/website_favourites_grid/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px;">
<img src="assets/modules/5.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Website Wishlist Grid View</p>
</div>
</a>
</div>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/16.0/ecommerce_barcode_search/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px;">
<img src="assets/modules/6.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Ecommerce Barcode Search</p>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel"
data-slide="prev" style="width: 35px; color: #000;">
<span class="carousel-control-prev-icon">
<i class="fa fa-chevron-left"
style="font-size: 24px;"></i>
</span>
</a>
<a class="carousel-control-next" href="#myCarousel"
data-slide="next" style="width: 35px; color: #000;">
<span class="carousel-control-next-icon">
<i class="fa fa-chevron-right"
style="font-size: 24px;"></i>
</span>
</a>
</div>
<div class="container mt-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4">
<p class="m-0"
style="font-weight: 600; font-size: 24px; color:#000 !important">
Our Services</p>
</div>
</div>
<div class="container my-5">
<div class="row py-3">
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#13EA36 ; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/cogs.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Customization</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#DBC711; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/wrench.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Implementation</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative; border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#FF6B6B ; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/lifebuoy.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Support</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative; border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#FFA801 ; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/user.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Hire
Odoo Developer</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative; border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#54A0FF; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/puzzle.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Integration</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#6D7680 ; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/update.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Migration</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#786FA6 ; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/consultation.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Consultancy</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;position: relative;border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#F8A5C2 ; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/training.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Implementation</p>
</div>
</div>
<div class="col-md-4 col-sm-6 px-4 py-4">
<div
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;">
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);">
<div style="background-color:#E6BE26; border-radius: 50%; padding: 15px; width: 68px;
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);">
<img src="assets/icons/license.png"
alt="service-icon" width="38px"
height="auto">
</div>
</div>
<p style="margin-top: 20px; font-weight: bold;">Odoo
Licensing Consultancy</p>
</div>
</div>
</div>
</div>
<div class="container mt-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4">
<p class="m-0"
style="font-weight: 600; font-size: 24px; color:#000 !important">
Our Industries</p>
</div>
</div>
<div class="container">
<div class="row my-5 py-4">
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100 "
style="border-right: 1px solid rgb(209, 209, 209); border-bottom: 1px solid rgb(209, 209, 209); padding: 30px; box-shadow: 6px 0 10px rgba(228, 227, 227, 0.373);">
<img src="assets/icons/trading-black.png" width="42px"
height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">Trading</p>
<p>Easily procure and sell your products</p>
</div>
</div>
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100"
style="border-right: 1px solid rgb(209, 209, 209);border-bottom: 1px solid rgb(209, 209, 209); padding: 30px;">
<img src="assets/icons/pos-black.png" width="42px"
height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">POS</p>
<p>Easy configuration and convivial experience</p>
</div>
</div>
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100"
style="border-right: 1px solid rgb(209, 209, 209);border-bottom: 1px solid rgba(0, 0, 0, 0.2); padding: 30px; box-shadow: 0 5px 10px rgba(228, 227, 227, 0.373)">
<img src="assets/icons/education-black.png" width="42px"
height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">
Education</p>
<p>A platform for educational management</p>
</div>
</div>
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100"
style="border-bottom: 1px solid rgb(209, 209, 209); padding: 30px; ">
<img src="assets/icons/manufacturing-black.png"
width="42px" height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">
Manufacturing</p>
<p>Plan, track and schedule your operations</p>
</div>
</div>
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100"
style="border-right: 1px solid rgb(209, 209, 209); padding: 30px;">
<img src="assets/icons/ecom-black.png" width="42px"
height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">E-commerce &
Website</p>
<p>Mobile friendly, awe-inspiring product pages</p>
</div>
</div>
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100"
style="border-right: 1px solid rgb(209, 209, 209); padding: 30px;box-shadow: 0 -5px 10px rgba(228, 227, 227, 0.373);">
<img src="assets/icons/service-black.png" width="42px"
height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">Service
Management</p>
<p>Keep track of services and invoice</p>
</div>
</div>
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100"
style="border-right: 1px solid rgb(209, 209, 209); padding: 30px; ">
<img src="assets/icons/restaurant-black.png"
width="42px" height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">
Restaurant</p>
<p>Run your bar or restaurant methodically</p>
</div>
</div>
<div class="col-md-3 col-sm-6 p-0">
<div class="d-flex flex-column h-100"
style=" padding: 30px;box-shadow: -5px 0 10px rgba(228, 227, 227, 0.373);">
<img src="assets/icons/hotel-black.png" width="42px"
height="auto" alt="">
<p style="color: #714B67;font-weight: 600; margin-top: 10px;
font-size: 1.2rem; margin-bottom: 2px;">Hotel
Management</p>
<p>An all-inclusive hotel management application</p>
</div>
</div>
</div>
</div>
<div class="container mt-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-5">
<p class="m-0"
style="font-weight: 600; font-size: 24px; color:#000 !important">
Support</p>
</div>
</div>
<div class="container my-5">
<div class="row" style="background-color: #FFFAFE;">
<div class="col-md-6 pb-4 d-flex align-items-center justify-content-center"
style="border-right: 1px solid #D9D9D9;">
<div style="padding: 30px;">
<div class="d-flex align-items-center">
<img src="assets/misc/support (1) 1.svg" alt=""
width="60px" style="margin-right: 12px;">
<div style="padding: 0px 8px;">
<span
style="color: #714B67;font-size: 24px;font-weight: 600;padding-bottom: 1rem;">Need
Help?</span>
<p class="m-0" style="color:#718096;">Got
questions or need help? Get in touch.</p>
<div style="font-weight: 400;"><span><img
src="assets/misc/support-email.svg"
alt=""
width="18px"
style="filter: invert(1);margin-right: 0.8rem;"></span>odoo@cybrosys.com
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 pb-4 d-flex align-items-center justify-content-center">
<div style="padding: 30px;">
<div class="d-flex align-items-center">
<img src="assets/misc/whatsapp 1.svg" alt=""
width="60px" style="margin-right: 12px;">
<div>
<span style="color: #714B67;font-size: 24px;font-weight: 600;">WhatsApp</span>
<p class="m-0" style="color:#718096;">Say hi to
us on WhatsApp!</p>
<div style="font-weight: 400; font-size: 16px;"><span><img
src="assets/misc/phone.svg"
alt="" width="14px"
style="filter: invert(1); margin-right: 0.8rem;"></span>+91
99456767686
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>

52
safer_pay/static/src/js/payment_form.js

@ -1,52 +0,0 @@
/** @odoo-module **/
import paymentForm from '@payment/js/payment_form';
import paymentSaferPayMixin from '@safer_pay/js/payment_saferpay_mixin';
paymentForm.include({
// #=== DOM MANIPULATION ===#
/**
* Prepare the inline form of safer_pay for direct payment.
*
* @override method from @payment/js/payment_form
* @private
* @param {number} providerId - The id of the selected payment option's provider.
* @param {string} providerCode - The code of the selected payment option's provider.
* @param {number} paymentOptionId - The id of the selected payment option
* @param {string} paymentMethodCode - The code of the selected payment method, if any.
* @param {string} flow - The online payment flow of the selected payment option.
* @return {void}
*/
async _prepareInlineForm(providerId, providerCode, paymentOptionId, paymentMethodCode, flow) {
if (providerCode !== 'saferpay') {
this._super(...arguments);
return;
} else if (flow === 'token') {
return;
}
this._setPaymentFlow('direct');
},
// #=== PAYMENT FLOW ===#
/**
* Simulate a feedback from a payment provider and redirect the customer to the status page.
*
* @override method from payment.payment_form
* @private
* @param {string} providerCode - The code of the selected payment option's provider.
* @param {number} paymentOptionId - The id of the selected payment option.
* @param {string} paymentMethodCode - The code of the selected payment method, if any.
* @param {object} processingValues - The processing values of the transaction.
* @return {void}
*/
async _processDirectFlow(providerCode, paymentOptionId, paymentMethodCode, processingValues) {
if (providerCode !== 'saferpay') {
this._super(...arguments);
return;
}
paymentSaferPayMixin.processSaferPayPayment(processingValues);
},
});

33
safer_pay/static/src/js/payment_saferpay_mixin.js

@ -1,33 +0,0 @@
/** @odoo-module **/
import { Dialog } from "@web/core/dialog/dialog";
import { _t } from "@web/core/l10n/translation";
import { jsonrpc, RPCError } from "@web/core/network/rpc_service";
export default {
/**
* Simulate a feedback from a payment provider and redirect the customer to the provider official page.
*
* @private
* @param {object} processingValues - The processing values of the transaction.
* @return {void}
*/
async processSaferPayPayment(processingValues) {
const customerInput = document.getElementById('customer_input').value;
const simulatedPaymentState = document.getElementById('simulated_payment_state').value;
console.log('f1',simulatedPaymentState)
jsonrpc('/saferpay/payment', {
'reference': processingValues.reference,
'payment_details': customerInput,
'simulated_state': simulatedPaymentState,
}).then((result) => {
window.location = result;
}).catch(error => {
if (error instanceof RPCError) {
this._displayErrorDialog(_t("Payment processing failed"), error.data.message);
this._enableButton?.(); // This method doesn't exists in Express Checkout form.
} else {
return Promise.reject(error);
}
})
}
}

25
safer_pay/views/payment_provider_views.xml

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Adding credentials fields to safer pay payment provider form-->
<record model="ir.ui.view"
id="payment_provider_form">
<field name="name">payment.provider.view.form.inherit.safer.pay</field>
<field name="model">payment.provider</field>
<field name="inherit_id" ref="payment.payment_provider_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='provider_credentials']"
position="inside">
<group>
<field name="customer"
required="code == 'saferpay'"/>
<field name="terminal"
required="code == 'saferpay'"/>
<field name="username"
required="code == 'saferpay'"/>
<field name="password"
required="code == 'saferpay'"/>
</group>
</xpath>
</field>
</record>
</odoo>

135
safer_pay/views/payment_safer_pay_templates.xml

@ -1,135 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="redirect_form">
<form action="https://test.saferpay.com/api/Payment/v1/PaymentPage/Initialize"
method="post">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<input type="hidden" name="RequestHeader" t-att-value="key"/>
<input type="hidden" name="TerminalId" t-att-value="TerminalId"/>
<input type="hidden" name="Payment" t-att-value="amount"/>
<input type="hidden" name="ReturnUrl" t-att-value="ReturnUrl"/>
<input type="submit" value="submit"/>
</form>
</template>
<template id="safer_pay.token_form" inherit_id="payment.token_form">
<xpath expr="//p[@name='o_payment_secured_by_desktop']"
position="attributes">
<attribute name="t-att-class"/>
<attribute name="class">d-none</attribute>
</xpath>
<xpath expr="//p[@name='o_payment_secured_by_mobile']"
position="attributes">
<attribute name="class" separator=" " add="d-none"/>
</xpath>
</template>
<template id="safer_pay.payment_method_form"
inherit_id="payment.method_form">
<xpath expr="//p[@name='o_payment_secured_by']" position="attributes">
<attribute name="class" separator=" " add="d-none"/>
</xpath>
</template>
<template id="inline_form">
<div t-attf-id="safer-pay-container-{{provider_id}}">
<t t-call="safer_pay.payment_details"/>
</div>
</template>
<template id="token_inline_form">
<div t-attf-id="safer-pay-token-container-{{token_sudo.id}}">
<div class="alert alert-warning mb-0">
<span t-if="token_sudo.safer_pay_simulated_state=='pending'">
Payments made with this payment method will remain <b>
pending</b>.
</span>
<span t-elif="token_sudo.safer_pay_simulated_state=='done'">
Payments made with this payment method will be <b>
successful</b>.
</span>
<span t-elif="token_sudo.safer_pay_simulated_state=='cancel'">
Payments made with this payment method will be automatically <b>
canceled</b>.
</span>
<span t-else="">
Payments made with this payment method will simulate a
processing <b>error</b>.
</span>
</div>
</div>
</template>
<template id="express_checkout_form">
<div name="o_express_checkout_container"
t-attf-id="o_safer_pay_express_checkout_container_{{provider_sudo.id}}"
t-att-data-provider-id="provider_sudo.id"
t-att-data-provider-code="provider_sudo.code"
>
<div t-attf-id="o_safer_pay_modal_{{provider_sudo.id}}"
class="modal fade mt-5"
tabindex="-1"
aria-labelledby="o_safer_pay_modal_label"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"
id="o_safer_pay_modal_label">
SaferPay Express Checkout
</h5>
<span t-if="provider_sudo.state == 'test'"
class="badge rounded-pill text-bg-warning ms-1"
>
Test Mode
</span>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
/>
</div>
</div>
</div>
</div>
</div>
</template>
<template id="payment_details">
<div class="row gap2 gap-md-0">
<input name="provider_id" type="hidden" id="provider_id"
t-att-value="id"/>
<input name="partner_id" type="hidden" t-att-value="partner_id"/>
<div class="col-12 col-md mt-0 mb-0">
<label for="customer_input" class="mt-0">
<small>Payment Details</small>
</label>
<input type="text"
name="customer_input"
id="customer_input"
class="form-control"
placeholder="XXXX XXXX XXXX XXXX"/>
</div>
<div class="col-12 col-md mb-0">
<label for="simulated_payment_state" class="mt-0 text-muted">
<small>Payment Status</small>
</label>
<select id="simulated_payment_state" class="form-select">
<option value="done" title="Successful payment">
Successful
</option>
<option value="pending" title="Payment processing">
Pending
</option>
<option value="cancel" title="Payment canceled by customer">
Canceled
</option>
<option value="error" title="Processing error">
Error
</option>
</select>
</div>
</div>
</template>
</odoo>

17
safer_pay/views/payment_token_views.xml

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="payment_token_form" model="ir.ui.view">
<field name="name">SafePay Token Form</field>
<field name="model">payment.token</field>
<field name="inherit_id" ref="payment.payment_token_form"/>
<field name="arch" type="xml">
<group name="general_information" position="inside">
<field name="provider_code" invisible="1"/>
<field name="safer_pay_simulated_state"
invisible="provider_code != 'saferpay'"
required="provider_code == 'saferpay'"/>
</group>
</field>
</record>
</odoo>

31
safer_pay/views/payment_transaction_views.xml

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="payment_transaction_form" model="ir.ui.view">
<field name="name">SaferPay Transaction Form</field>
<field name="model">payment.transaction</field>
<field name="inherit_id" ref="payment.payment_transaction_form"/>
<field name="arch" type="xml">
<header position="inside">
<field name="capture_manually" invisible="1"/>
<button string="Authorize"
type="object"
name="action_saferpay_set_done"
class="oe_highlight"
invisible="provider_code != 'saferpay' or not capture_manually or state != 'pending'"/>
<button string="Confirm"
type="object"
name="action_saferpay_set_done"
class="oe_highlight"
invisible="provider_code != 'saferpay' or capture_manually or state != 'pending'"/>
<button string="Cancel"
type="object"
name="action_saferpay_set_canceled"
invisible="provider_code != 'saferpay' or state != 'pending'"/>
<button string="Set to Error"
type="object"
name="action_saferpay_set_error"
invisible="provider_code != 'saferpay' or state != 'pending'"/>
</header>
</field>
</record>
</odoo>

14
safer_pay/views/sale_order_views.xml

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.view.form.inherit.safer.pay</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_term_id']" position="after">
<field name="payment" invisible="1"/>
<field name="sale_order" invisible="1"/>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save