Ejemplo n.º 1
0
    private void InitialiseMemberBank()
    {
        string strProcessCode = string.Empty;
        string strProcessText = string.Empty;

        svcPayMember.MemberBank[] ArrMB = null;

        using (svcPayMember.MemberClient svcInstance = new svcPayMember.MemberClient())
        {
            ArrMB = svcInstance.getBankAccounts(Convert.ToInt64(strOperatorId), strCurrencyCode, strCountryCode, out strProcessCode, out strProcessText);
        }

        drpBank.DataSource = ArrMB;

        if (xeResources.XPathSelectElement("BankNameNative/" + strSelectedLanguage.ToUpper() + "_" + strCurrencyCode.ToUpper()) != null)
        {
            drpBank.DataTextField = "bankNameNative";
        }
        else
        {
            drpBank.DataTextField = "bankName";
        }
        drpBank.DataValueField = "bankCode";
        //drpBank.DataTextField = "bankNameNative";
        drpBank.DataBind();
    }
Ejemplo n.º 2
0
    public static string ProcessWeChatNickname(string action, string nickname)
    {
        XElement processResult;

        using (svcPayMember.MemberClient client = new svcPayMember.MemberClient())
        {
            processResult = client.processMemberWeChatNickName(Convert.ToInt64(commonVariables.OperatorId), commonVariables.GetSessionVariable("MemberCode"), action, nickname);
        }

        if (processResult.Element("error") != null)
        {
            string error = processResult.Element("error").Value;

            if (action == "changeNickname" && error == "NA")
            {
                return(weChatNickNameNotAvailable);
            }

            if (action == "changeNickname" && error == "PendingDeposit")
            {
                return(weChatNickNamePendingDeposit);
            }
        }

        if (processResult.Element("result") != null) //only for success cases will return with result element
        {
            return(processResult.Element("result").Value);
        }
        else
        {
            return(serverError);
        }
    }
