protected void DepositViaRepresentativeButton_Click(object sender, EventArgs e) { ErrorMessagePanel.Visible = false; SuccMessagePanel.Visible = false; string amount = Request.Form["price"].ToString(); Money Amount; try { Amount = Money.Parse(amount).FromMulticurrency(); //Anti-Injection Fix if (Amount <= new Money(0)) { throw new MsgException(L1.ERROR); } if (Amount < AppSettings.Payments.MinimumTransferAmount) { throw new MsgException(U3000.ITSLOWERTHANMINIMUM); } if (string.IsNullOrEmpty(RepresentativeMessage.Text) || String.IsNullOrWhiteSpace(RepresentativeMessage.Text)) { throw new MsgException(L1.REQ_TEXT); } string Message = InputChecker.HtmlEncode(RepresentativeMessage.Text, RepresentativeMessage.MaxLength, U5004.MESSAGE); var SelectedRepresentative = new Representative(Convert.ToInt32(AvaibleRepresentativeList.SelectedValue)); if (ConversationMessage.CheckIfThisUserHavePendingActions(user.Id)) { throw new MsgException(U6010.YOUHAVEPENDINGACTION); } if (Amount > new Member(SelectedRepresentative.UserId).CashBalance) { throw new MsgException(U6010.REPRESENTATIVENOFUNDS); } RepresentativesTransferManager representativesTransferManager = new RepresentativesTransferManager(Member.CurrentId, SelectedRepresentative.UserId); representativesTransferManager.InvokeDeposit(Amount, Message); Response.Redirect("~/user/network/messenger.aspx"); } catch (MsgException ex) { ShowErrorMessage(ex.Message); } catch (Exception ex) { ErrorLogger.Log(ex); ShowErrorMessage(ex.Message); } }
public void TryRejectTransaction(int userId) { CheckRepresentativeModificationPermissions(userId); RepresentativesTransferManager representativesTransferManager = new RepresentativesTransferManager( Conversation.GetOtherUserId(userId), userId); this.RepresentativeRequestStatus = RepresentativeRequestStatus.Rejected; this.Save(); representativesTransferManager.RejectWithdrawal(this); }
protected void SendWithdrawViaRepresentativeButtonConfirm_Click(object sender, EventArgs e) { RepresentativeErrorMessagePanel.Visible = false; try { string amount = Request.Form["price"].ToString(); Money Amount = Money.Parse(amount).FromMulticurrency(); Member User = Member.Current; //Anti-Injection Fix if (Amount <= new Money(0)) { throw new MsgException(L1.ERROR); } if (string.IsNullOrEmpty(RepresentativeMessage.Text)) { throw new MsgException(L1.REQ_TEXT); } //Lets validate PayoutManager.ValidatePayout(User, Amount); PayoutManager.CheckMaxPayout(PaymentProcessor.ViaRepresentative, User, Amount); string Message = InputChecker.HtmlEncode(RepresentativeMessage.Text, RepresentativeMessage.MaxLength, U5004.MESSAGE); var SelectedRepresentative = new Representative(Convert.ToInt32(AvaibleRepresentativeList.SelectedValue)); if (ConversationMessage.CheckIfThisUserHavePendingActions(User.Id)) { throw new MsgException(U6010.YOUHAVEPENDINGACTION); } //All OK, let's proceed RepresentativesTransferManager representativesTransferManager = new RepresentativesTransferManager(Member.CurrentId, SelectedRepresentative.UserId); representativesTransferManager.InvokeWithdrawal(Amount, Message); Response.Redirect("~/user/network/messenger.aspx"); } catch (MsgException ex) { RepresentativeErrorMessagePanel.Visible = true; RepresentativeErrorMessage.Text = ex.Message; } catch (Exception ex) { ErrorLogger.Log(ex); RepresentativeErrorMessagePanel.Visible = true; RepresentativeErrorMessage.Text = ex.Message; } }
public void TryCancelTransaction(int userId) { int representativeId = Conversation.GetOtherUserId(userId); if (MessageType != MessageType.RepresentativeDepositRequest) { CheckRepresentativeModificationPermissions(representativeId); } else { CheckRepresentativeModificationPermissions(representativeId, false); } RepresentativesTransferManager representativesTransferManager = new RepresentativesTransferManager( userId, representativeId); representativesTransferManager.TryCancelDeposit(Member.CurrentInCache.Name, this); this.RepresentativeRequestStatus = RepresentativeRequestStatus.Cancelled; this.Save(); }
public string TryConfirmTransaction(int userId) { CheckRepresentativeModificationPermissions(userId); RepresentativesTransferManager representativesTransferManager = new RepresentativesTransferManager( Conversation.GetOtherUserId(userId), userId); string ResultMessage = String.Empty; if (this.MessageType == MessageType.RepresentativeDepositRequest) { ResultMessage = representativesTransferManager.TryConfirmDeposit(this); } if (this.MessageType == MessageType.RepresentativeWithdrawalRequest) { ResultMessage = representativesTransferManager.ConfirmWithdrawal(this); } this.RepresentativeRequestStatus = RepresentativeRequestStatus.Completed; this.Save(); return(ResultMessage); }