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);
                });
            }
        }
Exemplo n.º 2
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();
            }
        }