<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
#    @author: <NAME> <<EMAIL>>
#
#    The licence is in the file __manifest__.py
#
##############################################################################

import logging
import pprint

from odoo import http
from odoo.http import request
from odoo.addons.payment_ogone.controllers.main import OgoneController
from odoo.exceptions import ValidationError

_logger = logging.getLogger(__name__)

OgoneController._accept_url = '/payment/donation/test/accept'
OgoneController._cancel_url = '/payment/donation/test/cancel'
OgoneController._decline_url = '/payment/donation/test/decline'
OgoneController._except_url = '/payment/donation/test/except'


class OgoneController2(http.Controller):
    @http.route([
        '/payment/donation/<string:result>/',
        '/payment/donation/test/<string:result>/',
    ], type='http', auth='public', website=True)
    def ogone_form_feedback(self, result, **post):
        """ Ogone contacts using GET, at least for accept """
        _logger.info('Donation from Ogone: entering form_feedback with post '
                     'data %s',
                     pprint.pformat(post))  # debug
        if result != 'accept':
            result = 'decline'

        try:
            feedback = request.env['payment.transaction'].sudo().form_feedback(
                post, 'ogone')
        except ValidationError:
            feedback = False

        invoice_line = http.request.env['account.invoice.line'].browse(int(
            post['orderID']))
        registration = invoice_line.event_id.muskathlon_registration_ids \
            .filtered(lambda item: item.partner_id == invoice_line.user_id)

        if feedback:
            http.request.env['payment.acquirer'] \
                .validate_order_id(post['orderID'])
        return http.request.render('payment_ogone_compassion.' + result, {
            'event': invoice_line.event_id,
            'registration': registration
        })<commit_msg>[ADD] Thank you pages in odoo<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
#    @author: <NAME> <<EMAIL>>
#
#    The licence is in the file __manifest__.py
#
##############################################################################

import logging
import pprint

from odoo import http
from odoo.http import request
from odoo.addons.payment_ogone.controllers.main import OgoneController
from odoo.exceptions import ValidationError

_logger = logging.getLogger(__name__)

OgoneController._accept_url = '/payment/donation/test/accept'
OgoneController._cancel_url = '/payment/donation/test/cancel'
OgoneController._decline_url = '/payment/donation/test/decline'
OgoneController._except_url = '/payment/donation/test/except'


class OgoneController2(http.Controller):
    @http.route([
        '/payment/donation/<string:result>/',
        '/payment/donation/test/<string:result>/',
    ], type='http', auth='public', website=True)
    def ogone_form_feedback(self, result, **post):
        """ Ogone contacts using GET, at least for accept """
        _logger.info('Donation from Ogone: entering form_feedback with post '
                     'data %s',
                     pprint.pformat(post))  # debug
        if result != 'accept':
            result = 'decline'

        try:
            feedback = request.env['payment.transaction'].sudo().form_feedback(
                post, 'ogone')
        except ValidationError:
            feedback = False

        invoice_line = http.request.env['account.invoice.line'].browse(int(
            post['orderID']))
        registration = invoice_line.event_id.muskathlon_registration_ids \
            .filtered(lambda item: item.partner_id == invoice_line.user_id)

        if feedback:
            http.request.env['payment.acquirer'] \
                .validate_order_id(post['orderID'])
        return http.request.render('payment_ogone_compassion.' + result, {
            'event': invoice_line.event_id,
            'registration': registration
        })
        if result != 'accept':
            result = 'decline'

        try:
            feedback = request.env['payment.transaction'].sudo().form_feedback(
                post, 'ogone')
        except ValidationError:
            feedback = False

        invoice_line = http.request.env['account.invoice.line'].browse(int(
            post['orderID']))
        registration = invoice_line.event_id.muskathlon_registration_ids \
            .filtered(lambda item: item.partner_id == invoice_line.user_id)

        if feedback:
            http.request.env['payment.acquirer'] \
                .validate_order_id(post['orderID'])
        return http.request.render('payment_ogone_compassion.' + result, {
            'event': invoice_line.event_id,
            'registration': registration
        })
{'fraction_non_alphanumeric': 0.1740842851516345, 'fraction_numerical': 0.0023631350925561244, 'mean_word_length': 2.8979278587874138, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4253418', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1371, 'n_words': 267}