Ejemplo n.º 3
0
    private void InitializeMemberAccount()
    {
        DataTable dtMemberAccount;

        try
        {
            using (svcPayMember.MemberClient client = new svcPayMember.MemberClient())
            {
                dtMemberAccount = client.getMemberLastCreditCardDepositDetail(Convert.ToInt64(strOperatorId), strMemberCode);

                // it is ok if dtMemberAccount is null and should not be treated as error
                if (dtMemberAccount != null)
                {
                    if (dtMemberAccount.Rows.Count > 0)
                    {
                        DataRow dr = dtMemberAccount.Rows[0];
                        ddlCardType.SelectedValue    = dr["cardType"].ToString();
                        ddlExpiryMonth.SelectedValue = dr["expMonth"].ToString();
                        ddlExpiryYear.SelectedValue  = dr["expYear"].ToString();
                        txtCardName.Text             = dr["cardName"] == DBNull.Value ? string.Empty : dr["cardName"].ToString();
                        txtCardNo.Text = dr["cardNumber"] == DBNull.Value ? string.Empty : dr["cardNumber"].ToString();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            commonAuditTrail.appendLog("system", base.PageName, "InitializeMemberAccount", string.Empty, string.Empty, string.Empty, "-99", "exception", ex.Message, string.Empty, string.Empty, true);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request["dateFrom"]) && !string.IsNullOrEmpty(Request["dateTo"]) &&
            !string.IsNullOrEmpty(Request["status"]) && !string.IsNullOrEmpty(Request["type"]) &&
            !string.IsNullOrEmpty(commonVariables.OperatorId) &&
            !string.IsNullOrEmpty(base.userInfo.MemberCode))
        {
            //Request Params
            var dateFrom = DateTime.Parse(Request["dateFrom"].ToString());
            var dateTo   = DateTime.Parse(Request["dateTo"].ToString());
            var status   = Request["status"];
            var type     = int.Parse(Request["type"]);

            try
            {
                using (var svcInstance = new svcPayMember.MemberClient())
                {
                    //Other Params
                    var strOperatorId = int.Parse(commonVariables.OperatorId);
                    var strMemberCode = base.userInfo.MemberCode;

                    string statusCode;
                    var    history = svcInstance.getDepositWithdrawalHistory(strOperatorId, strMemberCode, type, status, dateFrom, dateTo, out statusCode);

                    var dvHistory = new DataView(history)
                    {
                        Sort = "requestDate DESC"
                    };

                    GridView1.DataSource            = dvHistory;
                    GridView1.PagerSettings.Mode    = PagerButtons.NextPrevious;
                    GridView1.EmptyDataText         = commonCulture.ElementValues.getResourceXPathString("norecords", commonVariables.HistoryXML);
                    GridView1.Columns[1].HeaderText = commonCulture.ElementValues.getResourceXPathString("dateTime", commonVariables.HistoryXML);
                    GridView1.Columns[2].HeaderText = commonCulture.ElementValues.getResourceXPathString("transId", commonVariables.HistoryXML);
                    GridView1.Columns[3].HeaderText = commonCulture.ElementValues.getResourceXPathString("paymentMethod", commonVariables.HistoryXML);
                    GridView1.Columns[4].HeaderText = commonCulture.ElementValues.getResourceXPathString("lblType", commonVariables.HistoryXML);
                    GridView1.Columns[5].HeaderText = commonCulture.ElementValues.getResourceXPathString("submittedAmt", commonVariables.HistoryXML);
                    GridView1.Columns[6].HeaderText = commonCulture.ElementValues.getResourceXPathString("receivedAmt", commonVariables.HistoryXML);
                    GridView1.Columns[7].HeaderText = commonCulture.ElementValues.getResourceXPathString("lblStatus", commonVariables.HistoryXML);
                    GridView1.DataBind();
                }
            }
            catch (Exception ex)
            {
                Console.Out.Write("ex: " + ex);
            }
        }
        else
        {
            Response.Redirect((string)HttpContext.Current.Session["domain_Account"] + "/History");
        }
    }
Ejemplo n.º 5
0
    private void InitialisePaymentLimits()
    {
        string strProcessCode  = string.Empty;
        string strProcessText  = string.Empty;
        string strMinLimit     = string.Empty;
        string strMaxLimit     = string.Empty;
        string strTotalAllowed = string.Empty;
        string strDailyLimit   = string.Empty;
        string strMethodId     = string.Empty;

        System.Data.DataTable dtPaymentMethodLimits = null;
        System.Data.DataRow   drPaymentMethodLimit  = null;

        System.Text.StringBuilder sbMethodsUnavailable = new System.Text.StringBuilder();

        strMethodId = "0";

        using (svcPayMember.MemberClient svcInstance = new svcPayMember.MemberClient())
        {
            dtPaymentMethodLimits = svcInstance.getMethodLimits(strOperatorId, strMemberCode, strMethodId, Convert.ToString(Convert.ToInt32(commonVariables.PaymentTransactionType.Withdrawal)), false, out strProcessCode, out strProcessText);
        }

        foreach (commonVariables.WithdrawalMethod EnumMethod in Enum.GetValues(typeof(commonVariables.WithdrawalMethod)))
        {
            if (dtPaymentMethodLimits.Select("[methodId] = " + Convert.ToInt32(EnumMethod)).Count() < 1)
            {
                sbMethodsUnavailable.AppendFormat("{0}|", Convert.ToInt32(EnumMethod));
            }
        }

        strMethodId = Convert.ToString(Convert.ToInt32(commonVariables.WithdrawalMethod.BankTransfer));

        if (dtPaymentMethodLimits.Select("[methodId] = " + strMethodId).Count() > 0)
        {
            drPaymentMethodLimit = dtPaymentMethodLimits.Select("[methodId] = " + strMethodId)[0];

            strMinLimit     = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["minDeposit"]).ToString(commonVariables.DecimalFormat);
            strMaxLimit     = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["maxDeposit"]).ToString(commonVariables.DecimalFormat);
            strTotalAllowed = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["totalAllowed"]).ToString(commonVariables.DecimalFormat);
            strDailyLimit   = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["limitDaily"]).ToString(commonVariables.DecimalFormat);

            //txtAmount.Attributes.Add("PLACEHOLDER", string.Format("{0} {1}({2} / {3})", lblAmount.Text, strCurrencyCode, strMinLimit, strMaxLimit));
            lblDailyLimit.InnerText   = string.Format("{0} {1}", commonCulture.ElementValues.getResourceString("lblDailyLimit", xeResources), strDailyLimit);
            lblTotalAllowed.InnerText = string.Format("{0} {1}", commonCulture.ElementValues.getResourceString("lblTotalAllowed", xeResources), strTotalAllowed);
        }
        //else { }

        strMethodsUnAvailable = Convert.ToString(sbMethodsUnavailable).TrimEnd('|');
    }
Ejemplo n.º 6
0
    protected void InitialisePendingWithdrawals(bool isApp)
    {
        string strStatusCode = string.Empty;
        string strStatusText = string.Empty;

        svcPayMember.PendingWithdrawal[] arrPending = null;

        using (svcPayMember.MemberClient svcInstance = new svcPayMember.MemberClient())
        {
            arrPending = svcInstance.getPendingWithdrawal(Convert.ToInt64(strOperatorId), strMemberCode, out strStatusCode, out strStatusText);

            if (arrPending != null && arrPending.Length > 0)
            {
                Response.Redirect("/Withdrawal/Pending.aspx");
            }
        }
    }
