public void BluePayPaymentDirectDebitAuthTest()
        {
            var customerData = new CustomerFields
            {
                Name1 = "Pablo",
                Name2 = "Picasso",
            };

            var     routingNumber     = "123123123";
            var     bankAccountNumber = "123456789";
            var     customId          = "ABC1234";
            Decimal amount            = 0; // Direct debit auth must be zero dollars or else an error is returned.

            var transaction = new Payment(UserName, Password, Mode, ResponseVersion);

            transaction.ProcessUsDirectDebitAuth(routingNumber, bankAccountNumber, DefaultAccountType, amount, customerData, AchDocType, customId);

            var result   = transaction.GetRawResponse();
            var response = new Response(result);

            Console.WriteLine("BluePayPaymentDirectDebitAuthTest: " + response.ToString());

            Assert.Equal(amount, Decimal.Parse(response.GetValue(ResponseFields.Amount)));
            Assert.Equal("ACH", response.GetValue(ResponseFields.PaymentType));
            Assert.Equal(AchDocType, response.GetValue(RequestFields.DocType));
            Assert.Equal(customerData.Name1, response.GetValue(RequestFields.Name1));
            Assert.Equal(customerData.Name2, response.GetValue(RequestFields.Name2));
            //  Assert.Equal(bankAccountNumber, response.GetValue(ResponseFields.PaymentAccount));
            Assert.Equal(customId, response.GetValue(ResponseFields.CustomId));

            Assert.Contains("APPROVED", response.GetValue(ResponseFields.Result));
            Assert.False(String.IsNullOrEmpty(response.GetValue(ResponseFields.ResultToken)), "token");
        }
示例#2
0
        /// <summary>
        /// Return an auth token that can be used for other tests
        /// </summary>
        /// <returns></returns>
        private string PerformCreditCardAuth()
        {
            var customerData = new CustomerFields
            {
                Address1 = "123 Main Street",
                Address2 = "Suite 200",
                City     = "St. Louis",
                Country  = "USA",
                Email    = "*****@*****.**",
                Name1    = "George",
                Name2    = "Washington",
                Phone    = "123-333-3333",
                State    = "MO",
                ZipCode  = "63102"
            };

            var transactionData = new CreditCardPayment
            {
                CardExpire = "1218",
                Cvv        = "123",
                CardNumber = "4111111111111111"
            };

            var transaction = new Payment(UserName, Password, Mode, ResponseVersion);

            transaction.ProcessCreditCardAuth(transactionData, customerData, 0);
            var result   = transaction.GetRawResponse();
            var response = new Response(result);

            return(response.GetValue(ResponseFields.ResultToken));
        }
        public ActionResult CustomerFilter(CustomerFields fields, User user = null)
        {
            ViewBag.Administrator = SiteSession.Current.Administrator;

            var clients = new core.Controllers.ClientController().Search(fields, user.UserId.Equals(default(Guid)) ? SiteSession.Current.User : user);

            return(PartialView("_customerList", clients));
        }
        /// <summary>
        ///     Runs an Auth Transaction
        /// </summary>
        public void ProcessUsDirectDebitAuth(string routingNumber, string bankAccountNumber, string accountType, decimal amount,
                                             CustomerFields customerData, string docType = "", string customId = "")
        {
            var transType   = "AUTH";
            var paymentType = "ACH";

            var paymentData = String.Format("&PAYMENT_TYPE={0}&ACH_ROUTING={1}&ACH_ACCOUNT={2}&ACH_ACCOUNT_TYPE={3}&DOC_TYPE={4}&NAME1={5}&NAME2={6}&CUSTOM_ID={7}",
                                            HttpUtility.UrlEncode(paymentType), HttpUtility.UrlEncode(routingNumber),
                                            HttpUtility.UrlEncode(bankAccountNumber), HttpUtility.UrlEncode(accountType),
                                            HttpUtility.UrlEncode(docType), HttpUtility.UrlEncode(customerData.Name1), HttpUtility.UrlEncode(customerData.Name2),
                                            HttpUtility.UrlEncode(customId));

            ProcessPayment(paymentData, transType, amount, "");
        }
        /// <summary>
        ///     ProcessUsDirectDebitSale
        /// </summary>
        /// <param name="directDebit">Details for this Direct Debit Transaction</param>
        /// <param name="customerData">Customer Details</param>
        public void ProcessUsDirectDebitSale(DirectDebitPayment directDebit, CustomerFields customerData)
        {
            var paymentType = "ACH";
            var transType   = "SALE";

            var paymentData =
                String.Format("&PAYMENT_TYPE={0}&ACH_ROUTING={1}&ACH_ACCOUNT={2}&ACH_ACCOUNT_TYPE={3}&DOC_TYPE={4}&NAME1={5}&NAME2={6}&CUSTOM_ID={7}",
                              HttpUtility.UrlEncode(paymentType),
                              HttpUtility.UrlEncode(directDebit.RoutingNumber), HttpUtility.UrlEncode(directDebit.BankAccountNumber),
                              HttpUtility.UrlEncode(directDebit.AccountType), HttpUtility.UrlEncode(directDebit.DocType),
                              HttpUtility.UrlEncode(customerData.Name1), HttpUtility.UrlEncode(customerData.Name2), HttpUtility.UrlEncode(directDebit.CustomId));

            ProcessPayment(paymentData, transType, directDebit.Amount, "");
        }
        private void ProcessSepaTransaction(DirectDebitPayment sepaPayment, CustomerFields customerData, string transType)
        {
            var paymentType = "SEPA";

            // to do - documentation says we need MANDATE_ID and MANDATE_DATE also
            var paymentData =
                String.Format(
                    "&BIC={0}&IBAN={1}&DOC_TYPE={2}&PAYMENT_TYPE={3}&NAME1={4}&NAME2={5}&ACH_ACCOUNT_TYPE={6}&CUSTOM_ID={7}",
                    HttpUtility.UrlEncode(sepaPayment.RoutingNumber),
                    HttpUtility.UrlEncode(sepaPayment.BankAccountNumber), HttpUtility.UrlEncode(sepaPayment.DocType), HttpUtility.UrlEncode(paymentType),
                    HttpUtility.UrlEncode(customerData.Name1), HttpUtility.UrlEncode(customerData.Name2), HttpUtility.UrlEncode(sepaPayment.AccountType),
                    HttpUtility.UrlEncode(sepaPayment.CustomId));

            ProcessPayment(paymentData, transType, sepaPayment.Amount, "");
        }
