HomeGuidesDeveloper HubRelease Notes
Get supportBook a chat
Developer Hub
These docs are for v2.152. Click to read the latest docs for v2.208.

FieloPLT.TransactionAPI Class

Generally used for the My Transactions component, the FieloPLT.TransactionAPI Class includes one method.

Get Transaction (getTransactions)

List<FieloPLT__Transaction__c> FieloPLT.TransactionAPI.getTransactions(Map<String, Set<String>> fieldsMap, Set<Id> transactionIds, Id memberId, Integer quantity, Integer offset, String orderBy, String dynamicFilter)

Returns information about the transactions from a particular Member, such as its amount and type, allowing the Member to keep track of the transaction that they received. It also allows Transaction filtering based on specific information you need to obtain (e.g. you need to get Transactions from a specific Program).

The difference between this method and the FieloPLT.TransactionService Class is that the TransactionAPI includes a new parameter that allows you to send a map defining the fields that you want to recover, from a greater range of objects. This method also makes it possible to recover data from a specific set of transactions.

Take a look at a step by step guide on how to use this method.

Parameters

Check an example of how the API can be used below and a definition of its parameters right after:

Set<String> fieldsTransactions = new Set<String>{'Id', 'Name', 'FieloPLT__Date__c'};	        
Set<String> fieldsPoint = new Set<String>('Id');
Set<String> fieldsRedemption = new Set<String>('Id');
Set<String> fieldsBadgeMember = new Set<String>('Id');
Set<String> fieldsRevertedTransaction = new Set<String>('Id');

Map<String, Set<String>> fieldsMap = new Map<String, Set<String>>();
fieldsMap.put('transaction',fieldsTransactions);
fieldsMap.put('point',fieldsPoint);
fieldsMap.put('redemption',fieldsRedemption);
fieldsMap.put('badgemember',fieldsBadgeMember);
fieldsMap.put('revertedtransaction',fieldsRevertedTransaction);

List<Id> transactionIds = new List<Id>(); //Empty to get all members transactions
Id memberId = [SELECT Id FROM FieloPLT__Member__c LIMIT 1].Id;
Integer quantity = 10;
Integer offset = 0;
String orderBy = 'Name';
String dynamicFilter = null;

TransactionAPI.getTransactions(fieldsMap,transactionIds,memberId,quantity,offset,orderBy,dynamicFilter);
ParameterTypeDescriptionRequired
fieldsMapMap<String, Set<String>>Define a map with the API names of the fields from the Transaction, Point, Redemption, Badge Member and Revert Transaction Objects that you want to be returned. The key is the Object's name.No
transactionIdsSet<Id>Set of transaction IDs to return in the response. If null, returns all transactions that belong to the member.No
memberIdIdID from a specific member.Yes
quantityIntegerThe quantity of transactions that must be returned.No
offsetIntegerNumber of records from a collection to skip.No
orderByStringRecords returned in an ascending or descending order.No
dynamicFilterStringJSON parameter to filter by an additional WHERE Clause. When null, no filter is applied.No

Return Value

Take a look below at an example of what is returned in the call and a definition of the return values right after:

List<FieloPLT__Transaction__c>
[{"attributes":{"type":"FieloPLT__Transaction__c","url":"/services/data/v51.0/sobjects/FieloPLT__Transaction__c/a151k000001PlvbAAC"},"Id":"a151k000001PlvbAAC","Name":"T-0100000","FieloPLT__Date__c":"2021-03-22T00:00:00.000+0000"}]
TypeDescription
List<FieloPLT__Transaction__c>A list of the member's transactions.

Exception

Errors can occur when you use the endpoint. See below the exception that you can receive when using the TransactionAPI:

TypeDescription
FieloApiException
  • Parameter {memberid} is necessary.* When Member ID is either invalid or empty.