diff --git a/payment_manual/README.md b/payment_manual/README.md index 372763a..ea4a5f6 100644 --- a/payment_manual/README.md +++ b/payment_manual/README.md @@ -8,6 +8,10 @@ integration with Indico. ## Changelog +### 3.1 + +- Add placeholders for the registration form id and the registration's database id + ### 3.0 - Initial release for Indico 3.0 diff --git a/payment_manual/indico_payment_manual/placeholders.py b/payment_manual/indico_payment_manual/placeholders.py index 624f50a..60073a6 100644 --- a/payment_manual/indico_payment_manual/placeholders.py +++ b/payment_manual/indico_payment_manual/placeholders.py @@ -55,6 +55,24 @@ class RegistrationIDPlaceholder(IDPlaceholder): name = 'registration_id' +class RegistrationDatabaseIDPlaceholder(Placeholder): + name = 'registration_db_id' + description = _("The database ID of the registration") + + @classmethod + def render(cls, regform, registration): + return registration.id + + +class RegistrationFormIDPlaceholder(Placeholder): + name = 'registration_form_id' + description = _("The ID of the registration form") + + @classmethod + def render(cls, regform, registration): + return registration.registration_form.id + + class EventIDPlaceholder(Placeholder): name = 'event_id' description = _("The ID of the event") diff --git a/payment_manual/indico_payment_manual/plugin.py b/payment_manual/indico_payment_manual/plugin.py index e8ce0df..f0b0c82 100644 --- a/payment_manual/indico_payment_manual/plugin.py +++ b/payment_manual/indico_payment_manual/plugin.py @@ -64,11 +64,14 @@ class ManualPaymentPlugin(PaymentPluginMixin, IndicoPlugin): def _get_details_placeholders(self, sender, regform, registration, **kwargs): from indico_payment_manual.placeholders import (CurrencyPlaceholder, EmailPlaceholder, EventIDPlaceholder, FirstNamePlaceholder, LastNamePlaceholder, PricePlaceholder, - RegistrationIDPlaceholder) + RegistrationDatabaseIDPlaceholder, + RegistrationFormIDPlaceholder, RegistrationIDPlaceholder) yield FirstNamePlaceholder yield LastNamePlaceholder yield EmailPlaceholder yield RegistrationIDPlaceholder + yield RegistrationDatabaseIDPlaceholder + yield RegistrationFormIDPlaceholder yield EventIDPlaceholder yield PricePlaceholder yield CurrencyPlaceholder diff --git a/payment_manual/setup.cfg b/payment_manual/setup.cfg index 3cf616a..e979f56 100644 --- a/payment_manual/setup.cfg +++ b/payment_manual/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = indico-plugin-payment-manual -version = 3.0 +version = 3.1 description = Payment plugin for Indico that can be used for custom payment information/links long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8; variant=GFM @@ -20,7 +20,7 @@ zip_safe = false include_package_data = true python_requires = ~=3.9.0 install_requires = - indico>=3.0 + indico>=3.1 [options.entry_points] indico.plugins =