def _process(self): event = self._conf methods = get_payment_plugins() enabled_methods = [method for method in methods.itervalues() if method.event_settings.get(event, 'enabled')] return WPPaymentEventManagement.render_template('management/payments.html', event, event=event, settings=event_settings.get_all(event), methods=methods.items(), enabled_methods=enabled_methods)
def _process(self): event = self._conf currencies = {c['code']: c['name'] for c in settings.get('currencies')} plugins = get_payment_plugins() enabled_plugins = [plugin for plugin in plugins.itervalues() if plugin.event_settings.get(event, 'enabled')] return WPPaymentEventManagement.render_template('event_settings.html', event, event=event, settings=event_settings.get_all(event), currencies=currencies, plugins=plugins.items(), enabled_plugins=enabled_plugins)
def _process(self): form = AdminSettingsForm(obj=FormDefaults(**settings.get_all())) if form.validate_on_submit(): settings.set_multi(form.data) flash(_('Settings saved'), 'success') return redirect(url_for('.admin_settings')) return WPPaymentAdmin.render_template( 'admin_settings.html', form=form, plugins=get_payment_plugins().values())
def _process(self): event = self._conf enabled = request.form['enabled'] == '1' if enabled and not get_payment_plugins(): flash(_('There are no payment methods available. Please contact your Indico administrator.'), 'error') return redirect(url_for('.event_settings', event)) if event_settings.get(event, 'enabled', None) is None: copy_settings = {'currency', 'conditions', 'register_email', 'success_email'} data = {k: v for k, v in settings.get_all().iteritems() if k in copy_settings} event_settings.set_multi(event, data) event_settings.set(event, 'enabled', enabled) return redirect(url_for('.event_settings', event))
def _process(self): event = self._conf currencies = {c['code']: c['name'] for c in settings.get('currencies')} plugins = get_payment_plugins() enabled_plugins = [ plugin for plugin in plugins.itervalues() if plugin.event_settings.get(event, 'enabled') ] return WPPaymentEventManagement.render_template( 'event_settings.html', event, event=event, settings=event_settings.get_all(event), currencies=currencies, plugins=plugins.items(), enabled_plugins=enabled_plugins)
def _process(self): event = self._conf enabled = request.form['enabled'] == '1' if enabled and not get_payment_plugins(): flash( _('There are no payment methods available. Please contact your Indico administrator.' ), 'error') return redirect(url_for('.event_settings', event)) if event_settings.get(event, 'enabled', None) is None: copy_settings = { 'currency', 'conditions', 'register_email', 'success_email' } data = { k: v for k, v in settings.get_all().iteritems() if k in copy_settings } event_settings.set_multi(event, data) event_settings.set(event, 'enabled', enabled) return redirect(url_for('.event_settings', event))
def _checkParams(self, params): RHConferenceModifBase._checkParams(self, params) try: self.plugin = get_payment_plugins()[request.view_args['method']] except KeyError: raise NotFound
def _process(self): form = AdminSettingsForm(obj=FormDefaults(**settings.get_all())) if form.validate_on_submit(): settings.set_multi(form.data) flash(_('Settings saved'), 'success') return redirect(url_for('.admin_settings')) return WPPaymentAdmin.render_template('admin_settings.html', form=form, plugins=get_payment_plugins().values())
def plugin(self): from indico.modules.payment.util import get_payment_plugins return get_payment_plugins().get(self.provider)
def _checkParams(self, params): RHPaymentManagementBase._checkParams(self, params) try: self.plugin = get_payment_plugins()[request.view_args['method']] except KeyError: raise NotFound