mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-12 23:27:22 +00:00
Merge branch 'master' into v2.1-dev
This commit is contained in:
commit
99056e71fd
@ -28,8 +28,8 @@ plugins_require = [
|
||||
'indico-plugin-livesync==1.0rc1',
|
||||
'indico-plugin-livesync-invenio==1.0rc1',
|
||||
'indico-plugin-payment-manual==1.0rc1',
|
||||
'indico-plugin-payment-paypal==1.0rc1',
|
||||
'indico-plugin-piwik==1.0rc1',
|
||||
'indico-plugin-payment-paypal==1.0rc2',
|
||||
'indico-plugin-piwik==1.0rc2',
|
||||
'indico-plugin-previewer-code==1.0rc1',
|
||||
'indico-plugin-previewer-jupyter==1.0rc1',
|
||||
'indico-plugin-search==1.0rc1',
|
||||
@ -43,7 +43,7 @@ extras_require = {
|
||||
|
||||
setup(
|
||||
name='indico-plugins',
|
||||
version='1.0rc1',
|
||||
version='1.0rc2',
|
||||
description='A meta-package containing the official Indico plugins',
|
||||
url='https://github.com/indico/indico-plugins',
|
||||
license='https://www.gnu.org/licenses/gpl-3.0.txt',
|
||||
|
||||
@ -85,11 +85,13 @@ class RHPaypalIPN(RH):
|
||||
|
||||
def _verify_business(self):
|
||||
expected = current_plugin.event_settings.get(self.registration.registration_form.event, 'business')
|
||||
business = request.form.get('business')
|
||||
if expected == business:
|
||||
candidates = {request.form.get('business'),
|
||||
request.form.get('receiver_id'),
|
||||
request.form.get('receiver_email')}
|
||||
if expected in candidates:
|
||||
return True
|
||||
current_plugin.logger.warning("Unexpected business: %s != %s", business, expected)
|
||||
current_plugin.logger.warning("Request data was: %s", request.form)
|
||||
current_plugin.logger.warning("Unexpected business: %s not in %r (request data: %r)", expected, candidates,
|
||||
request.form)
|
||||
return False
|
||||
|
||||
def _verify_amount(self):
|
||||
|
||||
@ -23,7 +23,7 @@ from wtforms.validators import DataRequired, Optional
|
||||
from indico.core.plugins import IndicoPlugin, url_for_plugin
|
||||
from indico.modules.events.payment import (PaymentEventSettingsFormBase, PaymentPluginMixin,
|
||||
PaymentPluginSettingsFormBase)
|
||||
from indico.util.string import remove_accents
|
||||
from indico.util.string import remove_accents, unicode_to_ascii
|
||||
from indico.web.forms.validators import UsedIf
|
||||
|
||||
from indico_payment_paypal import _
|
||||
@ -69,8 +69,10 @@ class PaypalPaymentPlugin(PaymentPluginMixin, IndicoPlugin):
|
||||
def adjust_payment_form_data(self, data):
|
||||
event = data['event']
|
||||
registration = data['registration']
|
||||
data['item_name'] = '{}: registration for {}'.format(remove_accents(registration.full_name),
|
||||
remove_accents(event.title))
|
||||
data['item_name'] = '{}: registration for {}'.format(
|
||||
unicode_to_ascii(remove_accents(registration.full_name, reencode=False)),
|
||||
unicode_to_ascii(remove_accents(event.title, reencode=False))
|
||||
)
|
||||
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)
|
||||
|
||||
@ -21,7 +21,7 @@ from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='indico-plugin-payment-paypal',
|
||||
version='1.0rc1',
|
||||
version='1.0rc2',
|
||||
description='PayPal payments for Indico event registration fees',
|
||||
url='https://github.com/indico/indico-plugins',
|
||||
license='https://www.gnu.org/licenses/gpl-3.0.txt',
|
||||
|
||||
@ -25,16 +25,19 @@ from indico_payment_paypal.plugin import PaypalPaymentPlugin
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('db', 'request_context')
|
||||
@pytest.mark.parametrize(('business', 'expected'), (
|
||||
('test', True),
|
||||
('foo', False)
|
||||
@pytest.mark.parametrize(('formdata', 'expected'), (
|
||||
({'business': 'test'}, True),
|
||||
({'receiver_id': 'test'}, True),
|
||||
({'receiver_email': 'test'}, True),
|
||||
({'business': 'foo'}, False),
|
||||
({}, False)
|
||||
))
|
||||
def test_ipn_verify_business(business, expected, dummy_event):
|
||||
def test_ipn_verify_business(formdata, expected, dummy_event):
|
||||
rh = RHPaypalIPN()
|
||||
rh.registration = MagicMock()
|
||||
rh.registration.registration_form.event = dummy_event
|
||||
PaypalPaymentPlugin.event_settings.set(dummy_event, 'business', 'test')
|
||||
request.form = {'business': business}
|
||||
request.form = formdata
|
||||
with PaypalPaymentPlugin.instance.plugin_context():
|
||||
assert rh._verify_business() == expected
|
||||
|
||||
|
||||
@ -111,9 +111,11 @@ class PiwikPlugin(IndicoPlugin):
|
||||
return {}
|
||||
params = {'site_id_events': site_id_events}
|
||||
if request.blueprint in ('event', 'events', 'contributions') and 'confId' in request.view_args:
|
||||
if not unicode(request.view_args['confId']).isdigit():
|
||||
return {}
|
||||
params['event_id'] = request.view_args['confId']
|
||||
contrib_id = request.view_args.get('contrib_id')
|
||||
if contrib_id is not None:
|
||||
if contrib_id is not None and unicode(contrib_id).isdigit():
|
||||
contribution = Contribution.find_first(event_id=params['event_id'], id=contrib_id)
|
||||
if contribution:
|
||||
cid = (contribution.legacy_mapping.legacy_contribution_id if contribution.legacy_mapping
|
||||
|
||||
@ -21,7 +21,7 @@ from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='indico-plugin-piwik',
|
||||
version='1.0rc1',
|
||||
version='1.0rc2',
|
||||
description='Piwik integration for global and event-specific statistics in Indico',
|
||||
url='https://github.com/indico/indico-plugins',
|
||||
license='https://www.gnu.org/licenses/gpl-3.0.txt',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user