Add PayDunya payment provider integration

- Implemented PayDunya payment provider with necessary models, controllers, and views.
- Added configuration files for Docker and Odoo setup.
- Included .gitignore for Python and Odoo specific files.
This commit is contained in:
MMG
2026-02-06 11:36:42 +00:00
commit c93b260937
14 changed files with 570 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import logging
from odoo import models, fields
_logger = logging.getLogger(__name__)
class PaymentProvider(models.Model):
_inherit = 'payment.provider'
# Override code field to add paydunya option
code = fields.Selection(
selection_add=[('paydunya', 'PayDunya')],
ondelete={'paydunya': 'cascade'}
)
# PayDunya specific credentials
paydunya_master_key = fields.Char('PayDunya Master Key')
paydunya_public_key = fields.Char('PayDunya Public Key')
paydunya_private_key = fields.Char('PayDunya Private Key')
paydunya_token = fields.Char('PayDunya Token')
environment = fields.Selection([
('sandbox', 'Sandbox'),
('production', 'Production')
], string='Environment', default='sandbox')
def _get_paydunya_api_base(self):
"""Return the correct API base URL for PayDunya based on environment."""
self.ensure_one()
if self.environment == 'production':
return 'https://app.paydunya.com/api/v1'
return 'https://app.paydunya.com/sandbox-api/v1'