Ejemplo n.º 1
0
        public async Task <bool> TokenizeAndCreate(string country_code, string currency, string iban)
        {
            WithdrawManager wm         = new WithdrawManager();
            var             user_token = UserManager.Get.getCurrentSessionToken();

            if (string.IsNullOrEmpty(iban) || string.IsNullOrEmpty(country_code) || string.IsNullOrEmpty(currency))
            {
                return(false);
            }

            LoaderManager.Get.LoaderController.ShowLoader();
            string account_token = await wm.TokenizeAccountAsync();

            string bank_account_token = await wm.TokenizeBankAccount(country_code, currency, iban);

            Debug.LogWarning(account_token);
            if (!string.IsNullOrEmpty(bank_account_token) && !string.IsNullOrEmpty(account_token))
            {
                Debug.LogWarning("here");
                bool res = await wm.CreateConnectAccount(account_token, bank_account_token, currency, country_code, user_token);

                LoaderManager.Get.LoaderController.HideLoader();
                return(res);
            }
            LoaderManager.Get.LoaderController.HideLoader();
            return(false);
        }
Ejemplo n.º 2
0
        public async Task <AccountStatus> GetAccountStatus()
        {
            WithdrawManager wm         = new WithdrawManager();
            var             user_token = UserManager.Get.getCurrentSessionToken();

            return(await wm.accountVerificationStatus(user_token));
        }
        public async void Withdraw()
        {
            WithdrawManager wm = new WithdrawManager();

            LoaderManager.Get.LoaderController.ShowLoader(null);
            string DocId          = PlayerPrefs.GetString("DocId");
            string withdrawResult = null;

            withdrawResult = await wm.Payout(token, WithdrawPresenter.WithdrawMoney);

            Debug.Log("withdrawResult: " + withdrawResult);
            currentIdProof = null;
            currentIBAN    = null;
            if (!string.IsNullOrEmpty(withdrawResult))
            {
                if (withdrawResult == "ProhibitedLocation")
                {
                    LoaderManager.Get.LoaderController.HideLoader();
                    EventsController.Get.withdrawFailed("Withdrawal", null, WithdrawManager.WITHDRAW_INSUFFICIENT_AMOUNT_FAILED_MESSAGE);
                }
                else if (withdrawResult == WithdrawManager.WITHDRAW_ERROR_AMOUNT_INSUFFICIENT)
                {
                    EventsController.Get.withdrawFailed("Withdrawal", null, WithdrawManager.WITHDRAW_INSUFFICIENT_AMOUNT_FAILED_MESSAGE);
                }
                else if (withdrawResult == WithdrawManager.WITHDRAW_ERROR_BALANCE_INSUFFICIENT)
                {
                    EventsController.Get.withdrawFailed("Withdrawal", null, WithdrawManager.WITHDRAW_INSUFFICIENT_FUNDS_FAILED_MESSAGE);
                }
                else if (withdrawResult == "error")
                {
                    EventsController.Get.withdrawFailed(null, null, WithdrawManager.WITHDRAW_FAILED_MESSAGE);
                }
                else if (withdrawResult == WithdrawManager.WITHDRAW_SUCCEEDED_STATUS)
                {
                    LoaderManager.Get.LoaderController.HideLoader();
                    UserManager.Get.UpdateUserMoneyCredit((float.Parse(UserManager.Get.GetCurrentMoneyCredit()) - WithdrawPresenter.WithdrawMoney).ToString("N2").Replace(",", "."));
                    EventsController.Get.backToWinMoney();
                }
            }
            else
            {
                UnityThreadHelper.Dispatcher.Dispatch(() =>
                {
                    EventsController.Get.withdrawFailed(null, null, WithdrawManager.WITHDRAW_FAILED_MESSAGE);
                });
            }
        }
