From a570a6bd4a4ee56bf7c5be8c929ef4831a9cad7f Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Fri, 14 Jun 2019 17:01:43 +0200 Subject: [PATCH] Payment/Paypal: add warning about UTF-8 config Closes #60 --- payment_paypal/indico_payment_paypal/plugin.py | 10 ++++++++++ .../templates/event_settings_encoding_warning.html | 9 +++++++++ payment_paypal/setup.py | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 payment_paypal/indico_payment_paypal/templates/event_settings_encoding_warning.html diff --git a/payment_paypal/indico_payment_paypal/plugin.py b/payment_paypal/indico_payment_paypal/plugin.py index bb350c8..4ac1745 100644 --- a/payment_paypal/indico_payment_paypal/plugin.py +++ b/payment_paypal/indico_payment_paypal/plugin.py @@ -7,6 +7,8 @@ from __future__ import unicode_literals +from flask_pluginengine import render_plugin_template + from wtforms.fields.core import StringField from wtforms.fields.html5 import URLField from wtforms.validators import DataRequired, Optional @@ -50,6 +52,10 @@ class PaypalPaymentPlugin(PaymentPluginMixin, IndicoPlugin): 'method_name': None, 'business': None} + def init(self): + super(PaypalPaymentPlugin, self).init() + self.template_hook('event-manage-payment-plugin-before-form', self._get_encoding_warning) + @property def logo_url(self): return url_for_plugin(self.name + '.static', filename='images/logo.png') @@ -67,3 +73,7 @@ class PaypalPaymentPlugin(PaymentPluginMixin, IndicoPlugin): data['return_url'] = url_for_plugin('payment_paypal.success', registration.locator.uuid, _external=True) data['cancel_url'] = url_for_plugin('payment_paypal.cancel', registration.locator.uuid, _external=True) data['notify_url'] = url_for_plugin('payment_paypal.notify', registration.locator.uuid, _external=True) + + def _get_encoding_warning(self, plugin=None, event=None): + if plugin == self: + return render_plugin_template('event_settings_encoding_warning.html') diff --git a/payment_paypal/indico_payment_paypal/templates/event_settings_encoding_warning.html b/payment_paypal/indico_payment_paypal/templates/event_settings_encoding_warning.html new file mode 100644 index 0000000..c5bcd16 --- /dev/null +++ b/payment_paypal/indico_payment_paypal/templates/event_settings_encoding_warning.html @@ -0,0 +1,9 @@ +{% from 'message_box.html' import message_box %} + +{% call message_box('warning', fixed_width=true) %} + {%- trans link=''|safe, endlink=''|safe -%} + Please make sure that you have your PayPal seller account configured to use UTF-8 by default, + otherwise some transactions may end up not being acknowledged by Indico!
+ You can find out how to set this up {{ link }}here{{ endlink }}. + {%- endtrans -%} +{% endcall %} diff --git a/payment_paypal/setup.py b/payment_paypal/setup.py index 5318456..0169ddd 100644 --- a/payment_paypal/setup.py +++ b/payment_paypal/setup.py @@ -12,7 +12,7 @@ from setuptools import find_packages, setup setup( name='indico-plugin-payment-paypal', - version='1.0', + version='2.2-dev', description='PayPal payments for Indico event registration fees', url='https://github.com/indico/indico-plugins', license='MIT', @@ -22,7 +22,7 @@ setup( zip_safe=False, include_package_data=True, install_requires=[ - 'indico>=2.0' + 'indico>=2.2.dev0' ], classifiers=[ 'Environment :: Plugins',