Payment¶
Todo
Docstrings (module, models, plugins)
Models¶
- exception indico.modules.events.payment.models.transactions.DoublePaymentTransaction¶
- exception indico.modules.events.payment.models.transactions.IgnoredTransactionAction¶
- exception indico.modules.events.payment.models.transactions.InvalidManualTransactionAction¶
- exception indico.modules.events.payment.models.transactions.InvalidTransactionAction¶
- exception indico.modules.events.payment.models.transactions.InvalidTransactionStatus¶
- class indico.modules.events.payment.models.transactions.PaymentTransaction(**kwargs)¶
Payment transactions.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- amount¶
the base amount the user needs to pay (without payment-specific fees)
- classmethod create_next(registration, amount, currency, action, provider=None, data=None)¶
- currency¶
the currency of the payment (ISO string, e.g. EUR or USD)
- data¶
plugin-specific data of the payment
- id¶
Entry ID
- property is_manual¶
- is_pending_expired()¶
- property plugin¶
- provider¶
the provider of the payment (e.g. manual, PayPal etc.)
- query: IndicoBaseQuery¶
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- registration¶
The associated registration
- registration_id¶
ID of the associated registration
- render_details()¶
Render the transaction details.
- status¶
- timestamp¶
the date and time the transaction was recorded
- class indico.modules.events.payment.models.transactions.TransactionAction(value)¶
An enumeration.
- cancel = 2¶
- complete = 1¶
- pending = 3¶
- reject = 4¶
- class indico.modules.events.payment.models.transactions.TransactionStatus(value)¶
An enumeration.
- cancelled = 2¶
payment cancelled manually
- failed = 3¶
payment attempt failed
- pending = 4¶
payment on hold pending approval of merchant
- rejected = 5¶
payment rejected after being pending
- successful = 1¶
payment attempt succeeded
Utilities¶
- indico.modules.events.payment.util.get_active_payment_plugins(event)¶
Return a dict containing the active payment plugins of an event.
- indico.modules.events.payment.util.get_payment_plugins()¶
Return a dict containing the available payment plugins.
- indico.modules.events.payment.util.register_transaction(registration, amount, currency, action, provider=None, data=None)¶
Create a new transaction for a certain transaction action.
- Parameters:
registration – the Registration associated to the transaction
amount – the (strictly positive) amount of the transaction
currency – the currency used for the transaction
action – the TransactionAction of the transaction
provider – the payment method name of the transaction, or ‘_manual’ if no payment method has been used
data – arbitrary JSON-serializable data specific to the transaction’s provider
Plugins¶
- class indico.modules.events.payment.plugins.PaymentPluginMixin¶
- adjust_payment_form_data(data)¶
Update the payment form data if necessary.
This method can be overridden to update e.g. the amount based on choices the user makes in the payment form or to provide additional data to the form. To do so, data must be modified.
- Parameters:
data – a dict containing event, registration, amount, currency, settings and event_settings
- can_be_modified(user, event)¶
Check if the user is allowed to enable/disable/modify the payment method.
- Parameters:
user – the
User
repesenting the userevent – the
Event
- category = 'Payment'¶
- property default_settings¶
- event_settings_form¶
alias of
PaymentEventSettingsFormBase
- get_event_management_url(event, **kwargs)¶
- get_invalid_regforms(event)¶
Return registration forms with incompatible currencies.
- get_method_name(event)¶
Return the (customized) name of the payment method.
- init()¶
- is_pending_transaction_expired(transaction)¶
Check if the transaction is pending but expired.
If this returns true, it will show up as unpaid instead of pending for the user and they can proceed to payment once again.
- property logo_url¶
- render_payment_form(registration)¶
Return the payment form shown to the user.
- Parameters:
registration – a
Registration
object
- render_transaction_details(transaction)¶
Render the transaction details in event management.
Override this (or inherit from the template) to show more useful data such as transaction IDs
- Parameters:
transaction – the
PaymentTransaction
- settings_form¶
alias of
PaymentPluginSettingsFormBase
- supports_currency(currency)¶
- valid_currencies = None¶
Set containing all valid currencies. Set to None to allow all.