def _process_args(self): RHPaymentBase._process_args(self) if 'sixpay' not in get_active_payment_plugins(self.event): raise NotFound if not SixpayPaymentPlugin.instance.supports_currency( self.registration.currency): raise BadRequest
def _process_args(self): RHPaymentBase._process_args(self) try: self.plugin = get_active_payment_plugins(self.event)[request.args['method']] except KeyError: raise NotFound if not self.plugin.supports_currency(self.registration.currency): raise BadRequest("Payment method incompatible with registration currency {}" .format(self.registration.currency))
def _checkParams(self, params): RHPaymentBase._checkParams(self, params) try: self.plugin = get_active_payment_plugins(self.event_new)[request.args['method']] except KeyError: raise NotFound if not self.plugin.supports_currency(self.registration.currency): raise BadRequest("Payment method incompatible with registration currency {}" .format(self.registration.currency))
def _process(self): if self.registration.state != RegistrationState.unpaid: flash(_("The registration doesn't need to be paid"), 'error') return redirect(url_for('event_registration.display_regform', self.registration.locator.registrant)) plugins = get_active_payment_plugins(self.event) valid_plugins = {k: v for k, v in plugins.iteritems() if v.supports_currency(self.registration.currency)} force_plugin = valid_plugins.items()[0] if len(valid_plugins) == 1 else None # only one plugin available return WPPaymentEvent.render_template('event_checkout.html', self.event, registration=self.registration, regform=self.registration.registration_form, plugins=valid_plugins.items(), force_plugin=force_plugin)
def _process(self): if self.registration.state != RegistrationState.unpaid: flash(_("The registration doesn't need to be paid"), 'error') return redirect(url_for('event_registration.display_regform', self.registration.locator.registrant)) plugins = get_active_payment_plugins(self.event_new) valid_plugins = {k: v for k, v in plugins.iteritems() if v.supports_currency(self.registration.currency)} force_plugin = valid_plugins.items()[0] if len(valid_plugins) == 1 else None # only one plugin available return WPPaymentEvent.render_template('event_checkout.html', self._conf, event=self.event_new, registration=self.registration, regform=self.registration.registration_form, plugins=valid_plugins.items(), force_plugin=force_plugin)