-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #885 from ostelco/feature/refactor-appnotify
Refactors application notifier by moving the building of the notification message to one place
- Loading branch information
Showing
4 changed files
with
105 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 25 additions & 2 deletions
27
prime-modules/src/main/kotlin/org/ostelco/prime/appnotifier/AppNotifier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,29 @@ | ||
package org.ostelco.prime.appnotifier | ||
|
||
/* Prime specific notification types. */ | ||
enum class NotificationType { | ||
JUMIO_VERIFICATION_SUCCEEDED, | ||
JUMIO_VERIFICATION_FAILED, | ||
} | ||
|
||
interface AppNotifier { | ||
fun notify(customerId: String, title: String, body: String) | ||
fun notify(customerId: String, title: String, body: String, data: Map<String, String>) | ||
|
||
/** | ||
* Prime specific interface for sending notification messages to | ||
* customers/clients. | ||
* @param notificationType Type of notification to be sent. | ||
* @param customerId Id of the receipient/customer. | ||
* @param data Additional data to be added to the message if any. | ||
*/ | ||
fun notify(notificationType: NotificationType, customerId: String, data: Map<String, Any> = emptyMap()) | ||
|
||
/** | ||
* Low level interface for sending notification messages to | ||
* customers/clients. | ||
* @param customerId Id of the customer to receive the notification. | ||
* @param title The 'title' part of the notification. | ||
* @param body The message part of the notification. | ||
* @param data Additional data to be added to the message if any. | ||
*/ | ||
fun notify(customerId: String, title: String, body: String, data: Map<String, Any> = emptyMap()) | ||
} |