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, send: polaris.integrations.sep31.SendIntegration = None, rails: polaris.integrations.rails.RailsIntegration = None, toml_func: Callable = None, scripts_func: Callable = None, fee_func: Callable = None, info_func: 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_func=toml_integration, scripts_func=scripts_integration, info_func=info_integration, fee_func=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 - send – the
SendIntegration
subclass instance to be used by Polaris - rails – the
RailsIntegration
subclass instance to be used by Polaris - toml_func – a function that returns stellar.toml data as a dictionary
- scripts_func – a function that returns a list of script tags as strings
- fee_func – a function that returns the fee that would be charged
- info_func – 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