Exemplo n.º 1
0
 public void UpdateDiscont(XsollaTranslations pTranslation, XsollaSummary pSummary)
 {
     // clear all gameobject
     linearLayout.objects.ForEach((obj) => Destroy(obj));
     // redraw
     InitView(pTranslation, pSummary);
 }
        public void InitScreen(XsollaUtils utils, XsollaForm form)
        {
            XsollaTranslations translations = utils.GetTranslations();

            Resizer.ResizeToParrent(gameObject);
            bool isPurchaseNull = utils.GetPurchase() == null;

            if (isPurchaseNull || !utils.GetPurchase().IsPurchase() || !utils.GetPurchase().IsPaymentSystem())
            {
                if (!isPurchaseNull)
                {
                    isPrevStepPaymentList = !utils.GetPurchase().IsPaymentSystem();
                }
                paymentForm.OnClickBack += () => {
                    Back();
                };
            }
            paymentForm.InitView(translations, form);
            if (form.GetSummary() != null)
            {
                tower.InitView(translations, form.GetSummary());
            }
            else
            {
                tower.gameObject.SetActive(false);
            }
        }
Exemplo n.º 3
0
 private void DrawScreen(XsollaTranslations translations, XsollaError error)
 {
     linerLayout.AddObject(GetError(error));
     linerLayout.AddObject(GetButton(translations.Get(XsollaTranslations.FORM_CONTINUE), delegate { OnClickButton(error); }));
     linerLayout.AddObject(GetHelp(translations));
     linerLayout.Invalidate();
 }
 public void UpdateDiscont(XsollaTranslations pTranslation, XsollaSummary pSummary)
 {
     // clear all gameobject
     linearLayout.objects.ForEach((obj) => Destroy(obj));
     // redraw
     InitView(pTranslation, pSummary);
 }
Exemplo n.º 5
0
 protected virtual void OnTranslationRecieved(XsollaTranslations translations)
 {
     if (TranslationRecieved != null)
     {
         TranslationRecieved(translations);
     }
 }
Exemplo n.º 6
0
 public void AddListRows(XsollaTranslations pTranslation, XsollaHistoryList pList)
 {
     foreach (XsollaHistoryItem item in pList.GetItemsList())
     {
         AddHistoryRow(pTranslation, item, mLimit%2 != 0, false);
         mLimit ++;
     }
 }
 public void AddListRows(XsollaTranslations pTranslation, XsollaHistoryList pList)
 {
     foreach (XsollaHistoryItem item in pList.GetItemsList())
     {
         AddHistoryRow(pTranslation, item, mLimit % 2 != 0, false);
         mLimit++;
     }
 }
Exemplo n.º 8
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);
        }
        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");
        }
