Merge pull request #6077 from expsa/store_hyperpay_response

[IMP] payment_hyperpay, payment_hyperpay_tokenization: add payment ic…
This commit is contained in:
abdurrahman-saber 2026-01-08 17:27:51 +04:00 committed by GitHub
commit b12c349e85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 2 deletions

View File

@ -11,7 +11,8 @@
'base', 'payment_hyperpay'
],
'data': [
'views/payment_acquirer_views.xml'
'views/payment_acquirer_views.xml',
'views/payment_template.xml'
]
}

View File

@ -231,15 +231,17 @@ class HyperPayTokenization(Controller):
except Exception as er:
_logger.error('Hyperpay Token Return Transaction refund failed: %s' % er)
payment_icon_id = request.env['payment.icon'].sudo().search([('name', 'ilike', data.get('paymentBrand', '')), ('acquirer_ids', 'in', [acquirer_id.id])], limit=1)
card_vals = {
'name': f"{card.get('bin', '')}XXXXXXXXXXXX{card.get('last4Digits', '')}",
'name': f"{card.get('bin', '')} **** **** **** {card.get('last4Digits', '')}",
'partner_id': request.env.user.partner_id.id,
'acquirer_id': acquirer_id.id,
'acquirer_ref': registration_id,
'hyperpay_payment_brand': data.get('paymentBrand'),
'hyperpay_initial_transaction_id': initial_tx_id,
'verified': True,
'payment_icon_id': payment_icon_id.id,
}
token_id = request.env['payment.token'].sudo().create(card_vals)

View File

@ -129,6 +129,7 @@ class HyperPayToken(models.Model):
_inherit = 'payment.token'
hyperpay_payment_brand = fields.Char('Payment Brand')
payment_icon_id = fields.Many2one('payment.icon', string='Payment Icon')
hyperpay_initial_transaction_id = fields.Char()

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template inherit_id="payment.payment_tokens_list">
<xpath expr="//t[@t-foreach='pms']//label" position="after">
<ul class="float-right list-inline payment_icon_list">
<li t-attf-class="list-inline-item">
<span t-field="token.payment_icon_id.image_payment_form" t-options='{"widget": "image", "alt-field": "hyperpay_payment_brand"}'/>
</li>
</ul>
</xpath>
</template>
</odoo>