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: Optional[polaris.integrations.transactions.DepositIntegration] = None, withdrawal: Optional[polaris.integrations.transactions.WithdrawalIntegration] = None, sep31_receiver: Optional[polaris.integrations.sep31.SEP31ReceiverIntegration] = None, rails: Optional[polaris.integrations.rails.RailsIntegration] = None, toml: Optional[Callable] = None, fee: Optional[Callable] = None, sep6_info: Optional[Callable] = None, customer: Optional[polaris.integrations.customers.CustomerIntegration] = None, quote: Optional[polaris.integrations.quote.QuoteIntegration] = 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, MyQuoteIntegration, toml_integration, fee_integrations, info_integration ) register_integrations( deposit=MyDepositIntegration(), withdrawal=MyWithdrawalIntegration(), customer=MyCustomerIntegration(), toml=toml_integration, sep6_info=info_integration, fee=fee_integration, quote=MyQuoteIntegration() )
Simply pass the integration classes or functions you use.
- Parameters
deposit – the
DepositIntegration
subclass instance to be used by Polariswithdrawal – the
WithdrawalIntegration
subclass instance to be used by Polarissep31_receiver – the
SEP31ReceiverIntegration
subclass instance to be used by Polarisrails – the
RailsIntegration
subclass instance to be used by Polaristoml – a function that returns stellar.toml data as a dictionary
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 Polarisquote – the
QuoteIntegration
subclass instance to be used by Polaris
- Raises
ValueError – missing argument(s)
TypeError – arguments are not subclasses of DepositIntegration or Withdrawal