GetUser() public method

public GetUser ( ) : XsollaUser
return XsollaUser
Esempio n. 1
0
        private void SelectGoodsGroup(XsollaGoodsGroup pGroup)
        {
            // Зачищаем панель с товарами
            ClearItemsContent();
            // Запускаем прелоадер
            mProgressBar.SetLoading(true);
            // выбор товаров по группе
            // Меняем заголовок
            mShopTitle.text = pGroup.GetName();
            mCurrGroupId    = pGroup.id;

            // запрос на данные
            Logger.Log("Load goods from groupId:" + pGroup.id.ToString());
            Dictionary <String, object> lParams = new Dictionary <string, object>();

            lParams.Add(XsollaApiConst.ACCESS_TOKEN, mUtils.GetAcceessToken());
            if (mUtils.GetUser().userBalance != null)
            {
                lParams.Add(XsollaApiConst.USER_INITIAL_CURRENCY, mUtils.GetUser().userBalance.currency);
            }
            lParams.Add("group_id", pGroup.id);
            // Если id = -1 то это распродажа и делаем запрос по другому адресу
            ApiRequest.Instance.getApiRequest(new XsollaRequestPckg((pGroup.id == -1) ? mSalesUrl : mGoodsUrl, lParams), GoodsRecived, ErrorRecived, mGroupUseCached.ContainsKey(mCurrGroupId) ? mGroupUseCached[mCurrGroupId] : true);

            SetCachedStateOnGroupId(mCurrGroupId, true);
        }
Esempio n. 2
0
        public void InitScreen(XsollaUtils pUtils)
        {
            // set title
            _titleProj.text = pUtils.GetProject().name;

            // user name
            _userName.text = pUtils.GetUser().GetName();

            if (pUtils.GetUser().virtualCurrencyBalance != null)
            {
                AddUserMenuBtn(pUtils.GetTranslations().Get("user_menu_balance"), ShowHistory);
                _pMenuBtnComponent.enabled = true;
            }

            if (!pUtils.IsServerLess())
            {
                AddUserMenuBtn(pUtils.GetTranslations().Get("user_menu_payment_accounts"), ShowPaymentManager);
            }

            if (pUtils.GetProject().components.ContainsKey("subscriptions"))
            {
                AddUserMenuBtn(pUtils.GetTranslations().Get("user_menu_user_subscription"), ShowSubscriptionManager);
            }

            if (pUtils.IsServerLess())
            {
                _userName.color            = StyleManager.Instance.GetColor(StyleManager.BaseColor.disable_user_menu);
                _pMenuBtnComponent.enabled = false;
                mDropIcon.gameObject.SetActive(false);
            }
        }
Esempio n. 3
0
        public void LoadPaymentManager()
        {
            Logger.Log("Show Payment manager");
            Dictionary <string, object> lParams = new Dictionary <string, object>();

            if (Utils.GetUser().userBalance != null)
            {
                lParams.Add(XsollaApiConst.USER_INITIAL_CURRENCY, Utils.GetUser().userBalance.currency);
            }
            Payment.GetSavedPaymentsForManager(lParams);
        }
        public void InitScreen(XsollaUtils pUtils)
        {
            // set title
            _titleProj.text = pUtils.GetProject().name;

            // user name
            _userName.text = pUtils.GetUser().GetName();

            if (pUtils.GetUser().virtualCurrencyBalance != null)
            {
                GameObject obj = Instantiate(Resources.Load(PREFAB_VIEW_MENU_ITEM_EMPTY)) as GameObject;
                UserProfileBtnController controller = obj.GetComponentInChildren<UserProfileBtnController>();
                controller.InitScreen("History", ShowHistory);
                obj.transform.SetParent(_btnDropDownObj.transform);
            }
        }
        public void InitScreen(XsollaUtils pUtils)
        {
            // set title
            _titleProj.text = pUtils.GetProject().name;

            // user name
            _userName.text = pUtils.GetUser().GetName();

            if (pUtils.GetUser().virtualCurrencyBalance != null)
            {
                GameObject obj = Instantiate(Resources.Load(PREFAB_VIEW_MENU_ITEM_EMPTY)) as GameObject;
                UserProfileBtnController controller = obj.GetComponentInChildren <UserProfileBtnController>();
                controller.InitScreen("History", ShowHistory);
                obj.transform.SetParent(_btnDropDownObj.transform);
            }
        }
