Front-End Integration
Guide on how to integrate Pending Bonuses in your site's front end.
💸Get Pending Bonuses
To get pending bonuses you will use the following code
FasttrackCrm.getPendingBonuses().then(response => console.log(response)).catch(error => console.log(errror));
So our call will return a Promiseand then you can do what you want in then & catch to implement error handling
An example response looks like this:
[{"Id": 1,"Reference": "3-3-ABC124","MobileGameId": 3,"DesktopGameId": 4,"MobileGameUrl": "https://fasttrack-solutions.com/game/1234","DesktopGameUrl": "https://fasttrack-solutions.com/game/1234","ImageUrl": "https://www.fasttrack-solutions.com/","DateCreated": "2018-04-26 09:20:14","Description": "10 Free spins on Aloha","Type": 1},{"Id": 2,"Reference": "3-3-ABC124","MobileGameId": 3,"DesktopGameId": 4,"MobileGameUrl": "https://fasttrack-solutions.com/game/1234","DesktopGameUrl": "https://fasttrack-solutions.com/game/1234","ImageUrl": "https://www.fasttrack-solutions.com/","DateCreated": "2018-04-26 09:20:54","Description": "10 Free spins on Aloha","Type": 2,"BonusCode": "STEPHENTESTBONUS"},{"Id": 3,"Reference": "3-3-ABC124","MobileGameId": 3,"DesktopGameId": 4,"MobileGameUrl": "https://fasttrack-solutions.com/game/1234","DesktopGameUrl": "https://fasttrack-solutions.com/game/1234","ImageUrl": "https://www.fasttrack-solutions.com/","DateCreated": "2018-04-26 09:23:55","Description": "10 Free spins on Aloha","Type": 3,"BonusCode": "STEPHENTESTBONUS2","IsLocked": 1,"UnlockAmount": 10}]
Type = 1 = Standard Bonus (no bonus code supplied)
Type = 2 = Deposit Bonus (code for deposit supplied)
Tyoe = 3 = Unlockable Bonus (code for bonus supplied)
💰Activate Pending Bonus
This method should be run only for:
Type = 1 Standard Bonuses - so that the bonus code is applied to the user and marked as claimed
Type = 3 Unlockable Bonus - so that the bonus code is applied to the user and marked as claimed (Needs to have property IsLocked = 0, otherwise error returned)
To consume a pending bonus you should pass the Id from the selected bonus.
FasttrackCrm.consumePendingReward(2).then(response => console.log(response)).catch(error => console.log(errror));
So our call will return a Promiseand then you can do what you want in then & catch to implement error handling
An example response
{"Id": 3,"Reference": "3-3-ABC124","MobileGameId": 3,"DesktopGameId": 4,"MobileGameSlug": "abc-1243","DesktopGameSlug": "abc-1234","ImageUrl": "https://www.fasttrack-solutions.com/","DateCreated": "2018-04-26 09:23:55","IsConsumed": true,"DateConsumed": "2018-04-26 11:25:45","Description": "10 Free spins on Aloha","Type": 1}