Example #1
0
        public void init(XsollaManagerSubDetails pSubDetail, XsollaUtils pUtils, Action <XsollaManagerSubDetails> pLinkAction)
        {
            mUtils          = pUtils;
            mSubDetail      = pSubDetail;
            mPartTitle.text = pUtils.GetTranslations().Get("user_subscription_payment_title");

            if (pSubDetail.mPaymentMethodType != "notify" && pSubDetail.mPaymentMethodName != "")
            {
                mUnLinkBtn.GetComponent <Text>().text = pUtils.GetTranslations().Get("user_subscription_unlink_payment_account");
            }
            else
            {
                mUnLinkBtn.GetComponent <Text>().text = pUtils.GetTranslations().Get("user_subscription_add");
            }
            getUnlinkBtn().onClick.AddListener(() => pLinkAction(pSubDetail));

            // добавляем поля датализации
            List <LabelValue> listFileds = getImportDetails();

            foreach (LabelValue item in listFileds)
            {
                GameObject           obj        = Instantiate(Resources.Load(mLabeltextPrefab)) as GameObject;
                LabelValueController controller = obj.GetComponent <LabelValueController>();
                controller.init(item.label, item.value, item.actionLabel, item.action);
                obj.transform.SetParent(mDetailsContainer.transform);
            }
        }
Example #2
0
        public void initScreen(XsollaManagerSubDetails pSubDetail, XsollaUtils pUtils)
        {
            mUtils             = pUtils;
            mSubDetail         = pSubDetail;
            mPartTitle.text    = pUtils.GetTranslations().Get("user_subscription_details_title");
            mBtnRenewName.text = pUtils.GetTranslations().Get("user_subscription_renew");

            mLinkUnhold.GetComponent <Text>().text = pUtils.GetTranslations().Get("user_subscription_unhold");
            //mLinkHoldCancel.GetComponent<Text>().text = pUtils.GetTranslations().Get("user_subscription_hold");
            mLinkHoldCancel.GetComponent <Text>().text = pUtils.GetTranslations().Get("hold_subscription_cancel_label");            // TODO вернуть обратно при реализации заморозки
            mLinkChangePlan.GetComponent <Text>().text = pUtils.GetTranslations().Get("user_subscription_change_plan");

            // кнопка обновления
            mBtnRenew.gameObject.SetActive(mSubDetail.mIsRenewPossible);
            // Unhold
            mLinkUnhold.SetActive(mSubDetail.mStatus == "freeze");
            // Hold or Cancel
            mLinkHoldCancel.SetActive((mSubDetail.mIsHoldPossible || mSubDetail.mStatus != "non_renewing") && (mSubDetail.mStatus != "freeze"));
            // TODO реализуем в последующих итерациях
            // Change Plan
            //mLinkChangePlan.SetActive(mSubDetail.mIsChangePlanAllowed);
            mLinkChangePlan.SetActive(false);

            // добавляем поля датализации
            List <LabelValue> listFileds = getImportDetails();

            foreach (LabelValue item in listFileds)
            {
                GameObject           obj        = Instantiate(Resources.Load(mLabeltextPrefab)) as GameObject;
                LabelValueController controller = obj.GetComponent <LabelValueController>();
                controller.init(item.label, item.value, item.actionLabel, item.action);
                obj.transform.SetParent(mDetailsContainer.transform);
            }
        }
Example #3
0
        public void init(String pMainLabel, String pBtnLabel, XsollaManagerSubDetails pSubDetail, Action <XsollaManagerSubDetails> pActionLink = null)
        {
            mMainLabel.text = pMainLabel;
            if (pBtnLabel != "")
            {
                mLink.GetComponent <Text>().text = pBtnLabel;
            }

            if (pActionLink != null)
            {
                getLinkBtn().onClick.AddListener(() => pActionLink(pSubDetail));
            }
        }
        private void OnUnlinkPaymentMethodAction(XsollaManagerSubDetails pSubDetail)
        {
            Logger.Log("Unlink payment method");
            Dictionary <String, object> lParams = new Dictionary <string, object>();

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

            getApiRequest(DOMAIN + "/paystation2/api/useraccount/unlinkpaymentaccount", lParams, callbackUnlinkMethod);
        }
        private void OnLinkPaymentMethodAction(XsollaManagerSubDetails pSubDetail)
        {
            Logger.Log("Link payment method");
            Dictionary <string, object> reqParams = new Dictionary <string, object>();

            reqParams.Add("change_account", "1");
            reqParams.Add("id_recurrent_subscription", pSubDetail.mId);
            reqParams.Add("id_payment_account", "");
            reqParams.Add("subscription_payment_type", "charge");

            XsollaPaystationController payController = GetComponentInParent <XsollaPaystationController> ();

            payController.ChooseItem(reqParams);
        }
        public void init(XsollaManagerSubDetails pSubDetail, XsollaUtils pUtils)
        {
            mTitle.text = pUtils.GetTranslations().Get("user_hold_subscription_title");

            if (pSubDetail.mStatus != "non_renewing")
            {
                mDontRenewLabel.text = pUtils.GetTranslations().Get("hold_subscription_dont_renew_label");
                mDontRenewDesc.text  = pUtils.GetTranslations().Get("hold_subscription_dont_renew_label_description");
            }
            else
            {
                mDontRenew.gameObject.SetActive(false);
                mDontRenewDesc.gameObject.SetActive(false);
            }

            mDeleteNowLabel.text = pUtils.GetTranslations().Get("hold_subscription_cancel_label");
            mDeleteNowDesc.text  = pUtils.GetTranslations().Get("hold_subscription_cancel_label_description");
        }