Ejemplo n.º 7
0
    private void InitialiseWithdrawalPaymentLimits()
    {
        string strProcessCode = string.Empty;
        string strProcessText = string.Empty;

        DataTable dtPaymentMethodLimits = null;
        DataRow   drPaymentMethodLimit  = null;

        StringBuilder sbMethodsUnavailable = new StringBuilder();

        strMethodId = "0";

        using (svcPayMember.MemberClient svcInstance = new svcPayMember.MemberClient())
        {
            dtPaymentMethodLimits = svcInstance.getMethodLimits_Mobile(strOperatorId, strMemberCode, strMethodId, Convert.ToString(Convert.ToInt32(commonVariables.PaymentTransactionType.Withdrawal)), false, out strProcessCode, out strProcessText);
        }

        foreach (commonVariables.WithdrawalMethod EnumMethod in Enum.GetValues(typeof(commonVariables.WithdrawalMethod)))
        {
            if (dtPaymentMethodLimits.Select("[methodId] = " + Convert.ToInt32(EnumMethod)).Count() < 1)
            {
                sbMethodsUnavailable.AppendFormat("{0}|", Convert.ToInt32(EnumMethod));
            }
        }

        if (!string.IsNullOrWhiteSpace(PaymentMethodId))
        {
            strMethodId = PaymentMethodId;

            if (dtPaymentMethodLimits.Select("[methodId] = " + strMethodId).Count() > 0)
            {
                drPaymentMethodLimit = dtPaymentMethodLimits.Select("[methodId] = " + strMethodId)[0];

                strMinLimit     = Convert.ToDecimal(drPaymentMethodLimit["minWithdrawal"]).ToString(commonVariables.DecimalFormat);
                strMaxLimit     = Convert.ToDecimal(drPaymentMethodLimit["maxWithdrawal"]).ToString(commonVariables.DecimalFormat);
                strTotalAllowed = Convert.ToDecimal(drPaymentMethodLimit["totalAllowed"]) <= 0 ? strUnlimited : Convert.ToDecimal(drPaymentMethodLimit["totalAllowed"]).ToString(commonVariables.DecimalFormat);
                strDailyLimit   = Convert.ToDecimal(drPaymentMethodLimit["limitDaily"]) == 0 ? strUnlimited : Convert.ToDecimal(drPaymentMethodLimit["limitDaily"]).ToString(commonVariables.DecimalFormat);
                strMerchantId   = Convert.ToString(drPaymentMethodLimit["merchantId"]);
                strMode         = Convert.ToString(drPaymentMethodLimit["paymentMode"]);
            }
        }

        strMethodsUnAvailable = Convert.ToString(sbMethodsUnavailable).TrimEnd('|');
    }