Ejemplo n.º 4
0
        public async void Withdraw(float amount)
        {
            WithdrawManager wm         = new WithdrawManager();
            var             user_token = UserManager.Get.getCurrentSessionToken();

            string withdrawResult = null;

            withdrawResult = await wm.Payout(user_token, amount);

            InfoPersonnelWithdraw.currentIdProof = null;
            InfoPersonnelWithdraw.currentIBAN    = null;
            if (withdrawResult == "ProhibitedLocation")
            {
                SeembaAnalyticsManager.Get.SendWithdrawalEvent("Withdrawal prohibited location", WithdrawPresenter.AmountToWithdraw);
                PopupManager.Get.PopupController.ShowPopup(PopupType.INFO_POPUP_PROHIBITED_LOCATION_WITHDRAW, PopupsText.Get.ProhibitedLocationWithdraw());
            }
            else if (withdrawResult == WithdrawManager.WITHDRAW_ERROR_AMOUNT_INSUFFICIENT)
            {
                SeembaAnalyticsManager.Get.SendWithdrawalEvent("Withdrawal amount insufficient", WithdrawPresenter.AmountToWithdraw);
                TranslationManager.scene = "Popups";
                EventsController.Get.withdrawFailed(TranslationManager.Get("withdrawal"), TranslationManager.Get("error"), WithdrawManager.WITHDRAW_INSUFFICIENT_AMOUNT_FAILED_MESSAGE);
            }
            else if (withdrawResult == WithdrawManager.WITHDRAW_ERROR_BALANCE_INSUFFICIENT)
            {
                SeembaAnalyticsManager.Get.SendWithdrawalEvent("Withdrawal balance insufficient", WithdrawPresenter.AmountToWithdraw);
                TranslationManager.scene = "Popups";
                EventsController.Get.withdrawFailed(TranslationManager.Get("withdrawal"), TranslationManager.Get("error"), WithdrawManager.WITHDRAW_INSUFFICIENT_FUNDS_FAILED_MESSAGE);
            }
            else if (withdrawResult == "error")
            {
                SeembaAnalyticsManager.Get.SendWithdrawalEvent("Withdrawal Error", WithdrawPresenter.AmountToWithdraw);
                TranslationManager.scene = "Popups";
                EventsController.Get.withdrawFailed(TranslationManager.Get("withdrawal"), TranslationManager.Get("error"), WithdrawManager.WITHDRAW_FAILED_MESSAGE);
            }
            else if (withdrawResult == WithdrawManager.WITHDRAW_SUCCEEDED_STATUS)
            {
                SeembaAnalyticsManager.Get.SendWithdrawalEvent("Withdrawal Succeeded", WithdrawPresenter.AmountToWithdraw);
                LoaderManager.Get.LoaderController.HideLoader();
                UserManager.Get.CurrentUser.money_credit = float.Parse((UserManager.Get.CurrentUser.money_credit - WithdrawPresenter.WithdrawMoney).ToString());
                EventsController.Get.withdrawSucceeded();
            }
        }
Ejemplo n.º 5
0
        public async void InitProfile(User user)
        {
            PlayerId      = user._id;
            avatar.sprite = await UserManager.Get.getAvatar(user.avatar);

            username.text = user.username;
            string          token         = UserManager.Get.getCurrentSessionToken();
            string          userId        = UserManager.Get.getCurrentUserId();
            WithdrawManager wm            = new WithdrawManager();
            AccountStatus   accountStatus = null;

            if (PlayerId == userId)
            {
                accountStatus = await wm.accountVerificationStatus(token);
            }

            string Vectoires      = user.victories_count.ToString();
            string SerieVectoires = user.current_victories_count.ToString();

            Loading.SetActive(false);
            if (PlayerId != userId)
            {
                changeAvatar.interactable = false;
            }
            else
            {
                if (accountStatus.verification_status == WithdrawManager.ACCOUNT_VERIFICATION_STATUS_PENDING)
                {
                    pending.SetActive(true);
                }
                else if (accountStatus.verification_status == WithdrawManager.ACCOUNT_VERIFICATION_STATUS_VERIFIED)
                {
                    verified.SetActive(true);
                }
                else
                {
                    unverified.SetActive(true);
                }
            }
            username.text = user.username;
            try
            {
                if (user.money_credit > 0)
                {
                    pro.gameObject.SetActive(true);
                }
                else
                {
                    pro.gameObject.SetActive(false);
                }
            }
            catch (FormatException)
            {
                if (user.money_credit > 0)
                {
                    pro.gameObject.SetActive(true);
                }
                else
                {
                    pro.gameObject.SetActive(false);
                }
            }
            var mTexture = await UserManager.Get.GetFlagBytes(user.country_code);

            drapeau.sprite       = Sprite.Create(mTexture, new Rect(0f, 0f, mTexture.width, mTexture.height), Vector2.zero);
            nbGameWon.text       = Vectoires;
            nbGameWonInARow.text = SerieVectoires;
        }