Manage requests related to loyalty program and interactions between the application and the APIs. The LoyaltyAPIManager class manages requests related to loyalty programs using the Force API and manages authentication by using the instance of ForceAuthenticator that was injected at the time of initialization. Use this class to manage asynchronous requests by using Retrofit and Kotlin coroutines.
LoyaltyAPIManager
1public final class LoyaltyAPIManager
Method Summary
Method
Description
enrollInPromotions
Enroll a loyalty member to a promotion, while asynchronously sending data to the Enroll for Promotions API.
getEligiblePromotions
Get promotions that a member is eligible to enroll for.
getMemberBenefits
Retrieve the benefits associated with a loyalty program member for the specified API version, while asynchronously requesting data from the Member Benefits API.
getMemberProfile
Get the profile details of a loyalty program member by using this code.
getTransactions
Get transaction journals of a loyalty member. Obtain either accrual or redemption transaction journal records.
getVouchers
Retrieve the vouchers issued to a loyalty member by using this code.
postEnrollment
Enroll a member to a loyalty program, while asynchronously sending data to the Individual Member Enrollments API.
unEnrollPromotion
Opt out a loyalty member from a promotion.
enrollInPromotions Method
Enroll a loyalty member to a promotion, while asynchronously sending data to the Enroll for Promotions API. Use this code to enroll a member.
The identifier of the member whose eligible promotions are being retrieved.
Optional
memberShipNumber
String
The membership number of the loyalty program member.
Required
getMemberBenefits Method
Retrieve the benefits associated with a loyalty program member for the specified API version, while asynchronously requesting data from the Member Benefits API. Use this code to get member benefits.
Identifier of the member whose profile is being retrieved.
Optional
memberShipNumber
String
The membership number of the loyalty program member.
Required
programCurrencyName
String
The name of the loyalty program currency associated with the member.
Optional
getTransactions Method
Get transaction journals of a loyalty member. Obtain either accrual or redemption transaction journal records. Use this code to get transactions.
final Result<MemberBenefitsResponse> getMemberBenefits(String memberId, String membershipNumber)
Parameter
Type
Description
Required or Optional
journalSubTypeName
String
The subtype of the transaction journal record.
Optional
journalTypeName
String
The type of the transaction journal record. Possible values are Accrual or Redemption.
Optional
pageNumber
Integer
The page number to be returned. If you don’t specify a value, the first page is returned. Each page contains 200 transactions, sorted by their date of creation.
Optional
memberShipNumber
String
The membership number of the loyalty program member.
Required
periodStartDate
String
Retrieve transaction journals starting on this date.
Optional
periodEndDate
String
Retrieve transaction journals until this date.
Optional
getVouchers Method
Retrieve the vouchers issued to a loyalty member by using this code.
This table shows the parameters in the getVouchers method.
Parameter
Description
membershipNumber
Membership number of the member whose vouchers are being retrieved.
voucherStatus
The status of a voucher.
pageNumber
Number of the page you want returned. If you don’t specify a value, the first page is returned. By default, each page contains 200 vouchers, which are sorted based on the voucher creation date.
productId
The ID of the product related to the vouchers that you want to retrieve. You can specify the ID of up to 20 products.
productCategoryId
The ID of the product categories related to the vouchers that you want to retrieve. You can specify the ID of up to 20 product categories.
productName
The product name related to the voucher.
productCategoryName
The name of the product categories related to the vouchers that you want to retrieve. You can specify the ID of up to 20 product category names.
postEnrollment Method
Enroll a member to a loyalty program, while asynchronously sending data to the Individual Member Enrollments API. Use this code to enroll a member.