Ejemplo n.º 8
0
    private void InitializePaymentGatewayLimit()
    {
        commonVariables.AutoRouteMethod autoRoute;
        Enum.TryParse(PaymentMethodId, out autoRoute);

        string gatewayGroup = GetPaymentGroup(autoRoute);

        using (var svcInstance = new svcPayMember.MemberClient())
        {
            var response = svcInstance.GetPaymentDepositGatewayLimit_Mobile(Convert.ToInt64(strOperatorId), strMemberCode);

            var gatewayGroupTable = response.Tables[0].AsEnumerable().FirstOrDefault(d => d.Field <string>("gatewayGroup").Equals(gatewayGroup, StringComparison.OrdinalIgnoreCase));

            if (gatewayGroupTable != null)
            {
                strMinLimit = Convert.ToDecimal(gatewayGroupTable["minDeposit"]).ToString(commonVariables.DecimalFormat);
                strMaxLimit = Convert.ToDecimal(gatewayGroupTable["maxDeposit"]).ToString(commonVariables.DecimalFormat);
                strMode     = "online";

                autoRouteBanks = response.Tables[1];
            }
        }
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Web.UI.WebControls.Literal litScript = (System.Web.UI.WebControls.Literal)Page.FindControl("litScript");

        xeErrors = commonVariables.ErrorsXML;

        string strOperatorId = string.Empty;
        string strMemberCode = string.Empty;
        string strStatusCode = string.Empty;
        string strStatusText = string.Empty;

        System.Xml.Linq.XElement xePaymentMethods = null;

        svcPayMember.PendingWithdrawal[] arrPendingTrx = null;

        strOperatorId = commonVariables.OperatorId;
        strMemberCode = base.userInfo.MemberCode;;

        if (!Page.IsPostBack)
        {
            commonCulture.appData.getLocalResource(out xeResources);
            commonCulture.appData.getRootResource("PaymentMethods", out xePaymentMethods);

            using (svcPayMember.MemberClient svcInstance = new svcPayMember.MemberClient())
            {
                arrPendingTrx = svcInstance.getPendingWithdrawal(Convert.ToInt64(strOperatorId), strMemberCode, out strStatusCode, out strStatusText);
            }

            if (arrPendingTrx != null && arrPendingTrx.Length > 0)
            {
                System.Text.StringBuilder sbPendingTrx = new System.Text.StringBuilder();

                sbPendingTrx.Append("<table data-role='table' id='table-reflow' class='ui-responsive table-stroke'>");
                sbPendingTrx.AppendFormat("<thead><tr><th>{0}</th><th>{1}</th><th>{2}</th><th>{3}</th><th>{4}</th></tr></thead><tbody>"
                                          , commonCulture.ElementValues.getResourceString("lblTransactionId", xeResources)
                                          , commonCulture.ElementValues.getResourceString("lblRequestDateTime", xeResources)
                                          , commonCulture.ElementValues.getResourceString("lblPaymentMethod", xeResources)
                                          , commonCulture.ElementValues.getResourceString("lblAmount", xeResources)
                                          , string.Empty);

                foreach (svcPayMember.PendingWithdrawal trxWithdrawal in arrPendingTrx)
                {
                    sbPendingTrx.AppendFormat("<tr id='tr_{0}'><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td><a href='javascript:void(0)' onclick='javascript:return CancelWithdrawal(this);' data-id='{0}' data-method='{5}'>{4}</a></td></tr>"
                                              , trxWithdrawal.invId, trxWithdrawal.requestDate,
                                              commonCulture.ElementValues.getResourceString("w" + Enum.GetName(typeof(commonVariables.WithdrawalMethod), trxWithdrawal.payMethodId), xePaymentMethods),
                                              trxWithdrawal.requestAmount.ToString(commonVariables.DecimalFormat), commonCulture.ElementValues.getResourceString("btnCancelWithdrawal", xeResources),
                                              trxWithdrawal.payMethodId);
                }

                sbPendingTrx.Append("</tbody></table>");

                litPending.Text = Convert.ToString(sbPendingTrx);
            }
            else
            {
                if (litScript != null)
                {
                    litScript.Text += "<script type='text/javascript'>window.location.replace('/Withdrawal/Default.aspx');</script>";
                }
            }
        }
    }
