Desposit and Bet the Derby with TwinSpires

\n" + " \n" + " \n" + " \n" + "\n" + "
\n" + " \n" + " \n" + "\n" + "
\n" + " \n" + "
\n" + " \n" + " \n" + " \n" + "\n" + "
\n" + " \n" + "
\n" + " \n" + " \n" + "\n" + "
\n" + " \n" + "
\n" + "
\n" + " \n" + " \n" + "
\n" + " \n" + " \n" + " \n" + " \n" + "
\n" + " \n" + " \n" + "
\n" + " \n" + "
\n" + " \n" + "
\n" + " \n" + "
\n" + " \n" + "
\n" + " \n" + "
\n" + " \n" + "
\n" + " \n" + "\n" + "\n" + ""); }]); angular.module("templates/qd-cc.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("templates/qd-cc.html", "
\n" + " \n" + "
\n" + " \n" + " \n" + "\n" + "
\n" + " \n" + "\n" + "
\n" + " \n" + " \n" + " \n" + "
\n" + " \n" + " \n" + "
\n" + "
\n" + " \n" + "\n" + "
\n" + " \n" + " \n" + "
\n" + " \n" + " \n" + "\n" + "
\n" + "
\n" + " \n" + " \n" + "\n" + "
\n" + " \n" + "
\n" + " \n" + " \n" + "
\n" + " \n" + "
\n" + " \n" + "\n" + "
\n" + " \n" + "
\n" + " \n" + "\n" + "
\n" + " \n" + "\n" + "
\n" + "
\n" + "
\n" + "

PayPal

\n" + " {{ppEmail}}\n" + "
\n" + "
\n" + "
\n" + " \n" + "
\n" + " \n" + " \n" + "\n" + " \n" + "\n" + "\n" + "
\n" + " \n" + "
\n" + "\n" + "
\n" + " \n" + "
\n" + "\n" + "
\n" + " \n" + "
\n" + "\n" + "\n" + "
\n" + " \n" + "
\n" + ""); }]); angular.module("templates/quickDeposit.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("templates/quickDeposit.html", "
\n" + "
\n" + "
\n" + "
\n" + " CashierX\n" + "
\n" + "
\n" + " \n" + " \n" + "\n" + "
{{registerSuccess}}
\n" + "
You have been successfully signed up for the bonus program.
\n" + "
There was an error signing you up for the bonus program.
\n" + "
{{errMsg}}
\n" + "
{{depositConfirmation}}
\n" + "\n" + " \n" + "\n" + "
\n" + " \n" + "
\n" + "
\n" + " \n" + "
\n" + "
\n" + ""); }]); angular.module("templates/quickDepositBonus.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("templates/quickDepositBonus.html", "
\n" + "
\n" + "
\n" + "
\n" + " {{bonusInfo.shortDescription ? bonusInfo.shortDescription : bonusInfo.name}}cancel\n" + "
\n" + "
\n" + "\n" + " \n" + " \n" + "
{{errMsg}}
\n" + "
{{depositConfirmation}}
\n" + "\n" + " \n" + "\n" + "
\n" + " \n" + "
\n" + "
\n" + ""); }]); angular.module("templates/withdraw-info.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("templates/withdraw-info.html", "
\n" + "
\n" + " Back\n" + "
\n" + "\n" + "
\n" + "
\n" + "
\n" + "
Current Account Balance:
\n" + "
{{currentAccountBalance | currency}}
\n" + "
\n" + "\n" + "
\n" + "
\n" + "
Pending EZMoney Deposits
\n" + "
-{{pendingEZMoneyDeposit | currency}}
\n" + "
\n" + "\n" + "
\n" + "
Pending PayPal Deposits
\n" + "
-{{pendingPaypalDeposit | currency}}
\n" + "
\n" + "\n" + "
\n" + "
Pending Conditional Bonus
\n" + "
-{{pendingConditionalBonus | currency}}
\n" + "
\n" + "\n" + "
\n" + "\n" + "
\n" + "
Available for withdrawal
\n" + "
{{availableWithdrawBalance | currency}}
\n" + "
\n" + " \n" + "
\n" + "\n" + "
\n" + "
EZMoney
\n" + "
\n" + " It will take 4 calendar days before we have confirmation of a completed deposit transaction. During this time, you will be able to play with the funds; however, you will not be able to withdraw those funds until they have cleared your bank.\n" + "
\n" + "
\n" + "\n" + "
\n" + "
PayPal
\n" + "
\n" + " It will take 4-6 calendar days before we have confirmation of a completed deposit transaction. During this time, you will be able to play with the funds; however, you will not be able to withdraw these funds until they have cleared with PayPal.\n" + "
\n" + "
\n" + "\n" + "
\n" + "
Conditional Bonus
\n" + "
\n" + " Bonus money is made available to wager, but can't be withdrawn until the defined criteria for that bonus has been met. Refer to your account page for bonus criteria information and progress.\n" + "
\n" + "
\n" + "\n" + "
\n" + "
\n" + ""); }]); angular.module('qdWidget', ['quickDeposit', 'user', 'EzMoney', 'fundingOptions', 'withdraw', 'featureToggle']); angular.module('quickDeposit', ['templates.quickDeposit']).value('version', '1.0.1') .directive('ngBindHtmlUnsafe', [function() { return function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtmlUnsafe); scope.$watch(attr.ngBindHtmlUnsafe, function ngBindHtmlUnsafeWatchAction(value) { element.html(value || ''); }); }; }]); angular.module('EzMoney', ['ngCookies', 'safeApply', 'templates.quickDeposit']) .value('version', '1.0.1'); angular.module('user', ['ngCookies', 'safeApply']) .value('version', '1.0.1'); angular.module('fundingOptions', ['ngCookies', 'safeApply']) .value('version', '1.0.1'); angular.module('withdraw', ['ngCookies', 'safeApply']) .value('version', '1.0.1'); angular.module('user').controller('acctBalanceController', ['$rootScope', '$scope', 'acctBalanceService', '$filter', function ($rootScope, $scope, acctBalanceService, $filter) { $scope.init = function () { // Once user session is available, get A/C Balance acctBalanceService.getBalancePromise().then(function (data) { if (data && data.AccountBalance) { var balance = data.AccountBalance.Balance; if (!isNaN(balance)) { //$rootScope.accountBalance = $filter('currency')(balance); $scope.accountBalance = $filter('currency')(balance); } else { $scope.accountBalance = "N/A"; } $scope.$apply(); } }); }; $scope.$on('updateBalance', function (e, data) { $scope.init(); }); $scope.init(); $scope.showWithdrawInfo = function(){ $rootScope.errMsg = ""; $rootScope.depositConfirmation = ""; $rootScope.isWithdrawInfo = true; $rootScope.isWithdrawBalance = false; $rootScope.isWithdrawSelect = false; $rootScope.isEZMW = false; $rootScope.isCheckW = false; $rootScope.isPaypalW = false; $rootScope.menuHide = true; $scope.ezmwscreen = false; $scope.checkwscreen = false; $scope.paypalwscreen = false; }; $scope.isNumeric = function(input) { return $.isNumeric(input); } } ]); angular.module('quickDeposit').controller('ccController', ['$scope', 'global', '$controller', 'errService', 'vpvConfig', '$filter', '$rootScope', 'ccService', 'ccTokens', function ($scope, global, $controller, errService, vpvConfig, $filter, $rootScope, CCService, Tokens) { $controller('qdBaseController', { $scope: $scope }); $scope.cc = {}; $rootScope.errMsg = ''; $scope.cc.billAddressDiff = 'false'; $rootScope.isQBContinue = false; $scope.$on("reset:creditCard", function() { $scope.isFormValid = true; $scope.ccDone = false; $scope.showCCDone = false; $scope.showCCWager = false; $scope.resetFieldValues(); }); $scope.reset = function() { $scope.isFormValid = true; $scope.ccDone = false; $scope.showCCDone = false; $scope.showCCWager = false; if (typeof TSM !== 'undefined') { TSM.LiveRaces.show(); } }; $scope.resetFieldValues = function(){ if (typeof $scope.amountToDeposit !== "undefined") $scope.amountToDeposit = ""; if (typeof $scope.cc.cvv2 !== "undefined") $scope.cc.cvv2 = ""; if (typeof $scope.cc.cardNumber !== "undefined") $scope.cc.cardNumber = ""; if (typeof $scope.cc.ccMonth !== "undefined") $scope.cc.ccMonth = ""; if (typeof $scope.cc.ccYear !== "undefined") $scope.cc.ccYear = ""; if (typeof $scope.cc.address !== "undefined") $scope.cc.address = ""; if (typeof $scope.cc.city !== "undefined") $scope.cc.city = ""; if (typeof $scope.cc.state !== "undefined") $scope.cc.state = ""; if (typeof $scope.cc.zipCode !== "undefined") $scope.cc.zipCode = ""; $scope.resetFieldValidation(); }; $scope.resetFieldValidation = function(){ $scope.amountErr = false; $scope.cardErr = false; $scope.monthErr = false; $scope.yearErr = false; $scope.cvvErr = false; $scope.addressErr = false; $scope.cityErr = false; $scope.stateErr = false; $scope.zipErr = false; }; $scope.validateField = function(value, field){ $scope.resetFieldValidation(); switch (field){ case 'amount': var regex = /^[+]?([.]\d+|\d+[.]?\d{0,2}?)$/; if (!value) { $rootScope.errMsg = errService['FE']['cc0024']; $scope.amountErr = true; return false; } else if (isNaN(value)) { $rootScope.errMsg = errService['FE']['cc0028']; return false; } else if (regex.test(value) === false || Number(value) === 0) { $rootScope.errMsg = errService['FE']['cc0024']; return false; } $scope.amountErr = false; break; case 'cardNumber': if (typeof value === "undefined"){ $rootScope.errMsg = errService['FE']['cc0001']; $scope.cardErr = true; return false; } else if (!value.cardNumber) { $rootScope.errMsg = errService['FE']['cc0001']; $scope.cardErr = true; return false; } else if (value.cardNumber.search("^[0-9]+$") === -1){ $rootScope.errMsg = errService['FE']['cc0015']; return false; } else if (value.cardNumber.length < 13 || value.cardNumber.length > 19){ $rootScope.errMsg = errService['FE']['cc0016']; return false; } $scope.amountErr = false; break; case 'ccMonth': if (!value) { $rootScope.errMsg = errService['FE']['cc0004']; $scope.monthErr = true; return false; } else if (value.length !== 2){ $rootScope.errMsg = errService['FE']['cc0017']; return false; } else if (value.search("^[0-9]+$") === -1){ $rootScope.errMsg = errService['FE']['cc0018']; return false; } else if (value < 1 || value > 12){ $rootScope.errMsg = errService['FE']['cc0019']; return false; } $scope.monthErr = false; break; case 'ccYear': if (!value) { $rootScope.errMsg = errService['FE']['cc0002']; $scope.yearErr = true; return false; } else if (value.length != 4){ $rootScope.errMsg = errService['FE']['cc0020']; return false; } else if (value < (new Date()).getFullYear() || value.search("^[0-9]+$") === -1 ){ $rootScope.errMsg = errService['FE']['cc0025']; return false; } $scope.yearErr = false; break; case 'cvv': if (!value) { $rootScope.errMsg = errService['FE']['cc0003']; $scope.cvvErr = true; return false; } else if (value.length < 3 || value.length > 4){ $rootScope.errMsg = errService['FE']['cc0021']; return false; } else if (value.search("^[0-9]+$") === -1){ $rootScope.errMsg = errService['FE']['cc0022']; return false; } $scope.cvvErr = false; break; case 'address': if (!value){ $rootScope.errMsg = errService['FE']['cc0005']; $scope.addressErr = true; return false; } else if (value.length > 30){ $rootScope.errMsg = errService['FE']['cc0009']; return false; } $scope.addressErr = false; break; case 'city': if (!value){ $rootScope.errMsg = errService['FE']['cc0006']; $scope.cityErr = true; return false; } else if (value.length > 30){ $rootScope.errMsg = errService['FE']['cc0010']; return false; } else if (value.search("^[A-z \s \.]+$") === -1){ $rootScope.errMsg = errService['FE']['cc0026']; return false; } $scope.cityErr = false; break; case 'state': if (!value){ $rootScope.errMsg = errService['FE']['cc0007']; $scope.stateErr = true; return false; } else if (value.length < 2 || value.length > 2){ $rootScope.errMsg = errService['FE']['cc0011']; return false; } else if (value.search("^[A-z \s \.]+$") === -1){ $rootScope.errMsg = errService['FE']['cc0012']; return false; } $scope.stateErr = false; break; case 'zip': if (!value){ $rootScope.errMsg = errService['FE']['cc0008']; $scope.zipErr = true; return false; } else if (value.length !== 5){ $rootScope.errMsg = errService['FE']['cc0013']; return false; } else if (isNaN(value)){ $rootScope.errMsg = errService['FE']['cc0014']; return false; } $scope.zipErr = false; break; } return true; }; $scope.sendToken = function () { var session = Cdi.Core.GlobalData.get(global.getKey()), cvv = $scope.cc.cvv2, cc = { account: session.accountNum, authKey: session.authKey, amount: parseFloat($scope.amountToDeposit), country: 'USA', token: $scope.token.token, cvv: cvv, cardtype: $scope.token.cardTypeID }; if (!$scope.validateField($scope.amountToDeposit, 'amount')) { return false; } if (!$scope.validateField(cvv, 'cvv')) { return false; } if ($scope.isFormValid !== false){ $scope.isFormValid = false; } else { //Deposit button disabled when deposit is in progress return false; } Tokens.submit(cc).then(function (data) { if (data.Response && data.Response.errorCode) { $scope.$evalAsync(function () { $scope.isFormValid = true; if (typeof errService["BE"][data.Response.errorCode] != 'undefined') { $rootScope.errMsg = errService["BE"][data.Response.errorCode]; if (data.Response.errorCode == 1007){ $rootScope.errMsg = $rootScope.errMsg.replace(/\{max_amount\}/, Number(data.Response.messageArgs.split(":")[1].replace("}", ''))); } } else { $rootScope.errMsg = errService['FE']['cc0000']; } $scope.fireVirtualPageView(vpvConfig['ccFailed']); }); } else if (data.Error) { $scope.$evalAsync(function () { $scope.isFormValid = true; $rootScope.errMsg = errService['FE']['cc0000']; $scope.fireVirtualPageView(vpvConfig['ccFailed']); }); } else { $scope.$evalAsync(function () { $scope.callAnalytics(data.Response); $scope.depositedAmount = $filter('currency')(data.Response.amount); $rootScope.$broadcast('updateBalance'); $scope.setCCToken(); //for showing cc logo and cc last 4 $scope.isFormValid = true; $scope.buttonToShowOnCC(); $rootScope.errMsg = ""; $rootScope.depositConfirmation = $filter('currency')(data.Response.amount) + ' has been deposited to your account'; if ($rootScope.ccFee) { $rootScope.depositConfirmation += '. In addition, a $' + $rootScope.ccFee + ' transaction fee has been charged to your card.'; } else { $rootScope.depositConfirmation += ', and charged to your card.'; } $scope.fireVirtualPageView(vpvConfig['ccSuccess']); $scope.resetFieldValues(); }); } }, function (err) { $scope.$evalAsync(function (err) { $scope.isFormValid = true; $rootScope.errMsg = errService['FE']['cc0000']; }); }); }; $scope.buttonToShowOnCC = function () { $scope.ccDone = true; if(Cdi.Core.GlobalData.get(global.getKey()).quickBet) { $scope.showCCWager = true; $rootScope.isQBContinue = true; } else { $scope.showCCDone = true; } }; $scope.setCCToken = function (){ Tokens.all().then(function(data) { $scope.$evalAsync(function() { if (data.Tokens.length) { for (var i=0; i $scope.maxAmountAllowed){ $rootScope.errMsg = errService['FE']['cc0039'] + $scope.maxAmountForWithdraw; return false; } } else if(field == "deliveryMethods") { if (!value) { $rootScope.errMsg = errService['FE']['cc0041']; return false; } } else { if (!value) { $rootScope.errMsg = errService['FE']['cc0042']; return false; } } return true; } function showLoading() { $rootScope.errMsg = ""; if($scope.isMobile) { TSM.showLoading(); } else { $scope.checkwloading = true; $scope.checkwscreen = false; } } function hideLoading(isToteDown) { if($scope.isMobile) { TSM.hideLoading(); } else { $scope.checkwloading = false; if(!isToteDown) { $scope.checkwscreen = true; } } } // Starting Point for check withdrawal. $scope.$on("checkWithdraw", function () { $scope.checkWithdrawInit(); }); } ]); /** * Created by alpesh.darji on 10/22/14. */ angular.module('quickDeposit').controller('depositScreenController', ['$rootScope', 'global', '$scope', 'infoService', 'ccTokens', 'errService', 'vpvConfig', 'fundingInfoService', '$filter', '$log', 'paypalService', 'bonusEngine', function($rootScope, global, $scope, infoService, ccTokens, errService, vpvConfig, fundingInfoService, $filter, $log, paypalService, bonusEngine) { var pathToAssets = "/tsui/widgets/images/quickDeposit/"; $scope.qdDefaultView = ""; $scope.bonusOptInDeposit = false; $scope.setDefaultView = function(lastDeposit){ $scope.resetSelect(); // Get PayPal info for withdrawal views if ($scope.isWithdraw) { $scope.getPaypalInfo().then(function () { $scope.setPaypal(); }, function (err) { $scope.setPaypal(); console.log(err); }); } }; $scope.getPaypalInfo = function(){ // Paypal $scope.ppAmt = 0; return paypalService.getInfo().then(function(data) { $scope.ppEnabled = false; if (typeof data === 'undefined') { return; } if (typeof data.error !== 'undefined' ){ return; } info = data.accountInfo; if (typeof info === 'undefined') { return; } $scope.$evalAsync(function() { $scope.camEnabled = info.camEnabled; $scope.hasPendingInitialDeposit = info.hasPendingInitialDeposit; $scope.ppFee = $filter('currency')(info.fee); $scope.ppMax = info.maximumDeposit; $scope.ppMin = info.minimumDeposit; if (!$scope.camEnabled || $scope.hasPendingInitialDeposit){ $scope.ppEnabled = false; } else { $scope.ppEnabled = info.payPalEnabled; } $scope.ppEmail = info.payPalEmail; $rootScope.ppEmail = info.payPalEmail; // allow to withdraw only when all followings are true $rootScope.ppWithdraw = info.payPalEnabled && info.camEnabled && info.hasSuccessfulDeposit; if ($scope.ppMax === 100) { $scope.ppAmt1 = 100; $scope.ppAmt2 = 50; $scope.ppAmt3 = 25; } else { $scope.ppAmt1 = 250; $scope.ppAmt2 = 100; $scope.ppAmt3 = 50; } }); }, function(err) { console.log(err); }); }; $scope.isBonusDepositView = function () { return ($scope.bonusOptInData !== undefined && $scope.bonusOptInData.bonus !== undefined); }; $scope.showBonusDepositOpts = function () { /** * Show deposit options based on funding list * applicable to deposit based bonuses. */ if ($scope.isBonusDepositView()) { // Get the funding list of bonus to display applicable deposit Types. var _fundingList = $rootScope.bonusInfo.idFundingList; console.log("_fundingList :", _fundingList); var enableAll = (_fundingList.length === 0); console.log("enableAll :", enableAll); $scope.isEZMEnabled = enableAll; $scope.isCCEnabled = enableAll; $scope.showPaypal = enableAll; $scope.showGD = enableAll; $scope.showEzBank = enableAll; $scope.showMoneyGram = enableAll; $scope.showDebitCard = enableAll; if (_fundingList.length > 0) { for (var fli = 0; fli < _fundingList.length; fli++) { var _depositMethod = ""; console.log("_fundingList[fli] :", _fundingList[fli]); switch (_fundingList[fli]) { case "CreditCard": //CreditCard $scope.isCCEnabled = true; _depositMethod = "CreditCard"; break; case "EzMoney": // EZMoney $scope.isEZMEnabled = true; _depositMethod = "EzMoney"; break; case "GreenDotATR": // Green Dot $scope.showGD = true; _depositMethod = "GreenDot"; break; case "Mazooma": // Mazooma/EZBank $scope.showEzBank = true; break; case "MoneyGram": // MoneyGram $scope.showMoneyGram = true; break; case "PayPal": // PayPal $scope.showPaypal = true; _depositMethod = "PayPal"; break; case "PaySecure": // Debit/ATM Card $scope.showDebitCard = true; break; } if (_fundingList.length === 1) { $scope.qdDefaultView = _depositMethod; } } } $scope.setDefaultView($scope.qdDefaultView); } }; $scope.getBonusOptInInfo = function () { // Check if player is visiting this widget from BONUS $scope.qdDefaultView = "Select"; if (Cdi.AppConfig.BONUS_OPTIN !== undefined && Cdi.AppConfig.BONUS_OPTIN === true) { $scope.bonusOptInDeposit = true; $scope.bonusOptInData = JSON.parse(localStorage.getItem('bonusOptInData')); if ($scope.bonusOptInData !== undefined && $scope.bonusOptInData.bonus !== undefined) { $rootScope.bonusInfo = $scope.bonusOptInData.bonus; } $rootScope.showDepositWidget = true; console.log("Show Deposit Widget from Bonus ", $scope.showDepositWidget);//, "$rootScope.bonusInfo : ", $rootScope.bonusInfo, " ShowPayPal : ", $scope.showPaypal); $scope.showBonusDepositOpts(); } }; $scope.setView = function () { if (sessionStorage.getItem('greendot') === 'true' || sessionStorage.getItem('paypal') === 'true') { return; } // Check iff bonus data is available, to load bonus based deposit screen $scope.getBonusOptInInfo(); if (!$scope.isBonusDepositView()) { fundingInfoService.getFundingInfoPromise().then(function (data) { $rootScope.ccFee = 0; if (data && data.status === "success" && data.ccFee){ $rootScope.ccFee = data.ccFee; } if (data && data.status === "success" && data.lastDeposit) { console.log('LAST DEPOSIT: ', data.lastDeposit) $scope.$evalAsync(function () { $scope.qdDefaultView = data.lastDeposit; $scope.setDefaultView($scope.qdDefaultView); }); } else { //[Native App] - Log First Time deposit into Tapjoy/Localytics. if(typeof TSM !== "undefined") { TSM.QuickDeposit.isFirstTimeDeposit = true; } $scope.$evalAsync(function () { $scope.qdDefaultView = "Select"; $scope.setDefaultView($scope.qdDefaultView); }); } $rootScope.showDepositWidget = true; }, function(err){ //console.log("Cdi.Service.ADW_ACCOUNT_LAST_DEPOSIT is down!", err); $scope.qdDefaultView = "Select"; $scope.setDefaultView($scope.qdDefaultView); }); } if ($rootScope.showPaypal === true) { $scope.getPaypalInfo(); } }; $scope.showScreen = function(screen, doBroadcast){ $rootScope.errMsg = ""; $rootScope.errSecondMsg = ""; $rootScope.depositConfirmation = ""; switch (screen){ case 'deposit': $scope.setView(); $scope.isDeposit = true; $scope.isWithdraw = false; break; case 'withdraw': $scope.isDeposit = false; $scope.isWithdraw = true; $rootScope.isWithdrawInfo = false; break; case 'manage': $scope.isDeposit = false; $scope.isWithdraw = false; break; case 'greendot': //$scope.setView(); $scope.isDeposit = true; $scope.isWithdraw = false; $scope.setGD(doBroadcast); $rootScope.showDepositWidget = true; break; case 'paypal': //$scope.setView(); $scope.isDeposit = true; $scope.isWithdraw = false; $scope.setPaypal(doBroadcast); $rootScope.showDepositWidget = true; break; } }; /** * Reset payment selection method */ $scope.resetSelect = function() { //Need to call WS to get ezmAcctNumberLast4 when default view is cc and 'change' link is clicked if (!$rootScope.ezmAcctNumberLast4){ infoService.getPromise().then(function (data) { $scope.$evalAsync(function () { $rootScope.ezmAcctNumberLast4 = ''; }); if (data.Error && data.Error.Description) { $rootScope.$broadcast('show:error', { errorMessage: data.Error.Description, status: "failure" }); } else if (data.Response && data.Response.status === "failure" && data.Response.errorCode !== 0) { $rootScope.$broadcast('show:error', data.Response); } else { if (/* data.Response.bankInfo.bankName !== null && */ data.Response.bankInfo.bankAccountNumber !== null) { $scope.$evalAsync(function () { $rootScope.ezmAcctNumberLast4 = data.Response.basicInfo.bankAccountNumber; }); } if (data.Response.basicInfo.minTxnAmount){ $scope.$evalAsync(function () { $rootScope.minDepositAmount = data.Response.basicInfo.minTxnAmount; }); } if (data.Response.basicInfo.maxTxnAmount){ $scope.$evalAsync(function () { $rootScope.maxDepositAmount = data.Response.basicInfo.maxTxnAmount; }); } } }); } if (!$rootScope.ppEmail){ if ($rootScope.showPaypal === true) { $scope.getPaypalInfo(); } } if (sessionStorage.getItem('greendot') === 'true') { sessionStorage.setItem('greendot', 'false'); } else if (sessionStorage.getItem('paypal') === 'true') { sessionStorage.setItem('paypal', 'false'); } else { $scope.showDepositOptionScreen(); } }; $scope.showDepositOptionScreen = function() { // Load isSelect if it's being loaded anywhere else other than bonus widget $rootScope.isSelect = !$scope.isBonusDepositView(); $rootScope.isCC = false; $rootScope.isEZ = false; $rootScope.isGD = false; $rootScope.isPaypal = false; // Show this only if deposit widget is loaded from Bonus Widget $rootScope.isBonusDeposit = $scope.isBonusDepositView(); }; if(typeof Cdi != "undefined" && typeof Cdi.AppConfig != "undefined" && typeof Cdi.AppConfig.isNative != "undefined" && Cdi.AppConfig.isNative || typeof TSM != "undefined") { var imgPath = "resources/shared/extlibs/tsui/widgets/quick-deposit/images/"; $scope.qdSprite = imgPath + "qd_sprite.png?v=152869"; $scope.gdSprite = imgPath + "gd_sprite.png?v=152869"; $scope.qdXsSprite = imgPath + "qd_xs_sprite.png?v=152869"; if ($scope.isBonusDepositView()) { $scope.qdBonusOptInNavi = imgPath + "qd_bonus_optin_navigation.png?v=152869"; } } else { $scope.qdSprite = pathToAssets + "qd_sprite.png?v=152869"; $scope.gdSprite = pathToAssets + "gd_sprite.png?v=152869"; $scope.qdXsSprite = pathToAssets + "qd_xs_sprite.png?v=152869"; if ($scope.isBonusDepositView()) { $scope.qdBonusOptInNavi = pathToAssets + "qd_bonus_optin_navigation.png?v=152869"; } } /** * Based on AppConfig Hide/Show specific FUNDING METHODS * US9385, Alpesh Darji */ if(Cdi.AppConfig.FUNDING_METHOD == "EZM") { $scope.isEZMEnabled = true; $scope.isCCEnabled = false; } else if(Cdi.AppConfig.FUNDING_METHOD == "CC") { $scope.isEZMEnabled = false; $scope.isCCEnabled = true; } else { $scope.isEZMEnabled = true; $scope.isCCEnabled = true; } $scope.showBonusDepositOpts(); $scope.ezmSetUpPage = Cdi.AppConfig.PATH.EZM_SETUP_URL; $scope.setEZ = function(val, replace) { $scope.showPanel("qd-depositView qd-ezMoneyInfo qd-amountInput qd-deposit"); if (replace == true){ //Replace Mode angular.element(".qd-ezmoneyFields").show(); $rootScope.$broadcast('reset:ezMoney'); $rootScope.$broadcast('reset:ezMoneyPresetAmt'); $rootScope.ezReplaceMode = true; $rootScope.ezmAcctNumberLast4 = ''; $rootScope.errMsg = ''; $rootScope.depositConfirmation = ''; } else { $rootScope.ezReplaceMode = false; if ($rootScope.ezmAcctNumberLast4){ angular.element(".qd-ezmoneyFields").hide(); } } //reset error fields $rootScope.ezAmountErr = false; $rootScope.ezRoutingErr = false; $rootScope.ezAccountErr= false; $rootScope.registerSuccess = ""; $rootScope.isEZ = val; $rootScope.isCC = false; $rootScope.isSelect = false; $rootScope.isBonusDeposit = false; $rootScope.isGD = false; $rootScope.isPaypal = false; $scope.fireVirtualPageView(vpvConfig['qdEZEnter']); }; $scope.setCC = function(val, replace) { if (replace == true) { //Replace Mode $rootScope.$broadcast('reset:creditCard'); $rootScope.ccReplaceMode = true; $rootScope.errMsg = ''; $rootScope.depositConfirmation = ''; } else { $rootScope.ccReplaceMode = false; } $rootScope.registerSuccess = ""; $rootScope.isCC = val; $rootScope.isEZ = false; $rootScope.isSelect = false; $rootScope.isBonusDeposit = false; $rootScope.isToken = false; $rootScope.isGD = false; $rootScope.isPaypal = false; if ($scope.ccDone){ $rootScope.$broadcast('reset:creditCard'); } $scope.fireVirtualPageView(vpvConfig['ccEnter']); setTimeout(function(){ $scope.doPlaceHolder(); }, 10); }; $scope.doToken = function(token){ $scope.setCC(true, false); $scope.token = token; $rootScope.isToken = true; $rootScope.isPaypal = false; setTimeout(function(){ $scope.doPlaceHolder(); }, 10); }; $scope.setGD = function(doGDComplete) { $rootScope.registerSuccess = ""; $rootScope.isGD = true; $rootScope.isEZ = false; $rootScope.isSelect = false; $rootScope.isBonusDeposit = false; $rootScope.isToken = false; $rootScope.isPaypal = false; angular.element(".qd-reg-success-msg").hide(); if (doGDComplete) { $rootScope.$broadcast('gd:complete'); } //$scope.fireVirtualPageView(vpvConfig['gdSelect']); $scope.fireVirtualPageView(vpvConfig['gdEnter']); }; $scope.setPaypal = function(doPPCall) { if ($scope.isBonusDepositView()) { window.parent.window.location.href = window.parent.window.location.protocol + '//' + window.parent.window.location.hostname + '/account/deposit/paypal'; return; } $scope.$evalAsync(function() { $rootScope.errMsg = ""; $rootScope.errSecondMsg = ""; /*if ($scope.camEnabled == false){ $scope.ppEnabled = false; $rootScope.errMsg = errService['BE']['2015']; } else if ($scope.hasPendingInitialDeposit == true){ $scope.ppEnabled = false; $rootScope.errMsg = errService['PPBE']['2125'][0]; $rootScope.errSecondMsg = errService['PPBE']['2125'][1]; } else if ($scope.ppEnabled == false){ $rootScope.errMsg = errService['PPBE']['2060'][0]; $rootScope.errSecondMsg = errService['PPBE']['2060'][1]; }*/ }); $rootScope.registerSuccess = ""; $rootScope.isGD = false; $rootScope.isEZ = false; $rootScope.isCC = false; $rootScope.isSelect = false; $rootScope.isBonusDeposit = false; $rootScope.isToken = false; $rootScope.isPaypal = true; angular.element(".qd-reg-success-msg").hide(); $scope.fireVirtualPageView(vpvConfig['ppEnter']); if (doPPCall) { $rootScope.$broadcast('reset:paypal'); } }; $scope.doPlaceHolder = function() { /*** DE5263 - IE9 issue ***/ if (typeof $rootScope.placeHolderSupport == "undefined") { var input = document.createElement('input'); $rootScope.placeHolderSupport = ('placeholder' in input); } if (!$rootScope.placeHolderSupport) { $(".qd-quickDeposit :text[placeholder]").each( function (i, x) { var input = $(x); if (input.attr("placeholder")) { input.val(input.attr("placeholder")); $(this).addClass("placeHolderText"); input.focusin(function () { if ($(this).val() == $(this).attr("placeholder")) { $(this).val(""); $(this).removeClass("placeHolderText"); } }); input.focusout(function () { if ($(this).val() == '') { $(this).val($(this).attr("placeholder")); $(this).addClass("placeHolderText"); } }); } $(x).focusin(); $(x).focusout(); }); } }; /** * msg screen when deposit failed */ $scope.depositFail = function(data) { $scope.$evalAsync(function() { $rootScope.errMsg = data.errorMessage; }); }; $scope.depositSuccess = function(data) { $rootScope.errMsg = ""; $rootScope.depositConfirmation = $filter('currency')(data.transactionAmount) + ' has been deposited to your account.'; }; $scope.hideOverlay = function() { angular.element("#divQuickDepositInfo").hide(); angular.element(".quickDepositOverlay").hide(); }; /** * Function for displaying loading screen when deposit in progress */ $scope.depositInProgress = function(){ $rootScope.errMsg = ""; $scope.showPanel("qd-inProgress"); }; /** * inArray * Array search helper method (sequential) * @return {boolean} Whether or not the specified key was found in the array. */ $scope.inArray = function(needle, haystack) { var length = haystack.length; for(var i = 0; i < length; i++) { if(haystack[i] == needle) return true; } return false; }; $scope.firedVPVs = []; /** * fireVirtualPageView * @param vpv string Virtual page string to be sent to google. * @return boolean Whether or not the VPV was successfully fired. */ $scope.fireVirtualPageView = function(vpv) { try { // Only fire virtual page views once. if (!$scope.inArray(vpv, $scope.firedVPVs)) { $log.log("Firing VPV: " + vpv); $scope.firedVPVs.push(vpv); // Send page view event to Google. Cdi.Core.Analytics.action('navigate', {path: vpv}); return true; } else { $log.log("VPV already fired this page load: " + vpv); } return false; } catch (e){ $log.log(e); } }; $scope.fireFieldVPV = function(value, vpvKey){ if (value) return $scope.fireVirtualPageView(vpvConfig[vpvKey]); }; $scope.cancelAssignment = function () { // Reset the bonus Widget config $scope.bonusOptInDeposit = false; delete $rootScope.bonusInfo; Cdi.AppConfig.BONUS_OPTIN = false; $scope.resetWidget(undefined, false); localStorage.removeItem("bonusOptInData"); hideBonusDepositLayer(Cdi); }; /** * Reset widget before closing so that when opened next time, we have default screen shown */ $scope.resetWidget = function(callback, showLiveRaces) { $rootScope.menuHide = false; var sub, href, topWinSearch; if (sessionStorage.getItem('greendot') === 'true') { sessionStorage.setItem('greendot', 'false'); topWinSearch = window.parent.window.location.search; if (topWinSearch.indexOf('gdcomplete') !== -1) { if (topWinSearch == '?gdcomplete') { window.parent.window.location.href = window.parent.window.location.href.replace('?gdcomplete', ''); } else { window.parent.window.location.href = window.parent.window.location.href.replace('&gdcomplete', ''); } } } if (sessionStorage.getItem('paypal') === 'true') { sessionStorage.setItem('paypal', 'false'); } if ($rootScope.showRegisterSuccess > 0){ $rootScope.registerSuccess = ""; } $rootScope.showRegisterSuccess++; // bonus program messaging $rootScope.optInSuccess = bonusEngine.hasSuccessfulOptIn(); if($rootScope.optInSuccess != null) { // clean up the data for messaging bonusEngine.deleteOptInResponseData(); } angular.element(".qd-tcView").hide(); angular.element(".qd-main").show(); angular.element(".qd-accBalance").show(); $rootScope.$broadcast('reset:ezMoney'); $rootScope.$broadcast('reset:creditCard'); $rootScope.$broadcast('updateBalance'); //console.log("="+$rootScope.isQBContinue); setTimeout(function() { $scope.$apply(); }, 500); if (callback) { callback(); } else { $scope.hideOverlay(); } if (typeof TSM !== "undefined" && showLiveRaces) { if(Cdi.Core.GlobalData.get(global.getKey()).quickBet) { TSM.TopLevel.goToProgram(); } else { TSM.LiveRaces.show(); } } else { //$scope.setView(); $scope.showScreen('deposit'); } $scope.firedVPVs = []; }; /** * reset selection methods & bring user to first screen of widget */ $scope.resetPaymentMethods = function() { $scope.resetSelect(); $scope.showPanel("qd-depositView qd-ezMoneyInfo qd-amountInput qd-ezmoneyFields qd-deposit"); angular.element(".qd-tcView").hide(); angular.element(".qd-main").show(); angular.element(".qd-accBalance").show(); $rootScope.errMsg = ""; $rootScope.depositConfirmation = ""; }; window.resetPaymentMethods = function(){ $scope.resetPaymentMethods() } // helper function to show a particular panel while hide all others // arg is a string: ie. "foobar" or "foo bar baz" $scope.showPanel = function(panels) { $scope.hidePanels(); var p = panels.split(" "); for (i = 0; i < p.length; i++) { var panel = p[i]; if (panel.charAt(0) != "." && panel.charAt(0) != "#") { panel = "." + panel; } angular.element(panel).show(); } }; // helper function to hide all panels $scope.hidePanels = function() { angular.element(".qd-errorView").hide(); angular.element(".qd-confirmationView").hide(); angular.element(".qd-depositView").hide(); angular.element(".qd-inProgress").hide(); angular.element(".qd-qd-amountInput").hide(); angular.element(".qd-ezmoneyFields").hide(); angular.element(".qd-ezmoneyInfo").hide(); angular.element(".qd-deposit").hide(); angular.element(".qd-exit").hide(); angular.element(".qd-success").hide(); }; $scope.safeApply = function(fn) { var phase = this.$root.$$phase; if (phase == '$apply' || phase == '$digest') { if (fn) fn(); } else { this.$apply(fn); } }; /** Event Listeners */ $scope.$on("deposit:fail", function(e, data) { $scope.depositFail(data); }); $scope.$on("deposit:success", function(e, data) { $scope.depositSuccess(data); }); $scope.$on("deposit:progress", function() { $scope.depositInProgress(); }); $scope.$on("hideOverlay", function() { $scope.resetWidget(function() { $scope.hideOverlay(); }, true); }); $scope.gotoDepositOption = function(){ var depositOptionUrl = window.parent.window.location.protocol + '//' + window.parent.window.location.hostname + '/account/deposit'; //Func to redirect user to Deposit Option page on main site if (typeof Cdi.AppConfig.isExpress !== "undefined"){ //Use AppConfig to determine whether it is Express for now. window.open(depositOptionUrl); } else { window.parent.window.location.href = depositOptionUrl; } }; $scope.gotoWagerNow = function() { //Func to redirect user to Wager Now page on main site window.parent.window.location.href = window.parent.window.location.protocol + '//' + window.parent.window.location.hostname + '/wager/start'; }; $scope.setEZBank = function () { window.parent.window.location.href = window.parent.window.location.protocol + '//' + window.parent.window.location.hostname + '/account/deposit/onlinebanking'; }; $scope.setMoneyGram = function () { window.parent.window.location.href = window.parent.window.location.protocol + '//' + window.parent.window.location.hostname + '/moneygram-info'; }; $scope.setDebitCard = function () { window.parent.window.location.href = window.parent.window.location.protocol + '//' + window.parent.window.location.hostname + '/account/deposit/debitcard'; }; } ]); angular.module('EzMoney').controller('ezMoneyController', ['$rootScope', 'global', '$scope', 'errService', 'vpvConfig', 'depositService', 'infoService', '$filter', '$templateCache', '$log', 'setupService', function($rootScope, global, $scope, errService, vpvConfig, depositService, infoService, $filter, $templateCache, $log, setupService) { $scope.routingNumber = ""; $scope.accountNumber = ""; $scope.bankAccountType = ""; $scope.isFormValid = true; $scope.amountToDeposit = ""; $scope.showEZDone = false; $scope.showEZWager = false; $rootScope.isQBContinue = false; $scope.depositFail = function(data) { $scope.$evalAsync(function() { $scope.fireVirtualPageView(vpvConfig['qdEZFailed']); angular.element(".qd-depositView").show() angular.element(".qd-inProgress").hide(); angular.element(".qd-deposit").show(); }); }; $scope.depositSuccess = function(data) { var isTSMAvailable = window.hasOwnProperty('TSM'); if(!data.hasOwnProperty('camid')) { // if we didn't get the camid in the response // check in the globaldata for it var globalData = Cdi.Core.GlobalData.get(global.getKey()); if(globalData.hasOwnProperty('camid')) { data.camid = globalData.camid; } else if(isTSMAvailable) { // if it isn't in globaldata and we're on mobile, get it out of the usersession data.camid = TSM.GlobalData.UserSession.CamID; } } //[Native App] - Log First Time deposit into Localytics. var ftd = false; if(isTSMAvailable) { ftd = TSM.QuickDeposit.firstTimeDeposit(); } // call the deposit analytics action Cdi.Core.Analytics.action('deposit', { 'firstTime': ftd, 'camid': data.camid, 'amount': data.transactionAmount, 'depositMethod': 'EZMoney' }); $rootScope.errMsg = ""; if ($rootScope.ezReplaceMode == true){ $rootScope.depositConfirmation = "Your EZ Money account was replaced. " + $filter('currency')(data.transactionAmount) + ' has been deposited to your account.'; } else { $rootScope.depositConfirmation = $filter('currency')(data.transactionAmount) + ' has been deposited to your account.'; } $scope.accountBalance = $filter('currency')(data.balanceAmount); $rootScope.$broadcast('updateBalance'); $scope.depositedAmount = $filter('currency')(data.transactionAmount); $scope.amountToDeposit = ""; $scope.showPanel("qd-confirmationView qd-depositView qd-exit qd-ezMoneyInfo qd-success"); $scope.showExitButton(); $scope.$apply(); angular.element(".qd-amountInput").hide(); $scope.fireVirtualPageView(vpvConfig['qdEZSuccess']); }; $scope.showExitButton = function () { if(Cdi.Core.GlobalData.get(global.getKey()).quickBet) { $scope.showEZWager = true; $rootScope.isQBContinue = true; } else { $scope.showEZDone = true; } } $scope.updateAmount = function(idx){ var amt = $scope.presetAmt[idx]; angular.element(".qd-errorView").hide(); $scope.amountToDeposit = amt.replace("$", ""); angular.element("#qd-amountToDeposit").val(amt); setTimeout(function() { $scope.$apply(); }, 1000); }; $scope.noEZM = function() { $scope.showPanel("qd-depositView qd-ezmoneyFields qd-deposit"); }; $scope.init = function() { infoService.getPromise().then(function(data) { //angular.element(".qd-loading").hide(); angular.element(".qd-quickDeposit").show(); angular.element(".qd-main").css("visibility", "visible"); // No EZM Setup //var data = {"UTS":"1415682933","Debug":"off","Response":{"basicInfo":{"bankAccountNumber":"4567","camEnabled":true,"isInitialDeposit":true,"minTxnAmount":10,"maxTxnAmount":100,"txnLimit":1000,"toteBalance":0,"hasPendingInitialTxn":false,"ezMoneyEnabled":3,"bankAccountExist":true},"bankInfo":{"bankRoutingNumber":null,"bankAccountNumber":null,"bankAccountType":"Checking","bankName":"CHASE","bankCity":"Sunnyvale","bankState":"CA"},"dlInfo":null,"authInfo":null,"nsVerifyInfo":null,"errorMessage":null,"response":null,"status":"success","errorCode":0,"messageArgs":null,"customAttrs":null}}; if (data.Error && data.Error.Description) { $rootScope.errMsg = data.Error.Description; } else if (data.Response && data.Response.status === "failure" && data.Response.errorCode != 0) { $rootScope.errMsg = data.Response; } else if (/* data.Response.bankInfo.bankName != null && */ data.Response.bankInfo.bankAccountNumber != null) { $rootScope.presetAmt = ["250", "100", "50", data.Response.basicInfo.minTxnAmount]; $rootScope.ezmAcctNumberLast4 = data.Response.basicInfo.bankAccountNumber; // Note -- Be default EZM is set as selected, but it may change in future. - Alpesh $scope.selectedDepositMethod = "EZM"; $scope.updateLimits(data.Response.basicInfo.minTxnAmount, data.Response.basicInfo.maxTxnAmount); angular.element(".qd-ezmoneyFields").hide(); //$rootScope.$broadcast('ezmStatus', true); } else { $rootScope.ezmAcctNumberLast4 = ""; $scope.resetPresetAmt(); $scope.selectedDepositMethod = "EZM"; $scope.noEZM(); //$rootScope.$broadcast('ezmStatus', false); } }); }; /** * Function to handle deposit WS call via Service */ $scope.depositFund = function () { $rootScope.$broadcast('deposit:progress'); var session = Cdi.Core.GlobalData.get(global.getKey()), params = { amount: $scope.amountToDeposit, bac4: $rootScope.ezmAcctNumberLast4, authKey: session.authKey, account: session.accountNum }; depositService.getPromise(params).then(function(data) { // When Tote is down //var data = {"UTS":"1414176488","Debug":"off","Response":{"errorMessage":"
\r\n\t\t\t\t