<commit_before># -*- coding: utf-8 *-*
from billing import Integration, IntegrationNotConfigured
from django.conf import settings
from django_ogone.ogone import Ogone
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf.urls import patterns, url
from django_ogone.status_codes import get_status_category, get_status_description
from django_ogone.signals import ogone_payment_accepted, ogone_payment_failed, ogone_payment_cancelled
from django.http import HttpResponse
from billing.utils.utilities import Bunch
from billing.forms.ogone_payments_forms import OgonePaymentsForm


class OgonePaymentsIntegration(Integration):
    display_name = "Ogone Payments Integration"
    template = "billing/ogone_payments.html"

    def __init__(self, options=None):
        if not options:
            options = {}
        super(OgonePaymentsIntegration, self).__init__(options=options)
        merchant_settings = getattr(settings, "MERCHANT_SETTINGS")
        if not merchant_settings or not merchant_settings.get("ogone_payments"):
            raise IntegrationNotConfigured("The '%s' integration is not correctly "
                                       "configured." % self.display_name)
        bunch = Bunch()
        bunch.update(merchant_settings["ogone_payments"])
        self.settings = bunch

    @property
    def service_url(self):
        return Ogone.get_action()

    def ogone_notify_handler(self, request):
        response = Ogone(request=request, settings=self.settings)
        if response.is_valid():
            fpath = request.get_full_path()
            query_string = fpath.split("?", 1)[1]
            transaction_feedback = query_string.split('&')
            result = {}
            for item in transaction_feedback:
                k, v = item.split("=")
                result[k] = v

            # Default transaction feedback parameters
            status = result.get('STATUS', False)
            orderid = result.get('orderID', '')
            payid = result.get('PAYID', '')<commit_msg>use merchant test mode instead of settings debug<commit_after># -*- coding: utf-8 *-*
from billing import Integration, IntegrationNotConfigured
from django.conf import settings
from django_ogone.ogone import Ogone
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf.urls import patterns, url
from django_ogone.status_codes import get_status_category, get_status_description
from django_ogone.signals import ogone_payment_accepted, ogone_payment_failed, ogone_payment_cancelled
from django.http import HttpResponse
from billing.utils.utilities import Bunch
from billing.forms.ogone_payments_forms import OgonePaymentsForm


class OgonePaymentsIntegration(Integration):
    display_name = "Ogone Payments Integration"
    template = "billing/ogone_payments.html"

    def __init__(self, options=None):
        if not options:
            options = {}
        super(OgonePaymentsIntegration, self).__init__(options=options)
        merchant_settings = getattr(settings, "MERCHANT_SETTINGS")
        if not merchant_settings or not merchant_settings.get("ogone_payments"):
            raise IntegrationNotConfigured("The '%s' integration is not correctly "
                                       "configured." % self.display_name)
        bunch = Bunch()
        bunch.update(merchant_settings["ogone_payments"])
        self.settings = bunch

    @property
    def service_url(self):
        return Ogone.get_action(production=not settings.MERCHANT_TEST_MODE)

    def ogone_notify_handler(self, request):
        response = Ogone(request=request, settings=self.settings)
        if response.is_valid():
            fpath = request.get_full_path()
            query_string = fpath.split("?", 1)[1]
            transaction_feedback = query_string.split('&')
            result = {}
            for item in transaction_feedback:
                k, v = item.split("=")
                result[k] = v

            # Default transaction feedback parameters
            status = result.get('STATUS', False)
            orderid = result.get('orderID', '')
            payid = result.get('PAYID', '')
{'fraction_non_alphanumeric': 0.08454048919496557, 'fraction_numerical': 0.0014248397055331276, 'mean_word_length': 3.1294117647058823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2761403', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1115, 'n_words': 274}