Implementation references
Example Connectors
Presumably the ATM connector will be an incoming connector, so the stellar-connector is probably of more use
https://github.com/openMF/stellar-connector (incoming and outgoing)
https://github.com/mgeiss/mifos-twilio-bridge (outgoing)
Tool Reference
jPOS documentation: http://jpos.org/doc/proguide-draft.pdf (Keep in mind that jPOS is GPL – you'll need to open source your connector, and you'll need to do so as GPL)
MifosX API docs: https://demo.openmf.org/api-docs/apiLive.htm
Use Cases
Inquiries (synchronous)
→ return balance
Authorize (synchronous)
→ if authorization is provided, book money into an auxiliary account. To provide authorization examine customer's main account minus this auxiliary account.
Deposit (asynchronous?)
Settle (asynchronous?)
→ Book balance out of auxiliary account and the customer's main account.
Installation:
→ Start and configure service
→ Create an ATM bridge for a tenant
Implementation
Create a REST service using spring
Save any residual data in a database
Create a REST controller which accepts the calls to create a bridge for a tenant.
- example: https://github.com/openMF/stellar-connector/blob/master/src/main/java/org/fineract/module/stellar/controller/BridgeController.java (createStellarBridgeConfiguration)
If necessary create an intermediate data store so that asynchronous requests can be retried.
Use retrofit to call MifosX interface to perform the bookings.
example of asynchronous event handling
jPOS listener saves transaction to transaction DB
- example: https://github.com/openMF/stellar-connector/blob/master/src/main/java/org/fineract/module/stellar/horizonadapter/HorizonServerEffectsListener.java (savePaymentEvent)
creates event using ApplicationEventPublisher
- example: https://github.com/openMF/stellar-connector/blob/master/src/main/java/org/fineract/module/stellar/horizonadapter/HorizonServerEffectsListener.java (handleOperation)
event listener reads from transaction DB, increments try count
- example: https://github.com/openMF/stellar-connector/blob/master/src/main/java/org/fineract/module/stellar/listener/FineractPaymentEventListener.java
- note: that retry synchronizer is going to be very useful...
creates journal entries to settle accounts.
- (using retrofit as described above)
regularly check for unprocessed events in order to retry