PointsInput Class

Use this class to credit loyalty points to a loyalty program member’s balance or debit loyalty points from a loyalty program member’s balance. This class receives the input parameter values for the Credit and Debit point actions.

Namespace

LoyaltyManagement

Example

This example is to credit loyalty points to a member’s balance:
1public void creditPointsTest(){
2   //...Create a list with LoyaltyManagement.PointsInput as a datatype
3   List<LoyaltyManagement.PointsInput> creditPointsList = new List<LoyaltyManagement.PointsInput>();
4
5   //...Create an instance of the list object and set the input values 
6   creditPointsList.add(new LoyaltyManagement.PointsInputBuilder()
7      .setLoyaltyProgramMemberId('0lMRM0000002BD12AM')
8      .setProgramName('LP01')
9      .setProgramCurrencyName('Miles')
10      .setPoints(100)
11      .setJournalId('0lVRM0000004DH22AM')
12      .build());
13
14   //...Pass the list that contains the input values to the LoyaltyResources.creditPoints() function.
15   //...Store the output returned by the function in the CreditPointsOutput object
16   List<LoyaltyManagement.CreditPointsOutput> creditPointActionResults = LoyaltyManagement.LoyaltyResources.creditPoints(creditPointsList);
17   System.debug('Credit Successful Operation:'+ creditPointActionResults.get(0));
18}
This example is to debit loyalty points from a member’s balance:
1public void debitPointsTest(){
2   //...Create a list with LoyaltyManagement.PointsInput as a datatype
3   List<LoyaltyManagement.PointsInput> debitPointsList = new List<LoyaltyManagement.PointsInput>();
4
5   //...Create an instance of the list object and set the input values 
6   debitPointsList.add(new LoyaltyManagement.PointsInputBuilder()
7      .setLoyaltyProgramMemberId('0lMRM0000002BD12AM')
8      .setProgramName('LP01')
9      .setProgramCurrencyName('Miles')
10      .setPoints(1000)
11      .setJournalId('0lVRM0000004COB2A2')
12      .build());
13
14   //...Pass the list that contains the input values to the LoyaltyResources.debitPoints() function.
15   //...Store the output returned by the function in the DebitPointsOutput object
16   List<LoyaltyManagement.DebitPointsOutput> debitPointActionResults = LoyaltyManagement.LoyaltyResources.debitPoints(debitPointsList);
17   System.debug('Debit Successful Operation:'+ debitPointActionResults.get(0));
18}