private void onMethodClick(XsollaSavedPaymentMethod pMethod) { Dictionary <string, object> purchase = new Dictionary <string, object>(); purchase.Add("saved_method_id", pMethod.GetKey()); purchase.Add("pid", pMethod.GetPid()); purchase.Add("paymentWithSavedMethod", 1); purchase.Add("paymentSid", pMethod.GetFormSid()); purchase.Add("userInitialCurrency", pMethod.GetCurrency()); GetComponentInParent <XsollaPaystationController> ().ChoosePaymentMethod(purchase); }
public void setToggleObj(bool pState, Action <string, bool> pActionChange) { _toggleObj.SetActive(pState); _toggle.onValueChanged.RemoveAllListeners(); _toggle.onValueChanged.AddListener((value) => { if (value) { pActionChange(_method.GetKey(), value); } }); }
private void onClickConfirmDeletePaymentMethod(XsollaSavedPaymentMethod pMethod) { Logger.Log("Delete payment method"); Dictionary <string, object> reqParams = new Dictionary <string, object>(); reqParams.Add("id", pMethod.GetKey()); reqParams.Add("type", pMethod.GetMethodType()); XsollaPaystationController controller = gameObject.GetComponentInParent <XsollaPaystationController>(); controller.DeleteSavedPaymentMethod(reqParams); }
private void onClickConfirmReplacedAnotherMethod(XsollaSavedPaymentMethod pMethod) { Logger.Log("Raplaced existing method"); Dictionary <string, object> reqParams = new Dictionary <string, object>(); reqParams.Add("id_payment_account", pMethod.GetKey()); reqParams.Add("replace_payment_account", 1); reqParams.Add("type_payment_account", pMethod.GetMethodType()); XsollaPaystationController payController = GetComponentInParent <XsollaPaystationController> (); payController.ChooseItem(reqParams); }
private void onClickConfirmReplaced(XsollaSavedPaymentMethod pMethod) { Logger.Log("Raplaced existing method"); Dictionary <string, object> reqParams = new Dictionary <string, object>(); reqParams.Add("id_payment_account", pMethod.GetKey()); reqParams.Add("saved_method_id", mSelectedMethod.GetKey()); reqParams.Add("pid", mSelectedMethod.GetPid()); reqParams.Add("paymentWithSavedMethod", 1); reqParams.Add("paymentSid", pMethod.GetFormSid()); reqParams.Add("type_payment_account", pMethod.GetMethodType()); Dictionary <string, object> replacedParam = new Dictionary <string, object>(); replacedParam.Add("replace_payment_account", 1); XsollaPaystationController payController = GetComponentInParent <XsollaPaystationController> (); payController.FillPurchase(ActivePurchase.Part.PAYMENT_MANAGER_REPLACED, replacedParam); payController.ChoosePaymentMethod(reqParams); }
private void onClickReplacePeymentMethod(XsollaSavedPaymentMethod pMethod) { Logger.Log("Click replace method"); mListReplacedMethods = new ArrayList(); // open form with replaced methods mInfoPanel.SetActive(false); mDelPanelMethod.SetActive(false); mContainer.SetActive(false); mReplacePanelMethod.SetActive(true); for (int i = 0; i < mPanelForReplacedMethods.transform.childCount; i++) { Logger.Log("Destroy child on panel for edit saved payment method with ind - " + i); Destroy(mPanelForReplacedMethods.transform.GetChild(i).gameObject); } // TODO // if we don't have account on replace we must click on another method // set all foreach (GameObject btnObj in mListBtnsObjs) { // check if this method not method those replaced SavedMethodBtnController controller = btnObj.GetComponent <SavedMethodBtnController>(); if (controller.getMethod().GetKey() == pMethod.GetKey()) { continue; } // add this obj on panel SavedMethodBtnController controllerClone = Instantiate(controller); controllerClone.setMethod(controller.getMethod()); controllerClone.setDeleteBtn(false); controllerClone.setMethodBtn(false); controllerClone.setToggleObj(true, onToggleChange); controllerClone.transform.SetParent(mPanelForReplacedMethods.transform); RectTransform methodPanelrecttransform = controllerClone.GetComponent <RectTransform>(); methodPanelrecttransform.anchorMin = new Vector2(0, 0); methodPanelrecttransform.anchorMax = new Vector2(1, 1); methodPanelrecttransform.pivot = new Vector2(0.5f, 0.5f); methodPanelrecttransform.offsetMin = new Vector2(0, 0); methodPanelrecttransform.offsetMax = new Vector2(0, 0); mListReplacedMethods.Add(controllerClone); } // set titles for replace screen mLinkGetAnotherMethods.GetComponent <Text>().text = mUtilsLink.GetTranslations().Get("savedmethod_other_change_account_label"); Button linkAnotherMethod = mLinkGetAnotherMethods.GetComponent <Button>(); linkAnotherMethod.onClick.RemoveAllListeners(); linkAnotherMethod.onClick.AddListener(() => onClickConfirmReplacedAnotherMethod(pMethod)); mLinkBack.GetComponent <Text>().text = mUtilsLink.GetTranslations().Get("back_to_paymentaccount"); Button linkBack = mLinkBack.GetComponent <Button>(); linkBack.onClick.RemoveAllListeners(); linkBack.onClick.AddListener(() => onClickCancelEditMethod()); mBtnContinue.GetComponentInChildren <Text>().text = mUtilsLink.GetTranslations().Get("form_continue"); Button btnContinue = mBtnContinue.GetComponent <Button>(); btnContinue.onClick.RemoveAllListeners(); btnContinue.onClick.AddListener(() => onClickConfirmReplaced(pMethod)); }