public async Task WithdrawFromWallet(decimal amount) { if (!Context.IsPrivate) { string wallet = ""; bool success = true; success = global.client.GetWalletAddressFromUser(Context.User.Id.ToString(), true, out wallet); if (success) { if (amount > 0) { decimal balance = global.client.GetRawAccountBalance(Context.User.Id.ToString()); decimal txfee; string feeAccount; global.GetTXFeeAndAccount(Context, out txfee, out feeAccount); if (balance >= amount + txfee) { if (global.WithdrawlObjects.Any(x => x.guildUser.Id == Context.User.Id)) { WithdrawManager withdrawlObject = global.WithdrawlObjects.First(x => x.guildUser.Id == Context.User.Id); withdrawlObject.amount = amount; await Context.User.SendMessageAsync("Please respond with your wallet addresss to withdraw " + amount + "DAL or `cancel` to cancel the withdraw."); } else { WithdrawManager withdrawlObject = new WithdrawManager(Context.User as SocketGuildUser, amount); global.WithdrawlObjects.Add(withdrawlObject); await Context.User.SendMessageAsync("Please respond with your wallet addresss to withdraw " + amount + "DAL or `cancel` to cancel the withdraw."); } } else { await Context.User.SendMessageAsync(Context.User.Mention + ", looks like you don't have the funds to do this!"); } } else { await Context.User.SendMessageAsync(Context.User.Mention + ", please enter a value above 0!"); } } else { await Context.User.SendMessageAsync("Something went wrong! (Please contact an Administrator)"); } await Context.Message.DeleteAsync(); } else { await Context.User.SendMessageAsync("Sorry, for now you have to use withdraw commands in a server. We're working on this."); } }
public async Task <bool> updateStripeAccount(string key, string value) { bool success = false; WithdrawManager wm = new WithdrawManager(); Debug.Log("Key:" + key); switch (key) { case "firstname": return(await wm.attachInfoToAccount(token, value, "first_name")); break; case "lastname": return(await wm.attachInfoToAccount(token, value, "last_name")); break; case "address": return(await wm.attachInfoToAccount(token, value, "address", "line1")); break; case "zipcode": return(await wm.attachInfoToAccount(token, value, "address", "postal_code")); break; case "city": return(await wm.attachInfoToAccount(token, value, "address", "city")); break; case "phone": return(await wm.attachInfoToAccount(token, value, "phone")); break; case "birthdate": Debug.Log("case birthdate"); char[] spearator = { '-' }; String[] birth = value.Split(spearator); return(wm.attachDOBToAccount(token, int.Parse(birth[2]), int.Parse(birth[1]), int.Parse(birth[0]))); break; default: return(false); } }
// Use this for initialization void Start() { ProfilLastResultListController.profileSceneOpened = true; Texture2D txtAvatar = new Texture2D(1, 1); Sprite newSpriteAvatar; Texture2D txtDrapeau = new Texture2D(1, 1); Sprite newSpriteDrapeau; WithdrawManager wm = new WithdrawManager(); UnityThreading.ActionThread thread; Loading.SetActive(true); string token = um.getCurrentSessionToken(); string userId = um.getCurrentUserId(); string accountStatus = ""; thread = UnityThreadHelper.CreateThread(() => { if (PlayerId == userId) { accountStatus = wm.accountVerificationStatus(token); } User player = um.getUser(PlayerId, token); string Vectoires = player.victories_count.ToString(); //Debug.Log("Vectoires " +Vectoires); string SerieVectoires = player.victories_streak.ToString(); //Debug.Log("SerieVectoires " + SerieVectoires); UnityThreadHelper.Dispatcher.Dispatch(() => { Loading.SetActive(false); if (PlayerId != userId) { changeAvatar.interactable = false; avatar.sprite = Avatar; } else { avatar.sprite = UserManager.CurrentAvatarBytesString; if (accountStatus == WithdrawManager.ACCOUNT_VERIFICATION_STATUS_PENDING) { pending.SetActive(true); } else if (accountStatus == WithdrawManager.ACCOUNT_VERIFICATION_STATUS_VERIFIED) { verified.SetActive(true); } else { unverified.SetActive(true); } } //Set User Name username.text = player.username; //Set User pro label try{ if (player.money_credit > 0) { pro.gameObject.SetActive(true); } else { pro.gameObject.SetActive(false); } }catch (FormatException ex) { if (player.money_credit > 0) { pro.gameObject.SetActive(true); } else { pro.gameObject.SetActive(false); } } //set User Drapeau Byte[] img1 = Convert.FromBase64String(um.GetFlagByte(player.country_code)); txtDrapeau.LoadImage(img1); newSpriteDrapeau = Sprite.Create(txtDrapeau as Texture2D, new Rect(0f, 0f, txtDrapeau.width, txtDrapeau.height), Vector2.zero); drapeau.sprite = newSpriteDrapeau; //set Games Won nbGameWon.text = Vectoires; //set nb Game Won In a Row nbGameWonInARow.text = SerieVectoires; }); }); }
public WithdrawController() { withdrawManager = new WithdrawManager(); accountManager = new AccountManager(); }
private void withdrawButton_Click(object sender, EventArgs e) { TransactionInfo withdrawObj = new TransactionInfo(); if (transactionAccnNoTextBox.Text == "" || transactionAmountTextBox.Text == "") { MessageBox.Show("No empty value accepted"); return; } withdrawObj.TranAccNo = transactionAccnNoTextBox.Text; try { withdrawObj.TransAmmount = Convert.ToDouble(transactionAmountTextBox.Text); } catch { MessageBox.Show("Amount must be in number !"); return; } if (withdrawObj.TransAmmount <= 0) { MessageBox.Show("Ammount should be positive and greater than 0"); return; } try { WithdrawManager withMangObj = new WithdrawManager(); string withdrawInfo = withMangObj.WithdrawInfo(withdrawObj); MessageBox.Show(withdrawInfo); return; } catch (Exception exception) { MessageBox.Show(exception.Message); } //try //{ // DipositManager dipoMangObj = new DipositManager(); // bool dipositInfo = dipoMangObj.DipositInfo(dipositObj); // if (dipositInfo == true) // { // MessageBox.Show("Taka " + dipositObj.TransAmmount + " Diposited Successfully !"); // } // else // { // MessageBox.Show("Diposit Failed!"); // } //} //catch (Exception exception) //{ // MessageBox.Show(exception.Message); //} }
public void Withdraw() { EventsController behaviourScript = new EventsController(); behaviourScript.StepAnimation("circleEmpty3"); WithdrawManager wm = new WithdrawManager(); SceneManager.LoadScene("Loader", LoadSceneMode.Additive); string DocId = PlayerPrefs.GetString("DocId"); UnityThreadHelper.CreateThread(() => { string withdrawResult = null; withdrawResult = wm.payout(token, WithdrawPresenter.WithdrawMoney); Debug.Log("withdrawResult: " + withdrawResult); InfoPersonnelWithdraw.currentIdProof = null; InfoPersonnelWithdraw.currentIBAN = null; if (!string.IsNullOrEmpty(withdrawResult)) { if (withdrawResult == "ProhibitedLocation") { UnityThreadHelper.Dispatcher.Dispatch(() => { SceneManager.UnloadSceneAsync("Loader"); GameObject.Find("CalqueWidhraw").transform.localScale = Vector3.one; var animator = GameObject.Find("popupProhibitedLocation").GetComponent <Animator> (); animator.SetBool("Show Error", true); }); } else if (withdrawResult == WithdrawManager.WITHDRAW_ERROR_AMOUNT_INSUFFICIENT) { UnityThreadHelper.Dispatcher.Dispatch(() => { behaviourScript.withdrawFailed("Withdrawal", null, WithdrawManager.WITHDRAW_INSUFFICIENT_AMOUNT_FAILED_MESSAGE); }); } else if (withdrawResult == WithdrawManager.WITHDRAW_ERROR_BALANCE_INSUFFICIENT) { UnityThreadHelper.Dispatcher.Dispatch(() => { behaviourScript.withdrawFailed("Withdrawal", null, WithdrawManager.WITHDRAW_INSUFFICIENT_FUNDS_FAILED_MESSAGE); }); } else if (withdrawResult == "error") { UnityThreadHelper.Dispatcher.Dispatch(() => { behaviourScript.withdrawFailed(null, null, WithdrawManager.WITHDRAW_FAILED_MESSAGE); }); } else if (withdrawResult == WithdrawManager.WITHDRAW_SUCCEEDED_STATUS) { UnityThreadHelper.Dispatcher.Dispatch(() => { SceneManager.UnloadSceneAsync("Loader"); SceneManager.UnloadSceneAsync("WithdrawalInfo"); UserManager.CurrentMoney = (float.Parse(UserManager.CurrentMoney) - WithdrawPresenter.WithdrawMoney).ToString("N2").Replace(",", "."); behaviourScript.backToWinMoney(); behaviourScript.ShowPopup("popupCongratWithdraw"); }); } } else { UnityThreadHelper.Dispatcher.Dispatch(() => { behaviourScript.withdrawFailed(null, null, WithdrawManager.WITHDRAW_FAILED_MESSAGE); }); } }); }
//signup with the new api public IEnumerator signingUp(string username, string email, string password, string avatar) { WithdrawManager wm = new WithdrawManager(); Debug.Log("username: "******"email: " + email); Debug.Log("password: "******"country_code: " + GetGeoLoc()); Debug.Log("longLat: " + longLat); Debug.Log("avatar: " + avatar); Debug.Log("game_id: " + GamesManager.GAME_ID); WWWForm form = new WWWForm(); form.AddField("username", username); form.AddField("email", email); form.AddField("password", password); form.AddField("country_code", GetGeoLoc()); form.AddField("long_lat", longLat); form.AddField("game_id", GamesManager.GAME_ID); form.AddField("avatar", avatar); var download = UnityWebRequest.Post(Endpoint.classesURL + "/users", form); download.timeout = 4000; yield return(download.Send()); //Debug.Log (download.downloadHandler.text); if (download.isNetworkError) { print("Error downloading: " + download.error); UserService.statusCode = 400; try { SceneManager.UnloadSceneAsync("Loader"); } catch (ArgumentException ex) { } yield return(400); } else { if (download.responseCode == 200) { Debug.Log(download.downloadHandler.text); var N = JSON.Parse(download.downloadHandler.text); //Attach Info to Stripe Account wm.attachBusinessProfileToAccount(N["token"].Value); wm.attachInfoToAccount(N["token"].Value, N["data"]["email"].Value, "email"); UnityThreadHelper.Dispatcher.Dispatch(() => { Debug.Log(download.downloadHandler.text); //Save The current Session ID saveUserId(N["data"]["_id"].Value); //Save Session Token saveSessionToken(N["token"].Value); UserService.statusCode = 0; }); yield return(0); } else { UserService.statusCode = 400; yield return(400); } } }