I’m sharing on-list some of the guidance Ebenezer provided on extending the notifications microservice he built to support some of the specific use cases related to generating and responding to FCM notifications.
I believe we discussed back in June on how best we can implement a feature like this but that all the same let’s give it another try. Firstly, the fineract-cn-notification service is only designed to subscribe to the topics in the message broker and respond accordingly. Whatever service that works with the Mojaloop/Payment Hub must create a topic and push payment events into it as they happen. If no service directly works with Mojaloop then we can look at other alternatives. But assuming that is the case. Then the notification service can subscribe to the “mojaloop events” assuming the payload which comes has all the details required to trigger a push notification.
Secondly, the APIs are not designed to trigger notifications but only to interface with the Web App for configuration purposes eg: setting FCM configuration details as Fineract CN is a multi-tenant application. Having Endpoints to trigger notifications is not the intended design. Every action that requires a notification must come from one of the services in Fineract CN eg: customer, portfolio etc. It will be tedious to implement something outside this design pattern and I wouldn’t recommend it.
[Ed]: So for this use case of a merchant-initiated payment and a request to pay to a customer - the notification would be coming/going to the customer and/or deposit microservice?
Suppose we must implement an API just to trigger the FCM we will need to discuss this with other experienced Fineract CN committers to assess the best way to do this. And even if we’re to go ahead with an API endpoint approach, the notification service can only implement the Firebase API required to send a push notification but each request must come with the needed details i.e device token, message, data and Tenant ID to know which FCM configuration to use.
Once we have a topic in the message broker which sends payment payloads from mojaloop we can implement the FCM. Please let me know if something like this exists.
Please let me know if this help.