CRM integration
context donate-static#111
this issue is to coordinate the design and implementation of the civicrm data layer in donate-neo. the planned design is to have donate-neo use the civicrm REST api over a secure connection (like an ssh tunnel).
data needs to flow from civi to django; for things like active perks, YEC total, etc. the work for this is currently in the civicrm-integration
branch.
the civi integration is being accomplished with a repository pattern. a main CivicrmRepositoryProtocol
interface defines the methods for retrieving data from civi (currently just get_active_perks
and get_yec_total
). all of these methods are asynchronous; django isn't completely async-ready yet, but making these methods async gives us an easy upgrade path. a WithSyncMeta
metaclass adds synchronous versions of the async methods, using asgiref.sync.async_to_sync
, so that calling code doesn't need to do the heavy lifting of wrapping these asynchronous methods.
a CivicrmRepositoryMock
class provides a mock implementation of the civi repository interface for testing, until i can work with @mathieu to set up an implementation that uses the REST API