private void callbackDeleteSubMethod(JSONNode pNode)
 {
     if (pNode["status"].Value == "saved")
     {
         // перестроить детализацию и показать статус подписка отменена
         OnClickBackSubsListAction();
         showStatus(String.Format(StringHelper.PrepareFormatString(mUtils.GetTranslations().Get("user_subscription_message_canceled")), mLocalSubDetail.mName, mUtils.GetProject().name));
     }
 }
 private void callbackDontrenewMethod(JSONNode pNode)
 {
     if (pNode["status"].Value == "saved")
     {
         // перестроить детализацию и показать что подписка не будет продлеваться
         ShowLocalSubDetail();
         // показать статус
         showStatus(String.Format(StringHelper.PrepareFormatString(mUtils.GetTranslations().Get("user_subscription_message_non_renewing")), StringHelper.DateFormat(mLocalSubDetail.mDateNextCharge)));
     }
 }
        public void init(XsollaManagerSubscription pSub, XsollaTranslations pTranslation)
        {
            mSub          = pSub;
            mSubName.text = mSub.GetName();
            String nextChargeFormat = pTranslation.Get("next_charge");             // next_charge:"Next invoice: {{amount}}, {{date}}↵"

            int indx = 0;

            while (nextChargeFormat.Contains("{{"))
            {
                String replacedPart = nextChargeFormat.Substring(nextChargeFormat.IndexOf("{{", 0) + 1, nextChargeFormat.IndexOf("}}", 0) - nextChargeFormat.IndexOf("{{", 0));
                nextChargeFormat = nextChargeFormat.Replace(replacedPart, indx.ToString());
                indx++;
            }

            if (pSub.mStatus == "active")
            {
                mNextInvoice.text = String.Format(nextChargeFormat, mSub.mCharge.ToString(), StringHelper.DateFormat(pSub.mDateNextCharge));
            }
            else
            {
                mNextInvoice.gameObject.SetActive(false);
            }

            if (pSub.mPaymentMethod != "null")
            {
                mPaymentMethodName.text = pSub.mPaymentMethod + " " + pSub.mPaymentVisibleName;
            }
            else
            {
                switch (pSub.mStatus)
                {
                case "freeze":
                {
                    mPaymentMethodName.text = String.Format(StringHelper.PrepareFormatString(pTranslation.Get("user_subscription_hold_to")), StringHelper.DateFormat(pSub.mHoldDates.dateTo));
                    break;
                }

                case "non_renewing":
                {
                    mPaymentMethodName.text = String.Format(StringHelper.PrepareFormatString(pTranslation.Get("user_subscription_non_renewing")), StringHelper.DateFormat(pSub.mDateNextCharge));
                    break;
                }

                default:
                {
                    mPaymentMethodName.gameObject.SetActive(false);
                    break;
                }
                }
            }

            mDetailText.text = pTranslation.Get("user_subscription_to_details");
        }
        private IEnumerator getRequest(WWW pWww, Action <JSONNode> pCallback)
        {
            yield return(pWww);

            if (pWww.error == null)
            {
                JSONNode rootNode = JSON.Parse(pWww.text);
                pCallback(rootNode);
            }
            else
            {
                JSONNode rootNode = JSON.Parse(pWww.error);
                showError(String.Format(StringHelper.PrepareFormatString(mUtils.GetTranslations().Get("error_code")), rootNode["error"].Value));
            }
        }
Ejemplo n.º 5
0
        public List <LabelValue> getImportDetails()
        {
            List <LabelValue>  list        = new List <LabelValue>();
            XsollaTranslations translation = mUtils.GetTranslations();

            // ПОЛЯ ДЕТАЛИЗАЦИИ
            // имя
            list.Add(new LabelValue(translation.Get("user_subscription_name"), mSubDetail.mName));
            // статус
            list.Add(new LabelValue(translation.Get("user_subscription_status"), translation.Get("user_subscription_status_" + mSubDetail.mStatus)));
            // ценa
            list.Add(new LabelValue(translation.Get("user_subscription_charge"), mSubDetail.mCharge.ToString()));
            // цикл платежа
            list.Add(new LabelValue(translation.Get("user_subscription_period"), formattedPeriod(mSubDetail.mPeriod.mValue.ToString(), mSubDetail.mPeriod.mUnit)));

            if (mSubDetail.mStatus == "non_renewing")
            {
                list.Add(new LabelValue(translation.Get("user_subscription_end_bill_date"), StringHelper.DateFormat(mSubDetail.mDateNextCharge)));
            }

            if (mSubDetail.mNextPeriodPlanChange != null)
            {
                list.Add(new LabelValue(translation.Get("user_subscription_new_plan"), string.Format(StringHelper.PrepareFormatString(translation.Get("user_subscription_next_period_plan_change")), mSubDetail.mNextPeriodPlanChange.name, StringHelper.DateFormat(mSubDetail.mNextPeriodPlanChange.date))));
            }

            if (mSubDetail.mIsSheduledHoldExist && (mSubDetail.mSheduledHoldDates != null) || (mSubDetail.mStatus == "freeze") && (mSubDetail.mHoldDates != null))
            {
                String lDateFrom = "", lDateTo = "";
                if (mSubDetail.mStatus == "freeze")
                {
                    if (mSubDetail.mHoldDates != null)
                    {
                        lDateFrom = StringHelper.DateFormat(mSubDetail.mHoldDates.dateFrom);
                        lDateTo   = StringHelper.DateFormat(mSubDetail.mHoldDates.dateTo);
                    }
                }
                else
                {
                    if (mSubDetail.mSheduledHoldDates != null)
                    {
                        lDateFrom = StringHelper.DateFormat(mSubDetail.mSheduledHoldDates.dateFrom);
                        lDateTo   = StringHelper.DateFormat(mSubDetail.mSheduledHoldDates.dateTo);
                    }
                }

                if (mSubDetail.mIsSheduledHoldExist)
                {
                    list.Add(new LabelValue(translation.Get("user_subscription_hold_dates"), lDateFrom + " - " + lDateTo, translation.Get(mSubDetail.mStatus == "freeze"?"user_subscription_unhold":"cancel"), cancelHoldDates));
                }
                else
                {
                    list.Add(new LabelValue(translation.Get("user_subscription_hold_dates"), lDateFrom + " - " + lDateTo));
                }
            }

            return(list);
        }
 private void ErrorRecived(XsollaErrorRe pErrors)
 {
     mHasError           = true;
     btnPay.interactable = false;
     mErrorPanel.GetComponentInChildren <Text>().text = pErrors.mErrorList[0].mMessage + "\n" + String.Format(StringHelper.PrepareFormatString(mUtils.GetTranslations().Get("error_code")), pErrors.mErrorList[0].mSupportCode);
     if (mVcRecalc)
     {
         virtCurrAmount.textComponent.color = StyleManager.Instance.GetColor(StyleManager.BaseColor.bg_error);
         virtCurrAmount.gameObject.GetComponent <ColorInputController>().pType = StyleManager.BaseSprite.bckg_input_error;
         virtCurrAmount.gameObject.GetComponent <ColorInputController>().UpdateSprite();
         SetVirtError();
     }
     else
     {
         realCurrAmount.textComponent.color = StyleManager.Instance.GetColor(StyleManager.BaseColor.bg_error);
         realCurrAmount.gameObject.GetComponent <ColorInputController>().pType = StyleManager.BaseSprite.bckg_input_error;
         realCurrAmount.gameObject.GetComponent <ColorInputController>().UpdateSprite();
         SetRealError();
     }
 }