示例#7
0
    protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string message = "";

        try
        {
            CustomerFields m_CustomerFields = new CustomerFields();
            m_CustomerFields.CustomerFieldId = System.Int32.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString());
            m_CustomerFields.Delete();
        }
        catch (Exception ex)
        {
            sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
        }
        ShowGrid();
    }
        /// <summary>
        ///     Runs a Sale Transaction
        /// </summary>
        public void ProcessCreditCardAuth(CreditCardPayment cardData, CustomerFields customerData, Decimal amount)
        {
            var transType = "AUTH";

            string paymentData = string.Format("&PAYMENT_TYPE=CREDIT&CC_NUM={0}&CC_EXPIRES={1}&CVCVV2={2}&NAME1={3}&NAME2={4}&ADDR1={5}&ADDR2={6}&CITY={7}&STATE={8}&ZIPCODE={9}",
                                               cardData.CardNumber,
                                               cardData.CardExpire,
                                               cardData.Cvv,
                                               customerData.Name1,
                                               customerData.Name2,
                                               customerData.Address1,
                                               customerData.Address2,
                                               customerData.City,
                                               customerData.State,
                                               customerData.ZipCode);

            ProcessPayment(paymentData, transType, amount, "");
        }
        public void BluePayPaymentSepaSaleTest()
        {
            var testBic  = "OKOYFIHH";
            var testIban = "DE89370400440532013000";

            var sepaPayment = new DirectDebitPayment
            {
                AccountType       = "",
                Amount            = 3,
                BankAccountNumber = testIban,
                CustomId          = "A8G2LR6054V4C7G1WFP",
                DocType           = AchDocType,
                RoutingNumber     = testBic
            };

            var customerData = new CustomerFields
            {
                Name1 = "James",
                Name2 = "Bond",
            };

            var transaction = new Payment(UserName, Password, Mode, ResponseVersion);

            transaction.ProcessIntlDirectDebitSale(sepaPayment, customerData);

            var result = transaction.GetRawResponse();

            Assert.NotNull(result);

            var response = new Response(result);

            Console.WriteLine("BluePayPaymentSepaSaleTest: " + response.ToString());


            //  Assert.Equal(customId, response.GetValue(ResponseFields.CustomId), "custom id");
            Assert.Equal(sepaPayment.Amount, Decimal.Parse(response.GetValue(ResponseFields.Amount)));
            Assert.Equal("SEPA", response.GetValue(ResponseFields.PaymentType));
            Assert.Equal(AchDocType, response.GetValue(RequestFields.DocType));
            Assert.Equal(customerData.Name1, response.GetValue(RequestFields.Name1));
            Assert.Equal(customerData.Name2, response.GetValue(RequestFields.Name2));

            Assert.Contains("APPROVED", response.GetValue(ResponseFields.Result));
            Assert.False(String.IsNullOrEmpty(response.GetValue(ResponseFields.ResultToken)), "token");
        }
