Payment¶
Todo
Docstrings (module, models, plugins)
Models¶
-
exception
indico.modules.events.payment.models.transactions.
DoublePaymentTransaction
¶ Bases:
exceptions.Exception
-
exception
indico.modules.events.payment.models.transactions.
IgnoredTransactionAction
¶ Bases:
exceptions.Exception
-
exception
indico.modules.events.payment.models.transactions.
InvalidManualTransactionAction
¶ Bases:
exceptions.Exception
-
exception
indico.modules.events.payment.models.transactions.
InvalidTransactionAction
¶ Bases:
exceptions.Exception
-
exception
indico.modules.events.payment.models.transactions.
InvalidTransactionStatus
¶ Bases:
exceptions.Exception
-
class
indico.modules.events.payment.models.transactions.
PaymentTransaction
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Model
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
-
is_manual
¶
-
plugin
¶
-
provider
¶ the provider of the payment (e.g. manual, PayPal etc.)
-
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
¶ Bases:
int
,indico.util.struct.enum.IndicoEnum
-
cancel
= 2¶
-
complete
= 1¶
-
pending
= 3¶
-
reject
= 4¶
-
-
class
indico.modules.events.payment.models.transactions.
TransactionStatus
¶ Bases:
int
,indico.util.struct.enum.IndicoEnum
-
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
¶ Bases:
object
-
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 user - event – the
Event
- user – the
-
category
= u'Payment'¶
-
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
()¶
-
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.
-