Skip to main content

Recon Service

The recon service is responsible for how funds are disbursed in reOS. It coordinates what state invoices should be in based on funds available on customers wallet. As well as this it allows nudging credit noting and viewing an activity log for the account.

Listeners

The recon service listens to the following services

  • Party Service
  • Portfolio Service
  • Property Service
  • Invoice Service
  • Wallet Service
  • Banking Service

All services apart from the Wallet and Banking service are really just inserting entries into databases. The core business logic resides with the wallet listener and how assets being transferred moves invoices into various states. What is interesting to note is we do not store the customers available funds on the Recon Entity itself, too many events would take place if we went this route which would polute the entity. Instead we use a table to store the funds and move the invoices to various states.

Workflow

Invoices can be in any of the following states:

  • Pipeline: No funds available but due date has not been reached
  • Overdue: No funds available and due date is in the past
  • Not Set: Invoice has no payment rules
  • Short: Funds are available but not enough to settle all invoices
  • Ready: Fudns available and all invoices can be settled

Refresh Invoices happens anytime an invoice is updated, we will grab all the customers open invoices and move them accordingly.

sequenceDiagram participant A as UI participant L as Listener participant E as Entity participant R as Readside participant C as Connector participant T as Topic note over A,T: Asset Transferred L->>C: Insert Activity L->>C: Update available funds alt Refresh Invoice L->>+C: Fetch open invoices for customer C->>-L: Seq(Invoice) note right of L: Recalc Invoices L->>C: Update all invoices end note over A,T: Payments Approved A->>E: ApprovePayments alt has available funds E->>A: Done else E->>A: Error with Reason end E-->>R: PaymentsApproved E-->>T: Payments Approved event emitted R->>C: Insert Activity R->>C: Update party account balance* R->>C: Refresh Invoices note over A,T: Credit Note A->>E: IssueCreditNote alt can credit note E->>A: Done else E->>A: Error with Reason end E-->>R: CreditNoteIssued E-->>T: CreditNoteIssued event emitted R->>C: Insert Activity R->>C: Refresh Invoices note over A,T: Nudge tenant A->>E: NudgeBuyer E-->>T: User Nudge event emitted
  • We temporarily update the customers available funds. We then pick up the available funds a few seconds later from the AssetTransferred event

Schedulers

  • Overdue invoice scheduler: Goes through all invoices that are overdue and emits a UserNudged event for the e-mail service to pick up and send.