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:
32
addons/payment_paydunya/models/payment_provider.py
Normal file
32
addons/payment_paydunya/models/payment_provider.py
Normal 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'
|
||||
|
||||
Reference in New Issue
Block a user