Processors are a set of functions used by the engagement service for determining criteria, setting state and/or calling methods from others services for a certain entity. These functions utilize parameters which are saved as Map<String, Any>
in the database.
Parameter Processor
Parameter Processors are used for the Completion Definition
of a mission. This is used by the engagement service to determine whether a mission has been completed or not (checkChallengesCompletion
method calls the canMissionBeCompleted
). The ProcessorService
is responsible for calling the appropriate processor to check for a mission’s completion.
Abstract Class Methods:
process(events: List<CustomerEvent>, parameters: Map<String, Any>): Boolean
Parameters:
events: List<CustomerEvent>
The list of customer events used to check if the mission has been completed. The processor also uses the parameters saved in the
CustomerEvent
entity when necessary.
parameters: Map<String, Any>
Parameters of the
CompletionDefinition
which are utilized by the processor to check if the required criteria has been met (e.g.minValue
parameter in theSumUpProcessor
is used to check if the summed parameters reach the minimum value required by the processor).
Processors
Processor types can be found in https://safibank.atlassian.net/wiki/spaces/ITArch/pages/221547439/Data+Models#ProcessorType
AlwaysTrueProcessor
Always returns true.
Used for the onboarding challenge/mission, and is called on the user’s onboarded event.
CounterProcessor
Counts the number of times a user event occurred and compares it to the required
targetCount
for completion.processorParameters:
eventTypes: String
- Space separated customer events to consider in counting. (e.g."TOPUP_BANK TOPUP_CASH TOPUP_DEBIT_CARD TOPUP_EWALLET"
).targetCount: Int
- Required count for completion.
SumUpProcessor
Sums up a certain parameter of a user event and checks if it meets the
minValue
needed for completion.processorParameters:
eventTypes: String
- Space separated customer events to consider in counting. (e.g."TOPUP_BANK TOPUP_CASH TOPUP_DEBIT_CARD TOPUP_EWALLET"
).parameterToSum: String
- The parameter in the customer event that will be used for summing.minValue: String | BigDecimal
- The minimum value needed for the sum.
CashInProcessor
Checks if a user cash-in event reaches the
minValue
amount needed for completion.processorParameters:
minAmount: String | BigDecimal
- The minimum value needed for the sum.
TopUpProcessor
Checks if a user top-up event reaches the
minValue
amount needed for completion.processorParameters:
minAmount: String | BigDecimal
- The minimum value needed for the sum.
BillPaymentProcessor
Checks if a user bill-payment event reaches the
minValue
amount needed for completion.processorParameters:
minAmount: String | BigDecimal
- The minimum value needed for the sum.
Reward Processor
Reward Processors are used for the claiming and deactivating of a reward if it is available.
Abstract Class Methods:
claimReward(customerReward: CustomerReward, customerChallenge: CustomerChallenge): CustomerReward
deactivateReward(customerReward: CustomerReward): CustomerReward
Parameters:
customerReward: CustomerReward
The customer reward entity to be used for the claiming/deactivating of a reward.
The parameters in the customer reward is needed for certain processors (e.g.
accountId
for theBonusInterestProcessor
).
customerChallenge: CustomerChallenge
The customer challenge related to the reward.
Contains the
customerId
.Used to get the parameters of the reward itself in
CustomerChallenge.Reward
(e.g.validInterval
for setting the validity period of the reward)
Processors
Reward processor types can be found in https://safibank.atlassian.net/wiki/spaces/ITArch/pages/221547439/Data+Models#RewardProcessorType
BonusInterestProcessor
Sets or removes bonus interest in a user's account.
If no
accountId
is provided in the customer reward parameters the processor will select the account with the highest balance.Reward parameters:
bonusInterest: String | BigDecimal
- The amount of interest to add/remove for the reward.
Customer reward parameters:
accountId: UUID
- The account that will be given the bonus interest.
BonusOperationsProcessor
Adds bonus transactions in a user's subscription.
Reward parameters:
validInterval: Map<*, *>
- The interval that the reward will be valid until.
Customer reward parameters:
(key: BonusOperationType, value: Int)
- The operation (key) and the count (value) that will be given for the reward.
FreeSubscriptionProcessor
Applies free subscription for a user.
Reward parameters:
SUBSCRIPTION: Int
- The number of months of free subscription to give for the reward.