Exemplo n.º 10
0
        public IParseble Parse(JSONNode utilsNode)
        {
            user         = new XsollaUser().Parse(utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project      = new XsollaProject().Parse(utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase     = new XsollaPurchase().Parse(utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings     = new XsollaSettings().Parse(utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations = new XsollaTranslations().Parse(utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api          = new XsollaApi().Parse(utilsNode [XsollaApiConst.R_API]) as XsollaApi;

            return(this);
        }
Exemplo n.º 11
0
        public IParseble Parse(JSONNode utilsNode)
        {
            accessToken 	= utilsNode [XsollaApiConst.ACCESS_TOKEN].Value;
            user 			= new XsollaUser ().Parse (utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project 		= new XsollaProject ().Parse (utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase 		= new XsollaPurchase ().Parse (utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings 		= new XsollaSettings ().Parse (utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations 	= new XsollaTranslations ().Parse (utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api 			= new XsollaApi ().Parse (utilsNode [XsollaApiConst.R_API]) as XsollaApi;

            return this;
        }
Exemplo n.º 12
0
        public IParseble Parse(JSONNode utilsNode)
        {
            accessToken  = utilsNode [XsollaApiConst.ACCESS_TOKEN].Value;
            user         = new XsollaUser().Parse(utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project      = new XsollaProject().Parse(utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase     = new XsollaPurchase().Parse(utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings     = new XsollaSettings().Parse(utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations = new XsollaTranslations().Parse(utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api          = new XsollaApi().Parse(utilsNode [XsollaApiConst.R_API]) as XsollaApi;
            mBonus       = new XsollaBonus().Parse(utilsNode["bonus"]) as XsollaBonus;

            return(this);
        }
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SHOP <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        private void DrawStatus(XsollaTranslations translations, XsollaStatus status)
        {
            currentActive = ActiveScreen.STATUS;
            GameObject statusScreen = Instantiate(Resources.Load(PREFAB_SCREEN_STATUS)) as GameObject;

            statusScreen.transform.SetParent(mainScreenContainer.transform);
            statusScreen.GetComponent <RectTransform> ().anchoredPosition    = new Vector2(0, 0);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = statusScreen.GetComponent <RectTransform> ();
            StatusViewController controller = statusScreen.GetComponent <StatusViewController> ();

            controller.StatusHandler += OnUserStatusExit;
            controller.InitScreen(translations, status);
        }
 private void InitFooter(XsollaUtils utils)
 {
     if (utils != null)
     {
         Text[]             texts         = mainScreen.GetComponentsInChildren <Text> ();
         XsollaTranslations translatrions = utils.GetTranslations();
         texts [4].text = translatrions.Get(XsollaTranslations.SUPPORT_CUSTOMER_SUPPORT);
         texts [5].text = translatrions.Get(XsollaTranslations.SUPPORT_CONTACT_US);
         texts [6].text = translatrions.Get(XsollaTranslations.XSOLLA_COPYRIGHT);
         texts [7].text = translatrions.Get(XsollaTranslations.FOOTER_SECURED_CONNECTION);
         texts [8].text = translatrions.Get(XsollaTranslations.FOOTER_AGREEMENT);
     }
 }
 protected GameObject GetHelp(XsollaTranslations translations)
 {
     if (translations != null)
     {
         GameObject helpObj = GetObject("Prefabs/SimpleView/Help");
         Text[]     texsts  = helpObj.GetComponentsInChildren <Text>();
         texsts[0].text = translations.Get(XsollaTranslations.SUPPORT_PHONE);
         texsts[1].text = translations.Get(XsollaTranslations.SUPPORT_NEED_HELP);
         texsts[2].text = "*****@*****.**";
         texsts[3].text = translations.Get(XsollaTranslations.SUPPORT_CUSTOMER_SUPPORT);
         return(helpObj);
     }
     return(null);
 }
Exemplo n.º 16
0
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SHOP <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        private void OpenStatus(XsollaTranslations translations, XsollaStatus status)
        {
            currentActive = ActiveScreen.STATUS;
            menuTransform.gameObject.SetActive(false);
            GameObject statusScreen = Instantiate(Resources.Load("Prefabs/SimpleView/_ScreenStatus/ScreenStatusNew")) as GameObject;

            statusScreen.transform.SetParent(mainScreenContainer.transform);
            statusScreen.GetComponent <RectTransform> ().anchoredPosition    = new Vector2(0, 0);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = statusScreen.GetComponent <RectTransform> ();
            StatusViewController controller = statusScreen.GetComponent <StatusViewController> ();

            controller.StatusHandler += OnUserStatusExit;
            controller.InitScreen(translations, status);
        }
Exemplo n.º 17
0
		protected GameObject GetHelp(XsollaTranslations translations)
		{
			if (translations != null)
			{ 
				GameObject helpObj = Instantiate (Resources.Load ("Prefabs/SimpleView/Help")) as GameObject;
				Text[] texsts = helpObj.GetComponentsInChildren<Text>();
				texsts[0].text = translations.Get(XsollaTranslations.SUPPORT_PHONE);
				texsts[1].text = translations.Get(XsollaTranslations.SUPPORT_NEED_HELP);
				texsts[2].text = "*****@*****.**";
				texsts[3].text = translations.Get(XsollaTranslations.SUPPORT_CUSTOMER_SUPPORT);
				return helpObj;
			}
			return null;
		}
Exemplo n.º 18
0
        public GameObject GetFormView(XsollaForm xsollaForm, XsollaTranslations translations)
        {
            bool isCcRender = xsollaForm.GetCurrentCommand() == XsollaForm.CurrentCommand.FORM && xsollaForm.IsCreditCard();

            if (isCcRender)
            {
                return(GetCardViewWeb(xsollaForm, translations));
            }
            else
            {
                FormElementAdapter adapter = GetComponent <FormElementAdapter>();
                adapter.SetForm(xsollaForm, translations);
                GameObject list = GetList(adapter);
                list.GetComponent <ListView>().DrawList(GetComponent <RectTransform> ());
                return(list);
            }
        }
Exemplo n.º 19
0
        public List <LabelValue> getImportDetails()
        {
            List <LabelValue>  list        = new List <LabelValue>();
            XsollaTranslations translation = mUtils.GetTranslations();

            // ПОЛЯ ДЕТАЛИЗАЦИИ
            // имя
            if (mSubDetail.mPaymentMethodName != "null")
            {
                list.Add(new LabelValue(translation.Get("user_subscription_payment_method"), mSubDetail.mPaymentMethodName + " (" + mSubDetail.mPaymentMethodVisName + ")"));
            }
            // сумма след списание
            list.Add(new LabelValue(translation.Get("user_subscription_next_bill_sum"), mSubDetail.mNextCharge.ToString()));
            // дата след списание
            list.Add(new LabelValue(translation.Get("user_subscription_next_bill_date"), StringHelper.DateFormat(mSubDetail.mDateNextCharge)));
            return(list);
        }
Exemplo n.º 20
0
        public void Init(XsollaUtils pUtils)
        {
            if (pUtils != null)
            {
                XsollaTranslations lTranslatrions = pUtils.GetTranslations();
                mCustomerSupport.text   = lTranslatrions.Get(XsollaTranslations.SUPPORT_CUSTOMER_SUPPORT);
                mContactUs.text         = lTranslatrions.Get(XsollaTranslations.SUPPORT_CONTACT_US);
                mCopyRight.text         = lTranslatrions.Get(XsollaTranslations.XSOLLA_COPYRIGHT);
                mSecuredConnection.text = lTranslatrions.Get(XsollaTranslations.FOOTER_SECURED_CONNECTION);

                mAgreement.text = pUtils.GetProject().eula != "null" ? pUtils.GetProject().eula : lTranslatrions.Get(XsollaTranslations.FOOTER_AGREEMENT);

                mAgreement.gameObject.GetComponent <Button>().onClick.AddListener(delegate
                {
                    new OpenUrlHelper().OpenUrl(pUtils.GetProject().eulaUrl != "null" ? pUtils.GetProject().eulaUrl : mUrl);
                });
            }
        }
Exemplo n.º 21
0
 public void AddHistoryRow(XsollaTranslations pTranslation, XsollaHistoryItem pItem, Boolean pEven, Boolean pHeader = false)
 {
     Logger.Log("AddHistoryRow");
     GameObject itemRow = Instantiate(Resources.Load(PREFAB_HISTORY_ROW)) as GameObject;
     HistoryElemController controller = itemRow.GetComponent<HistoryElemController>();
     if (controller != null)
     {
         if (pHeader)
         {
             controller.Init(pTranslation, null, mVirtCurrName, pEven, SortHistory, true, sortDesc);
         }
         else
         {
             controller.Init(pTranslation, pItem, mVirtCurrName, pEven, null);
         }
     }
     itemRow.transform.SetParent(mHistoryContainer.transform);
 }
Exemplo n.º 22
0
        public void InitScreen(XsollaTranslations pTranslation, XsollaFormElement pForm)
        {
            _promoBtn.GetComponent<Text>().text = pTranslation.Get("coupon_control_header");
            _promoDesc.text = pTranslation.Get("coupon_control_hint");
            _promoCodeApply.gameObject.GetComponentInChildren<Text>().text = pTranslation.Get("coupon_control_apply");
            _acceptLable.text = pTranslation.Get("coupon_control_accepted");

            _inputField.onValueChanged.AddListener(delegate
                {
                    if (_panelError.activeSelf)
                        _panelError.SetActive(false);
                });

            if (pForm.IsReadOnly() && !pForm.GetValue().Equals(""))
            {
                _inputField.text = pForm.GetValue();
                ApplySuccessful();
            }
        }
Exemplo n.º 23
0
        public void AddHistoryRow(XsollaTranslations pTranslation, XsollaHistoryItem pItem, Boolean pEven, Boolean pHeader = false)
        {
            Logger.Log("AddHistoryRow");
            GameObject            itemRow    = Instantiate(Resources.Load(PREFAB_HISTORY_ROW)) as GameObject;
            HistoryElemController controller = itemRow.GetComponent <HistoryElemController>();

            if (controller != null)
            {
                if (pHeader)
                {
                    controller.Init(pTranslation, null, mVirtCurrName, pEven, SortHistory, true, sortDesc);
                }
                else
                {
                    controller.Init(pTranslation, pItem, mVirtCurrName, pEven, null);
                }
            }
            itemRow.transform.SetParent(mHistoryContainer.transform);
        }
        public void InitView(XsollaTranslations translations, XsollaSummary summary)
        {
            _translations = translations;
            _summary      = summary;

            if (this.gameObject.GetComponent <VerticalLayoutGroup>() == null)
            {
                this.gameObject.AddComponent <VerticalLayoutGroup>();
                VerticalLayoutGroup obj = this.GetComponent <VerticalLayoutGroup>();
                obj.childForceExpandHeight = false;
            }
            GameObject header = Instantiate(orderSummaryPrefab);

            header.GetComponentsInChildren <Text> () [0].text = translations.Get(XsollaTranslations.PAYMENT_SUMMARY_HEADER);
            linearLayout.AddObject(header);
            foreach (IXsollaSummaryItem purchase in _summary.GetPurchases())
            {
                linearLayout.AddObject(GetSummaryItem(purchase));
            }
            XsollaFinance finance = _summary.GetFinance();

            linearLayout.AddObject(GetItem(subTotalPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_SUBTOTAL), PriceFormatter.Format(finance.subTotal.amount, finance.subTotal.currency)));
            if (finance.discount != null && finance.discount.amount > 0)
            {
                linearLayout.AddObject(GetItem(financeItemPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_DISCOUNT), "- " + PriceFormatter.Format(finance.discount.amount, finance.discount.currency)));
            }
            if (finance.fee != null)
            {
                linearLayout.AddObject(GetItem(financeItemPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_FEE), PriceFormatter.Format(finance.fee.amount, finance.fee.currency)));
            }
            if (finance.xsollaCredits != null && finance.xsollaCredits.amount > 0)
            {
                linearLayout.AddObject(GetItem(financeItemPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_XSOLLA_CREDITS), PriceFormatter.Format(finance.xsollaCredits.amount, finance.xsollaCredits.currency)));
            }
            linearLayout.AddObject(GetItem(totalPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_TOTAL), PriceFormatter.Format(finance.total.amount, finance.total.currency)));
            if (finance.vat != null && finance.vat.amount > 0)
            {
                linearLayout.AddObject(GetItem(financeItemPrefab, "VAT", PriceFormatter.Format(finance.vat.amount, finance.vat.currency)));
            }
            linearLayout.Invalidate();
        }
        public void InitScreen(XsollaTranslations pTranslation, XsollaFormElement pForm)
        {
            _promoBtn.GetComponent <Text>().text = pTranslation.Get("coupon_control_header");
            _promoDesc.text = pTranslation.Get("coupon_control_hint");
            _promoCodeApply.gameObject.GetComponentInChildren <Text>().text = pTranslation.Get("coupon_control_apply");
            _acceptLable.text = pTranslation.Get("coupon_control_accepted");

            _inputField.onValueChanged.AddListener(delegate
            {
                if (_panelError.activeSelf)
                {
                    _panelError.SetActive(false);
                }
            });

            if (pForm.IsReadOnly() && !pForm.GetValue().Equals(""))
            {
                _inputField.text = pForm.GetValue();
                ApplySuccessful();
            }
        }
        public void DrawVpStatus(XsollaUtils utils, XVPStatus status)
        {
            XsollaTranslations translations = utils.GetTranslations();
            string             input;

            if (status.Status.HeaderDescription == null)
            {
                input = translations.Get(XsollaTranslations.STATUS_PURCHASED_DESCRIPTION);
            }
            else
            {
                input = status.Status.HeaderDescription;
            }
            XsollaStatus.Group currentStatus = status.GetGroup();

            PrepareStatus(currentStatus, status.Status.Header, input, "");
            AddTitle(utils.GetProject().name);
            AddStatus(status.Status.Description);
            AddElement(translations.Get("virtualstatus_check_operation"), status.OperationId);
            AddElement(translations.Get("virtualstatus_check_time"), string.Format("{0:dd/MM/yyyy HH:mm}", DateTime.Parse(status.OperationCreated)));
            if (status.Items.Count > 0)
            {
                AddElement(translations.Get("virtualstatus_check_virtual_items"), status.GetPurchase(0));
            }
            if (status.vCurr.Count > 0)
            {
                AddElement(translations.Get("virtualstatus_check_virtual_currency"), status.GetVCPurchase(0) + " " + utils.GetProject().virtualCurrencyName);
            }

            if (status.OperationType != "coupon")
            {
                AddLine();
                AddBigElement(translations.Get("virtualstatus_check_vc_amount"), status.VcAmount + " " + utils.GetProject().virtualCurrencyName);
            }
            statusViewExitButton.gameObject.GetComponent <Text> ().text = translations.Get(XsollaTranslations.BACK_TO_STORE);
            statusViewExitButton.onClick.AddListener(delegate
            {
                OnClickBack(currentStatus, status.OperationId, Xsolla.XsollaStatusData.Status.DONE, status.GetPurchaseList());
            });
        }
Exemplo n.º 27
0
        public void InitView(XsollaTranslations translations, XsollaSummary summary)
        {
            _translations = translations;
            _summary = summary;

            if (this.gameObject.GetComponent<VerticalLayoutGroup>() == null)
            {
                this.gameObject.AddComponent<VerticalLayoutGroup>();
                VerticalLayoutGroup obj = this.GetComponent<VerticalLayoutGroup>();
                obj.childForceExpandHeight = false;
            }
            GameObject header = Instantiate (orderSummaryPrefab);
            header.GetComponentsInChildren<Text> () [0].text = translations.Get (XsollaTranslations.PAYMENT_SUMMARY_HEADER);
            linearLayout.AddObject(header);
            foreach(IXsollaSummaryItem purchase in _summary.GetPurchases ())
            {
                linearLayout.AddObject(GetSummaryItem(purchase));
            }
            XsollaFinance finance = _summary.GetFinance ();
            linearLayout.AddObject(GetItem(subTotalPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_SUBTOTAL), PriceFormatter.Format(finance.subTotal.amount, finance.subTotal.currency)));
            if (finance.discount != null && finance.discount.amount > 0)
            {
                linearLayout.AddObject(GetItem(financeItemPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_DISCOUNT), "- " + PriceFormatter.Format(finance.discount.amount, finance.discount.currency)));
            }
            if (finance.fee != null)
            {
                linearLayout.AddObject (GetItem (financeItemPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_FEE), PriceFormatter.Format (finance.fee.amount, finance.fee.currency)));
            }
            if (finance.xsollaCredits != null && finance.xsollaCredits.amount > 0)
            {
                linearLayout.AddObject(GetItem(financeItemPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_XSOLLA_CREDITS), PriceFormatter.Format(finance.xsollaCredits.amount, finance.xsollaCredits.currency)));
            }
            linearLayout.AddObject(GetItem(totalPrefab, translations.Get(XsollaTranslations.PAYMENT_SUMMARY_TOTAL), PriceFormatter.Format(finance.total.amount, finance.total.currency)));
            if (finance.vat != null && finance.vat.amount > 0)
            {
                    linearLayout.AddObject(GetItem(financeItemPrefab, "VAT", PriceFormatter.Format(finance.vat.amount, finance.vat.currency)));
            }
            linearLayout.Invalidate ();
        }
        public void InitBtn(XsollaSubscription pSub, XsollaTranslations pTranslation)
        {
            _sub          = pSub;
            _subName.text = _sub.GetName();

            if (_sub.description != null)
            {
                _desc.GetComponent <Text>().text = _sub.description;
                _desc.SetActive(true);
            }
            else
            {
                _desc.SetActive(false);
            }

            if (!_sub.IsSpecial())
            {
                _newPrice.text = CurrencyFormatter.Instance.FormatPrice(_sub.chargeCurrency, _sub.chargeAmount);
                _oldPrice.gameObject.SetActive(false);
            }
            else
            {
                _oldPrice.text = CurrencyFormatter.Instance.FormatPrice(_sub.chargeCurrency, _sub.chargeAmountWithoutDiscount);
                _newPrice.text = CurrencyFormatter.Instance.FormatPrice(_sub.chargeCurrency, _sub.chargeAmount);
                _offerText.GetComponent <Text>().text = pTranslation.Get("option_offer");
            }
            _offerText.SetActive(_sub.IsSpecial()?true:false);
            _offerImagePanel.enabled = _sub.IsSpecial()?true:false;

            _period.text = _sub.GetPeriodString("Every");

            _btnSub.onClick.AddListener(() => {
                Dictionary <string, object> purchase = new Dictionary <string, object>();
                purchase.Add("id_package", _sub.id);

                gameObject.GetComponentInParent <XsollaPaystationController> ().ChooseItem(purchase, false);
            });
        }
Exemplo n.º 29
0
        public void InitScreen(XsollaTranslations pTranslation, XsollaHistoryList pList, String pVirtualCurrName)
        {
            mVirtCurrName = pVirtualCurrName;
            Logger.Log("Init history screen");
            mTitle.text = pTranslation.Get("balance_history_page_title");

            mBtnContinue.GetComponent<Text>().text = pTranslation.Get("balance_back_button") + " >";
            mBtnContinue.GetComponent<Button>().onClick.AddListener(delegate
                {
                    Logger.Log("Destroy history");
                    Destroy(this.gameObject);
                });

            AddHistoryRow(pTranslation, null, false, true);

            foreach (XsollaHistoryItem item in pList.GetItemsList())
            {
                AddHistoryRow(pTranslation, item, mLimit%2 != 0, false);
                mLimit ++;
            }

            isRefresh = false;
        }
Exemplo n.º 30
0
        public void InitScreen(XsollaTranslations pTranslation, XsollaHistoryList pList, String pVirtualCurrName)
        {
            mVirtCurrName = pVirtualCurrName;
            Logger.Log("Init history screen");
            mTitle.text = pTranslation.Get("balance_history_page_title");

            mBtnContinue.GetComponent <Text>().text = pTranslation.Get("balance_back_button") + " >";
            mBtnContinue.GetComponent <Button>().onClick.AddListener(delegate
            {
                Logger.Log("Destroy history");
                Destroy(this.gameObject);
            });

            AddHistoryRow(pTranslation, null, false, true);

            foreach (XsollaHistoryItem item in pList.GetItemsList())
            {
                AddHistoryRow(pTranslation, item, mLimit % 2 != 0, false);
                mLimit++;
            }

            isRefresh = false;
        }
Exemplo n.º 31
0
        public void DrawScreen(XsollaTranslations translations, XsollaStatus xsollaStatus)
        {
            ResizeToParent();
            XsollaStatus.Group group = xsollaStatus.GetGroup();
            switch (group)
            {
            case XsollaStatus.Group.DONE:
                linerLayout.AddObject(GetOkStatus(xsollaStatus.GetStatusText().GetState()));
                break;

            case XsollaStatus.Group.TROUBLED:
                linerLayout.AddObject(GetErrorByString(xsollaStatus.GetStatusText().GetState()));
                break;

            case XsollaStatus.Group.INVOICE:
            case XsollaStatus.Group.UNKNOWN:
            default:
                linerLayout.AddObject(GetWaitingStatus(xsollaStatus.GetStatusText().GetState()));
                StartCoroutine(TryIt(xsollaStatus.GetInvoice()));
                break;
            }
            linerLayout.AddObject(GetError(null));
            linerLayout.AddObject(GetEmpty());
            adapter.SetElements(xsollaStatus.GetStatusText().GetStatusTextElements());
            GameObject list = GetList(adapter);

            list.GetComponent <ListView> ().DrawList(GetComponent <RectTransform> ());
            linerLayout.AddObject(list);
            linerLayout.AddObject(GetEmpty());
            if (group == XsollaStatus.Group.INVOICE || group == XsollaStatus.Group.UNKNOWN)
            {
                linerLayout.AddObject(GetButton("Start again", delegate { StartAgain(); }));
                linerLayout.AddObject(GetEmpty());
            }
            linerLayout.Invalidate();
        }
 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SHOP <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 private void DrawStatus(XsollaTranslations translations, XsollaStatus status)
 {
     currentActive = ActiveScreen.STATUS;
     menuTransform.gameObject.SetActive (false);
     GameObject statusScreen = Instantiate (Resources.Load(PREFAB_SCREEN_STATUS)) as GameObject;
     statusScreen.transform.SetParent(mainScreenContainer.transform);
     statusScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0);
     mainScreenContainer.GetComponentInParent<ScrollRect> ().content = statusScreen.GetComponent<RectTransform> ();
     StatusViewController controller = statusScreen.GetComponent<StatusViewController> ();
     controller.StatusHandler += OnUserStatusExit;
     controller.InitScreen(translations, status);
 }
Exemplo n.º 33
0
 public override void InitScreen(XsollaTranslations translations, XsollaStatus status)
 {
     DrawScreen(translations, status);
 }
Exemplo n.º 34
0
 public override void InitScreen(XsollaTranslations translations, object model)
 {
     throw new System.NotImplementedException();
 }
 protected override void ShowPaymentStatus(XsollaTranslations translations, XsollaStatus status)
 {
     Logger.Log ("Status recived");
     SetLoading (false);
     DrawStatus (translations, status);
 }
Exemplo n.º 36
0
        public void InitView(XsollaTranslations pTranslations, XsollaForm form)
        {
            _form = form;
            // if have skipCheckout and this checkout form
            if ((form.GetCurrentCommand() == XsollaForm.CurrentCommand.CHECKOUT) && form.GetSkipChekout())
            {
                string checkoutToken  = _form.GetCheckoutToken();
                bool   isLinkRequired = checkoutToken != null &&
                                        !"".Equals(checkoutToken) &&
                                        !"null".Equals(checkoutToken) &&
                                        !"false".Equals(checkoutToken);
                if (isLinkRequired)
                {
                    OnClickPay(isLinkRequired);
                    return;
                }
            }

            string pattern = "{{.*?}}";
            Regex  regex   = new Regex(pattern);
            string title   = regex.Replace(pTranslations.Get(XsollaTranslations.PAYMENT_PAGE_TITLE_VIA), form.GetTitle(), 1);

            layout.AddObject(GetTitle(title));
            layout.AddObject(GetError(form.GetError()));
            layout.AddObject(GetInfo(form.GetMessage()));
            if (form.GetVisible().Count > 0)
            {
                GameObject formView = GetFormView(form, pTranslations);
                layout.AddObject(formView);
            }
            if (form.GetAccountXsolla() != null && !"".Equals(form.GetAccountXsolla()) && !"null".Equals(form.GetAccountXsolla()))
            {
                layout.AddObject(GetTwoTextPlate("Xsolla number", form.GetAccountXsolla()));
            }
            if (form.GetAccount() != null && !"".Equals(form.GetAccount()) && !"null".Equals(form.GetAccount()))
            {
                layout.AddObject(GetTwoTextPlate("2pay number", form.GetAccount()));
            }
            if (form.IsValidPaymentSystem())
            {
                layout.AddObject(GetTextPlate(pTranslations.Get(XsollaTranslations.FORM_CC_EULA)));
            }
            GameObject footerInstance = Instantiate(footer);

            Text[] footerTexts = footerInstance.GetComponentsInChildren <Text> ();
//			footerTexts [0].text = "back";//back
            string nextStep = form.GetNextStepString();

            footerTexts [2].text = nextStep;            //translations.Get (XsollaTranslations.FORM_CONTINUE);//pay now
            Button[] footerButtons = footerInstance.GetComponentsInChildren <Button> ();
            if (OnClickBack != null)
            {
                footerButtons [0].onClick.AddListener(() => {
                    OnBack();
                });
            }
            else
            {
                footerButtons [0].gameObject.SetActive(false);
            }

            if (form.GetCurrentCommand() == XsollaForm.CurrentCommand.ACCOUNT ||
                form.GetCurrentCommand() == XsollaForm.CurrentCommand.CREATE ||
                form.GetCurrentCommand() == XsollaForm.CurrentCommand.CHECKOUT) //
            {
                footerTexts [1].text = "";                                      //total
                RectTransform buttonRect = footerButtons [1].GetComponent <RectTransform>();
                Vector2       vecMin     = buttonRect.anchorMin;
                vecMin.x             = vecMin.x - (buttonRect.anchorMax.x - vecMin.x) / 2;
                buttonRect.anchorMin = vecMin;
            }
            else
            {
                footerTexts [1].text = pTranslations.Get(XsollaTranslations.TOTAL) + " " + form.GetSumTotal();                  //total
            }

            layout.AddObject(footerInstance);
            layout.Invalidate();

            if (!"".Equals(nextStep) && form.GetCurrentCommand() != XsollaForm.CurrentCommand.ACCOUNT)
            {
                string checkoutToken  = _form.GetCheckoutToken();
                bool   isLinkRequired = checkoutToken != null &&
                                        !"".Equals(checkoutToken) &&
                                        !"null".Equals(checkoutToken) &&
                                        !"false".Equals(checkoutToken);
                string link = "https://secure.xsolla.com/pages/checkout/?token=" + _form.GetCheckoutToken();
                if (isLinkRequired && Application.platform == RuntimePlatform.WebGLPlayer)
                {
                    RectTransform buttonRect = footerButtons [1].GetComponent <RectTransform>();
                    int           width      = (int)(buttonRect.rect.xMax - buttonRect.rect.xMin);
                    int           height     = (int)(buttonRect.rect.yMax - buttonRect.rect.yMin);
                    height = height * 8;
                    Vector3[] vec = new Vector3[4];
                    buttonRect.GetWorldCorners(vec);
                    int xPos = (int)vec[0].x;
                    int yPos = (int)vec[0].y;
                    yPos = yPos / 2;
                    CreateLinkButtonWebGl(xPos, yPos, width, height, link, "CardPaymeentForm", "Next");
                    footerButtons [1].onClick.AddListener(() => {
                        OnClickPay(false);
                    });
                }
                else
                {
                    footerButtons [1].onClick.AddListener(() => {
                        OnClickPay(isLinkRequired);
                    });
                }
            }
            else
            {
                footerButtons [1].gameObject.SetActive(false);
            }
        }
Exemplo n.º 37
0
        public GameObject GetCardViewWeb(XsollaForm xsollaForm, XsollaTranslations translations)
        {
            GameObject cardViewObj = Instantiate(Resources.Load("Prefabs/SimpleView/_ScreenCheckout/CardViewLayoutWeb")) as GameObject;

            InputField[] inputs = cardViewObj.GetComponentsInChildren <InputField>();
            validators = new List <ValidatorInputField> ();
            for (int i = inputs.Length - 1; i >= 0; i--)
            {
                XsollaFormElement   element     = null;
                string              newErrorMsg = "Invalid";
                InputField          input       = inputs[i];
                ValidatorInputField validator   = input.GetComponentInChildren <ValidatorInputField>();
                // CVV > *HOLDER* > *ZIP* > YEAR > MONTH > NUMBER
                switch (i)               //input.tag)
                {
                case 5:                  //"CardNumber":
                    element     = xsollaForm.GetItem(XsollaApiConst.CARD_NUMBER);
                    newErrorMsg = translations.Get(XsollaTranslations.VALIDATION_MESSAGE_CARDNUMBER);
                    CCEditText ccEditText = input.GetComponent <CCEditText>();
                    isMaestro = ccEditText.IsMaestro();
                    validator.AddValidator(new ValidatorEmpty(newErrorMsg));
                    validator.AddValidator(new ValidatorCreditCard(newErrorMsg));
                    break;

                case 4:                        //"Month":
                    element     = xsollaForm.GetItem(XsollaApiConst.CARD_EXP_MONTH);
                    newErrorMsg = translations.Get(XsollaTranslations.VALIDATION_MESSAGE_CARD_MONTH);
                    validator.AddValidator(new ValidatorEmpty(newErrorMsg));
                    validator.AddValidator(new ValidatorMonth(newErrorMsg));
                    break;

                case 3:                        //"Year":
                    element     = xsollaForm.GetItem(XsollaApiConst.CARD_EXP_YEAR);
                    newErrorMsg = translations.Get(XsollaTranslations.VALIDATION_MESSAGE_CARD_YEAR);
                    validator.AddValidator(new ValidatorEmpty(newErrorMsg));
                    validator.AddValidator(new ValidatorYear(newErrorMsg));
                    break;

                case 2:                        //"Zip":
                    element     = xsollaForm.GetItem(XsollaApiConst.CARD_ZIP);
                    newErrorMsg = translations.Get(XsollaTranslations.VALIDATION_MESSAGE_REQUIRED);
                    validator.AddValidator(new ValidatorEmpty(newErrorMsg));
                    break;

                case 1:                        //"CardHolder":
                    element     = xsollaForm.GetItem(XsollaApiConst.CARD_HOLDER);
                    newErrorMsg = translations.Get(XsollaTranslations.VALIDATION_MESSAGE_REQUIRED);
                    validator.AddValidator(new ValidatorEmpty(newErrorMsg));
                    break;

                case 0:                        //"Cvv":
                    element     = xsollaForm.GetItem(XsollaApiConst.CARD_CVV);
                    newErrorMsg = translations.Get(XsollaTranslations.VALIDATION_MESSAGE_CVV);
                    validator.AddValidator(new ValidatorEmpty(newErrorMsg));
                    validator.AddValidator(new ValidatorCvv(newErrorMsg, isMaestro));
                    break;

                default:
                    break;
                }

                if (element != null)
                {
                    //		input.text = element.GetTitle();
                    //						input.GetComponentInChildren<MainValidator>().setErrorMsg(newErrorMsg);
                    if (element.GetName() != XsollaApiConst.CARD_CVV)
                    {
                        input.GetComponentInChildren <Text>().text = element.GetExample();
                    }
                    // FIX update with unity 5.2
                    input.onValueChanged.AddListener(delegate { OnValueChange(input, element.GetName()); });
                }
                else
                {
                    DestroyImmediate(input.transform.parent.gameObject);
                }

                if (validator != null)
                {
                    validators.Add(validator);
                }
            }
            // Toggle allowSubscription
            // get toggle object
            Toggle toggle = cardViewObj.GetComponentInChildren <Toggle> ();

            if (xsollaForm.Contains(XsollaApiConst.ALLOW_SUBSCRIPTION))
            {
                XsollaFormElement ToggleElement = null;
                ToggleElement = xsollaForm.GetItem(XsollaApiConst.ALLOW_SUBSCRIPTION);
                // set label name
                Text lable = toggle.transform.GetComponentInChildren <Text>();
                lable.text = ToggleElement.GetTitle();
                OnValueChange(ToggleElement.GetName(), toggle.isOn?"1":"0");
                toggle.onValueChanged.AddListener((b) => {
                    OnValueChange(ToggleElement.GetName(), b?"1":"0");
                });
            }
            else
            {
                GameObject.Find(toggle.transform.parent.name).SetActive(false);
            }

            if (xsollaForm.Contains("couponCode") && xsollaForm.GetItem("couponCode").IsVisible())
            {
                GameObject          promoController = Instantiate(Resources.Load("Prefabs/SimpleView/_PaymentFormElements/ContainerPromoCode")) as GameObject;
                PromoCodeController controller      = promoController.GetComponent <PromoCodeController>();
                controller.InitScreen(translations, xsollaForm.GetItem("couponCode"));
                controller._inputField.onValueChanged.AddListener((s) => {
                    OnValueChange("couponCode", s.Trim());
                });
                controller._promoCodeApply.onClick.AddListener(() =>
                {
                    bool isLinkRequired = false;
                    if ((_form.GetCurrentCommand() == XsollaForm.CurrentCommand.CHECKOUT) && _form.GetSkipChekout())
                    {
                        string checkoutToken = _form.GetCheckoutToken();
                        isLinkRequired       = checkoutToken != null &&
                                               !"".Equals(checkoutToken) &&
                                               !"null".Equals(checkoutToken) &&
                                               !"false".Equals(checkoutToken);
                    }
                    if (isLinkRequired)
                    {
                        string link = "https://secure.xsolla.com/pages/checkout/?token=" + _form.GetCheckoutToken();
                        if (Application.platform == RuntimePlatform.WebGLPlayer ||
                            Application.platform == RuntimePlatform.OSXWebPlayer ||
                            Application.platform == RuntimePlatform.WindowsWebPlayer)
                        {
                            Application.ExternalEval("window.open('" + link + "','Window title')");
                        }
                        else
                        {
                            Application.OpenURL(link);
                        }
                    }
                    gameObject.GetComponentInParent <XsollaPaystationController> ().ApplyPromoCoupone(_form.GetXpsMap());
                });
                promoController.transform.SetParent(cardViewObj.transform);
            }
            return(cardViewObj);
        }
Exemplo n.º 38
0
 protected virtual void OnTranslationRecieved(XsollaTranslations translations)
 {
     if (TranslationRecieved != null)
         TranslationRecieved(translations);
 }
 protected override void ShowPaymentStatus(XsollaTranslations translations, XsollaStatus status)
 {
     Logger.Log("Status recived");
     SetLoading(false);
     DrawStatus(translations, status);
 }
 public override void InitScreen(XsollaTranslations translations, XVirtualPaymentSummary summary)
 {
 }