Esempio n. 6
0
 public void SetCountries(string pStartCountry, XsollaCountries countries)
 {
     _countries = countries;
     if (utilsLink.GetUser().IsAllowChangeCountry())
     {
         allController.SetCountries(pStartCountry != ""?pStartCountry:startCountryIso, _countries);
     }
 }
Esempio n. 7
0
 public void InitScreen(XsollaUtils utils)
 {
     utilsLink       = utils;
     titleText.text  = utils.GetTranslations().Get(XsollaTranslations.PAYMENT_METHODS_PAGE_TITLE);
     startCountryIso = utils.GetUser().GetCountryIso();
     savedPayController.InitScreen(utilsLink);
     quickController.InitScreen(utilsLink);
     allController.InitScreen(utilsLink);
 }
        private void InitChildView()
        {
//			Resizer.ResizeToParrent (gameObject);
            quickController.SetQuickMethods(_quickPayments);
            quickController.SetAllMethods(_paymentMethods);
            allController.SetPaymentMethods(_paymentMethods);
            if (utilsLink.GetUser().IsAllowChangeCountry())
            {
                allController.SetCountries(startCountryIso, _countries);
            }
            screenHider.SetActive(false);
        }
Esempio n. 9
0
        public void init(XsollaUtils pUtils)
        {
            mUtils     = pUtils;
            mListItems = new List <PricePointItemController>();

            mStartProgressBar();

            mShopTitle.text = (pUtils.GetProject().components ["virtual_currency"].Name != "") ? pUtils.GetProject().components["virtual_currency"].Name : pUtils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_TITLE);

            // Задаем перевод на отсутствие товаров
            mEmptyLabel.text = mUtils.GetTranslations().Get("virtualitem_no_data");
            mEmptyLabel.gameObject.SetActive(false);

            // Возможность произвольной покупки
            if (mUtils.GetSettings().components.virtualCurreny.customAmount)
            {
                mCustomAmountLink.SetActive(true);
                mCustomController = mCustomAmountScreen.GetComponent <CustomVirtCurrAmountController>();
                mCustomAmountLink.GetComponent <Button>().onClick.AddListener(ChangeStateCusomAmount);
                StateCustomAmount = false;
            }
            else
            {
                mCustomAmountLink.SetActive(false);
                StateCustomAmount = false;
            }

            // получить список пакетов
            Dictionary <String, object> lParams = new Dictionary <string, object>();

            lParams.Add(XsollaApiConst.ACCESS_TOKEN, mUtils.GetAcceessToken());
            if (mUtils.GetUser().userBalance != null)
            {
                lParams.Add(XsollaApiConst.USER_INITIAL_CURRENCY, mUtils.GetUser().userBalance.currency);
            }
            ApiRequest.Instance.getApiRequest(new XsollaRequestPckg(mPricePointsUrl, lParams), PricePointsRecived, ErrorRecived);
        }
