Reference / @getenginex/sdk-igaming / LoyaltyApi
LoyaltyApi
The player's loyalty (points and tier). Both methods require login.
Methods
get()
get(
params?,options?):Promise<LoyaltyStatus>
The player's points balance, tier and benefits.
Parameters
params?
options?
Returns
Promise<LoyaltyStatus>
Example
const loyalty = await igaming.loyalty.get()
console.log(loyalty.currentPoints, loyalty.currentTier, loyalty.tierBenefits)Throws
UNAUTHENTICATED without a session. With validation: 'strict', VALIDATION_ERROR if tier_benefits_json is not a JSON object.
redeem()
redeem(
input,options?):Promise<RedeemedPoints>
Exchanges points for a bonus, cash or a free bet. It sends Idempotency-Key (generated per call or the one in options.idempotencyKey, kept on the retry after renewing the session), but the gateway does not apply the idempotency middleware on this route yet: a double click may redeem twice. Lock the button until the call finishes.
Parameters
input
options?
Returns
Promise<RedeemedPoints>
Example
const result = await igaming.loyalty.redeem({ points: 500, redemptionType: 'bonus' })
console.log(result.redeemedPoints, result.bonusId)Throws
CONFIGURATION_ERROR (without a request) if points is not an integer > 0 or redemptionType is empty; INSUFFICIENT_BALANCE or FAILED_PRECONDITION when the service refuses the redemption (always identify by error.code); UNKNOWN with status 200 if the gateway answers without confirming the redemption (success: false, absent or malformed; it also applies in validation: 'warn'; message is the gateway's when it comes, otherwise the SDK's). General rule: UNKNOWN with a 2xx status = unconfirmed operation: re-read the state (LoyaltyApi.get) before trying again. UNAUTHENTICATED without a session.