示例#10
0
        public void BluePayPaymentCreditCardAuthTest()
        {
            var customerData = new CustomerFields
            {
                Address1 = "123 Main Street",
                Address2 = "Suite 200",
                City     = "St. Louis",
                Country  = "USA",
                Email    = "*****@*****.**",
                Name1    = "George",
                Name2    = "Washington",
                Phone    = "123-333-3333",
                State    = "MO",
                ZipCode  = "63102"
            };

            var transactionData = new CreditCardPayment
            {
                CardExpire = "1218",
                Cvv        = "123",
                CardNumber = "4111111111111111"
            };

            var transaction = new Payment(UserName, Password, Mode, ResponseVersion);

            transaction.ProcessCreditCardAuth(transactionData, customerData, 3.00M);

            var result = transaction.GetRawResponse();

            var response = new Response(result);

            Console.WriteLine("BluePayPaymentCreditCardAuthTest: " + response.ToString());

            Assert.NotNull(result);
            List <string> returnStrings = result.Split('&').ToList();

            Assert.True(returnStrings.Contains("TRANSACTION_TYPE=AUTH"), "AUTH");

            Assert.True(returnStrings.Contains("Result=APPROVED"), "approved");

            // store output so that token can be used for other tests
            AuthToken = response.GetValue(ResponseFields.ResultToken);
        }
示例#11
0
 private void bindData()
 {
     System.Int32 EditId;
     if (Request.QueryString["id"] == null)
     {
         return;
     }
     else
     {
         EditId = System.Int32.Parse(Request.QueryString["id"].ToString());
         CustomerFields m_CustomerFields = new CustomerFields();
         m_CustomerFields.CustomerFieldId = EditId;
         m_CustomerFields    = m_CustomerFields.Get();
         txCustomerId.Text   = m_CustomerFields.CustomerId.ToString();
         txFieldId.Text      = m_CustomerFields.FieldId.ToString();
         txDocGroupId.Text   = m_CustomerFields.DocGroupId.ToString();
         txDisplayOrder.Text = m_CustomerFields.DisplayOrder.ToString();
         txCrDateTime.Text   = m_CustomerFields.CrDateTime.ToString("dd/MM/yyyy");
     }
 }