Esempio n. 10
0
        public void init(XsollaUtils pUtils)
        {
            mUtils          = pUtils;
            mListItems      = new List <ShopItemController>();
            mGroupUseCached = new Dictionary <int, bool>();
            // Задаем настройки на лэндинг
            mIsListLayout = pUtils.GetSettings().mDesktop.pVirtItems.isListLayout();
            SetLanding();

            // Задаем перевод на отсутствие товаров
            mEmptyLabel.text = mUtils.GetTranslations().Get("virtualitem_no_data");
            mEmptyLabel.gameObject.SetActive(false);

            // строим навигационное меню магазина
            // получить список групп
            Dictionary <String, object> lParams = new Dictionary <string, object>();

            lParams.Add(XsollaApiConst.ACCESS_TOKEN, mUtils.GetAcceessToken());
            if (mUtils.GetUser().userBalance != null)
            {
                lParams.Add(XsollaApiConst.USER_INITIAL_CURRENCY, mUtils.GetUser().userBalance.currency);
            }
            ApiRequest.Instance.getApiRequest(new XsollaRequestPckg(mGroupsUrl, lParams), GoodsGroupRecived, ErrorRecived);
        }
 /// <summary>
 /// Sets the state of the favorite.
 /// </summary>
 private void SetFavoriteState()
 {
     // Проверка на бессерверную интеграцию
     mFav.gameObject.SetActive(mUtils.GetUser().userBalance != null);
     mFav.text = mItem.IsFavorite() ? "" : "";
 }
        public void Init(XsollaUtils pUtils, XsollaHistoryItem pItem, Boolean pEven, Action pSortAction, Boolean pHeader = false, Boolean pDesc = true)
        {
            mUtils = pUtils;
            Image imgComp = this.GetComponent <Image>();

            imgComp.enabled = pEven;

            if (pHeader)
            {
                mDate.text = mUtils.GetTranslations().Get("balance_history_date") + (pDesc == true?" ▼":" ▲");
                Button sortBtn = mDate.gameObject.AddComponent <Button>();
                sortBtn.onClick.AddListener(delegate
                {
                    Logger.Log("On sort btn click");
                    pSortAction();
                    mDate.text = mUtils.GetTranslations().Get("balance_history_date") + " ↓";
                });

                mType.text       = mUtils.GetTranslations().Get("balance_history_purpose");
                mItem.text       = mUtils.GetTranslations().Get("balance_history_item");
                mBalance.text    = mUtils.GetTranslations().Get("balance_history_vc_amount");
                mPrice.text      = mUtils.GetTranslations().Get("balance_history_payment_amount");
                mPrice.alignment = TextAnchor.LowerLeft;

                // Activate devider
                mDevider.SetActive(true);
                LayoutElement layout = this.transform.GetComponent <LayoutElement>();
                layout.minHeight = 30;
                return;
            }

            mDate.text = pItem.date.ToString("MMM d, yyyy hh:mm tt");
            // balance_history_payment_info:"Payment via {{paymentName}}, transaction ID {{transactionId}}"
            // balance_history_payment_info_cancellation:"Refund. Payment via {{paymentName}}, transaction ID {{transactionId}}"
            // balance_history_subscription_change:"Subscription change. Payment via {{paymentName}}, transaction ID: {{transactionId}} "
            // balance_history_subscription_create:"Subscription create. Payment via {{paymentName}}, transaction ID {{transactionId}}"
            // balance_history_subscription_renew:"Subscription renewal. Payment via {{paymentName}}, transaction ID: {{transactionId}} "
            // balance_history_ingame_info:"In-Game Purchase"
            // balance_history_internal_info:"{{comment}}"
            // balance_history_coupon_info:"Coupon, code {{code}}"
            // subscription_cancellation:"Subscription cancellation"

            switch (pItem.operationType)
            {
            case "payment":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_payment_info")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "cancellation":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_payment_info_cancellation")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "inGamePurchase":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_ingame_info")));
                break;
            }

            case "internal":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_internal_info")), pItem.comment);
                break;
            }

            case "coupon":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_coupon_info")), pItem.couponeCode);
                break;
            }

            case "subscriptionRenew":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_subscription_renew")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "subscriptionCreate":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_subscription_create")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "subscriptionChange":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("balance_history_subscription_change")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "subscriptionCancellation":
            {
                mType.text = String.Format(prepareTypeStr(mUtils.GetTranslations().Get("subscription_cancellation")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            default:
            {
                mType.text = "";
                break;
            }
            }

            if (pItem.virtualItems.items.GetCount() != 0)
            {
                mItem.text = pItem.virtualItems.items.GetItemByPosition(0).GetName();
            }

            if (pItem.vcAmount != 0)
            {
                if (mUtils.GetUser().userBalance != null)
                {
                    mBalance.text = ((pItem.vcAmount > 0)?"+":"") + pItem.vcAmount + " " + mUtils.GetProject().virtualCurrencyName + "\n" + "(=" + pItem.userBalance + " " + mUtils.GetProject().virtualCurrencyName + ")";
                }
            }
            else
            {
                mBalance.text = "";
            }

            if (pItem.paymentAmount != 0)
            {
                mPrice.text = CurrencyFormatter.Instance.FormatPrice(pItem.paymentCurrency, pItem.paymentAmount);
            }
            else
            {
                mPrice.text = "";
            }
        }
        private void GetDetailSub(int pSubId)
        {
            Dictionary <string, object> lParams = new Dictionary <string, object>();

            lParams.Add(XsollaApiConst.ACCESS_TOKEN, mUtils.GetAcceessToken());
            lParams.Add("subscription_id", pSubId);
            if (mUtils.GetUser().userBalance != null)
            {
                lParams.Add(XsollaApiConst.USER_INITIAL_CURRENCY, mUtils.GetUser().userBalance.currency);
            }

            getApiRequest(DOMAIN + "/paystation2/api/useraccount/subscription", lParams, callbackShowSubDetail);
        }