Example #7
0
        public void init(XsollaManagerSubDetails pSubDetail, XsollaUtils pUtils)
        {
            mUtils       = pUtils;
            mSubDetail   = pSubDetail;
            mListCharges = new List <GameObject>();

            mPartTitle.text = mUtils.GetTranslations().Get("user_subscription_charges_title");

            String lDateTitle        = mUtils.GetTranslations().Get("virtualstatus_check_time");
            String lPaymenyTypeTitle = mUtils.GetTranslations().Get("user_subscription_payment_header");
            String lAmountTitle      = mUtils.GetTranslations().Get("user_subscription_payment");

            // добавляем заголовки
            addChargeElem(lDateTitle, lPaymenyTypeTitle, lAmountTitle, true);

            mSubDetail.mCharges.Sort(delegate(XsollaSubDetailCharge charge1, XsollaSubDetailCharge charge2)
            {
                if (charge1.mDateCreate < charge2.mDateCreate)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            });

            mMorePanel.SetActive(mSubDetail.mCharges.Count > 4);
            mShowMoreBtn.onClick.AddListener(OnMoreBtnAction);

            // добавляем историю
            foreach (XsollaSubDetailCharge charge in mSubDetail.mCharges)
            {
                mListCharges.Add(addChargeElem(StringHelper.DateFormat(charge.mDateCreate), charge.mPaymentMethod, charge.mCharge.ToString()));
            }

            ShowList(mShowState);
        }
        private void callbackShowSubDetail(JSONNode pNode)
        {
            mLocalSubDetail = new XsollaManagerSubDetails().Parse(pNode) as XsollaManagerSubDetails;
            // зачищаем то что было раньше
            var children = new List <GameObject>();

            foreach (Transform child in mSubsContainer.transform)
            {
                if (child.gameObject != mLabel.gameObject)
                {
                    children.Add(child.gameObject);
                }
                else
                {
                    mLabel.gameObject.SetActive(false);
                }
            }
            children.ForEach(child => Destroy(child));

            // скрыть заголовок
            mLabel.gameObject.SetActive(false);
            mTitleScreen.text = mUtils.GetTranslations().Get("user_subscription_info_page_title");

            // если в типе метода идет notify то нужно выдать уведомление о том что метод оплаты не привязан и дать ссылку на линку метода
            if ((mLocalSubDetail.mStatus != "non_renewing") && (mLocalSubDetail.mPaymentMethodName == "null"))             // TODO добавить условие с allow_recurrent
            {
                isLinkPaymentMethod = false;
                GameObject notifyObj = Instantiate(Resources.Load(mDetailNotifyPartPrefab)) as GameObject;
                SubManagerNotifyPartController notifyController = notifyObj.GetComponent <SubManagerNotifyPartController>() as SubManagerNotifyPartController;
                notifyController.init(mUtils.GetTranslations().Get("user_subscription_payment_not_link_account_message"), mUtils.GetTranslations().Get("user_subscription_add"), mLocalSubDetail, OnLinkPaymentMethodAction);
                notifyController.transform.SetParent(mSubsContainer.transform);
            }

            // добавить часть детализации
            GameObject detailPart = Instantiate(Resources.Load(mDetailPartPrefab)) as GameObject;
            SubManagerDetailPartController controller = detailPart.GetComponent <SubManagerDetailPartController>() as SubManagerDetailPartController;

            controller.initScreen(mLocalSubDetail, mUtils);
            controller.getHoldCancelBtn().onClick.AddListener(OnHoldCancelLinkAction);
            controller.getUnholdBtn().onClick.AddListener(OnUnHoldLinkAction);
            controller.getRenewBtn().onClick.AddListener(OnRenewBtnAction);

            detailPart.transform.SetParent(mSubsContainer.transform);

            // добавить префаб платежного метода
            if (mLocalSubDetail.mStatus != "non_renewing")
            {
                GameObject detailPaymentPart = Instantiate(Resources.Load(mDetailPaymentPartPrefab)) as GameObject;
                SubManagerDetailPaymentPartController paymentPartController = detailPaymentPart.GetComponent <SubManagerDetailPaymentPartController>() as SubManagerDetailPaymentPartController;
                if (isLinkPaymentMethod)
                {
                    paymentPartController.init(mLocalSubDetail, mUtils, OnUnlinkPaymentMethodAction);
                }
                else
                {
                    paymentPartController.init(mLocalSubDetail, mUtils, OnLinkPaymentMethodAction);
                }
                paymentPartController.transform.SetParent(mSubsContainer.transform);
            }

            // добавить префаб истории платежей
            if (mLocalSubDetail.mCharges != null)
            {
                GameObject detailCharges = Instantiate(Resources.Load(mDetailChargePartPrefab)) as GameObject;
                SubManagerDetailChargesPartController chargesController = detailCharges.GetComponent <SubManagerDetailChargesPartController>() as SubManagerDetailChargesPartController;
                chargesController.init(mLocalSubDetail, mUtils);
                chargesController.transform.SetParent(mSubsContainer.transform);
            }

            addBackLinkPart(mUtils.GetTranslations().Get("user_subscription_back_to_subscription_list"), OnClickBackSubsListAction);
        }