diff --git a/payment_sixpay/indico_sixpay/blueprint.py b/payment_sixpay/indico_sixpay/blueprint.py index 8d48893..1bbae7e 100644 --- a/payment_sixpay/indico_sixpay/blueprint.py +++ b/payment_sixpay/indico_sixpay/blueprint.py @@ -21,10 +21,7 @@ from __future__ import unicode_literals from indico.core.plugins import IndicoPluginBlueprint -from .request_handlers import ( - SixPayResponseHandler, UserCancelHandler, - UserFailureHandler, UserSuccessHandler -) +from .request_handlers import SixPayResponseHandler, UserCancelHandler, UserFailureHandler, UserSuccessHandler #: url mount points exposing callbacks diff --git a/payment_sixpay/indico_sixpay/plugin.py b/payment_sixpay/indico_sixpay/plugin.py index c93099c..9e4bf0e 100644 --- a/payment_sixpay/indico_sixpay/plugin.py +++ b/payment_sixpay/indico_sixpay/plugin.py @@ -22,41 +22,27 @@ The entry point for indico is the :py:class:`~.SixpayPaymentPlugin`. It handles configuration via the settings forms, initiates payments and provides callbacks for finished payments via its blueprint. """ -from __future__ import unicode_literals, absolute_import -import urlparse +from __future__ import absolute_import, unicode_literals import requests -from werkzeug.exceptions import ( - NotImplemented as HTTPNotImplemented, - InternalServerError as HTTPInternalServerError -) - +import urlparse +from werkzeug.exceptions import InternalServerError as HTTPInternalServerError +from werkzeug.exceptions import NotImplemented as HTTPNotImplemented from wtforms.fields import StringField from wtforms.fields.html5 import URLField -from wtforms.validators import ( - DataRequired, Optional, Regexp, Length, Email, ValidationError -) -from indico.web.forms.fields import IndicoPasswordField +from wtforms.validators import DataRequired, Email, Length, Optional, Regexp, ValidationError from indico.core.plugins import IndicoPlugin, url_for_plugin -from indico.modules.events.payment import ( - PaymentEventSettingsFormBase, - PaymentPluginMixin, - PaymentPluginSettingsFormBase) -from indico.modules.events.payment.models.transactions import ( - PaymentTransaction, - TransactionAction -) +from indico.modules.events.payment import (PaymentEventSettingsFormBase, PaymentPluginMixin, + PaymentPluginSettingsFormBase) +from indico.modules.events.payment.models.transactions import PaymentTransaction, TransactionAction +from indico.web.forms.fields import IndicoPasswordField - -from .utility import ( - gettext, to_small_currency, get_request_header, get_terminal_id, - provider -) # blueprint mounts the request handlers onto URLs from .blueprint import blueprint +from .utility import (get_request_header, get_terminal_id, gettext, provider, saferpay_json_api_spec, + saferpay_pp_init_url, to_small_currency) -from .utility import saferpay_json_api_spec, saferpay_pp_init_url # Dear Future Maintainer, # diff --git a/payment_sixpay/indico_sixpay/request_handlers.py b/payment_sixpay/indico_sixpay/request_handlers.py index 3b7d4a4..4e9a8a6 100644 --- a/payment_sixpay/indico_sixpay/request_handlers.py +++ b/payment_sixpay/indico_sixpay/request_handlers.py @@ -18,32 +18,23 @@ # if not, see . """Callbacks for asynchronous replies by Saferpay and to redirect the user.""" from __future__ import unicode_literals -import urlparse import requests +import urlparse from flask import flash, redirect, request from flask_pluginengine import current_plugin from werkzeug.exceptions import BadRequest from indico.modules.events.payment.models.transactions import TransactionAction -from indico.modules.events.payment.notifications \ - import notify_amount_inconsistency -from indico.modules.events.registration.models.registrations \ - import Registration +from indico.modules.events.payment.notifications import notify_amount_inconsistency +from indico.modules.events.registration.models.registrations import Registration from indico.web.flask.util import url_for from indico.web.rh import RH -from .utility import ( - gettext, to_large_currency, to_small_currency, get_request_header, - get_setting -) -from .utility import ( - saferpay_pp_assert_url, - saferpay_pp_capture_url, - saferpay_json_api_spec, - saferpay_pp_cancel_url, - provider -) +from .utility import (get_request_header, get_setting, gettext, provider, saferpay_json_api_spec, + saferpay_pp_assert_url, saferpay_pp_cancel_url, saferpay_pp_capture_url, to_large_currency, + to_small_currency) + # RH from indico.web.rh # - the logic to execute when SixPay/Users are redirected *after* a transaction diff --git a/payment_sixpay/indico_sixpay/utility.py b/payment_sixpay/indico_sixpay/utility.py index ed7f45e..5234bab 100644 --- a/payment_sixpay/indico_sixpay/utility.py +++ b/payment_sixpay/indico_sixpay/utility.py @@ -17,16 +17,17 @@ # along with SixPay Indico EPayment Plugin; # if not, see . """Utility functions used by the Sixpay payment plugin.""" -from __future__ import unicode_literals, division +from __future__ import division, unicode_literals import uuid import iso4217 -from werkzeug.exceptions import NotImplemented as HTTPNotImplemented from flask_pluginengine import current_plugin +from werkzeug.exceptions import NotImplemented as HTTPNotImplemented from indico.util.i18n import make_bound_gettext + #: internationalisation/localisation of strings gettext = make_bound_gettext('payment_sixpay') diff --git a/payment_sixpay/setup.py b/payment_sixpay/setup.py index 2c80685..741e51b 100644 --- a/payment_sixpay/setup.py +++ b/payment_sixpay/setup.py @@ -1,5 +1,7 @@ import os -from setuptools import setup, find_packages + +from setuptools import find_packages, setup + repo_base_dir = os.path.abspath(os.path.dirname(__file__)) # pull in the packages metadata