Registering Integrations¶
In order for Polaris to use the integration classes and functions you’ve defined, you must register them.
-
polaris.integrations.
register_integrations
(deposit: polaris.integrations.transactions.DepositIntegration = None, withdrawal: polaris.integrations.transactions.WithdrawalIntegration = None, sep31_receiver: polaris.integrations.sep31.SEP31ReceiverIntegration = None, rails: polaris.integrations.rails.RailsIntegration = None, toml: Callable = None, scripts: Callable = None, fee: Callable = None, sep6_info: Callable = None, customer: polaris.integrations.customers.CustomerIntegration = None)[source]¶ Registers the integration classes and functions with Polaris
Call this function in your app’s Django AppConfig.ready() function:
from django.apps import AppConfig class PolarisIntegrationApp(AppConfig): name = 'Polaris Integration' verbose_name = name def ready(self): from polaris.integrations import register_integrations from myapp.integrations import ( MyDepositIntegration, MyWithdrawalIntegration, MyCustomerIntegration, toml_integration, fee_integrations, scripts_integration, info_integration ) register_integrations( deposit=MyDepositIntegration(), withdrawal=MyWithdrawalIntegration(), customer=MyCustomerIntegration(), toml=toml_integration, scripts=scripts_integration, sep6_info=info_integration, fee=fee_integration )
Simply pass the integration classes or functions you use.
Parameters: - deposit – the
DepositIntegration
subclass instance to be used by Polaris - withdrawal – the
WithdrawalIntegration
subclass instance to be used by Polaris - sep31_receiver – the
SEP31ReceiverIntegration
subclass instance to be used by Polaris - rails – the
RailsIntegration
subclass instance to be used by Polaris - toml – a function that returns stellar.toml data as a dictionary
- scripts – a function that returns a list of script tags as strings
- fee – a function that returns the fee that would be charged
- sep6_info – a function that returns the /info fields or types values for an Asset
- customer – the
CustomerIntegration
subclass instance to be used by Polaris
Raises: - ValueError – missing argument(s)
- TypeError – arguments are not subclasses of DepositIntegration or Withdrawal
- deposit – the