Ejemplo n.º 10
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "Deposit.FastDeposit";

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long   lngOperatorId    = long.MinValue;
        string strDepositAmount = string.Empty;
        string strReferenceId   = string.Empty;
        string strSystemAccount = string.Empty;
        string strDepositDate   = string.Empty;
        //string strDepositDay = string.Empty;
        //string strDepositMonth = string.Empty;
        //string strDepositYear = string.Empty;
        string strDepositHour    = string.Empty;
        string strDepositMinute  = string.Empty;
        string strDepositChannel = string.Empty;
        string strBankCode       = string.Empty;
        string strBankName       = string.Empty;
        string strBankNameInput  = string.Empty;
        string strAccountName    = string.Empty;
        string strAccountNumber  = string.Empty;

        decimal decMinLimit     = decimal.Zero;
        decimal decMaxLimit     = decimal.Zero;
        decimal decTotalAllowed = decimal.Zero;
        decimal decDailyLimit   = decimal.Zero;

        System.DateTime          dtDepositDateTime = System.DateTime.MinValue;
        System.Xml.Linq.XElement xeResponse        = null;

        bool   isDepositSuccessful = false;
        string strTransferId       = string.Empty;
        bool   sessionExpired      = false;

        #endregion

        #region populateVariables
        lngOperatorId   = long.Parse(commonVariables.OperatorId);
        strMemberCode   = commonVariables.GetSessionVariable("MemberCode");
        strCurrencyCode = commonVariables.GetSessionVariable("CurrencyCode");

        strDepositAmount = txtAmount.Value;
        strReferenceId   = txtReferenceId.Value;
        strSystemAccount = drpSystemAccount.Value;
        strDepositDate   = drpDepositDate.Value;
        //strDepositDay = drpDay.SelectedValue;
        //strDepositMonth = drpMonth.SelectedValue;
        //strDepositYear = drpYear.SelectedValue;
        strDepositHour    = drpHour.Value;
        strDepositMinute  = drpMinute.Value;
        strDepositChannel = drpDepositChannel.Value;
        strBankCode       = drpBank.Value;
        strBankName       = drpBank.Items.FindByValue(strBankCode).Text;
        strBankNameInput  = txtBankName.Value;
        strAccountName    = txtAccountName.Value;
        strAccountNumber  = txtAccountNumber.Value;

        if (string.Compare(strCurrencyCode, "krw", true) == 0)
        {
            dtDepositDateTime = System.DateTime.Now;
        }
        //else { dtDepositDateTime = System.DateTime.Parse(drpDepositDate.SelectedValue)}//new System.DateTime(Convert.ToInt32(strDepositYear), Convert.ToInt32(strDepositMonth), Convert.ToInt32(strDepositDay), Convert.ToInt32(strDepositHour), Convert.ToInt32(strDepositMinute), 0); }
        #endregion

        #region parametersValidation
        if (string.IsNullOrEmpty(strDepositAmount))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/MissingDepositAmount", xeErrors); return;
        }
        else if (string.IsNullOrEmpty(strAccountName))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/MissingAccountName", xeErrors); return;
        }
        else if (string.IsNullOrEmpty(strAccountNumber))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/MissingAccountNumber", xeErrors); return;
        }
        else if (string.Compare(drpBank.Value, "OTHER", true) == 0 && string.IsNullOrEmpty(strBankNameInput))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/MissingBankName", xeErrors); return;
        }
        else if (Convert.ToString(drpSystemAccount.Value) == "-1")
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/SelectSystemAccount", xeErrors); return;
        }
        else if (Convert.ToString(drpDepositChannel.Value) == "-1")
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/SelectDepositChannel", xeErrors); return;
        }
        else if (Convert.ToString(drpBank.Value) == "-1")
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/SelectBank", xeErrors); return;
        }
        else if (!commonValidation.isDecimal(strDepositAmount))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidDepositAmount", xeErrors); return;
        }
        else if (Convert.ToDecimal(strDepositAmount) <= 0)
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidDepositAmount", xeErrors); return;
        }
        else if (commonValidation.isInjection(strDepositAmount))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidDepositAmount", xeErrors); return;
        }
        else if (commonValidation.isInjection(strReferenceId))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidReferenceId", xeErrors); return;
        }
        else if (commonValidation.isInjection(strBankNameInput))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidBankName", xeErrors); return;
        }
        else if (commonValidation.isInjection(strAccountName))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidAccountName", xeErrors); return;
        }
        else if (commonValidation.isInjection(strAccountNumber))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidAccountNumber", xeErrors); return;
        }
        else if (string.Compare(strCurrencyCode, "krw", true) != 0)
        {
            if (!string.IsNullOrEmpty(strDepositDate))
            {
                dtDepositDateTime = System.DateTime.Parse(strDepositDate);
                if ((dtDepositDateTime - System.DateTime.Now).TotalHours > 72 || (dtDepositDateTime - System.DateTime.Now).TotalHours < -72)
                {
                    strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidDateTime", xeErrors); return;
                }
            }
            else if (string.IsNullOrEmpty(strDepositDate))
            {
                strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/InvalidDateTime", xeErrors); return;
            }
        }
        else if (string.IsNullOrEmpty(strMemberCode))
        {
            strAlertCode    = "-1";
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/SessionExpired", xeErrors);
            isProcessAbort  = true;
            sessionExpired  = true;
        }
        else if (string.IsNullOrEmpty(strCurrencyCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/FundTransfer/SessionExpired", xeErrors);
            isProcessAbort  = true;
            sessionExpired  = true;
        }

        #endregion

        #region initialiseDeposit
        if (!isProcessAbort)
        {
            try
            {
                string strProcessCode = string.Empty;
                string strProcessText = string.Empty;

                System.Data.DataTable dtPaymentMethodLimits = null;

                using (svcPayMember.MemberClient svcInstance = new svcPayMember.MemberClient())
                {
                    dtPaymentMethodLimits = svcInstance.getMethodLimits(strOperatorId, strMemberCode, Convert.ToString(Convert.ToInt32(commonVariables.DepositMethod.FastDeposit)), Convert.ToString(Convert.ToInt32(commonVariables.PaymentTransactionType.Deposit)), false, out strProcessCode, out strProcessText);

                    if (dtPaymentMethodLimits.Rows.Count > 0)
                    {
                        decMinLimit     = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["minDeposit"]);
                        decMaxLimit     = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["maxDeposit"]);
                        decTotalAllowed = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["totalAllowed"]);
                        decDailyLimit   = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["limitDaily"]);

                        if (Convert.ToDecimal(strDepositAmount) < decMinLimit)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/AmountMinLimit", xeErrors);
                            isProcessAbort  = true;
                        }
                        else if (Convert.ToDecimal(strDepositAmount) > decMaxLimit)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/AmountMaxLimit", xeErrors);
                            isProcessAbort  = true;
                        }
                        else if (Convert.ToDecimal(strDepositAmount) > decTotalAllowed)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/TotalAllowedExceeded", xeErrors);
                            isProcessAbort  = true;
                        }
                    }
                }

                if (!isProcessAbort)
                {
                    using (svcPayDeposit.DepositClient svcInstance = new svcPayDeposit.DepositClient())
                    {
                        xeResponse = svcInstance.createFastDepositTransactionV1(lngOperatorId, strMemberCode, strDepositChannel, Convert.ToInt64(commonVariables.DepositMethod.FastDeposit),
                                                                                strCurrencyCode, Convert.ToDecimal(strDepositAmount), Convert.ToInt64(strSystemAccount), strAccountName, strAccountNumber, dtDepositDateTime,
                                                                                strReferenceId, strBankCode, strBankName, strBankNameInput, Convert.ToString(commonVariables.TransactionSource.Wap));

                        if (xeResponse == null)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/TransferFail", xeErrors);
                        }
                        else
                        {
                            isDepositSuccessful = Convert.ToBoolean(commonCulture.ElementValues.getResourceString("result", xeResponse));
                            strTransferId       = commonCulture.ElementValues.getResourceString("invId", xeResponse);

                            if (isDepositSuccessful)
                            {
                                strAlertCode      = "0";
                                strAlertMessage   = string.Format("{0}\\n{1}: {2}", commonCulture.ElementValues.getResourceXPathString("/Deposit/TransferSuccess", xeErrors), commonCulture.ElementValues.getResourceString("lblTransactionId", xeResources), strTransferId);
                                btnSubmit.Visible = false;
                                btnBack.Value     = commonCulture.ElementValues.getResourceString("home", commonVariables.LeftMenuXML);
                            }
                            else
                            {
                                strAlertCode    = "-1";
                                strAlertMessage = string.Format("{0}\\n{1}", commonCulture.ElementValues.getResourceXPathString("/Deposit/TransferFail", xeErrors), commonCulture.ElementValues.getResourceXPathString("/Deposit/error" + strTransferId, xeErrors));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                strAlertCode    = "-1";
                strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Deposit/Exception", xeErrors);

                strErrorDetail = ex.Message;
            }

            strProcessRemark = string.Format("OperatorId: {0} | MemberCode: {1} | CurrencyCode: {2} | DepositAmount: {3} | DepositChannel: {4} | AccountName: {6} | AccountNumber: {6} | SystemAccount: {7} | BankCode: {8} | BankName: {9} | BankNameInput: {10} | ReferenceID: {11} | DepositDateTime: {12} | MinLimit: {13} | MaxLimit: {14} | TotalAllowed: {15} | DailyLimit: {16} | Response: {17}",
                                             lngOperatorId, strMemberCode, strCurrencyCode, strDepositAmount, strDepositChannel, strAccountName, strAccountNumber, strSystemAccount, strBankCode, strBankName, strBankNameInput, strReferenceId, dtDepositDateTime.ToString("yyyy-MM-dd HH:mm:ss"), decMinLimit, decMaxLimit, decTotalAllowed, decDailyLimit, xeResponse == null ? string.Empty : xeResponse.ToString());

            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", strPageName, "InitiateDeposit", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
        }

        #region Response
        txtMessage.InnerHtml = strAlertMessage.Replace("\\n", "<br />");
        #endregion

        #endregion

        if (sessionExpired)
        {
            Response.Redirect("/Expire");
        }
    }
