docs(payment_paydunya): documente les methodes en francais
This commit is contained in:
@@ -9,7 +9,7 @@ _logger = logging.getLogger(__name__)
|
||||
class PaydunyaController(http.Controller):
|
||||
@http.route('/payment/paydunya/return', type='http', auth='public', methods=['GET'], csrf=False)
|
||||
def paydunya_return(self, **kwargs):
|
||||
"""Handle return from PayDunya after payment attempt."""
|
||||
"""Traite le retour utilisateur PayDunya après tentative de paiement."""
|
||||
token = kwargs.get('token') or http.request.params.get('token')
|
||||
tx_id = kwargs.get('tx_id') or http.request.params.get('tx_id')
|
||||
sale_order_id = kwargs.get('sale_order_id') or http.request.params.get('sale_order_id')
|
||||
@@ -29,7 +29,7 @@ class PaydunyaController(http.Controller):
|
||||
|
||||
data = {}
|
||||
if token and provider:
|
||||
# Build check URL using the confirm endpoint
|
||||
# Construit l'URL de vérification via l'endpoint de confirmation.
|
||||
base = provider._get_paydunya_api_base()
|
||||
confirm_url = base + '/checkout-invoice/confirm/{}'.format(token)
|
||||
|
||||
@@ -41,7 +41,7 @@ class PaydunyaController(http.Controller):
|
||||
}
|
||||
|
||||
try:
|
||||
# GET request to verify status
|
||||
# Vérifie le statut de paiement côté PayDunya.
|
||||
resp = requests.get(confirm_url, headers=headers, timeout=15)
|
||||
data = resp.json()
|
||||
_logger.info('PayDunya confirm response: %s', data)
|
||||
@@ -49,12 +49,12 @@ class PaydunyaController(http.Controller):
|
||||
_logger.exception('Error verifying PayDunya invoice: %s', e)
|
||||
data = {'token': token, 'status': 'failed', 'sale_order_id': sale_order_id, 'tx_id': tx_id}
|
||||
elif tx:
|
||||
# Fallback when PayDunya did not return token: rely on tx current state.
|
||||
# Fallback: si PayDunya ne renvoie pas de token, on s'appuie sur la transaction.
|
||||
data = {'tx_id': tx.id, 'sale_order_id': sale_order_id}
|
||||
else:
|
||||
return http.request.redirect('/')
|
||||
|
||||
# Trigger transaction handling with the confirmed data
|
||||
# Déclenche la mise à jour de la transaction avec les données confirmées.
|
||||
try:
|
||||
handled = tx_model._handle_notification_data(data)
|
||||
tx = tx or tx_model._get_tx_from_notification(data)
|
||||
@@ -73,16 +73,17 @@ class PaydunyaController(http.Controller):
|
||||
|
||||
@http.route('/payment/paydunya/cancel', type='http', auth='public', methods=['GET'], csrf=False)
|
||||
def paydunya_cancel(self, **kwargs):
|
||||
"""Handle cancellation from PayDunya."""
|
||||
"""Traite l'annulation de paiement renvoyée par PayDunya."""
|
||||
token = kwargs.get('token') or http.request.params.get('token')
|
||||
_logger.info('PayDunya payment cancelled: token=%s', token)
|
||||
return http.request.redirect('/shop/cart')
|
||||
|
||||
@http.route('/payment/paydunya/callback', type='http', auth='public', methods=['GET', 'POST'], csrf=False)
|
||||
def paydunya_callback(self, **kwargs):
|
||||
"""Handle IPN callback from PayDunya.
|
||||
|
||||
PayDunya sends data as application/x-www-form-urlencoded with 'data' key containing JSON.
|
||||
"""Traite le callback IPN envoyé par PayDunya.
|
||||
|
||||
PayDunya peut envoyer des données en `application/x-www-form-urlencoded`
|
||||
dans une clé `data` contenant du JSON.
|
||||
"""
|
||||
try:
|
||||
payload = {}
|
||||
@@ -105,5 +106,5 @@ class PaydunyaController(http.Controller):
|
||||
except Exception:
|
||||
_logger.exception('Error handling PayDunya callback')
|
||||
|
||||
# Always return 200 OK to PayDunya
|
||||
# Retourne toujours HTTP 200 à PayDunya.
|
||||
return 'OK'
|
||||
|
||||
Reference in New Issue
Block a user