示例#12
0
    //--------------------------------------------------------------------------------

    private void ShowGrid()
    {
        try
        {
            CustomerFields m_CustomerFields = new CustomerFields();
            m_CustomerFields.CustomerFieldName = txtSearch.Text;
            string DateFrom = txtDateFrom.Text;
            string DateTo   = txtDateTo.Text;
            int    RowCount = 0;
            List <CustomerFields> l_CustomerFields = m_CustomerFields.GetPage("", "", ddlOrderBy.SelectedValue, m_grid.PageSize, CustomPaging.PageIndex - 1, ref RowCount);

            m_grid.DataSource = l_CustomerFields;
            m_grid.DataBind();
            lblTong.Text           = RowCount.ToString();
            CustomPaging.TotalPage = (RowCount == 0) ? 1 : (RowCount % m_grid.PageSize == 0) ? RowCount / m_grid.PageSize : (RowCount - RowCount % m_grid.PageSize) / m_grid.PageSize + 1;
        }
        catch (Exception ex)
        {
            sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
        }
    }
        public void BluePayPaymentDirectDebitSaleTest()
        {
            var customerData = new CustomerFields
            {
                Name1 = "Abe",
                Name2 = "Lincoln",
            };

            var directDebit = new DirectDebitPayment
            {
                AccountType       = DefaultAccountType,
                Amount            = 5,
                BankAccountNumber = "123456789",
                RoutingNumber     = "123123123",
                DocType           = AchDocType,
                CustomId          = "ABC1234"
            };

            var transaction = new Payment(UserName, Password, Mode, ResponseVersion);

            transaction.ProcessUsDirectDebitSale(directDebit, customerData);

            var result   = transaction.GetRawResponse();
            var response = new Response(result);

            Console.WriteLine("BluePayPaymentDirectDebitSaleTest: " + response.ToString());

            Assert.Equal(directDebit.Amount, Decimal.Parse(response.GetValue(ResponseFields.Amount)));
            Assert.Equal("ACH", response.GetValue(ResponseFields.PaymentType));
            Assert.Equal(AchDocType, response.GetValue(RequestFields.DocType));
            Assert.Equal(customerData.Name1, response.GetValue(RequestFields.Name1));
            Assert.Equal(customerData.Name2, response.GetValue(RequestFields.Name2));
            // Assert.Equal(directDebit.BankAccountNumber, response.GetValue(ResponseFields.PaymentAccount));
            Assert.Equal(directDebit.CustomId, response.GetValue(ResponseFields.CustomId));

            Assert.Contains("APPROVED", response.GetValue(ResponseFields.Result));
            Assert.False(String.IsNullOrEmpty(response.GetValue(ResponseFields.ResultToken)), "token");
        }
示例#14
0
 protected void lbDelete_Click(object sender, EventArgs e)
 {
     try
     {
         CustomerFields m_CustomerFields = new CustomerFields();
         foreach (GridViewRow m_Row in m_grid.Rows)
         {
             CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction");
             if (chkAction != null)
             {
                 if (chkAction.Checked)
                 {
                     m_CustomerFields.CustomerFieldId = System.Int32.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString());
                     m_CustomerFields.Delete();
                 }
             }
         }
         ShowGrid();
     }
     catch (Exception ex)
     {
         sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
     }
 }
        /// <summary>
        ///     Runs an Auth Transaction
        /// </summary>
        public void ProcessIntlDirectDebitSale(DirectDebitPayment sepaPayment, CustomerFields customerData)
        {
            var transType = "SALE";

            ProcessSepaTransaction(sepaPayment, customerData, transType);
        }
        /// <summary>
        ///     Runs an Auth Transaction
        /// </summary>
        public void ProcessIntlDirectDebitAuth(DirectDebitPayment directDebit, CustomerFields customerData)
        {
            var transType = "AUTH";

            ProcessSepaTransaction(directDebit, customerData, transType);
        }
示例#17
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int32   EditId;
        CustomerFields m_CustomerFields = new CustomerFields();

        if (Request.QueryString["id"] == null)
        {
            EditId = 0;
        }
        else
        {
            EditId = System.Int32.Parse(Request.QueryString["id"].ToString());
            m_CustomerFields.CustomerFieldId = EditId;
            m_CustomerFields = m_CustomerFields.Get();
        }
        try
        {
            if (txCustomerId.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }
            if (txFieldId.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }
            if (txDocGroupId.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }
            if (txDisplayOrder.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }


            m_CustomerFields.CrUserId = ActUserId;

            m_CustomerFields.CustomerId = int.Parse(txCustomerId.Text);

            m_CustomerFields.FieldId = short.Parse(txFieldId.Text);

            m_CustomerFields.DocGroupId = byte.Parse(txDocGroupId.Text);

            m_CustomerFields.DisplayOrder = short.Parse(txDisplayOrder.Text);

            m_CustomerFields.CustomerFieldId = EditId;
            SysMessageTypeId = m_CustomerFields.InsertOrUpdate(ConstantHelpers.Replicated, ActUserId, ref SysMessageId);

            StringBuilder       csText = new StringBuilder();
            Type                cstype = this.GetType();
            ClientScriptManager cs     = Page.ClientScript;
            csText.Clear();
            csText.Append("<script type=\"text/javascript\">");
            csText.Append("window.parent.jQuery('#divEdit').dialog('close');");
            csText.Append("</script>");
            cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "system_message", csText.ToString());
        }
        catch (Exception ex)
        {
            sms.utils.LogFiles.LogError(((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name + "\t" + ex.ToString());
            JSAlertHelpers.Alert(ex.Message, this);
        }
    }