function CustomEvents() {
/* polyfill for CustomEvent https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill */
(function () {
if ( typeof window.CustomEvent === "function" ) return false;
function CustomEvent ( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: null };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
}
window.CustomEvent = CustomEvent;
})();
/* end polyfill for CustomEvents */
}
CustomEvents.prototype.openGame = function(data) {
var event = new CustomEvent('CASHIER_OPEN_GAME', { detail: data });
window.dispatchEvent(event);
};
var OryxApiCodes = {
status: {
LOGGED_IN: 1,
LOGGED_OUT: 2,
LOGGED_IN_ANONYMOUS: 3,
SYSTEM_ERROR: 100
},
login: {
OK: 1,
LOGIN_FAILED: 2,
SYSTEM_ERROR: 100
},
loginwithtoken: {
OK: 1,
LOGIN_FAILED: 2,
SYSTEM_ERROR: 100
},
gamelink: {
OK: 1,
NO_FREE_ANONYMOUS_SLOTS: 2,
GAME_NOT_AVAILABLE: 3,
BONUS_RESTRICTION: 4,
SYSTEM_ERROR: 100
},
opengame: {
OK: 1,
NO_FREE_ANONYMOUS_SLOTS: 2,
GAME_NOT_AVAILABLE: 3,
BONUS_RESTRICTION: 4,
SYSTEM_ERROR: 100
},
registrationForm: {
OK: 1,
SYSTEM_ERROR: 100
},
submitRegistration: {
OK: 1,
FAILED: 2,
SYSTEM_ERROR: 100
},
accepttc: {
OK: 1,
ERROR: 2,
SYSTEM_ERROR: 100
},
changepassword: {
OK: 1,
PASSWORD_INCORRECT: 2,
LOCKED: 3,
PASSWORD_LENGTH_PROBLEM: 4,
PASSWORD_DATA_FORMAT: 5,
AUTH_NEEDED: 6,
AUTH_ERROR: 7,
SYSTEM_ERROR: 100
},
listGames: {
OK: 1,
SYSTEM_ERROR: 100
},
ackClientNotification: {
OK: 1,
ERROR: 2,
SYSTEM_ERROR: 100
},
ackPlayStat: {
OK: 1,
SYSTEM_ERROR: 100
},
extBalanceInfo: {
OK: 1,
ERROR: 2,
SYSTEM_ERROR: 100
},
fundTransfer: {
OK: 1,
ERROR: 2,
SYSTEM_ERROR: 100
},
chatInit: {
OK: 'OK'
},
chatCommand: {
OK: 'OK'
},
listFunPlayPackages: {
OK: 1,
ERROR: 2,
SYSTEM_ERROR: 100
},
getPlayerPromotionTokens: {
OK: 1,
ERROR: 2,
SYSTEM_ERROR: 100
},
lostPassword: {
OK: 1,
PLAYER_NOT_FOUND: 2,
LOGIN_WITH_EMAIL_NOT_ALLOWED: 3,
MISSING_DATA: 4,
EMAIL_AND_USERNAME_DOES_NOT_MATCH: 5,
NOT_ALLOWED: 6,
AUTH_NEEDED: 7,
AUTH_ERROR: 8,
SYSTEM_ERROR: 100
},
changeLostPassword: {
OK: 1,
PLAYER_NOT_FOUND: 2,
KEY_NOT_VALID: 3,
MISSING_DATA: 4,
PASSWORD_DATA_FORMAT: 5,
AUTH_NEEDED: 6,
AUTH_ERROR: 7,
SYSTEM_ERROR: 100
},
getPlayerProfile: {
OK: 'OK',
NO_PLAYER_FOUND: 'NO_PLAYER_FOUND',
ERROR: 'ERROR'
},
updatePlayerProfile: {
OK: 'OK',
VALIDATION_ERROR: 'VALIDATION_ERROR',
DUPLICATE_EMAIL: 'DUPLICATE_EMAIL',
DUPLICATE_NICKNAME: 'DUPLICATE_NICKNAME',
DENIED: 'DENIED',
NO_PLAYER_FOUND: 'NO_PLAYER_FOUND',
ERROR: 'ERROR'
},
updatePMAccount: {
OK: 'OK',
LABEL_NOT_FOUND: 'LABEL_NOT_FOUND',
NO_ALLOWED_FIELDS: 'NO_ALLOWED_FIELDS',
ERROR: 'ERROR',
SYSTEM_ERROR: 100
},
GetTopWinsList: {
OK: 'OK',
ERROR: 'ERROR',
SYSTEM_ERROR: 100
}
};
var OryxEnum = {
FundTransfer: {
DEPOSIT: 'DEPOSIT',
WITHDRAWAL: 'WITHDRAWAL'
},
PlayerPaymentStatus: {
APPROVED: 'APPROVED',
DECLINED: 'DECLINED',
ERROR: 'ERROR'
},
ChatMsgTypes: {
MSG: 'MSG',
CHAT_OPEN: 'CHAT_OPEN',
CHAT_CLOSE: 'CHAT_CLOSE'
},
ChatWindowState: {
CLOSE: 'CLOSE',
MIN: 'MIN',
MAX: 'MAX'
},
ForceLogoutCode: {
KILL: 'KILL',
SESSION_DURATION_LIMIT_REACHED: "SESSION_DURATION_LIMIT_REACHED"
},
LoginResponseCode: {
OK: 'OK',
DENIED: 'DENIED',
ERROR: 'ERROR',
NOT_FOUND: 'NOT_FOUND',
INCORRECT_PASSWORD: 'INCORRECT_PASSWORD',
NOT_FOUND_OR_INCORRECT_PASSWORD: 'NOT_FOUND_OR_INCORRECT_PASSWORD',
LOCKED: 'LOCKED',
WRONG_PLAY_MODE: 'WRONG_PLAY_MODE',
PLAYER_BIRTH_DATE_NOT_SET: 'PLAYER_BIRTH_DATE_NOT_SET',
PLAYER_COUNTRY_NOT_SET: 'PLAYER_COUNTRY_NOT_SET',
BANNED_COUNTRY: 'BANNED_COUNTRY',
FIELDS_EMPTY: 'FIELDS_EMPTY',
ALREADY_LOGGED_IN: 'ALREADY_LOGGED_IN',
ANOTHER_LOGIN_ACTIVE: 'ANOTHER_LOGIN_ACTIVE',
EXTERNAL_SYSTEM_LIMITS: 'EXTERNAL_SYSTEM_LIMITS',
EXTERNAL_SYSTEM_ERROR: 'EXTERNAL_SYSTEM_ERROR',
ERR_LIMIT_REACHED_LOGONCOUNTDAY: 'ERR_LIMIT_REACHED_LOGONCOUNTDAY',
ERR_LIMIT_REACHED_LOGONBREAK: 'ERR_LIMIT_REACHED_LOGONBREAK',
ERR_LIMIT_REACHED_LOGONDURATION: 'ERR_LIMIT_REACHED_LOGONDURATION',
ERR_LIMIT_REACHED_LOGONCOUNTMONTH: 'ERR_LIMIT_REACHED_LOGONCOUNTMONTH'
},
CashierMode: {
AUTO: 0,
DESKTOP: 1,
MOBILE: 2
},
SubmitRegistrationForm: {
ERROR: 'ERROR',
DUPLICATE_EMAIL: 'DUPLICATE_EMAIL',
VALIDATION_ERROR: 'VALIDATION_ERROR',
DUPLICATE_MAIN_DATA: 'DUPLICATE_MAIN_DATA',
DUPLICATE_NICKNAME: 'DUPLICATE_NICKNAME',
DUPLICATE_USERNAME: 'DUPLICATE_USERNAME',
DUPLICATE_EXT_PLATFORM_PLAYER_ID: "DUPLICATE_EXT_PLATFORM_PLAYER_ID",
DUPLICATE_PERSONAL_ID: "DUPLICATE_PERSONAL_ID",
PERSONAL_ID_ERROR: "PERSONAL_ID_ERROR",
BANNED_COUNTRY: 'BANNED_COUNTRY',
DENIED: 'DENIED',
REGISTRATION_CHECK_ERROR: 'REGISTRATION_CHECK_ERROR',
PROFILE_AUTH_ERROR_TITLE: 'PROFILE_AUTH_ERROR_TITLE',
PROFILE_AUTH_ERROR: 'PROFILE_AUTH_ERROR'
},
FormatAmountOrigin: {
CASHIER_MAIN_BALANCE: 'CASHIER_MAIN_BALANCE',
BALANCE_CLASS_OUTPUT: 'BALANCE_CLASS_OUTPUT',
MOD_TRANSACTION_HISTORY: 'MOD_TRANSACTION_HISTORY',
AM_BALANCE_DETAILS: 'AM_BALANCE_DETAILS'
}
};
var OryxHandlers = {
openGame: function(data) {
_oryxApi.customEvents.openGame(data);
OryxUtil.trace("openGame main handler", data);
},
popMsg: function(data) {
if (oryxApi.cashier === null || (oryxApi.cashier && oryxApi.cashier.ocSuccessHandler === null)) {
setTimeout(function(){
OryxHandlers.popMsg(data);
}, 500);
} else {
window.ocSuccess(data);
}
},
status: function(status) {
var self = this;
OryxUtil.trace("status main handler", status);
switch (status) {
case OryxApiCodes.status.LOGGED_IN:
var player = oryxApi.getPlayer();
if (player) {
$('.playerName').html(player.firstName + " " + player.lastName);
}
$('.player-unauth').hide();
$('.player-auth').show();
// continue deposit notification, in cases, where Payment Provider redirects player out of the IFRAME
if ($.cookie("oryxContinue")) {
var objContinueCookie = $.parseJSON($.cookie("oryxContinue"));
if (!OryxUtil.isFunction(oryxApi.handlers.customOpenCashier)) {
$.cookie("oryxContinue", null, {path: '/'});
}
var objOpenTab = { "tab": objContinueCookie.tab };
if (objContinueCookie.sub) {
objOpenTab["sub"] = objContinueCookie.sub;
}
if (objContinueCookie.pmCode) {
objOpenTab["pmCode"] = objContinueCookie.pmCode;
}
if (objContinueCookie.pspCode) {
objOpenTab["pspCode"] = objContinueCookie.pspCode;
}
if (objContinueCookie.pmId) {
objOpenTab["pmId"] = objContinueCookie.pmId;
}
if (objContinueCookie.data) {
objOpenTab["data"] = objContinueCookie.data;
}
if (window.OryxCashier) {
window.OryxCashier.continueDepositData = objContinueCookie;
}
if (OryxUtil.isFunction(oryxApi.handlers.customOpenCashier)) {
oryxApi.handlers.customOpenCashier.apply(this, [objOpenTab, objContinueCookie]);
} else {
oryxApi.openCashier(objOpenTab).then(function () {
OryxHandlers.popMsg(objContinueCookie.data);
});
}
}
break;
case OryxApiCodes.status.LOGGED_OUT:
case OryxApiCodes.status.LOGGED_IN_ANONYMOUS:
$('.player-auth').hide();
$('.player-unauth').show();
break;
default:
alert("Error");
}
},
login: function(status, response) {
OryxUtil.trace("login main handler", status, response);
},
balance: function(balance) {
OryxUtil.trace("balance main handler", balance);
var player = oryxApi.getPlayer();
if (player && player.currencyCode) {
$('.balance').html(oryxApi.formatAmount(balance.balance, player.currencyCode, OryxEnum.FormatAmountOrigin.BALANCE_CLASS_OUTPUT));
}
},
countryChange: function() {
var $stateEl = $('.form-element[data-field="STATE"]');
if ($stateEl.length === 0) {
return;
}
$stateEl.find('input').remove();
$stateEl.find('select').remove();
var $this = $(this);
var $f = null;
var field = OryxApi._tmpStateField;
var stateValues = [];
if (field !== undefined && typeof field.allowedValues === 'string') {
field.allowedValues = [ field.allowedValues ];
}
if (field !== undefined && field.allowedValues !== undefined) {
$.each(field.allowedValues, function() {
var elt = this.split("|");
var val = elt[0];
if (elt[1] !== $this.val()) {
return;
}
stateValues.push({ key: val, text: elt[elt.length-1]});
});
}
if (stateValues.length === 0) {
$f = $(" ");
} else {
$f = $(" ", {
name: field.fieldCode,
'class': 'field'
});
$f.append('' + oryxApi.translate('REGISTRATION_FORM_EMPTY_' + field.fieldCode) + ' ');
$.each(stateValues, function(i, f) {
//$f.append('' + f.text + ' ');
$f.append('' + f.text + ' ');
});
}
// enter default value
if (field.defaultValue !== undefined) {
$f.val(field.defaultValue);
}
// required class + asterisk sign
if (field.fieldValidation == 'REQUIRED') {
$f.addClass('REQUIRED');
}
if ($f) {
$stateEl.find('label').after($f);
}
$stateEl.show();
},
registrationForm: function(responseCode, registrationFormData, options) {
OryxUtil.trace("registrationForm main handler", responseCode, registrationFormData);
var container = $('.registration-form .registration-form-container');
if (options && options.container) {
container = $(options.container);
}
container.html('');
if (responseCode != OryxApiCodes.registrationForm.OK) {
if (registrationFormData && registrationFormData.responseCode === 'DENIED') {
container.html(oryxApi.translate('REGISTER_BANNED_COUNTRY')).fadeIn();
} else {
container.html(oryxApi.translate('GETFORMDATA_2')).fadeIn();
}
return;
}
var form = $('
', {
name: 'registration_form'
});
var $countryField = null;
var formItems = [];
// add T&C field to the form
var tc = " ";
tc += " ";
tc += ' ' + oryxApi.translate('AGREE_TXT') + ' ' + oryxApi.translate('TERMS_AND_CONDITIONS_TXT');
tc += '* ';
tc += "
";
formItems.push({ element: tc, elementType: OryxUtil.FormElementType.TC, data: { currentTcVersion: registrationFormData.currentTcVersion, tcContent: registrationFormData.tcContent }});
//form.append(tc);
registrationFormData.fieldInfos.sort(OryxUtil.formFieldComparator);
// find password and add validate pwd
for (var i = 0; i < registrationFormData.fieldInfos.length; i++) {
if (registrationFormData.fieldInfos[i].fieldCode == 'PASSWORD') {
var newField = $.extend(true, {}, registrationFormData.fieldInfos[i]);
newField.fieldCode = 'VALIDATE_PASSWORD';
registrationFormData.fieldInfos.splice(i+1, 0, newField);
break;
} else if (registrationFormData.fieldInfos[i].fieldCode == 'STATE') {
registrationFormData.fieldInfos[i].visible = false;
}
}
for (i = 0; i < registrationFormData.fieldInfos.length; i++) {
registrationFormData.fieldInfos[i].category = OryxUtil.getFieldCategory(registrationFormData.fieldInfos[i].fieldCode);
}
// loop through all fields in form, generate them
$.each(registrationFormData.fieldInfos, function(i, field) {
// surrounding div
var el = $('' + oryxApi.translate('FIELD_LABEL_' + field.fieldCode) + '
');
if (field.visible === false) {
el.hide();
}
var $f = null;
if (field.allowedValues === undefined) {
// it's an input field
if (field.fieldCode == 'PASSWORD' || field.fieldCode == 'VALIDATE_PASSWORD') {
$f = $(" ");
} else if (field.fieldCode == 'NO_PROMO_EMAILS') {
if (oryxApi.reverse_opt_out) {
$f = $(" ");
}
else {
$f = $(" ");
}
} else if (field.fieldCode == 'NO_PROMO_SMS') {
if (oryxApi.reverse_opt_out) {
$f = $(" ");
}
else {
$f = $(" ");
}
} else if (field.fieldCode == 'NO_PROMO_PHONECALLS') {
if (oryxApi.reverse_opt_out) {
$f = $(" ");
}
else {
$f = $(" ");
}
}
else if (field.fieldCode == 'BIRTH_DATE') {
$f = $(" ");
} else {
$f = $(" ");
}
} else {
// it's a dropdown (because of allowedValues)
$f = $(" ", {
name: field.fieldCode,
'class': 'field'
});
$f.append('' + oryxApi.translate('REGISTRATION_FORM_EMPTY_' + field.fieldCode) + ' ');
if (typeof field.allowedValues === 'string') {
field.allowedValues = [ field.allowedValues ];
}
if (field.fieldCode == 'COUNTRY_CODE') {
$countryField = $f;
$f.change(function() {
if (OryxUtil.isFunction(oryxApi.mainHandlers.countryChange)) {
oryxApi.mainHandlers.countryChange.apply(this, []);
}
});
} else if (field.fieldCode == 'STATE') {
OryxApi._tmpStateField = field;
}
$.each(field.allowedValues, function() {
var elt = this.split("|");
var val = elt[0];
var text;
if (field.fieldCode === 'STATE') {
return;
} else if (field.fieldCode == 'GENDER') {
if (elt[0] == 'M') {
text = oryxApi.translate('MALE_LABEL_TXT');
} else if (elt[0] == 'F') {
text = oryxApi.translate('FEMALE_LABEL_TXT');
} else {
text = elt[elt.length-1];
}
} else if (field.fieldCode === 'COUNTRY_CODE' || field.fieldCode === 'CITIZENSHIP_COUNTRY_CODE') {
if (OryxLang['COUNTRY_' + elt[0]] !== undefined) {
text = oryxApi.translate('COUNTRY_' + elt[0]);
} else {
text = elt[elt.length-1];
}
} else {
text = elt[elt.length-1];
}
$f.append('' + text + ' ');
});
/////
// sort it by option.text
OryxUtil.sortSelect($f);
}
// enter default value
if (field.defaultValue !== undefined) {
$f.val(field.defaultValue);
} else {
$f.val("");
}
// required class + asterisk sign
if (field.fieldValidation == 'REQUIRED') {
$f.addClass('REQUIRED');
$f.after('* ');
}
if ($f) {
el.append($f);
}
formItems.push({element: el, elementType: OryxUtil.FormElementType.FIELD, data: field});
});
// AUTHENTICATIONS
if (registrationFormData.authType !== undefined) {
formItems.push({
element: $("
"),
elementType: OryxUtil.FormElementType.FORM_ERROR_FIELD
});
}
//form.append("
");
formItems.push({
element: $("
"),
elementType: OryxUtil.FormElementType.FORM_ERROR_FIELD
});
// form register button
var el = $('
');
$f = $(" ", {
type: 'submit',
value: oryxApi.translate('BUTTON_REGISTER')
});
el.append($f);
//form.append(el);
formItems.push({
element: el,
elementType: OryxUtil.FormElementType.SUBMIT
});
if (OryxUtil.isFunction(oryxApi.mainHandlers.attachRegistrationForm)) {
oryxApi.mainHandlers.attachRegistrationForm.apply(this, [form, formItems]);
}
container.append(form);
if ($countryField !== false) {
$countryField.change();
}
// AUTHENTICATIONS
if (registrationFormData.authType !== undefined) {
if (registrationFormData.authConfig) {
if (registrationFormData.authType === "QUESTION") {
var numQuestions = registrationFormData.authConfig.numberOfQuestions;
var $authContainer = $(".registration-form .auth-form");
for (var intI = 0; intI < numQuestions; intI++) {
var $divContainer = $('
'),
$select = $(' ');
$select.append('- ');
for (var intJ = 0, max = registrationFormData.authConfig.questions.length; intJ < max; intJ++) {
//console.warn(this);
$select.append('' + oryxApi.translate(registrationFormData.authConfig.questions[intJ]) + ' ');
}
$divContainer.append($select);
$divContainer.append(' ');
$authContainer.append($divContainer);
}
}
}
}
$(document).on("blur", "[name='EMAIL']", function() {
//var container = $('.registration-form .registration-form-container');
var val_email = $("[name='EMAIL']").val();
// reset everything
$(this).removeClass("error");
container.find('.form-error .errorDiv.EMAIL').remove();
if (container.find('.form-error .errorDiv').length === 0) {
container.find('.form-error').hide();
}
if (val_email.length === 0) {
return;
}
if (!OryxUtil.isEmail(val_email)) {
$(this).addClass("error");
container.find('.form-error').append('' + oryxApi.translate("WRONG_EMAIL_FORMAT") + '
').fadeIn();
}
});
$(document).on("blur", "[name='PASSWORD']", function(){
var val_password = $("[name='PASSWORD']").val();
//var container = $('.registration-form .registration-form-container');
// reset everything
$(this).removeClass("error");
container.find('.form-error .errorDiv.PASSWORD').remove();
if (container.find('.form-error .errorDiv').length === 0) {
container.find('.form-error').hide();
}
if (val_password.length === 0) {
return;
}
var returnObj = OryxUtil.checkIfPasswordIsOk(val_password);
if (!returnObj.valid) {
$(this).addClass("error");
container.find('.form-error').append('' + OryxUtil.formatString(oryxApi.translate(returnObj.errorCode), [oryxApi.passwordSecurity.min_password_length]) + '
').fadeIn();
}
})
$(document).on("blur", "[name='VALIDATE_PASSWORD']", function(){
var val_password = $("[name='PASSWORD']").val();
var val_validate = $("[name='VALIDATE_PASSWORD']").val();
//var container = $('.registration-form .registration-form-container');
// reset everything
$(this).removeClass("error");
container.find('.form-error .errorDiv.VALIDATE_PASSWORD').remove();
if (container.find('.form-error .errorDiv').length === 0) {
container.find('.form-error').hide();
}
if (val_validate.length === 0) {
return;
}
if (val_validate !== val_password) {
$("[name='VALIDATE_PASSWORD']").addClass("error");
$("[name='PASSWORD']").addClass("error");
container.find('.form-error').append('' + oryxApi.translate('PASSWORD_MISMATCH') + '
').fadeIn();
return;
}
})
$(document).on("focus", (options && options.container ? options.container + " .field" : ".registration-form .registration-form-container .field"), function(){
$(this).removeClass("error");
})
},
attachRegistrationForm: function($form, items) {
$.each(items, function() {
/*
if (this.elementType === OryxUtil.FormElementType.TC) ...
if (this.elementType === OryxUtil.FormElementType.FIELD) ...
if (this.data.category === 'personal_info')
if (this.data.category === 'contact_info')
if (this.data.category === 'account_info')
if (this.elementType === OryxUtil.FormElementType.FORM_ERROR_FIELD) ...
if (this.elementType === OryxUtil.FormElementType.SUBMIT) ...
*/
$form.append(this.element);
});
},
submitRegistration: function(responseCode, responseData, options) {
OryxUtil.trace("submitRegistration main handler", responseCode, responseData);
var container = $('.registration-form .registration-form-container');
if (options && options.container) {
container = $(this.document).find(options.container);
}
if (responseCode == OryxApiCodes.submitRegistration.FAILED) {
switch (responseData.responseCode) {
case OryxEnum.SubmitRegistrationForm.VALIDATION_ERROR:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_1") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.ERROR:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_3") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.DENIED:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_DENIED") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.DUPLICATE_EMAIL:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_5") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.DUPLICATE_MAIN_DATA:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_7") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.DUPLICATE_NICKNAME:
var $el = container.find('.form-element[data-field="NICKNAME"]');
$el.find('input[name="NICKNAME"]').addClass('error');
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_DUPLICATENICKNAME") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.DUPLICATE_USERNAME:
var $el = container.find('.form-element[data-field="USERNAME"]');
$el.find('input[name="USERNAME"]').addClass('error');
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_DUPLICATEUSERNAME") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.DUPLICATE_EXT_PLATFORM_PLAYER_ID:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_DUPLICATE_EXT_PLATFORM_PLAYER_ID") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.DUPLICATE_PERSONAL_ID:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_DUPLICATE_PERSONAL_ID") + '
').fadeIn();
case OryxEnum.SubmitRegistrationForm.PERSONAL_ID_ERROR:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_PERSONAL_ID_ERROR") + '
').fadeIn();
break;
case OryxEnum.SubmitRegistrationForm.REGISTRATION_CHECK_ERROR:
container.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_REGISTRATION_CHECK_ERROR") + '
').fadeIn();
break;
default:
container.find('.form-error').append('' + oryxApi.translate("SUBMIT_REG_FORM_ERROR") + '
').fadeIn();
}
} else if (responseCode == OryxApiCodes.submitRegistration.OK) {
$('.registration-form').hide().find('.registration-form-container').html("");
$('.registration-complete')
.find('.username').html(responseData.username).end()
.find('.password').html(responseData.password).end()
.fadeIn();
} else {
container.find('.form-error').append('' + oryxApi.translate("SUBMIT_REG_FORM_ERROR") + '
').fadeIn();
}
if (responseData && responseData.errorFields !== undefined) {
$.each(responseData.errorFields, function(fieldCode, fieldError) {
var $el = container.find('.form-element[data-field="' + fieldCode + '"]');
$el.find('input[name="' + fieldCode + '"]').addClass('error');
$el.find('> span').html("* " + fieldError);
});
}
},
acceptTC: function(responseCode, acceptedTcVersion, response) {
OryxUtil.trace("acceptTC main handler", responseCode, acceptedTcVersion, response);
},
changePassword: function(responseCode) {
OryxUtil.trace("changePassword main handler", responseCode);
},
closeClient: function(event) {
OryxUtil.trace("closeClient main handler", event);
},
clientNotifications: function(newNotification, data) {
/*
var oryxNotificationStore = new OryxNotificationStore();
if (data.type) {
oryxNotificationStore.addItem(data);
} else if (data.signal && data.signal.type) {
oryxNotificationStore.addItem(data.signal);
if (data.signal.type == 'FORCE_LOGOUT') {
oryxApi.status();
}
}
*/
OryxUtil.trace("clientNotifications main handler", data);
},
ackClientNotification: function(responseCode) {
OryxUtil.trace("ackClientNotification main handler", responseCode);
},
limitNotifications: function(data) {
OryxUtil.trace("limitNotifications main handler", data);
},
playStat: function(data) {
if (oryxApi.player.jurisdictionCode == "MALTA") {
var strPlayStatMsg = OryxUtil.formatString(
oryxApi.translate('PLAYSTAT_MSG_MALTA'),
[ data.playTime, oryxApi.formatAmount(data.gamingTotalBets, oryxApi.player.currencyCode), oryxApi.formatAmount(data.gamingTotalWins, oryxApi.player.currencyCode) ]
);
var popupResult = new OryxCashier.MsgPopup();
popupResult.init(oryxApi.cashier);
popupResult.open({
title: oryxApi.translate('PLAYSTAT_MSG_MALTA_TITLE'),
content: strPlayStatMsg,
showMask: true,
unique: true,
identifier: "PLAYSTAT_MSG",
buttons: [
new OryxCashier.Button({ title: oryxApi.translate('BTN_CONTINUE'), strClass: 'btnSpecial', handler: function() {
oryxApi.ackPlayStat();
popupResult.close();
}}),
new OryxCashier.Button({ title: oryxApi.translate('BTN_LOGOUT'), handler: function() {
oryxApi.logout();
popupResult.close();
}})
]
});
}
// disable all games in autoplay ... msg is posted to ALL iframes ... but we do not have reference to game iframe and if some x iframe gets this postMessage it will ignore it since it will not have handler for it ... so there shouldn't be any issues COMMENT by Saso (2019-09-24)
var iframes = window.document.getElementsByTagName("iframe");
for (var intI = 0, max = iframes.length; intI < max; intI++) {
iframes[intI].contentWindow.postMessage({ wpgaction: "doGameSuspend" }, '*');
}
window.contentWindow.postMessage({ wpgaction: "doGameSuspend" }, '*');
OryxUtil.trace("playStat main handler", data);
},
ackPlayStat: function(responseCode) {
OryxUtil.trace("ackPlayStat main handler", responseCode);
},
openCashier: function(gameCode, param) {
OryxUtil.trace("openCashier main handler", gameCode, param);
},
closeCashier: function() {
OryxUtil.trace("closeCashier main handler");
},
logout: function(logoutData) {
OryxUtil.trace("Logout main handler");
},
forceLogout: function(forceLogoutCode) {
// HACK - simulating SOCKET signal (expect soon to be implemented, then this can be deleted)
if (forceLogoutCode == OryxEnum.ForceLogoutCode.SESSION_DURATION_LIMIT_REACHED) {
oryxApi.notificationStore.addItem({ type: 'FORCE_LOGOUT', reason: 'SESSION_DURATION_LIMIT_REACHED', important: true });
}
// END HACK
OryxUtil.trace("forceLogout main handler", forceLogoutCode);
},
chatMsgUpdate: function(data) {
/*
data [{ id, time, nick, msg, fresh, is_player }, ... ]
*/
OryxUtil.trace("chatMsgUpdate main handler", data);
},
chatAvailable: function(data) {
/*
data { ? }
*/
OryxUtil.trace("chatAvailable main handler", data);
},
listGames: function() {
OryxUtil.trace("listGames main handler");
},
balancePush: function(data) {
OryxUtil.trace("balancePush main handler", data);
},
promotionAwardPush: function(data) {
OryxUtil.trace("promotionAwardPush main handler", data);
},
lostPassword: function(responseCode, response) {
OryxUtil.trace("lostPassword main handler", responseCode, response);
},
changeLostPassword: function(responseCode, response) {
OryxUtil.trace("changeLostPassword main handler", responseCode, response);
},
taxableWinPush: function(data) {
OryxUtil.trace("taxableWinPush main handler", data);
},
new_sessionid: function(data) {
OryxUtil.trace("new_sessionid main handler", data);
},
GetTopWinsList: function(responseCode, response) {
OryxUtil.trace("GetTopWinsList main handler", responseCode, response);
},
depositUnderReview: function(data) {
OryxUtil.trace("depositUnderReview main handler", data);
oryxApi.popUpMsg(oryxApi.translate("DEPOSIT_UNDER_REVIEW"));
},
serverTime: function(data) {
OryxUtil.trace("serverTime main handler", data);
},
depositStatusUpdateHandler: function(data) {
OryxUtil.trace("depositStatusUpdateHandler", data);
if (data && data.status && data.status === "OK" && data.depositAmount) {
oryxApi.popUpMsg(OryxUtil.formatString(oryxApi.translate("DEPOSIT_STATUS_UPDATE"), ["", oryxApi.formatAmount(data.depositAmount, oryxApi.getPlayer().currencyCode) ]), { "title": oryxApi.translate('DEPOSIT_STATUS_UPDATE_TITLE') });
}
},
customOpenCashier: function(data) {
OryxUtil.trace("customOpenCashier main handler", data);
},
chatWindowState: function(data) {
OryxUtil.trace("chatWindowState main handler", data);
},
player: function(data) {
OryxUtil.trace("player main handler", data);
}
};
var OryxUtil = {
FormElementType: {
TC: 0,
FIELD: 1,
FORM_ERROR_FIELD: 2,
SUBMIT: 3
},
FormOrdering: {
USERNAME: { order: 1, category: 'personal_info' },
NICKNAME: { order: 2, category: 'account_info', minLength: 3, maxLength: 30 },
TITLE: { order: 3, category: 'personal_info', maxLength: 30 },
FIRSTNAME: { order: 4, category: 'personal_info', maxLength: 30 },
MIDDLE_NAME: { order: 5, category: 'personal_info', maxLength: 30 },
BIRTHNAME: { order: 6, category: 'personal_info' },
LASTNAME: { order: 7, category: 'personal_info', maxLength: 30 },
SECOND_NAME: { order: 8, category: 'personal_info', maxLength: 30 },
GENDER: { order: 9, category: 'personal_info' },
BIRTH_DATE: { order: 10, category: 'personal_info' },
PLACE_OF_BIRTH: { order: 11, category: 'personal_info' },
PERSONAL_ID: { order: 12, category: 'personal_info' },
OCCUPATION: { order: 13, category: 'personal_info', maxLength: 30 },
ADDRESS: { order: 14, category: 'contact_info', maxLength: 100 },
CITY: { order: 15, category: 'contact_info', maxLength: 30 },
ZIP_CODE: { order: 16, category: 'contact_info', maxLength: 30 },
STATE: { order: 17, category: 'contact_info', maxLength: 30 },
COUNTRY_CODE: { order: 18, category: 'contact_info', minLength: 2, maxLength: 3, hidden: false },
EMAIL: { order: 19, category: 'account_info', minLength: 3, maxLength: 50, isEmail: true },
FAX: { order: 20, category: 'contact_info', maxLength: 30 },
PHONE: { order: 21, category: 'contact_info', maxLength: 30 },
CELLPHONE: { order: 22, category: 'contact_info', maxLength: 30 },
WORKPHONE: { order: 23, category: 'contact_info', maxLength: 30 },
TEMP_ADDRESS: { order: 24, category: 'contact_info', maxLength: 100 },
TEMP_CITY: { order: 25, category: 'contact_info', maxLength: 30 },
TEMP_ZIP_CODE: { order: 26, category: 'contact_info', maxLength: 30 },
CITIZENSHIP_COUNTRY_CODE: { order: 27, category: 'contact_info', minLength: 2, maxLength: 3 },
CURRENCY_CODE: { order: 28, category: 'account_info', minLength: 2, maxLength: 3 },
IBAN: { order: 29, category: 'account_info' },
BIC: { order: 30, category: 'account_info' },
AFFILIATE_COUPON_CODE: { order: 31, category: 'account_info', minLength: 3, maxLength: 15 },
NO_PROMO_EMAILS: { order: 32, category: 'account_info', checkbox: true, hiddenIfNotEditable: true },
NO_PROMO_SMS: { order: 33, category: 'account_info', checkbox: true, hiddenIfNotEditable: true },
NO_PROMO_PHONECALLS: { order: 34, category: 'account_info', checkbox: true, hiddenIfNotEditable: true },
PASSWORD: { order: 35, category: 'account_info'},
CUSTOM1: { order: 36, category: 'custom_fields', hidden: false },
CUSTOM2: { order: 37, category: 'custom_fields', hidden: false },
CUSTOM3 : { order: 38, category: 'custom_fields', hidden: false },
VALIDATE_PASSWORD: { category: 'account_info'}
},
getVisibilitySetting: function(fieldCode, boolFieldEditable){
var boolHidden = false;
if (this.FormOrdering[fieldCode] && this.FormOrdering[fieldCode].hidden) {
boolHidden = true;
} else {
if (this.FormOrdering[fieldCode] && this.FormOrdering[fieldCode].hiddenIfNotEditable) {
boolHidden = !boolFieldEditable;
}
}
return boolHidden;
},
getFieldCategory: function(fieldCode) {
if (this.FormOrdering[fieldCode] !== undefined) {
return this.FormOrdering[fieldCode].category;
}
return false;
},
formFieldComparator: function(a, b) {
var av = OryxUtil.FormOrdering[a.fieldCode];
var bv = OryxUtil.FormOrdering[b.fieldCode];
if (av === undefined) {
return 1;
} else if (bv === undefined) {
return -1;
} else if (av.order < bv.order) {
return -1;
} else if (av.order > bv.order) {
return 1;
} else {
return 0;
}
},
isFunction: function(functionToCheck) {
var getType = {};
return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
},
formatString: function(txt, data) {
var str = txt;
for (var i = 0; i < data.length; i++) {
if (_oryxApi && _oryxApi.player && _oryxApi.player.currencyCode && data[i] === _oryxApi.player.currencyCode) {
var altCurrency = oryxApi.translate('CURRENCY_' + _oryxApi.player.currencyCode);
if (altCurrency && altCurrency !== "") {
str = str.replace('{' + i + '}', altCurrency);
} else {
str = str.replace('{' + i + '}', data[i]);
}
} else {
str = str.replace('{' + i + '}', data[i]);
}
}
return str;
},
setTraceEnabled: function(isTrace) {
OryxUtil.traceEnabled = isTrace;
},
trace: function() {
if (OryxUtil.traceEnabled && window.console && window.console.log) {
console.log(arguments);
}
},
getQueryString: function (query) {
var query_string = {};
if (query === undefined || query === null) {
query = window.location.search.substring(1);
}
var vars = query.split("&");
for (var i=0;i= 0) {
return OryxUtil.formatString(
oryxApi.translate('ONE_HOUR_REMINDER_WIN'),
[
Math.round(data.playTime/60),
oryxApi.formatAmount(data.gamingActivityBalance , player.currencyCode)
]
);
} else {
return OryxUtil.formatString(
oryxApi.translate('ONE_HOUR_REMINDER_LOST'),
[
Math.round(data.playTime/60),
oryxApi.formatAmount(-1 * data.gamingActivityBalance , player.currencyCode)
]
);
}
},
formatLoginResponseCode: function(oryxApi, responseCode) {
switch (responseCode) {
case OryxEnum.LoginResponseCode.OK:
return "";
case OryxEnum.LoginResponseCode.DENIED:
return oryxApi.translate('LOGIN_FAILED_DENIED');
case OryxEnum.LoginResponseCode.NOT_FOUND:
case OryxEnum.LoginResponseCode.INCORRECT_PASSWORD:
return oryxApi.translate('LOGIN_FAILED_NOT_FOUND_OR_INCORRECT_PASSWORD');
case OryxEnum.LoginResponseCode.LOCKED:
return oryxApi.translate('LOGIN_FAILED_LOCKED');
case OryxEnum.LoginResponseCode.PLAYER_BIRTH_DATE_NOT_SET:
return oryxApi.translate('LOGIN_FAILED_PLAYER_BIRTH_DATE_NOT_SET');
case OryxEnum.LoginResponseCode.PLAYER_COUNTRY_NOT_SET:
return oryxApi.translate('LOGIN_FAILED_PLAYER_COUNTRY_NOT_SET');
case OryxEnum.LoginResponseCode.BANNED_COUNTRY:
return oryxApi.translate('LOGIN_FAILED_BANNED_COUNTRY');
case OryxEnum.LoginResponseCode.FIELDS_EMPTY:
return oryxApi.translate('LOGIN_FAILED_FIELDS_EMPTY');
case OryxEnum.LoginResponseCode.ALREADY_LOGGED_IN:
return oryxApi.translate('LOGIN_FAILED_ALREADY_LOGGED_IN');
case OryxEnum.LoginResponseCode.ANOTHER_LOGIN_ACTIVE:
return oryxApi.translate('LOGIN_FAILED_ANOTHER_LOGIN_ACTIVE');
case OryxEnum.LoginResponseCode.EXTERNAL_SYSTEM_LIMITS:
return oryxApi.translate('LOGIN_FAILED_EXTERNAL_SYSTEM_LIMITS');
case OryxEnum.LoginResponseCode.EXTERNAL_SYSTEM_ERROR:
return oryxApi.translate('LOGIN_FAILED_EXTERNAL_SYSTEM_ERROR');
case OryxEnum.LoginResponseCode.ERR_LIMIT_REACHED_LOGONCOUNTDAY:
return oryxApi.translate('ERR_LIMIT_REACHED_LOGONCOUNTDAY');
case OryxEnum.LoginResponseCode.ERR_LIMIT_REACHED_LOGONCOUNTMONTH:
return oryxApi.translate('ERR_LIMIT_REACHED_LOGONCOUNTMONTH');
case OryxEnum.LoginResponseCode.ERR_LIMIT_REACHED_LOGONBREAK:
return oryxApi.translate('ERR_LIMIT_REACHED_LOGONBREAK');
case OryxEnum.LoginResponseCode.ERR_LIMIT_REACHED_LOGONDURATION:
return oryxApi.translate('ERR_LIMIT_REACHED_LOGONDURATION');
//case OryxEnum.LoginResponseCode.WRONG_PLAY_MODE:
//case OryxEnum.LoginResponseCode.ERROR:
default:
return oryxApi.translate('LOGIN_FAILED_ERROR');
}
},
formatGamelinkResponseCode: function(oryxApi, responseCode) {
switch (responseCode) {
case OryxApiCodes.gamelink.OK:
return "";
case OryxApiCodes.gamelink.NO_FREE_ANONYMOUS_SLOTS:
return oryxApi.translate('OPEN_GAME_NO_FREE_ANONYMOUS_SLOTS');
case OryxApiCodes.gamelink.GAME_NOT_AVAILABLE:
return oryxApi.translate('OPEN_GAME_GAME_NOT_AVAILABLE');
case OryxApiCodes.gamelink.BONUS_RESTRICTION:
return oryxApi.translate('OPEN_GAME_BONUS_RESTRICTION');
default:
return oryxApi.translate('LAUNCH_GAME_FAILED');
}
},
sortSelect: function($selElem) {
var $options = $selElem.find("OPTION");
var arrOptions = [];
$options.each(function(index, element){
arrOptions.push($(element).text() + "|" + index);
});
arrOptions.sort(function(a, b) {
return a == b ? 0 : a < b ? -1 : 1;
});
var $newSort = $(" ");
for (var intI = 0; intI < arrOptions.length; intI++) {
var intIndex = +arrOptions[intI].split("|")[1];
if ($selElem.find("OPTION:nth-child(" + (intIndex+1) + ")").val() === "") {
$newSort.prepend($selElem.find("OPTION:nth-child(" + (intIndex+1) + ")").clone());
} else {
$newSort.append($selElem.find("OPTION:nth-child(" + (intIndex+1) + ")").clone());
}
}
$selElem.find("OPTION").remove();
$selElem.append($newSort.find("OPTION"));
},
checkIfPasswordIsOk: function(val_password) {
var returnObj = {
valid: true
}
if (oryxApi.passwordSecurity === null || oryxApi.passwordSecurity === undefined || oryxApi.passwordSecurity.password_strength === null || oryxApi.passwordSecurity.min_password_length === null || oryxApi.passwordSecurity.password_strength === undefined || oryxApi.passwordSecurity.min_password_length === undefined) {
return returnObj;
}
returnObj["errorCode"] = "PASSWORD_SECURITY_CHECK_" + oryxApi.passwordSecurity.password_strength;
var password_strength = oryxApi.passwordSecurity.password_strength;
var password_length = oryxApi.passwordSecurity.min_password_length;
var password_strength_binary = Number(password_strength).toString(2);
if (password_strength_binary.length === 0) password_strength_binary = "0000";
if (password_strength_binary.length === 1) password_strength_binary = "000" + password_strength_binary;
if (password_strength_binary.length === 2) password_strength_binary = "00" + password_strength_binary;
if (password_strength_binary.length === 3) password_strength_binary = "0" + password_strength_binary;
// 1 (1. from right) - at least 1 character
// 2 (2. from right) - at least one number
// 4 (3. from right) - at least one special char
// 8 (4. from right) - at least one lower&upper
if (val_password.length === 0 || val_password.length < password_length) {
returnObj.valid = false;
return returnObj;
}
// Check from last to first.
for (var intI = 0, max = password_strength_binary.length; intI < max; intI++) {
if (intI === 3) {
// 1. check if val_password.length is at least on character
if (password_strength_binary.charAt(intI) === "1") {
if (/[a-z]/i.test(val_password) === false){
returnObj.valid = false;
}
}
}
if (intI === 2) {
// 2. at least one number
if (password_strength_binary.charAt(intI) === "1") {
if (val_password.match(/\d+/g) === null) {
returnObj.valid = false;
}
}
}
if (intI === 1) {
// 3. at least one special char
if (password_strength_binary.charAt(intI) === "1") {
if(/^[a-zA-Z0-9- ]*$/.test(val_password) === true) {
returnObj.valid = false;
}
}
}
if (intI === 0) {
// 4. at least one lower&upper
if (password_strength_binary.charAt(intI) === "1") {
if(/(?=.*[a-z])(?=.*[A-Z])/.test(val_password) === false) {
returnObj.valid = false;
}
}
}
}
return returnObj;
},
isEmail: function(val_email) {
var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
return pattern.test(val_email);
},
getIsoCodeObject: function(code) {
var isoCodes = [{"alpha2":"AL","alpha3":"ALB"},{"alpha2":"DZ","alpha3":"DZA"},{"alpha2":"AS","alpha3":"ASM"},{"alpha2":"AD","alpha3":"AND"},{"alpha2":"AO","alpha3":"AGO"},{"alpha2":"AI","alpha3":"AIA"},{"alpha2":"AQ","alpha3":"ATA"},{"alpha2":"AG","alpha3":"ATG"},{"alpha2":"AR","alpha3":"ARG"},{"alpha2":"AM","alpha3":"ARM"},{"alpha2":"AW","alpha3":"ABW"},{"alpha2":"AU","alpha3":"AUS"},{"alpha2":"AT","alpha3":"AUT"},{"alpha2":"AZ","alpha3":"AZE"},{"alpha2":"BS","alpha3":"BHS"},{"alpha2":"BH","alpha3":"BHR"},{"alpha2":"BD","alpha3":"BGD"},{"alpha2":"BB","alpha3":"BRB"},{"alpha2":"BY","alpha3":"BLR"},{"alpha2":"BE","alpha3":"BEL"},{"alpha2":"BZ","alpha3":"BLZ"},{"alpha2":"BJ","alpha3":"BEN"},{"alpha2":"BM","alpha3":"BMU"},{"alpha2":"BT","alpha3":"BTN"},{"alpha2":"BO","alpha3":"BOL"},{"alpha2":"BQ","alpha3":"BES"},{"alpha2":"BA","alpha3":"BIH"},{"alpha2":"BW","alpha3":"BWA"},{"alpha2":"BV","alpha3":"BVT"},{"alpha2":"BR","alpha3":"BRA"},{"alpha2":"IO","alpha3":"IOT"},{"alpha2":"BN","alpha3":"BRN"},{"alpha2":"BG","alpha3":"BGR"},{"alpha2":"BF","alpha3":"BFA"},{"alpha2":"BI","alpha3":"BDI"},{"alpha2":"KH","alpha3":"KHM"},{"alpha2":"CM","alpha3":"CMR"},{"alpha2":"CA","alpha3":"CAN"},{"alpha2":"CV","alpha3":"CPV"},{"alpha2":"KY","alpha3":"CYM"},{"alpha2":"CF","alpha3":"CAF"},{"alpha2":"TD","alpha3":"TCD"},{"alpha2":"CL","alpha3":"CHL"},{"alpha2":"CN","alpha3":"CHN"},{"alpha2":"CX","alpha3":"CXR"},{"alpha2":"CC","alpha3":"CCK"},{"alpha2":"CO","alpha3":"COL"},{"alpha2":"KM","alpha3":"COM"},{"alpha2":"CG","alpha3":"COG"},{"alpha2":"CD","alpha3":"COD"},{"alpha2":"CK","alpha3":"COK"},{"alpha2":"CR","alpha3":"CRI"},{"alpha2":"HR","alpha3":"HRV"},{"alpha2":"CU","alpha3":"CUB"},{"alpha2":"CW","alpha3":"CUW"},{"alpha2":"CY","alpha3":"CYP"},{"alpha2":"CZ","alpha3":"CZE"},{"alpha2":"CI","alpha3":"CIV"},{"alpha2":"DK","alpha3":"DNK"},{"alpha2":"DJ","alpha3":"DJI"},{"alpha2":"DM","alpha3":"DMA"},{"alpha2":"DO","alpha3":"DOM"},{"alpha2":"EC","alpha3":"ECU"},{"alpha2":"EG","alpha3":"EGY"},{"alpha2":"SV","alpha3":"SLV"},{"alpha2":"GQ","alpha3":"GNQ"},{"alpha2":"ER","alpha3":"ERI"},{"alpha2":"EE","alpha3":"EST"},{"alpha2":"ET","alpha3":"ETH"},{"alpha2":"FK","alpha3":"FLK"},{"alpha2":"FO","alpha3":"FRO"},{"alpha2":"FJ","alpha3":"FJI"},{"alpha2":"FI","alpha3":"FIN"},{"alpha2":"FR","alpha3":"FRA"},{"alpha2":"GF","alpha3":"GUF"},{"alpha2":"PF","alpha3":"PYF"},{"alpha2":"TF","alpha3":"ATF"},{"alpha2":"GA","alpha3":"GAB"},{"alpha2":"GM","alpha3":"GMB"},{"alpha2":"GE","alpha3":"GEO"},{"alpha2":"DE","alpha3":"DEU"},{"alpha2":"GH","alpha3":"GHA"},{"alpha2":"GI","alpha3":"GIB"},{"alpha2":"GR","alpha3":"GRC"},{"alpha2":"GL","alpha3":"GRL"},{"alpha2":"GD","alpha3":"GRD"},{"alpha2":"GP","alpha3":"GLP"},{"alpha2":"GU","alpha3":"GUM"},{"alpha2":"GT","alpha3":"GTM"},{"alpha2":"GG","alpha3":"GGY"},{"alpha2":"GN","alpha3":"GIN"},{"alpha2":"GW","alpha3":"GNB"},{"alpha2":"GY","alpha3":"GUY"},{"alpha2":"HT","alpha3":"HTI"},{"alpha2":"HM","alpha3":"HMD"},{"alpha2":"VA","alpha3":"VAT"},{"alpha2":"HN","alpha3":"HND"},{"alpha2":"HK","alpha3":"HKG"},{"alpha2":"HU","alpha3":"HUN"},{"alpha2":"IS","alpha3":"ISL"},{"alpha2":"IN","alpha3":"IND"},{"alpha2":"ID","alpha3":"IDN"},{"alpha2":"IR","alpha3":"IRN"},{"alpha2":"IQ","alpha3":"IRQ"},{"alpha2":"IE","alpha3":"IRL"},{"alpha2":"IM","alpha3":"IMN"},{"alpha2":"IL","alpha3":"ISR"},{"alpha2":"IT","alpha3":"ITA"},{"alpha2":"JM","alpha3":"JAM"},{"alpha2":"JP","alpha3":"JPN"},{"alpha2":"JE","alpha3":"JEY"},{"alpha2":"JO","alpha3":"JOR"},{"alpha2":"KZ","alpha3":"KAZ"},{"alpha2":"KE","alpha3":"KEN"},{"alpha2":"KI","alpha3":"KIR"},{"alpha2":"KP","alpha3":"PRK"},{"alpha2":"KR","alpha3":"KOR"},{"alpha2":"KW","alpha3":"KWT"},{"alpha2":"KG","alpha3":"KGZ"},{"alpha2":"LA","alpha3":"LAO"},{"alpha2":"LV","alpha3":"LVA"},{"alpha2":"LB","alpha3":"LBN"},{"alpha2":"LS","alpha3":"LSO"},{"alpha2":"LR","alpha3":"LBR"},{"alpha2":"LY","alpha3":"LBY"},{"alpha2":"LI","alpha3":"LIE"},{"alpha2":"LT","alpha3":"LTU"},{"alpha2":"LU","alpha3":"LUX"},{"alpha2":"MO","alpha3":"MAC"},{"alpha2":"MK","alpha3":"MKD"},{"alpha2":"MG","alpha3":"MDG"},{"alpha2":"MW","alpha3":"MWI"},{"alpha2":"MY","alpha3":"MYS"},{"alpha2":"MV","alpha3":"MDV"},{"alpha2":"ML","alpha3":"MLI"},{"alpha2":"MT","alpha3":"MLT"},{"alpha2":"MH","alpha3":"MHL"},{"alpha2":"MQ","alpha3":"MTQ"},{"alpha2":"MR","alpha3":"MRT"},{"alpha2":"MU","alpha3":"MUS"},{"alpha2":"YT","alpha3":"MYT"},{"alpha2":"MX","alpha3":"MEX"},{"alpha2":"FM","alpha3":"FSM"},{"alpha2":"MD","alpha3":"MDA"},{"alpha2":"MC","alpha3":"MCO"},{"alpha2":"MN","alpha3":"MNG"},{"alpha2":"ME","alpha3":"MNE"},{"alpha2":"MS","alpha3":"MSR"},{"alpha2":"MA","alpha3":"MAR"},{"alpha2":"MZ","alpha3":"MOZ"},{"alpha2":"MM","alpha3":"MMR"},{"alpha2":"NA","alpha3":"NAM"},{"alpha2":"NR","alpha3":"NRU"},{"alpha2":"NP","alpha3":"NPL"},{"alpha2":"NL","alpha3":"NLD"},{"alpha2":"NC","alpha3":"NCL"},{"alpha2":"NZ","alpha3":"NZL"},{"alpha2":"NI","alpha3":"NIC"},{"alpha2":"NE","alpha3":"NER"},{"alpha2":"NG","alpha3":"NGA"},{"alpha2":"NU","alpha3":"NIU"},{"alpha2":"NF","alpha3":"NFK"},{"alpha2":"MP","alpha3":"MNP"},{"alpha2":"NO","alpha3":"NOR"},{"alpha2":"OM","alpha3":"OMN"},{"alpha2":"PK","alpha3":"PAK"},{"alpha2":"PW","alpha3":"PLW"},{"alpha2":"PS","alpha3":"PSE"},{"alpha2":"PA","alpha3":"PAN"},{"alpha2":"PG","alpha3":"PNG"},{"alpha2":"PY","alpha3":"PRY"},{"alpha2":"PE","alpha3":"PER"},{"alpha2":"PH","alpha3":"PHL"},{"alpha2":"PN","alpha3":"PCN"},{"alpha2":"PL","alpha3":"POL"},{"alpha2":"PT","alpha3":"PRT"},{"alpha2":"PR","alpha3":"PRI"},{"alpha2":"QA","alpha3":"QAT"},{"alpha2":"RO","alpha3":"ROU"},{"alpha2":"RU","alpha3":"RUS"},{"alpha2":"RW","alpha3":"RWA"},{"alpha2":"RE","alpha3":"REU"},{"alpha2":"BL","alpha3":"BLM"},{"alpha2":"SH","alpha3":"SHN"},{"alpha2":"KN","alpha3":"KNA"},{"alpha2":"LC","alpha3":"LCA"},{"alpha2":"MF","alpha3":"MAF"},{"alpha2":"PM","alpha3":"SPM"},{"alpha2":"VC","alpha3":"VCT"},{"alpha2":"WS","alpha3":"WSM"},{"alpha2":"SM","alpha3":"SMR"},{"alpha2":"ST","alpha3":"STP"},{"alpha2":"SA","alpha3":"SAU"},{"alpha2":"SN","alpha3":"SEN"},{"alpha2":"RS","alpha3":"SRB"},{"alpha2":"SC","alpha3":"SYC"},{"alpha2":"SL","alpha3":"SLE"},{"alpha2":"SG","alpha3":"SGP"},{"alpha2":"SX","alpha3":"SXM"},{"alpha2":"SK","alpha3":"SVK"},{"alpha2":"SI","alpha3":"SVN"},{"alpha2":"SB","alpha3":"SLB"},{"alpha2":"SO","alpha3":"SOM"},{"alpha2":"ZA","alpha3":"ZAF"},{"alpha2":"GS","alpha3":"SGS"},{"alpha2":"SS","alpha3":"SSD"},{"alpha2":"ES","alpha3":"ESP"},{"alpha2":"LK","alpha3":"LKA"},{"alpha2":"SD","alpha3":"SDN"},{"alpha2":"SR","alpha3":"SUR"},{"alpha2":"SJ","alpha3":"SJM"},{"alpha2":"SZ","alpha3":"SWZ"},{"alpha2":"SE","alpha3":"SWE"},{"alpha2":"CH","alpha3":"CHE"},{"alpha2":"SY","alpha3":"SYR"},{"alpha2":"TW","alpha3":"TWN"},{"alpha2":"TJ","alpha3":"TJK"},{"alpha2":"TZ","alpha3":"TZA"},{"alpha2":"TH","alpha3":"THA"},{"alpha2":"TL","alpha3":"TLS"},{"alpha2":"TG","alpha3":"TGO"},{"alpha2":"TK","alpha3":"TKL"},{"alpha2":"TO","alpha3":"TON"},{"alpha2":"TT","alpha3":"TTO"},{"alpha2":"TN","alpha3":"TUN"},{"alpha2":"TR","alpha3":"TUR"},{"alpha2":"TM","alpha3":"TKM"},{"alpha2":"TC","alpha3":"TCA"},{"alpha2":"TV","alpha3":"TUV"},{"alpha2":"UG","alpha3":"UGA"},{"alpha2":"UA","alpha3":"UKR"},{"alpha2":"AE","alpha3":"ARE"},{"alpha2":"GB","alpha3":"GBR"},{"alpha2":"US","alpha3":"USA"},{"alpha2":"UM","alpha3":"UMI"},{"alpha2":"UY","alpha3":"URY"},{"alpha2":"UZ","alpha3":"UZB"},{"alpha2":"VU","alpha3":"VUT"},{"alpha2":"VE","alpha3":"VEN"},{"alpha2":"VN","alpha3":"VNM"},{"alpha2":"VG","alpha3":"VGB"},{"alpha2":"VI","alpha3":"VIR"},{"alpha2":"WF","alpha3":"WLF"},{"alpha2":"EH","alpha3":"ESH"},{"alpha2":"YE","alpha3":"YEM"},{"alpha2":"ZM","alpha3":"ZMB"},{"alpha2":"ZW","alpha3":"ZWE"},{"alpha2":"AX","alpha3":"ALA"}];
var alpha = "alpha" + code.length;
code = code.toUpperCase();
for (var intI = 0, max = isoCodes.length; intI < max; intI++) {
if (isoCodes[intI][alpha] === code) {
return isoCodes[intI];
}
}
return {};
}
};
/*
Notification item
*/
function OryxNotificationItem(data) {
this.data = data;
this.timeCreated = +new Date();
this.timeAction = null;
this.deleted = false;
}
OryxNotificationItem.prototype.getId = function() {
if (this.data !== undefined && this.data.id !== undefined) {
return this.data.id;
}
return null;
};
OryxNotificationItem.prototype.getData = function() {
if (this.data !== undefined) {
return this.data;
}
return null;
};
OryxNotificationItem.prototype.getText = function() {
if (this.data === undefined) {
return null;
}
var player = oryxApi.getPlayer();
switch (this.data.type) {
case 'DEPOSIT_UPDATE':
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_DEPOSIT_UPDATE'),
[ oryxApi.translate('PM_LABEL_' + this.data.paymentMethodCode) ]
);
case 'DEPOSIT_SUCCESS':
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_DEPOSIT_SUCCESS'),
[ oryxApi.translate('PM_LABEL_' + this.data.paymentMethodCode), oryxApi.formatAmount(this.data.amount, player.currencyCode)]
);
case 'DEPOSIT_CANCELED':
return oryxApi.translate('NOTIFY_DEPOSIT_CANCELED');
case 'BONUS':
if (this.data.data && this.data.data.message) {
return this.data.data.message;
}
if (this.data.amount === 0 || this.data.amount === undefined) {
return oryxApi.translate('NOTIFY_FREE_BONUS');
} else {
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_BONUS'),
[ oryxApi.formatAmount((this.data.amount ? this.data.amount : this.data.data.bonusAmount), player.currencyCode) ]
);
}
case 'WITHDRAWAL_CANCELED':
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_WITHDRAWAL_CANCELED'),
[ oryxApi.formatAmount((this.data.amount ? this.data.amount : this.data.data.amount), player.currencyCode) ]
);
case 'COMP_POINT_CONVERSION':
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_COMP_POINT_CONVERSION'),
[ (this.data.points ? this.data.points : this.data.data.points), oryxApi.formatAmount((this.data.amount ? this.data.amount : this.data.data.amount), player.currencyCode)]
);
case 'FORCE_LOGOUT':
return oryxApi.translate('NOTIFY_FORCE_LOGOUT_' + this.data.reason);
case 'DEPOSIT_DECLINED':
return oryxApi.translate('NOTIFY_DEPOSIT_DECLINED');
case 'DEPOSIT_GIVEUP':
return oryxApi.translate('NOTIFY_DEPOSIT_GIVEUP');
case 'WITHDRAWAL_UPDATE':
return oryxApi.translate('NOTIFY_WITHDRAWAL_UPDATE');
case 'WITHDRAWAL_SUCCESS':
return oryxApi.translate('NOTIFY_WITHDRAWAL_SUCCESS');
case 'WITHDRAWAL_DECLINE':
return oryxApi.translate('NOTIFY_WITHDRAWAL_DECLINE');
case 'WITHDRAWAL_GIVEUP':
return oryxApi.translate('NOTIFY_WITHDRAWAL_GIVEUP');
case 'PROMOTION_AWARD':
if (this.data.data !== undefined) {
switch (this.data.data.promotionType) {
case 'FREE_PLAY':
var amount = this.data.data.promotionAmount;
amount = oryxApi.formatAmount(amount, player.currencyCode);
if (this.data.data.validityDurationDays !== undefined) {
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_FREE_PLAY_LIMITED'),
[ amount, this.data.data.validityDurationDays]
);
} else {
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_FREE_PLAY'),
[ amount]
);
}
case 'LOYALTY_POINTS':
return OryxUtil.formatString(
oryxApi.translate('NOTIFY_LOYALTY_POINTS'),
[ this.data.data.promotionAmount]
);
default:
return oryxApi.translate('NOTIFY_PROMOTION_AWARD');
}
} else {
return oryxApi.translate('NOTIFY_PROMOTION_AWARD');
}
default:
return oryxApi.translate('NOTIFY_' + this.data.type);
}
};
/*
Notification store
*/
function OryxNotificationStore() {
this.notifications = [];
this.tmpIndex = -1;
this.api = null;
}
OryxNotificationStore.prototype.setApi = function(api) {
this.api = api;
}
OryxNotificationStore.prototype.getNumNotifications = function() {
var num = 0;
for (var i = 0; i < this.notifications.length; i++) {
if (this.notifications[i].deleted === false) {
num++;
}
}
return num;
};
OryxNotificationStore.prototype.findItemIndexById = function(itemId) {
for (var i = 0; i < this.notifications.length; i++) {
if (this.notifications[i].getId() == itemId) {
return i;
}
}
return false;
};
OryxNotificationStore.prototype.removeItemById = function(itemId) {
var i = this.findItemIndexById(itemId);
if (i !== false) {
this.notifications.splice(i, 1);
}
};
OryxNotificationStore.prototype.markDeletedItemById = function(itemId) {
var i = this.findItemIndexById(itemId);
if (i !== false) {
var notif = this.notifications[i];
notif.deleted = true;
notif.timeAction = +new Date();
}
};
OryxNotificationStore.prototype.addItem = function(itemData) {
var nItem;
var self = this;
if (itemData.id === undefined) {
itemData.id = this.tmpIndex--;
}
nItem = this.findItemIndexById(itemData.id);
if (nItem === false) {
if (itemData.timestamp === undefined) {
itemData["timestamp"] = new Date().getTime();
}
nItem = new OryxNotificationItem(itemData);
this.notifications.push(nItem);
}
if (itemData.important) {
if (self.api.suppressSocketMsg.indexOf(itemData.type) == -1) {
// this 'IF' added for free rounds bonuses
var cdnUrl = "https://cdn.oryxgaming.com/medialib/{{gameCode}}/launch/188x125.png";
if (self.api.cashierParams && self.api.cashierParams.cdnUrl) {
cdnUrl = self.api.cashierParams.cdnUrl;
}
if (itemData.type === "BONUS" && itemData.data && itemData.data.gameCodes && itemData.data.gameNames) {
var games = [];
for (var i = 0, max = itemData.data.gameCodes.length; i < max; i++) {
games.push({
gameCode: itemData.data.gameCodes[i],
gameName: itemData.data.gameNames[i],
thumbUrl: cdnUrl.replace('{{gameCode}}', itemData.data.gameCodes[i])
});
}
delete itemData.data.gameCodes;
delete itemData.data.gameNames;
itemData.data.games = games;
self.api.popUpMsg(nItem.getText(), { title: self.api.translate('NOTIFY_PROMOTION_AWARD'), data: itemData.data });
} else {
self.api.popUpMsg(nItem.getText());
}
}
self.api.ackClientNotification(nItem.id);
self.api.status({ resync: true });
}
return true;
};
/*
Chat API
*/
function OryxChat(api) {
this.api = api;
this.connected = false;
this.available = false;
this.initialized = false;
this.chatWindowState = OryxEnum.ChatWindowState.CLOSE;
}
OryxChat.prototype.init = function(params) {
this.chatEnabled = params.chatEnabled || false;
this.chatUrl = params.chatUrl || null;
this.initialized = true;
this.startHandler = params.startHandler || null;
};
OryxChat.prototype.start = function() {
if (!this.chatEnabled || !this.initialized) {
return false;
}
if (this.connected) {
this.socket.socket.reconnect();
return false;
}
try {
var self = this;
if (this.socket !== undefined) {
this.socket.socket.reconnect();
return;
}
this.socket = io.connect(this.chatUrl);
this.socket.on('data', function (data) {
});
this.socket.on('Ping', function (data, fn) {
fn(true);
});
this.socket.on('ChatAvailableUpdate', function(data) {
if (!data) {
return;
}
if (self.available !== data.signal.available) {
self.available = data.signal.available;
self.api.executeHandlers.apply({ api: self.api, handlerFor: "chatAvailable"}, [self.available]);
}
});
this.socket.on('ChatMsgUpdate', function (data) {
if (!data) {
return;
}
if (data.signal && data.signal.lines && data.signal.lines.length) {
self.api.executeHandlers.apply({ api: self.api, handlerFor: "chatMsgUpdate"}, [data.signal.lines]);
}
if (data.signal && data.signal.chatWindowState && self.chatWindowState !== data.signal.chatWindowState) {
self.chatWindowState = data.signal.chatWindowState;
self.api.executeHandlers.apply({ api: self.api, handlerFor: "chatWindowState"}, [data.signal.chatWindowState]);
}
});
this.socket.on('DepositStatusUpdate', function (data) {
if (data && data.signal && data.signal.status && data.signal.status === "REVIEW") {
//self.api.cashier.clearActiveDeposit();
self.api.executeHandlers.apply({ api: self.api, handlerFor: "depositUnderReview"}, [data.signal]);
} else {
//self.api.cashier.clearActiveDeposit();
if (self.api.cashier && self.api.cashier.ocDepositStatusUpdateHandler && typeof self.api.cashier.ocDepositStatusUpdateHandler === "function") {
self.api.cashier.ocDepositStatusUpdateHandler(data);
} else {
self.api.executeHandlers.apply({ api: self.api, handlerFor: "depositStatusUpdateHandler"}, [data.signal]);
}
}
});
this.socket.on('LimitNotification', function(data) {
if (!data) {
return;
}
if(data.signal && data.signal.type) {
self.api.executeHandlers.apply({ api: self.api, handlerFor: "limitNotifications"}, [data.signal]);
}
});
/* LIMITI */
this.socket.on('ClientNotification', function (data) {
if (!data) {
return;
}
if (data && data.balance && data.balance.balance === 0 && data.balance.version === 0 && data.signal.data && data.signal.data.balance && data.signal.data.balanceVersion) {
data.balance.balance = data.signal.data.balance;
data.balance.version = data.signal.data.balanceVersion;
}
self.api.checkResponse(data);
if (data.signal && data.signal.type) {
if (data.signal.type === 'BALANCE_UPDATE') {
// no need to store balance update item
return;
}
if (data.signal.type === 'WIN_TAXES') {
self.api.executeHandlers.apply({ api: self.api, handlerFor: "taxableWinPush"}, [data.signal]);
}
if (data.signal.type === 'PROMOTION_AWARD') {
self.api.executeHandlers.apply({ api: self.api, handlerFor: "promotionAwardPush"}, [data.signal]);
}
if (data.signal.type === 'ACCOUNT_ADDED') {
if (
self.api.cashier &&
typeof self.api.cashier.ocAccountAddedHandler === 'function'
) {
self.api.cashier.ocAccountAddedHandler(data);
}
}
if (data.signal.id === undefined) {
if (data.signal.data && data.signal.data.id && data.signal.data.id > -1) {
data.signal.id = data.signal.data.id;
}
}
if (data.signal.amount === undefined) {
if (data.signal.data && data.signal.data.bonusAmount && data.signal.data.bonusAmount > -1) {
data.signal.amount = data.signal.data.bonusAmount;
}
}
oryxApi.notificationStore.addItem(data.signal);
}
});
this.socket.on('disconnect', function (e) {
OryxUtil.trace("Disconnect chat");
self.available = false;
self.connected = false;
self.api.executeHandlers.apply({ api: self.api, handlerFor: "chatAvailable"}, [self.available]);
});
this.socket.on('reconnect', function (e) {
self.socket.emit('init', self.api.getSessionId(), function(response) {
if (response.responseCode === OryxApiCodes.chatInit.OK) {
self.connected = true;
OryxUtil.trace("chat RECONNECTED");
} else {
OryxUtil.trace("chat RECONNECT FAILED: ",response);
}
});
});
this.socket.on('connect', function (e) {
self.socket.emit('init', self.api.getSessionId(), function(response) {
if (response.responseCode === OryxApiCodes.chatInit.OK) {
self.connected = true;
OryxUtil.trace("chat CONNECTED");
self.api.notificationService({ 'origin': "CHAT", 'action': 'SOCKET_CONNECTED' });
} else {
OryxUtil.trace("chat CONNECT FAILED: ",response);
self.api.notificationService({ 'origin': "CHAT", 'action': 'SOCKET_CONNECT_FAILED', 'data': response });
}
});
});
if (this.startHandler) {
this.startHandler();
}
} catch (err) {
OryxUtil.trace("Exception chat init", err.message);
return false;
}
return true;
};
OryxChat.prototype.stop = function() {
//todo close socket...
var self = this;
try {
this.socket.disconnect();
} catch (err) {
}
if (this.available !== false) {
this.available = false;
self.connected = false;
self.api.executeHandlers.apply({ api: self.api, handlerFor: "chatAvailable"}, [self.available]);
}
};
OryxChat.prototype.setChatWindowState = function(chatWindowState) {
if (this.chatWindowState == chatWindowState) {
return;
}
this.chatWindowState = chatWindowState;
this.sendLocation();
};
OryxChat.prototype.sendMsg = function(msg, type) {
if (!this.connected) {
return false;
}
var self = this;
this.socket.emit('command', {
op: 'ChatMsg',
request: {
type: type,
msg: msg
}
}, function (res) {
if (res.responseCode != OryxApiCodes.chatCommand.OK) {
self.api.executeHandlers.apply({ api: self.api, handlerFor: "chatMsgUpdate"}, [[{ msg: 'ERROR' }]]);
}
});
self.api.executeHandlers.apply({ api: self.api, handlerFor: "chatMsgUpdate"}, [[{ msg: msg }]]);
};
OryxChat.prototype.sendLocation = function(activeWindows, inactiveWindows) {
if (!this.connected) {
return false;
}
if (activeWindows !== undefined) {
this.activeWindows = activeWindows;
}
if (inactiveWindows !== undefined) {
this.inactiveWindows = inactiveWindows;
}
this.socket.emit('command', {
op: 'ChatLocation',
request: {
activeWindows: this.activeWindows,
inactiveWindows: this.inactiveWindows,
chatWindowState: this.chatWindowState
}
}, function (res) {
//do nothing...
});
};
OryxChat.prototype.sendIdle = function(time) {
this.socket.emit('command', {
op: 'ChatIdle',
request: {
idleTimeInSeconds: time
}
}, function (res) {
//do nothing...
});
};
OryxChat.prototype.isInitialized = function() {
return this.initialized;
};
function OryxApi() {
this.apiVersion = "ORYX_JSAPI_20.03_01";
this.mainHandlers = OryxHandlers;
this.handlers = {};
this.notificationStore = new OryxNotificationStore();
this.customEvents = new CustomEvents();
}
OryxApi.prototype.registerHandlers = function(objCustomHandlers, strLevel) {
var oryxApiHandlers = this[strLevel];
for (var customHandler in objCustomHandlers) {
if (!objCustomHandlers.hasOwnProperty(customHandler)) {
continue;
}
if (this.mainHandlers[customHandler] !== undefined) {
oryxApiHandlers[customHandler] = objCustomHandlers[customHandler];
} else {
OryxUtil.trace(customHandler + ": unsupported handler ('" + strLevel + "')!");
}
}
}
OryxApi.prototype.executeHandlers = function() {
if (this.handlerFor !== undefined) {
var strHandler = this.handlerFor;
if (OryxUtil.isFunction(this.api.mainHandlers[strHandler])) {
this.api.mainHandlers[strHandler].apply(undefined, arguments);
}
if (OryxUtil.isFunction(this.api.handlers[strHandler])) {
this.api.handlers[strHandler].apply(undefined, arguments);
}
}
if (this.callBack !== undefined && OryxUtil.isFunction(this.callBack)) {
this.callBack.apply(undefined, arguments);
}
}
OryxApi.prototype.init = function(params) {
if (params === undefined) {
throw "init error";
}
var self = this;
window._oryxApi = this;
$.ajaxSetup({
beforeSend: function (xhr, request)
{
if (self.isLoggedIn(false) || !self.statusCode) {
var oct = self.getOryxCsrfToken();
if (oct) {
// only POST calls to portalWS need token ... this way we prevent adding custom header to all ajax calls (ours or from web page)
if (request.type === "POST" && request.url === self.url) {
xhr.setRequestHeader("oryx-csrf-token", oct);
}
}
}
}
});
//////////////////////
//if (OryxCashier.Util.checkIfIE() && OryxCashier.Util.checkIfIE() < 9) {
// alert("to je IE manjši od 9!");
//}
////////////////////////////
if (params.passwordSecurity) {
this.passwordSecurity = params.passwordSecurity;
}
this.reverse_opt_out = false;
if (params.reverse_opt_out) {
this.reverse_opt_out = params.reverse_opt_out;
}
this.suppressSocketMsg = [];
if (params.suppressSocketMsg) {
this.suppressSocketMsg = params.suppressSocketMsg;
}
this.resourceUrl = (params.resourceUrl != undefined ? params.resourceUrl : null);
this.url = params.url;
this.cage = params.cage;
this.languageCode = params.languageCode;
this.key = params.key;
this.defaultAffiliate = params.affiliate;
this.wsStartHandlers = [];
this.clientType = (params.clientType ? params.clientType : (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Mobile|Opera Mini/i.test(navigator.userAgent) ? "MOBILE" : "DESKTOP"));
this.userAgent = params.userAgent || navigator.userAgent;
this.notificationServiceHandler = (params.notificationServiceHandler !== undefined ? params.notificationServiceHandler : null);
this.useSecureCookies = (params.useSecureCookies ? params.useSecureCookies : false);
if (params.alternativeCurrency && params.alternativeCurrency.useAlternativeCurrency === true) {
this.alternativeCurrency = params.alternativeCurrency;
} else {
this.alternativeCurrency = {
useAlternativeCurrency: false
}
}
this.cashierParams = $.extend(true, { mode: (this.resourceUrl ? 0 : 1) }, params.cashier);
this.cashierMode = this.cashierParams.mode;
this.currentCashierMode = OryxEnum.CashierMode.DESKTOP;
/* MOBILE */
if (this.cashierMode === OryxEnum.CashierMode.AUTO){
/* Auto mode */
try {
this.currentCashierMode = OryxCashier.Util.detectMobile();
} catch(e) {
this.cashierMode = OryxEnum.CashierMode.DESKTOP;
}
}
if (this.cashierMode == OryxEnum.CashierMode.MOBILE){
if (oryxApi.resourceUrl) {
oryxApi.currentCashierMode = OryxEnum.CashierMode.MOBILE;
} else {
// if no resourceUrl is passed, then MOBILE CSS can not start
OryxUtil.trace("No 'resourceUrl' param! Unable to load MOBILE - default DESKTOP mode!");
}
}
var self = this;
if (this.cashierMode == OryxEnum.CashierMode.AUTO || this.cashierMode == OryxEnum.CashierMode.MOBILE) {
$.getScript(oryxApi.resourceUrl + '/oryx_cashier_templates_mobile.min.js.gz').then(function(data, textStatus, jqxhr){
if (self.handlers && self.handlers.loadCustomMobileTemplates) {
self.handlers.loadCustomMobileTemplates();
}
}).fail(function(){
$.getScript(oryxApi.resourceUrl + '/oryx_cashier_templates_mobile.min.js').then(function(data, textStatus, jqxhr){
if (self.handlers && self.handlers.loadCustomMobileTemplates) {
self.handlers.loadCustomMobileTemplates();
}
});
});
}
/* MOBILE */
if (params.handlers !== undefined) {
this.registerHandlers(params.handlers, "handlers");
}
if (params.mainHandlers !== undefined) {
this.registerHandlers(params.mainHandlers, "mainHandlers");
}
this.sessionId = null;
this.statusCode = null;
this.player = null;
this.balance = {
version: -1,
balance: null
};
this.pullTime = 30;
this.pullTimeAnonymous = params.pullTimeAnonymous || 180;
this.chat = new OryxChat(this);
this.notificationStore.setApi(this);
this.cashier = null;
$(window).on('message', $.proxy(this.handleMessage, this));
this.status({ resync: true });
// this.scheduleStatus(this.pullTime * 1000);
};
/*
* Utilities
*/
OryxApi.prototype.setLanguage = function(languageCode) {
this.languageCode = languageCode;
this.sendRequest("setlangcode", { "langCode": this.languageCode });
};
OryxApi.prototype.getLanguage = function() {
return this.languageCode;
};
OryxApi.prototype.translate = function(code, richtext) {
return OryxLang.get(this.languageCode, code, richtext);
};
OryxApi.prototype.setCustomTranslate = function(data) {
OryxLang.setCustomTranslate(data);
};
OryxApi.prototype.formatAmount = function(amountInCents, currencyCode, origin) {
if (this.alternativeCurrency.useAlternativeCurrency && this.alternativeCurrency.useAlternativeCurrency === true && origin !== undefined && this.alternativeCurrency.origin.indexOf(origin) > -1) {
var altCurrencyCode = oryxApi.translate('ALTERNATIVE_CURRENCY');
var options = {
stringFormat: oryxApi.translate('ALTERNATIVE_CURRENCY'),
formatAsCurrency: (this.alternativeCurrency.formatAsCurrency !== undefined ? this.alternativeCurrency.formatAsCurrency : true),
trimeLastTwoDigits: (this.alternativeCurrency.trimeLastTwoDigits !== undefined ? this.alternativeCurrency.trimeLastTwoDigits : false)
}
return OryxLang.formatAmount(this.languageCode, amountInCents, currencyCode, options);
} else {
return OryxLang.formatAmount(this.languageCode, amountInCents, currencyCode);
}
};
OryxApi.prototype.toCentsAmount = function(amount) {
return OryxLang.toCentsAmount(this.languageCode, amount);
};
OryxApi.prototype.addWsStartHandler = function(handler) {
this.wsStartHandlers.push(handler);
if (this.chat && this.chat.connected) {
this.executeHandlers.apply({ api: this, callBack: handler }, []);
}
};
OryxApi.prototype.getSessionId = function() {
if (this.sessionId != null) {
return this.sessionId;
}
return $.cookie('oryx_session_cookie');
};
OryxApi.prototype.getOryxCsrfToken = function() {
if (this.oct != null) {
return this.oct;
}
return $.cookie('oryx_csrf_token');
};
OryxApi.prototype.getPlayer = function() {
return this.player;
};
OryxApi.prototype.getBalance = function() {
return this.balance;
};
OryxApi.prototype.getDefaultAffiliate = function() {
return this.defaultAffiliate;
};
OryxApi.prototype.isLoggedIn = function(includeAnonymous) {
if (this.statusCode == OryxApiCodes.status.LOGGED_IN) {
return true;
} else if (includeAnonymous === true && this.statusCode == OryxApiCodes.status.LOGGED_IN_ANONYMOUS) {
return true;
}
return false;
};
OryxApi.prototype.handleMessage = function(event) {
var self = this;
OryxUtil.trace("handle message", event.originalEvent.data);
if (event.originalEvent.data && event.originalEvent.data.message == 'close') {
self.executeHandlers.apply({ api: self, handlerFor: "closeClient" }, [event.originalEvent.data]);
} else if (event.originalEvent.data && event.originalEvent.data.command == 'com.egt-bg.exit') {
self.executeHandlers.apply({ api: self, handlerFor: "closeClient" }, [event.originalEvent.data]);
} else if (event.originalEvent.data && event.originalEvent.data.message == 'cashier') {
self.executeHandlers.apply({ api: self, handlerFor: "openCashier" }, [event.originalEvent.data.gameCode, event.originalEvent.data.param]);
}
};
OryxApi.prototype.scheduleStatus = function(time) {
this.cancelScheduleStatus();
this.statusTimeout = setTimeout($.proxy(this.status, this), time);
if (this.statusCode == OryxApiCodes.status.LOGGED_IN) {
this.statusTimeoutLong = setTimeout($.proxy(this.status, this), time * 4);
}
};
OryxApi.prototype.cancelScheduleStatus = function() {
if (this.statusTimeout !== null) {
window.clearInterval(this.statusTimeout);
}
if (this.statusTimeoutLong !== null) {
window.clearInterval(this.statusTimeoutLong);
}
};
OryxApi.prototype.setLocation = function(activeWindows, inactiveWindows) {
this.chat.sendLocation(activeWindows, inactiveWindows);
};
OryxApi.prototype.setChatWindowState = function(chatWindowState) {
this.chat.setChatWindowState(chatWindowState);
};
OryxApi.prototype.chatMsg = function(msg) {
this.chat.sendMsg(msg.replace(/&/g, "&").replace(/ 0) {
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'deletependingmessage',
request: {
key: this.key,
sessionId: this.getSessionId(),
id: id
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var response = (data && data.response !== undefined) ? data.response : undefined;
self.executeHandlers.apply({ api: self, handlerFor: "ackClientNotification" }, [data.responseCode]);
dfd.resolve(data.responseCode);
} catch (e) {
dfd.resolve(OryxApiCodes.ackClientNotification.SYSTEM_ERROR, e);
}
}
});
} else {
self.executeHandlers.apply({ api: self, handlerFor: "ackClientNotification" }, [OryxApiCodes.ackClientNotification.OK]);
dfd.resolve(OryxApiCodes.ackClientNotification.OK);
}
return dfd.promise();
};
/*
* Actions
*/
OryxApi.prototype.defaultSubmitFormAction = function(container) {
var options = {};
if (container) {
options.container = container;
}
try {
var formdata = {};
var extraformdata = {};
var errors = false;
var self = this;
var $form = $(this);
$form.find('.form-error').hide().html("");
$form.find('.form-element .error').removeClass('error');
$form.find('.form-element > span').html("*");
var container = $('.registration-form .registration-form-container');
if (options && options.container) {
container = $(options.container);
}
var fields = $form.find('.field');
if (fields.length === 0) {
$form.find('.form-element .REQUIRED').addClass('error');
errors = true;
}
$.each(fields, function() {
var $el = $(this);
var val = $el.val();
if ($el.hasClass('REQUIRED') && $el.val().length === 0) {
$el.addClass("error");
errors = true;
}
if ($form.find('.field[name=GENDER] :selected').text() === "") {
$form.find('.field[name=GENDER]').addClass("error");
}
if ($el.attr('name') == 'EMAIL') {
//container.find('.form-error .errorDiv.EMAIL').remove();
if (!OryxUtil.isEmail(val)) {
$el.addClass("error");
if (val.length > 0) {
container.find('.form-error').append('' + oryxApi.translate("WRONG_EMAIL_FORMAT") + '
').fadeIn();
}
errors = true;
}
} else if ($el.attr('name') == 'PASSWORD') {
//container.find('.form-error .errorDiv.PASSWORD').remove();
var checkObj = OryxUtil.checkIfPasswordIsOk(val);
if (checkObj.valid === false) {
$el.addClass("error");
//container.find('.form-error').html(OryxUtil.formatString(oryxApi.translate(checkObj.errorCode), [oryxApi.passwordSecurity.min_password_length])).fadeIn();
if (val.length > 0) {
container.find('.form-error').append('' + OryxUtil.formatString(oryxApi.translate(checkObj.errorCode), [oryxApi.passwordSecurity.min_password_length]) + '
').fadeIn();
}
errors = true;
}
} else if ($el.attr('name') == 'VALIDATE_PASSWORD') {
//container.find('.form-error .errorDiv.VALIDATE_PASSWORD').remove();
if ($form.find("[name='PASSWORD']").val() !== val) {
$form.find('.field[name=PASSWORD]').addClass("error");
$el.addClass("error");
errors = true;
container.find('.form-error').append('' + oryxApi.translate("PASSWORD_MISMATCH") + '
').fadeIn();
}
} else if ($el.attr('name') == 'AFFILIATE_COUPON_CODE') {
val = val.toUpperCase();
} else if ($el.attr('name') === 'BIRTH_DATE') {
var today = new Date();
var birthDate = new Date(val);
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
if (age < 18) {
$el.addClass("error");
errors = true;
//$form.find('.form-error').html(oryxApi.translate('SUBMITREGFORM_MINOR')).fadeIn();
$form.find('.form-error').append('' + oryxApi.translate("SUBMITREGFORM_MINOR") + '
').fadeIn();
}
}
if ($el.data('extraformdata') !== undefined && $el.data('extraformdata').toString().toUpperCase() === "TRUE") {
extraformdata[$el.attr('name')] = val;
} else {
if ($el.attr('name') === "QUESTION") {
if ($el.parent().find("select.authQuestion").val() === "0") {
$el.addClass("error");
errors = true;
} else {
if (formdata["QUESTION"] === undefined) {
formdata["QUESTION"] = {};
}
var obj = {};
obj[$el.parent().find("select.authQuestion").val()] = val;
$.extend(true, formdata["QUESTION"], obj);
}
} else {
formdata[$el.attr('name')] = val;
}
}
});
var $acceptTc = $form.find("input[name=acceptedTcVersion]");
if (!$acceptTc.is(":checked")) {
$acceptTc.addClass("error");
$form.find('.form-error').prepend('' + oryxApi.translate('SUBMITREGFORM_TC') + '
').fadeIn();
errors = true;
}
if (errors) {
return false;
}
var affiliate = OryxUtil.getAffiliateData(oryxApi.getDefaultAffiliate());
var prop = {};
prop.acceptedTcVersion = $acceptTc.val();
prop.affiliateId = affiliate.affiliateId;
prop.affiliateProfileId = affiliate.affiliateProfileId;
prop.affiliateCustomTag = affiliate.affiliateCustomTag;
if (formdata.hasOwnProperty("NO_PROMO_EMAILS")) {
formdata.NO_PROMO_EMAILS = $("[name='NO_PROMO_EMAILS']").is(":checked");
if (oryxApi.reverse_opt_out) {
formdata.NO_PROMO_EMAILS = !formdata.NO_PROMO_EMAILS;
}
}
if (formdata.hasOwnProperty("NO_PROMO_SMS")) {
formdata.NO_PROMO_SMS = $("[name='NO_PROMO_SMS']").is(":checked");
if (oryxApi.reverse_opt_out) {
formdata.NO_PROMO_SMS = !formdata.NO_PROMO_SMS;
}
}
if (formdata.hasOwnProperty("NO_PROMO_PHONECALLS")) {
formdata.NO_PROMO_PHONECALLS = $("[name='NO_PROMO_PHONECALLS']").is(":checked");
if (oryxApi.reverse_opt_out) {
formdata.NO_PROMO_PHONECALLS = !formdata.NO_PROMO_PHONECALLS;
}
}
if (formdata.hasOwnProperty("VALIDATE_PASSWORD")) {
delete formdata.VALIDATE_PASSWORD;
}
oryxApi.submitRegistration(prop, formdata, extraformdata, options);
} catch (e) {
OryxUtil.trace("Exception defaultSubmitFormAction", err.message);
}
return false;
};
OryxApi.prototype.openIngameCashier = function() {
if (!$('iframe.gameFrame').length) {
OryxUtil.trace("iframe for ingame cashier not available");
return false;
}
$('iframe.gameFrame')[0].contentWindow.postMessage('openCashier', '*');
return true;
};
OryxApi.prototype.openCashier = function(objBeginingTab) {
var dfd = new $.Deferred();
try {
if (!this.isLoggedIn()) {
return false;
}
if (this.cashier === null) {
this.cashier = new OryxCashier.Cashier();
this.cashier.init({
api: this,
cashier: this.cashierParams
});
}
this.cashier.open(objBeginingTab);
dfd.resolve();
} catch (e) {
dfd.reject();
}
return dfd.promise();
};
OryxApi.prototype.closeCashier = function(handler) {
if (this.cashier !== null) {
this.cashier.close();
this.cashier = null;
this.executeHandlers.apply({ api: this, handlerFor: "closeCashier", callBack: handler }, []);
}
}
OryxApi.prototype.status = function(params) {
var self = this;
var dfd = new $.Deferred();
var sessionId = this.getSessionId();
if (sessionId === null && (!params || !params.resync)) {
this.checkResponse();
dfd.resolve(false);
return;
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'status',
request: {
sessionId: sessionId,
resync: (params && params.resync !== undefined) ? params.resync : false,
cage: this.cage,
languageCode: this.languageCode,
softwareSerial: this.apiVersion,
clientType: self.clientType,
userAgent: self.userAgent
}
},
dataType: 'json',
cache: false,
success: function(data) {
//$.proxy(self.checkResponse, data);
self.checkResponse(data);
dfd.resolve(data);
}
});
return dfd.promise();
};
OryxApi.prototype.login = function(username, password, handler, auth) {
OryxUtil.trace("login action", username, password);
var dfd = new $.Deferred();
var self = this;
if (username === undefined || username === null || password === undefined || password === null ||
username.length === 0 || password.length === 0) {
self.executeHandlers.apply({ api: self, handlerFor: "login", callBack: handler }, [OryxApiCodes.login.LOGIN_FAILED, { responseCode: OryxEnum.LoginResponseCode.FIELDS_EMPTY }]);
dfd.resolve({ responseCode: OryxEnum.LoginResponseCode.FIELDS_EMPTY });
return dfd.promise();
}
if (auth === undefined) {
if (typeof handler === "object") {
auth = handler;
}
}
var requestData = {
cage: this.cage,
key: this.key,
sessionId: this.getSessionId(),
username: username,
password: password,
languageCode: this.languageCode,
playModeCode: 'REAL',
softwareSerial: this.apiVersion,
clientType: self.clientType,
userAgent: self.userAgent
};
if (auth) {
requestData["auth"] = auth;
// added "loginSite" to "auth" for backward compatibility on js api ... not the cleanest solution but it will have do ... (comment by Saso 2020-03-04)
if (auth.loginSite) {
requestData.loginSite = auth.loginSite;
// remove so that everything is back to normal for PortalWS
delete auth.loginSite;
}
if (Object.keys(auth).length === 0) {
delete requestData.auth;
}
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'login',
request: requestData
},
dataType: 'json',
cache: false,
success: function(data, textStatus, xhr) {
try {
var oct = xhr.getResponseHeader('oryx_csrf_token');
if (oct) {
$.cookie('oryx_csrf_token', oct, { path: '/' });
self.oct = oct;
}
} catch(e) {
console.error("Reading and writing csrf token to cookie failed!");
}
self.checkResponse(data);
try {
var response = (data && data.response !== undefined) ? data.response : undefined;
self.executeHandlers.apply({ api: self, handlerFor: "login", callBack: handler }, [data.responseCode, response]);
dfd.resolve(data.responseCode, response);
} catch (e) {
dfd.resolve(OryxApiCodes.login.SYSTEM_ERROR);
}
},
error: function() {
dfd.resolve(OryxApiCodes.login.SYSTEM_ERROR);
}
});
return dfd.promise();
};
OryxApi.prototype.loginWithToken = function(token, extradata) {
OryxUtil.trace("login token", token);
var self = this;
if (token === undefined || token.length === 0) {
self.executeHandlers.apply({ api: self, handlerFor: "login" }, [OryxApiCodes.login.LOGIN_FAILED, {}]);
return;
}
var request = {
cage: this.cage,
key: this.key,
sessionId: this.getSessionId(),
token: token,
languageCode: this.languageCode,
playModeCode: 'REAL',
softwareSerial: this.apiVersion
};
if (extradata && extradata.state && extradata.state !== undefined && extradata && extradata.redirectUrl && extradata.redirectUrl !== undefined ) {
request.state = extradata.state;
request.redirectUrl = extradata.redirectUrl;
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'loginwithtoken',
request: request
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var response = (data && data.response !== undefined) ? data.response : undefined;
self.executeHandlers.apply({ api: self, handlerFor: "login" }, [data.responseCode, response]);
} catch (e) {}
},
error: function() {
dfd.resolve(OryxApiCodes.loginwithtoken.SYSTEM_ERROR);
}
});
};
OryxApi.prototype.acceptTC = function(acceptedTcVersion) {
OryxUtil.trace("acceptTC action", acceptedTcVersion);
var self = this;
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'accepttc',
request: {
key: this.key,
sessionId: this.getSessionId(),
acceptedTcVersion: acceptedTcVersion
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var response = (data && data.response !== undefined) ? data.response : undefined;
self.executeHandlers.apply({ api: self, handlerFor: "acceptTC" }, [data.responseCode, acceptedTcVersion, response]);
} catch (e) {}
}
});
};
OryxApi.prototype.changePassword = function(passwordOld, passwordNew, authModuleChallenge) {
OryxUtil.trace("changePassword action", passwordOld, passwordNew);
var self = this;
var dfd = new $.Deferred();
if (authModuleChallenge === undefined) {
authModuleChallenge = {};
}
var objSend = {
sessionId: this.getSessionId(),
passwordOld: passwordOld,
passwordNew: passwordNew
}
if (authModuleChallenge.password) {
if (objSend["auth"] === undefined) {
objSend["auth"] = {};
}
objSend["auth"]["password"] = authModuleChallenge.password;
}
if (authModuleChallenge.question) {
if (objSend["auth"] === undefined) {
objSend["auth"] = {};
}
objSend["auth"]["question"] = JSON.parse(decodeURIComponent(authModuleChallenge.question));
}
if (authModuleChallenge.sms) {
if (objSend["auth"] === undefined) {
objSend["auth"] = {};
}
objSend["auth"]["sms"] = authModuleChallenge.sms;
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'changepassword',
request: objSend
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var response = (data && data.response !== undefined) ? data.response : undefined;
self.executeHandlers.apply({ api: self, handlerFor: "changePassword" }, [ data.responseCode, response ]);
dfd.resolve(data.responseCode, response);
} catch (e) {
dfd.resolve(OryxApiCodes.changepassword.SYSTEM_ERROR, e);
}
},
error: function() {
dfd.resolve(OryxApiCodes.changepassword.SYSTEM_ERROR);
}
});
return dfd.promise();
};
OryxApi.prototype.logout = function(handler) {
OryxUtil.trace("logout action");
var self = this;
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'logout',
request: {
sessionId: this.getSessionId()
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
self.player = null;
self.executeHandlers.apply({ api: self, handlerFor: "player" }, [ self.player ]);
self.balance = {
version: -1,
balance: null
};
self.oct = null;
$.cookie("oryx_csrf_token", null, {path: '/'});
self.closeCashier();
self.executeHandlers.apply({ api: self, handlerFor: "closeClient" }, ['logout']);
self.executeHandlers.apply({ api: self, handlerFor: "logout", callBack: handler }, []);
}
});
};
OryxApi.prototype.gamelink = function(gameCode, handler, isAnonymousGame, objQueue) {
OryxUtil.trace("gamelink action", gameCode, handler);
var self = this;
var dfd = new $.Deferred();
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'gamelink',
request: {
sessionId: this.getSessionId(),
gameCode: gameCode,
languageCode: this.getLanguage(),
cage: this.cage,
softwareSerial: this.apiVersion,
isAnonymousGame: (isAnonymousGame === true ? true : false),
clientType: self.clientType
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var gameLink = (data && data.response !== undefined) ? data.response.gameLink : undefined;
self.executeHandlers.apply({ api: self, callBack: handler }, [data.responseCode, gameCode, gameLink, isAnonymousGame, objQueue]);
dfd.resolve(data.responseCode, gameCode, gameLink, isAnonymousGame, objQueue);
} catch (e) {
dfd.resolve(OryxApiCodes.gamelink.SYSTEM_ERROR, e);
}
},
error: function(e) {
dfd.resolve(OryxApiCodes.gamelink.SYSTEM_ERROR, e);
}
});
return dfd.promise();
};
OryxApi.prototype.opengame = function(prop, handler) {
OryxUtil.trace("opengame action", prop, handler);
var self = this;
var dfd = new $.Deferred();
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'opengame',
request: {
sessionId: this.getSessionId(),
gameCode: prop.gameCode,
languageCode: this.getLanguage(),
cage: this.cage,
softwareSerial: this.apiVersion,
isAnonymousGame: (prop.anonymous === true),
clientType: self.clientType
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, callBack: handler }, [ data.responseCode, data.response ]);
dfd.resolve(data.responseCode, data.response);
} catch (e) {
dfd.resolve(OryxApiCodes.opengame.SYSTEM_ERROR, e);
}
},
error: function(e) {
dfd.resolve(OryxApiCodes.opengame.SYSTEM_ERROR, e);
}
});
return dfd.promise();
};
OryxApi.prototype.registrationForm = function(container) {
OryxUtil.trace("registrationForm action");
var options = {};
if (container) {
options.container = container;
}
var self = this;
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'registrationform',
request: {
sessionId: this.getSessionId(),
cage: this.cage,
playModeCode: 'REAL',
languageCode: this.languageCode
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var registrationFormData = (data && data.response !== undefined) ? data.response : undefined;
self.executeHandlers.apply({ api: self, handlerFor: "registrationForm" }, [data.responseCode, registrationFormData, options]);
} catch (e) {}
}
});
};
OryxApi.prototype.submitRegistration = function(prop, formdata, extraformdata, options) {
if (extraformdata === undefined) {
extraformdata = {};
}
OryxUtil.trace("submitRegistration action", prop, formdata, extraformdata);
var self = this;
var request = {
sessionId: this.getSessionId(),
cage: this.cage,
playModeCode: 'REAL',
acceptedTcVersion: prop.acceptedTcVersion,
languageCode: this.languageCode,
softwareSerial: this.apiVersion,
affiliateId: prop.affiliateId,
affiliateProfileId: prop.affiliateProfileId,
affiliateCustomTag: prop.affiliateCustomTag,
data: formdata,
extraData: extraformdata
};
if (prop.signupSite) {
request.signupSite = prop.signupSite;
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'submitregistrationform',
request: request
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var response = (data && data.response !== undefined) ? data.response : undefined;
self.executeHandlers.apply({ api: self, handlerFor: "submitRegistration" }, [data.responseCode, response, options]);
} catch (e) {}
}
});
};
OryxApi.prototype.listGames = function(handler) {
OryxUtil.trace("listGames action", handler);
var self = this;
var player = this.getPlayer();
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'listgames',
request: {
sessionId: this.getSessionId(),
cage: this.cage,
currenyCode: player.currencyCode
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, handlerFor: "listGames", callBack: handler }, [data.responseCode, data.response]);
} catch (e) {}
}
});
};
OryxApi.prototype.ackPlayStat = function() {
OryxUtil.trace("ackPlayStat action");
var self = this;
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'ackplaystat',
request: {
sessionId: this.getSessionId()
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, handlerFor: "ackPlayStat" }, [data.responseCode]);
} catch (e) {}
}
});
};
OryxApi.prototype.extBalanceInfo = function(handler) {
OryxUtil.trace("extbalanceinfo action", handler);
var self = this;
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'extbalanceinfo',
request: {
sessionId: this.getSessionId()
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, callBack: handler }, [data.responseCode, data.response]);
} catch (e) {}
}
});
};
OryxApi.prototype.fundTransfer = function(amountInCents, transferType, handler) {
OryxUtil.trace("fund transfer action", amountInCents, transferType, handler);
var self = this;
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'fundtransfer',
request: {
sessionId: this.getSessionId(),
amount: amountInCents,
transferType: transferType
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, callBack: handler }, [data.responseCode, data.response]);
} catch (e) {}
}
});
};
/*
* Response handlers
*/
OryxApi.prototype.checkResponse = function(data) {
this.handlePlayer(data);
this.handleStatus(data);
this.handleBalance(data);
this.handleClientNotifications(data);
this.handlePlayStat(data);
this.handleForceLogout(data);
this.handleServerTime(data);
};
OryxApi.prototype.handleStatus = function(data) {
if (data === undefined || (data && data.status === undefined)) {
return;
}
var newStatusCode = (data === null ? null : +data.status.statusCode);
if (newStatusCode === null) {
newStatusCode = OryxApiCodes.status.LOGGED_OUT;
}
var newSessionId = (data === null ? null : data.status.sessionId);
if (this.sessionId !== newSessionId) {
this.executeHandlers.apply({ api: this, handlerFor: "new_sessionid" }, [{ "statusCode": newStatusCode, "old_sessionId": this.sessionId, "new_sessionId": newSessionId }]);
this.sessionId = (newSessionId == false ? null : newSessionId);
$.cookie('oryx_session_cookie', this.sessionId, { expires: 1, path: '/', secure: this.useSecureCookies});
}
if (this.statusCode !== newStatusCode) {
OryxUtil.trace("change status", this.statusCode, newStatusCode);
this.statusCode = newStatusCode;
if (this.isLoggedIn(true)) {
if (data.chatconfig !== undefined) {
this.chatInit(data.chatconfig);
if (data.chatconfig.pullTime && data.chatconfig.pullTime != this.pullTime) {
this.pullTime = data.chatconfig.pullTime;
// this.cancelScheduleStatus();
// this.scheduleStatus(this.pullTime * 1000);
}
}
this.chat.start();
} else {
this.chat.stop();
this.executeHandlers.apply({ api: this, handlerFor: "logout" }, [data]);
this.status({ resync: true });
}
try {
this.executeHandlers.apply({ api: this, handlerFor: "status" }, [this.statusCode]);
} catch (e) {
}
}
// new
if (this.isLoggedIn()) {
this.scheduleStatus(this.pullTime * 1000);
} else {
this.scheduleStatus(this.pullTimeAnonymous * 1000);
}
};
OryxApi.prototype.handlePlayer = function(data) {
if (!data || data.player === undefined) {
return;
}
OryxUtil.trace("handle player", data);
this.player = data.player;
this.executeHandlers.apply({ api: this, handlerFor: "player" }, [ this.player ]);
};
OryxApi.prototype.handleBalance = function(data) {
if (!data || data.balance === undefined) {
return;
}
OryxUtil.trace("handle balance", this.balance.version, this.balance.balance, data.balance.version, data.balance.balance);
if (data.balance.version > this.balance.version) {
this.balance.version = data.balance.version;
this.balance.balance = data.balance.balance;
this.executeHandlers.apply({ api: this, handlerFor: "balance" }, [this.balance]);
}
};
OryxApi.prototype.handleForceLogout = function(data) {
var self = this;
// if (!data || data.forcelogout === undefined) {
// return;
// }
if (data && data.forcelogout && data.forcelogout.reasonCode) {
var reason = data.forcelogout.reasonCode;
}
if (data && data.signal && data.signal.reason) {
var reason = data.signal.reason;
}
if (reason === undefined) {
return false;
}
OryxUtil.trace("handle forcelogout", data);
self.closeCashier();
self.executeHandlers.apply({ api: self, handlerFor: "closeClient" }, [reason]);
self.executeHandlers.apply({ api: self, handlerFor: "forceLogout" }, [reason]);
};
OryxApi.prototype.handleClientNotifications = function(data) {
if (!data || data.clientnotifications === undefined) {
return;
}
if (data.clientnotifications.notifications === undefined || data.clientnotifications.notifications.length === 0) {
return;
}
OryxUtil.trace("handle ClientNotifications", data.clientnotifications);
var newNotification = false;
var self = this;
$.each(data.clientnotifications.notifications, function(i, notif) {
if (self.notificationStore.addItem(notif)) {
newNotification = true;
}
});
this.executeHandlers.apply({ api: this, handlerFor: "clientNotifications" }, [newNotification, data]);
};
OryxApi.prototype.handlePlayStat = function(data) {
if (!data || data.playstat === undefined) {
return;
}
this.executeHandlers.apply({ api: this, handlerFor: "playStat" }, [data.playstat]);
};
OryxApi.prototype.handleServerTime = function(data) {
if (!data || data.servertime === undefined) {
return;
}
this.executeHandlers.apply({ api: this, handlerFor: "serverTime" }, [data.servertime]);
};
OryxApi.prototype.popUpMsg = function(msg, prop) {
if (typeof OryxCashier === 'undefined') {
OryxUtil.trace("Cashier not enabled!");
return;
}
var self = this;
if (prop) {
if (OryxUtil.isFunction(prop)) {
prop = $.extend(true, {}, { 'handler': prop });
}
} else {
prop = {};
}
var showPopUpNumbering = true;
if (oryxApi && oryxApi.cashierParams && oryxApi.cashierParams.hasOwnProperty("showPopUpNumbering") && oryxApi.cashierParams.showPopUpNumbering === false) {
showPopUpNumbering = false;
}
var popupResult = new OryxCashier.MsgPopup();
popupResult.init(oryxApi.cashier);
popupResult.open({
title: prop.title,
content: msg,
showMask: true,
unique: (prop.unique ? prop.unique : false),
identifier: prop.identifier,
showPopUpNumbering: showPopUpNumbering,
buttons: [
new OryxCashier.Button({ title: "OK", handler: function() {
popupResult.close();
self.executeHandlers.apply({ api: self, callBack: prop.handler }, []);
}})
],
data: prop.data
});
};
OryxApi.prototype.modal = function(prop) {
var self = this;
if (typeof OryxCashier === 'undefined') {
OryxUtil.trace("Cashier not enabled!");
return;
}
if (prop === undefined) {
OryxUtil.trace("Pass an object with properties!");
return;
}
var mod = new OryxCashier.Modal();
mod.open(prop);
return mod;
};
OryxApi.prototype.listFunPlayPackages = function(handler) {
var self = this;
var dfd = new $.Deferred();
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'getfunplaypackages',
request: {
sessionId: this.getSessionId()
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, callBack: handler }, [data.responseCode, data.response]);
dfd.resolve(data.responseCode, data.response);
} catch (e) {
self.executeHandlers.apply({ api: self, callBack: handler }, [OryxApiCodes.listFunPlayPackages.SYSTEM_ERROR, e]);
dfd.resolve(OryxApiCodes.listFunPlayPackages.SYSTEM_ERROR, e);
}
}
});
return dfd.promise();
}
OryxApi.prototype.getPlayerPromotionTokens = function(promotionType, handler) {
var self = this;
var dfd = new $.Deferred();
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'getplayerpromotiontokens',
request: {
sessionId: this.getSessionId(),
promotionType: promotionType
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, callBack: handler }, [data.responseCode, data.response]);
dfd.resolve(data.responseCode, data.response);
} catch (e) {
self.executeHandlers.apply({ api: self, callBack: handler }, [OryxApiCodes.getPlayerPromotionTokens.SYSTEM_ERROR, e]);
dfd.resolve(OryxApiCodes.getPlayerPromotionTokens.SYSTEM_ERROR, e);
}
}
});
return dfd.promise();
}
OryxApi.prototype.sendRequest = function (op, reqData) {
if (reqData === undefined) reqData = {};
OryxUtil.trace("Sending request", op, reqData);
var self = this;
var dfd = new $.Deferred();
if (reqData.sessionId === undefined) {
reqData.sessionId = this.getSessionId();
}
if (reqData.cage === undefined) {
reqData.cage = this.cage;
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: op,
request: reqData
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
dfd.resolve(data.responseCode, data);
} catch (e) {
dfd.resolve(OryxApiCodes.gamelink.SYSTEM_ERROR, e);
}
},
error: function(e) {
dfd.resolve(OryxApiCodes.gamelink.SYSTEM_ERROR, e);
}
});
return dfd.promise();
}
OryxApi.prototype.notificationService = function(objData) {
var self = this;
if (self.notificationServiceHandler !== undefined && self.notificationServiceHandler !== null && OryxUtil.isFunction(self.notificationServiceHandler)) {
self.notificationServiceHandler(objData);
}
}
OryxApi.prototype.lostPassword = function(param, handler, authConfig) {
var self = this;
var dfd = new $.Deferred();
var requestObj = {
cage: self.cage,
sessionId: self.getSessionId()
}
if (param && param.email) {
requestObj["email"] = param.email;
}
if (param && param.username) {
requestObj["username"] = param.username;
}
if (authConfig === undefined && typeof handler === "object") {
authConfig = handler;
} else if (authConfig === undefined) {
authConfig = {};
}
if (authConfig && authConfig.password) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["password"] = authConfig.password;
}
if (authConfig && authConfig.question) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["question"] = authConfig.question;
}
if (authConfig && authConfig.sms) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["sms"] = authConfig.sms;
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'lostpassword',
request: requestObj
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, handlerFor: "lostPassword", callBack: handler }, [data.responseCode, data.response]);
dfd.resolve(data.responseCode);
} catch (e) {
dfd.resolve(OryxApiCodes.lostPassword.SYSTEM_ERROR, e);
}
},
error: function(e) {
dfd.resolve(OryxApiCodes.lostPassword.SYSTEM_ERROR, e);
}
});
return dfd.promise();
}
OryxApi.prototype.changeLostPassword = function(password, key, handler, authConfig) {
var self = this;
var dfd = new $.Deferred();
var requestObj = {
key: key,
password: password,
cage: self.cage,
sessionId: self.getSessionId()
}
if (authConfig === undefined && typeof handler === "object") {
authConfig = handler;
} else if (authConfig === undefined) {
authConfig = {};
}
if (authConfig && authConfig.password) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["password"] = authConfig.password;
}
if (authConfig && authConfig.question) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["question"] = authConfig.question;
}
if (authConfig && authConfig.sms) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["sms"] = authConfig.sms;
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'changelostpassword',
request: requestObj
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, handlerFor: "changeLostPassword", callBack: handler }, [data.responseCode, data.response]);
dfd.resolve(data.responseCode);
} catch (e) {
dfd.resolve(OryxApiCodes.changeLostPassword.SYSTEM_ERROR, e);
}
},
error: function(e) {
dfd.resolve(OryxApiCodes.changeLostPassword.SYSTEM_ERROR, e);
}
});
return dfd.promise();
}
OryxApi.prototype.getPlayerProfile = function() {
var self = this;
var dfd = new $.Deferred();
self.sendRequest("playerprofileform", { 'key': self.key, 'sessionId': self.getSessionId()}).then(function(responseCode, data){
if (responseCode !== OryxApiCodes.getPlayerProfile.OK) {
dfd.resolve(responseCode, data);
return;
}
var arrFieldInfos = data.response.fieldInfos;
var objPlayerData = {};
for (var intJ = 0; intJ < arrFieldInfos.length; intJ++){
objPlayerData[arrFieldInfos[intJ].fieldCode] = arrFieldInfos[intJ].defaultValue;
}
dfd.resolve(responseCode, objPlayerData);
});
return dfd.promise();
}
OryxApi.prototype.updatePlayerProfile = function(objNewPlayerData, authConfig) {
var self = this;
var dfd = new $.Deferred();
self.getPlayerProfile().then(function(responseCode, responseData){
if (responseCode !== OryxApiCodes.getPlayerProfile.OK) {
dfd.resolve(responseCode, responseData);
return;
}
var requestObj = {
'key': self.key,
'sessionId': self.getSessionId(),
'data': responseData
}
if (authConfig === undefined) {
authConfig = {};
}
if (authConfig.password) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["password"] = authConfig.password;
}
if (authConfig.question) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["question"] = authConfig.question;
}
if (authConfig.sms) {
if (requestObj["auth"] === undefined) {
requestObj["auth"] = {};
}
requestObj["auth"]["sms"] = authConfig.sms;
}
$.extend(true, responseData, objNewPlayerData);
self.sendRequest("submitplayerprofileform", requestObj).then(function(responseCode, data){
dfd.resolve(responseCode, data);
});
});
return dfd.promise();
}
OryxApi.prototype.switchCashierTab = function(data) {
if (this.cashier) {
this.cashier.step('Cashier', 'go_module', data);
}
}
OryxApi.prototype.updatePMAccount = function(pmCode, label, data) {
var dfd = new jQuery.Deferred();
var self = this;
$.ajax({
url: self.url,
type: 'POST',
timeout: 30000,
data: {
op: 'updatepmaccount',
request: {
key: self.key,
sessionId: self.getSessionId(),
label: label,
pmCode: pmCode,
data: data
}
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
var response = (data && data.response !== undefined) ? data.response : undefined;
if (response === undefined) {
if (data.message !== undefined) {
response = data.message;
}
}
dfd.resolve(data.responseCode, response);
} catch (e) {
dfd.resolve(OryxCashier.Comm.Codes.updatePMAccount.ERROR, e);
}
},
error: function() {
dfd.resolve(OryxCashier.Comm.Codes.updatePMAccount.ERROR);
}
});
return dfd.promise();
};
OryxApi.prototype.GetTopWinsList = function(options, handler) {
var self = this;
var dfd = new jQuery.Deferred();
var postData = {
"cage": this.cage,
"sessionId": this.getSessionId()
}
if (options !== undefined) {
if (options.period) {
postData.period = options.period;
}
if (options.gameDefinitionCode) {
postData.gameDefinitionCode = options.gameDefinitionCode;
}
if (options.maxCount) {
postData.maxCount = options.maxCount;
}
}
$.ajax({
url: this.url,
type: 'POST',
data: {
op: 'gettopwinslist',
request: postData
},
dataType: 'json',
cache: false,
success: function(data) {
self.checkResponse(data);
try {
self.executeHandlers.apply({ api: self, handlerFor: "GetTopWinsList", callBack: handler }, [data.responseCode, data.response]);
dfd.resolve(data.responseCode, data.response);
} catch (e) {
dfd.resolve(OryxApiCodes.GetTopWinsList.ERROR, e);
}
},
error: function() {
dfd.resolve(OryxApiCodes.GetTopWinsList.ERROR);
}
});
return dfd.promise();
};
OryxApi.prototype.GetPlayerLoginSessions = function(numResults) {
var self = this;
var dfd = new jQuery.Deferred();
var options = {};
if (numResults !== undefined) {
options.numResults = numResults;
}
self.sendRequest("getplayerloginsessions", options).then(function(responseCode, response){
dfd.resolve(response.responseCode, (response.response && response.response.loginSessions ? response.response.loginSessions : []));
});
return dfd.promise();
};
OryxApi.prototype.GetPlayerLastGamesPlayed = function(maxCount) {
var self = this;
var dfd = new jQuery.Deferred();
var options = {};
if (maxCount !== undefined) {
options.maxCount = maxCount;
}
self.sendRequest("getplayerlastgamesplayed", options).then(function(responseCode, response){
dfd.resolve(responseCode, response.response);
});
return dfd.promise();
};
OryxApi.prototype.PlayerIdVerification = function(data) {
var self = this;
var dfd = new jQuery.Deferred();
/*data = {
"provider": "EE_KYC_IDCARD", // "EE_KYC_IDCARD", "EE_KYC_MOBILEID"
"verificationPayload": "some_base_64 string", // when using card ... payload is base64 certificate from card
"language": "ENG" // when MOBILE
};*/
self.sendRequest("playeridverification", data).then(function(responseCode, response){
dfd.resolve(responseCode, response.response);
});
return dfd.promise();
};
OryxApi.prototype.SetPlayerProperty = function(data) {
var self = this;
var dfd = new jQuery.Deferred();
self.sendRequest("setplayerproperty", data).then(function(responseCode, response){
dfd.resolve(responseCode, response.response);
});
return dfd.promise();
};
OryxApi.prototype.GetPlayerProperty = function(prop) {
var self = this;
var dfd = new jQuery.Deferred();
var options;
if(prop === undefined) {
options = {};
} else {
options = {
prop: prop
};
}
self.sendRequest("getplayerproperty", options).then(function(responseCode, response){
dfd.resolve(responseCode, response.response);
});
return dfd.promise();
};
OryxApi.prototype.smsVerification = function(prop) {
var self = this;
var dfd = new jQuery.Deferred();
if (prop && (prop.number || prop.token)) {
self.sendRequest("smsverification", prop).then(function(responseCode, response){
dfd.resolve(responseCode, response.response);
});
} else {
dfd.resolve({ "error": "Missing 'number' or 'token'" });
}
return dfd.promise();
};
OryxApi.prototype.getPlayerFavouriteGames = function(filter) {
var self = this;
var dfd = new jQuery.Deferred();
// filter options
// numRecords - number of results returned (default value is 10 in case parameter is not send)
// period - number of days to be included in the result (default value is 7 in case parameter is not send - meaning last week). Is restricted to max 60 days.
// desktop - include desktop games (default value is true in case parameter is not send)
// mobile - include mobile games (default value is true in case parameter is not send)
filter = filter || {};
self.sendRequest("getplayerfavouritegames", filter).then(function(responseCode, response){
dfd.resolve(responseCode, response.response);
});
return dfd.promise();
};
OryxApi.prototype.getPlayerValidations = function(options) {
var self = this;
var dfd = new jQuery.Deferred();
options = options || {};
self.sendRequest("getplayervalidations", options).then(function(responseCode, response){
dfd.resolve(responseCode, response.response);
});
return dfd.promise();
};