Ejemplo n.º 11
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "Withdrawal.BankTransfer";

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long   lngOperatorId     = long.MinValue;
        string strWithdrawAmount = string.Empty;
        string strBankCode       = string.Empty;
        string strBankName       = string.Empty;
        string strBankNameInput  = string.Empty;
        string strBankBranch     = string.Empty;
        string strBankAddress    = string.Empty;
        string strAccountName    = string.Empty;
        string strAccountNumber  = string.Empty;
        string strMyKad          = string.Empty;
        string strMobileNumber   = string.Empty;
        bool   MobileNotify      = false;

        decimal decMinLimit     = decimal.Zero;
        decimal decMaxLimit     = decimal.Zero;
        decimal decTotalAllowed = decimal.Zero;
        decimal decDailyLimit   = decimal.Zero;

        System.Xml.Linq.XElement xeResponse = null;

        bool   isWithdrawSuccessful = false;
        string strTransferId        = string.Empty;

        bool sessionExpired = false;
        #endregion

        #region populateVariables
        lngOperatorId   = long.Parse(commonVariables.OperatorId);
        strMemberCode   = commonVariables.GetSessionVariable("MemberCode");
        strCurrencyCode = commonVariables.GetSessionVariable("CurrencyCode");

        strWithdrawAmount = txtAmount.Value;
        strBankCode       = drpBank.Value;
        strBankName       = drpBank.Items.FindByValue(strBankCode).Text;
        strBankNameInput  = txtBankName.Value;
        strBankAddress    = txtAddress.Value;
        strBankBranch     = txtBankBranch.Value;
        strAccountName    = txtAccountName.Value;
        strAccountNumber  = txtAccountNumber.Value;
        strMyKad          = txtMyKad.Value;

        System.Text.RegularExpressions.Regex regxATM = new System.Text.RegularExpressions.Regex("([0-9]{16})$");

        #endregion

        #region parametersValidation
        if (string.IsNullOrEmpty(strWithdrawAmount))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingWithdrawalAmount", xeErrors); return;
        }
        else if (string.IsNullOrEmpty(strAccountName))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingAccountName", xeErrors); return;
        }
        else if (string.IsNullOrEmpty(strAccountNumber))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingAccountNumber", xeErrors); return;
        }
        else if (string.Compare(drpBank.Value, "OTHER", true) == 0 && string.IsNullOrEmpty(strBankNameInput))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingBankName", xeErrors); return;
        }
        //else if (string.Compare(drpBank.SelectedValue, "VIETIN", true) == 0 && (!commonValidation.isNumeric(strAccountNumber) || !regxATM.IsMatch(strAccountNumber))) { strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidAccountNumber", xeErrors); return; }
        else if (string.IsNullOrEmpty(strBankBranch) && string.Compare(strCurrencyCode, "krw", true) != 0)
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingBankBranch", xeErrors); return;
        }
        else if (string.IsNullOrEmpty(strBankAddress) && string.Compare(strCurrencyCode, "krw", true) != 0)
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingBankAddress", xeErrors); return;
        }
        else if (string.Compare(strCurrencyCode, "myr", true) == 0)
        {
            if (string.IsNullOrEmpty(strMyKad))
            {
                strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingAccountNumber", xeErrors); return;
            }
        }
        else if (Convert.ToString(drpBank.Value) == "-1")
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/SelectBank", xeErrors); return;
        }
        else if (!commonValidation.isDecimal(strWithdrawAmount))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidWithdrawAmount", xeErrors); return;
        }
        else if (Convert.ToDecimal(strWithdrawAmount) <= 0)
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidWithdrawAmount", xeErrors); return;
        }
        else if (commonValidation.isInjection(strWithdrawAmount))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidWithdrawAmount", xeErrors); return;
        }
        else if (commonValidation.isInjection(strBankNameInput))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidBankName", xeErrors); return;
        }
        else if (commonValidation.isInjection(strAccountName))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidAccountName", xeErrors); return;
        }
        else if (commonValidation.isInjection(strAccountNumber))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidAccountNumber", xeErrors); return;
        }
        else if (commonValidation.isInjection(strBankBranch))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidBankBranch", xeErrors); return;
        }
        else if (commonValidation.isInjection(strBankAddress))
        {
            strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/InvalidBankAddress", xeErrors); return;
        }
        else if (string.Compare(strCurrencyCode, "myr", true) == 0)
        {
            if (commonValidation.isInjection(strMyKad))
            {
                strAlertCode = "-1"; strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/MissingMyKad", xeErrors); return;
            }
        }
        else if (string.IsNullOrEmpty(strMemberCode))
        {
            strAlertCode    = "-1";
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/SessionExpired", xeErrors);
            isProcessAbort  = true;
            sessionExpired  = true;
        }
        else if (string.IsNullOrEmpty(strCurrencyCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/FundTransfer/SessionExpired", xeErrors);
            isProcessAbort  = true;
            sessionExpired  = true;
        }
        #endregion

        #region initialiseWithdrawal
        if (!isProcessAbort)
        {
            try
            {
                string strProcessCode = string.Empty;
                string strProcessText = string.Empty;

                System.Data.DataTable dtPaymentMethodLimits = null;

                using (svcPayMember.MemberClient svcInstance = new svcPayMember.MemberClient())
                {
                    dtPaymentMethodLimits = svcInstance.getMethodLimits(strOperatorId, strMemberCode, Convert.ToString(Convert.ToInt32(commonVariables.WithdrawalMethod.BankTransfer)), Convert.ToString(Convert.ToInt32(commonVariables.PaymentTransactionType.Withdrawal)), false, out strProcessCode, out strProcessText);

                    if (dtPaymentMethodLimits.Rows.Count > 0)
                    {
                        decMinLimit     = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["minWithdrawal"]);
                        decMaxLimit     = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["maxWithdrawal"]);
                        decTotalAllowed = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["totalAllowed"]);
                        decDailyLimit   = Convert.ToDecimal(dtPaymentMethodLimits.Rows[0]["limitDaily"]);

                        if (Convert.ToDecimal(strWithdrawAmount) < decMinLimit)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/AmountMinLimit", xeErrors);
                            isProcessAbort  = true;
                        }
                        else if (Convert.ToDecimal(strWithdrawAmount) > decMaxLimit)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/AmountMaxLimit", xeErrors);
                            isProcessAbort  = true;
                        }
                        else if (Convert.ToDecimal(strWithdrawAmount) > decTotalAllowed)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/TotalAllowedExceeded", xeErrors);
                            isProcessAbort  = true;
                        }
                    }
                }

                if (!isProcessAbort)
                {
                    using (svcPayWithdrawal.WithdrawalClient svcInstance = new svcPayWithdrawal.WithdrawalClient())
                    {
                        xeResponse = svcInstance.createBankTransferTransactionV1(lngOperatorId, strMemberCode, Convert.ToInt64(commonVariables.WithdrawalMethod.BankTransfer),
                                                                                 strCurrencyCode, Convert.ToDecimal(strWithdrawAmount), strAccountName, strAccountNumber, strBankAddress, strBankBranch, strBankCode, strBankName, strBankNameInput,
                                                                                 strMyKad, strMobileNumber, MobileNotify, Convert.ToString(commonVariables.TransactionSource.Wap));

                        if (xeResponse == null)
                        {
                            strAlertCode    = "-1";
                            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/TransferFail", xeErrors);
                        }
                        else
                        {
                            isWithdrawSuccessful = Convert.ToBoolean(commonCulture.ElementValues.getResourceString("result", xeResponse));
                            strTransferId        = commonCulture.ElementValues.getResourceString("invId", xeResponse);

                            if (isWithdrawSuccessful)
                            {
                                strAlertCode      = "0";
                                strAlertMessage   = string.Format("{0}\\n{1}: {2}", commonCulture.ElementValues.getResourceXPathString("/Withdrawal/TransferSuccess", xeErrors), commonCulture.ElementValues.getResourceString("lblTransactionId", xeResources), strTransferId);
                                btnSubmit.Visible = false;
                                btnBack.Value     = commonCulture.ElementValues.getResourceString("home", commonVariables.LeftMenuXML);
                            }
                            else
                            {
                                strAlertCode    = "-1";
                                strAlertMessage = string.Format("{0}\\n{1}", commonCulture.ElementValues.getResourceXPathString("/Withdrawal/TransferFail", xeErrors), commonCulture.ElementValues.getResourceXPathString("/Withdrawal/error" + strTransferId, xeErrors));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                strAlertCode    = "-1";
                strAlertMessage = commonCulture.ElementValues.getResourceXPathString("/Withdrawal/Exception", xeErrors);

                strErrorDetail = ex.Message;
            }

            strProcessRemark = string.Format("OperatorId: {0} | MemberCode: {1} | CurrencyCode: {2} | WithdrawAmount: {3} | AccountName: {4} | AccountNumber: {5} | BankAddress: {6} | BankBranch: {7} | BankCode: {8} | BankName: {9} | BankNameInput: {10} | MyKad: {11} | Mobile: {12} | MinLimit: {13} | MaxLimit: {14} | TotalAllowed: {15} | DailyLimit: {16} | Response: {17}",
                                             lngOperatorId, strMemberCode, strCurrencyCode, strWithdrawAmount, strAccountName, strAccountNumber, strBankAddress, strBankBranch, strBankCode, strBankName, strBankNameInput, strMyKad, strMobileNumber, decMinLimit, decMaxLimit, decTotalAllowed, decDailyLimit, xeResponse == null ? string.Empty : xeResponse.ToString());

            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", strPageName, "InitiateWithdrawal", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
        }
        #region Response
        txtMessage.InnerHtml = strAlertMessage.Replace("\\n", "<br />");
        #endregion

        #endregion

        if (sessionExpired)
        {
            Response.Redirect("/Expire");
        }
    }