Customize how additional Rewards are given as Rule outcomes
The FieloPLT.RuleRewarding interface includes two methods.
Grant Additional Rewarding (ruleRewarding)
void FieloPLT.RuleRewarding.reflectionRewarding (List<FieloPLT__Transaction__c> transactions)
This lets you extend how you grant Rewards as outcomes of Promotion Rules. The class in which you implement this interface can then be selected as Additional Rewarding.
Parameters
| Parameter | Type | Description |
|---|---|---|
| transactions | List<FieloPLT__Transaction__c> | List of Transactions |
Grant Additional Rewarding (ruleRewarding)
- Check below an example of how the API can be used:
global with sharing class CustomRewardingClass implements
FieloPLT.RuleRewarding{
global void reflectionRewarding(List<FieloPLT__Transaction__c> transactions){
List<DiscountCard__c> discountcards = new List<DiscountCard__c>();
for(FieloPLT__Transaction__c t : transactions){
discountcards.add( new DiscountCard__c(Member__c = t.FieloPLT__Member__c, Discount__c = t.Points__c, Transaction__c = t.Id) );
}
insert discountcards;
}
}Return Value
| Type | Description |
|---|---|
| Void | Void. |
Revert Additional Rewarding (revertRewarding)
void FieloPLT.RuleRewarding.revertRewarding (List<FieloPLT__Transaction__c> transactions)
This lets you revert the custom, additional Rewards you have chosen as an outcome of a Rule.
Parameters
| Parameter | Type | Description |
|---|---|---|
| transactions | List<FieloPLT__Transaction__c> | List of Transactions |
Get Member (getMember)
- Check below an example of how the API can be used:
global void revertRewarding(List<FieloPLT__Transaction__c> transactions){
Set<Id> discountCardIds = new Set<Id>();
for(FieloPLT__Transaction__c t : transactions){
discountCardIds.add(t.Id);
}
List<DiscountCard__c> discountcards = [Select Id, Transaction__c, Status__c From DiscountCard__c Where Id In: discountCardIds];
for(DiscountCard__c dc : discountcards){
dc.Status__c = 'Reverted';
}
update discountcards;
}Return Value
| Type | Description |
|---|---|
| Void | Void. |
