/// <summary>
        /// Deep load all CustInfo children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.CustInfoProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.CustInfoProvider.DeepLoading += new EntityProviderBaseCore <CustInfo, CustInfoKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.CustInfoProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("CustInfo instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.CustInfoProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
        public async Task <IActionResult> Order(CustomerReportViewModel viewModel)
        {
            var customer = new Customer
            {
                CustomerDate = viewModel.CustomerDate,
                NumOfGuests  = viewModel.NumOfGuests
            };
            var custInfo = new CustInfo
            {
                LastName    = viewModel.LastName,
                FirstName   = viewModel.FirstName,
                Email       = viewModel.Email,
                PhoneNumber = viewModel.PhoneNumber
            };

            var special = new Special
            {
                NumOfGuests = viewModel.NumOfGuests,
                Reasons     = viewModel.Reasons,
                Other       = viewModel.Other
            };

            if (ModelState.IsValid)
            {
                _context.Add(customer);
                _context.Add(custInfo);
                _context.Add(special);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Report", "Home"));
            }
            return(View(viewModel));
        }
Example #3
0
        ///<summary>
        ///  Update the Typed CustInfo Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, CustInfo mock)
        {
            CustInfoTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
Example #4
0
    // 客户信息查询接口 lihongtu
    public static Int32 QueryCustInfo(String ProductNo, out CustInfo custinfo, out String ErrMsg)
    {
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        String TransactionID = CreateTransactionID();
        StringBuilder requestXml = new StringBuilder();
        String responseXml = String.Empty;
        custinfo = new CustInfo();
        try
        {
            #region 拼接请求xml字符串
            //100101	客户查询
            requestXml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            requestXml.Append("<PayPlatRequestParameter>");
            requestXml.Append("<CTRL-INFO WEBSVRNAME=\"客户查询\" WEBSVRCODE=\"100101\" APPFROM=\"100101|310000-TEST1-127.0.0.1|1.0|127.0.0.1\" KEEP=\"" + TransactionID + "\" />");
            requestXml.Append("<PARAMETERS>");

            //添加参数

            requestXml.AppendFormat("<PRODUCTNO>{0}</PRODUCTNO>", "yy" + ProductNo);
            requestXml.AppendFormat("<ACCEPTORGCODE>{0}</ACCEPTORGCODE>", BesttoneAccountConstDefinition.DefaultInstance.ACCEPTORGCODE);  //002310000000000
            requestXml.AppendFormat("<ACCEPTSEQNO>{0}</ACCEPTSEQNO>", TransactionID);
            requestXml.AppendFormat("<INPUTTIME>{0}</INPUTTIME>", DateTime.Now.ToString("yyyyMMddHHmmss"));

            requestXml.Append("</PARAMETERS>");
            requestXml.Append("</PayPlatRequestParameter>");

            #endregion

            //请求接口

            responseXml = serviceProxy.dispatchCommand("100101|310000-TEST1-127.0.0.1|1.0|127.0.0.1", requestXml.ToString());

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(responseXml);

            String responseCode = xmlDoc.SelectSingleNode("/PayPlatResponseParameter/RESPONSECODE").InnerText;
            ErrMsg = xmlDoc.SelectSingleNode("/PayPlatResponseParameter/RESPONSECONTENT").InnerText;

            if (responseCode == "000000")
            {
                XmlNode dataNode = xmlDoc.SelectNodes("/PayPlatResponseParameter/RESULTDATESET/DATAS")[0];
                custinfo.CustomerNo = dataNode.Attributes["CUSTOMER_NO"].Value;
                custinfo.ProductNo = dataNode.Attributes["PRODUCT_NO"].Value;
                custinfo.CustomerName = dataNode.Attributes["CUSTOMER_NAME"].Value;
                custinfo.IdType = dataNode.Attributes["ID_TYPE"].Value;
                custinfo.IdNo = dataNode.Attributes["ID_NO"].Value;
                Result = 0;
                ErrMsg = String.Empty;
            }

        }
        catch (System.Exception ex)
        {

        }
        return Result;
    }
    // 客户信息查询接口 lihongtu
    public static Int32 QueryCustInfo(String ProductNo, out CustInfo custinfo, out String ErrMsg)
    {
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;

        ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        String        TransactionID = CreateTransactionID();
        StringBuilder requestXml    = new StringBuilder();
        String        responseXml   = String.Empty;

        custinfo = new CustInfo();
        try
        {
            #region 拼接请求xml字符串
            //100101	客户查询
            requestXml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            requestXml.Append("<PayPlatRequestParameter>");
            requestXml.Append("<CTRL-INFO WEBSVRNAME=\"客户查询\" WEBSVRCODE=\"100101\" APPFROM=\"100101|310000-TEST1-127.0.0.1|1.0|127.0.0.1\" KEEP=\"" + TransactionID + "\" />");
            requestXml.Append("<PARAMETERS>");

            //添加参数

            requestXml.AppendFormat("<PRODUCTNO>{0}</PRODUCTNO>", "yy" + ProductNo);
            requestXml.AppendFormat("<ACCEPTORGCODE>{0}</ACCEPTORGCODE>", BesttoneAccountConstDefinition.DefaultInstance.ACCEPTORGCODE);  //002310000000000
            requestXml.AppendFormat("<ACCEPTSEQNO>{0}</ACCEPTSEQNO>", TransactionID);
            requestXml.AppendFormat("<INPUTTIME>{0}</INPUTTIME>", DateTime.Now.ToString("yyyyMMddHHmmss"));

            requestXml.Append("</PARAMETERS>");
            requestXml.Append("</PayPlatRequestParameter>");

            #endregion

            //请求接口

            responseXml = serviceProxy.dispatchCommand("100101|310000-TEST1-127.0.0.1|1.0|127.0.0.1", requestXml.ToString());

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(responseXml);

            String responseCode = xmlDoc.SelectSingleNode("/PayPlatResponseParameter/RESPONSECODE").InnerText;
            ErrMsg = xmlDoc.SelectSingleNode("/PayPlatResponseParameter/RESPONSECONTENT").InnerText;

            if (responseCode == "000000")
            {
                XmlNode dataNode = xmlDoc.SelectNodes("/PayPlatResponseParameter/RESULTDATESET/DATAS")[0];
                custinfo.CustomerNo   = dataNode.Attributes["CUSTOMER_NO"].Value;
                custinfo.ProductNo    = dataNode.Attributes["PRODUCT_NO"].Value;
                custinfo.CustomerName = dataNode.Attributes["CUSTOMER_NAME"].Value;
                custinfo.IdType       = dataNode.Attributes["ID_TYPE"].Value;
                custinfo.IdNo         = dataNode.Attributes["ID_NO"].Value;
                Result = 0;
                ErrMsg = String.Empty;
            }
        }
        catch (System.Exception ex)
        {
        }
        return(Result);
    }
 ///<summary>
 ///  Update the Typed CustInfo Entity with modified mock values.
 ///</summary>
 static public void UpdateMockInstance_Generated(TransactionManager tm, CustInfo mock)
 {
     mock.ImpQty   = (decimal)TestUtility.Instance.RandomShort();
     mock.ImpAmt   = (decimal)TestUtility.Instance.RandomShort();
     mock.ExpQty   = (decimal)TestUtility.Instance.RandomShort();
     mock.ExpAmt   = (decimal)TestUtility.Instance.RandomShort();
     mock.Lastwspr = (decimal)TestUtility.Instance.RandomShort();
     mock.LastDate = TestUtility.Instance.RandomDateTime();
 }
        /// <summary>
        /// Check the foreign key dal methods.
        /// </summary>
        private void Step_10_FK_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                CustInfo entity = CreateMockInstance(tm);
                bool     result = DataRepository.CustInfoProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test FK, Insert Failed");
            }
        }
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                CustInfo entity = mock.Copy() as CustInfo;
                entity = (CustInfo)mock.Clone();
                Assert.IsTrue(CustInfo.ValueEquals(entity, mock), "Clone is not working");
            }
        }
Example #9
0
        ///<summary>
        ///  Returns a Typed CustInfo Entity with mock values.
        ///</summary>
        static public CustInfo CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            CustInfo mock = CustInfoTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
        /// <summary>
        /// Check the indexes dal methods.
        /// </summary>
        private void Step_11_IX_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                CustInfo entity = CreateMockInstance(tm);
                bool     result = DataRepository.CustInfoProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test IX, Insert Failed");


                CustInfo t0 = DataRepository.CustInfoProvider.GetByCustIdGoodsId(tm, entity.CustId, entity.GoodsId);
            }
        }
        /// <summary>
        /// Serialize the mock CustInfo entity into a temporary file.
        /// </summary>
        private void Step_06_SerializeEntity_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_CustInfo.xml");

                EntityHelper.SerializeXml(mock, fileName);
                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");

                System.Console.WriteLine("mock correctly serialized to a temporary file.");
            }
        }
        /// <summary>
        /// Inserts a mock CustInfo entity into the database.
        /// </summary>
        private void Step_01_Insert_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                Assert.IsTrue(DataRepository.CustInfoProvider.Insert(tm, mock), "Insert failed");

                System.Console.WriteLine("DataRepository.CustInfoProvider.Insert(mock):");
                System.Console.WriteLine(mock);

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
        /// <summary>
        /// Serialize a CustInfo collection into a temporary file.
        /// </summary>
        private void Step_08_SerializeCollection_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_CustInfoCollection.xml");

                mock = CreateMockInstance(tm);
                TList <CustInfo> mockCollection = new TList <CustInfo>();
                mockCollection.Add(mock);

                EntityHelper.SerializeXml(mockCollection, fileName);

                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
                System.Console.WriteLine("TList<CustInfo> correctly serialized to a temporary file.");
            }
        }
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                CustInfo mock   = CreateMockInstance(tm);
                bool     result = DataRepository.CustInfoProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                CustInfoQuery query = new CustInfoQuery();

                query.AppendEquals(CustInfoColumn.CustId, mock.CustId.ToString());
                query.AppendEquals(CustInfoColumn.GoodsId, mock.GoodsId.ToString());
                if (mock.ImpQty != null)
                {
                    query.AppendEquals(CustInfoColumn.ImpQty, mock.ImpQty.ToString());
                }
                if (mock.ImpAmt != null)
                {
                    query.AppendEquals(CustInfoColumn.ImpAmt, mock.ImpAmt.ToString());
                }
                if (mock.ExpQty != null)
                {
                    query.AppendEquals(CustInfoColumn.ExpQty, mock.ExpQty.ToString());
                }
                if (mock.ExpAmt != null)
                {
                    query.AppendEquals(CustInfoColumn.ExpAmt, mock.ExpAmt.ToString());
                }
                if (mock.Lastwspr != null)
                {
                    query.AppendEquals(CustInfoColumn.Lastwspr, mock.Lastwspr.ToString());
                }
                if (mock.LastDate != null)
                {
                    query.AppendEquals(CustInfoColumn.LastDate, mock.LastDate.ToString());
                }

                TList <CustInfo> results = DataRepository.CustInfoProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
        ///<summary>
        ///  Returns a Typed CustInfo Entity with mock values.
        ///</summary>
        static public CustInfo CreateMockInstance_Generated(TransactionManager tm)
        {
            CustInfo mock = new CustInfo();

            mock.CustId   = TestUtility.Instance.RandomString(5, false);;
            mock.GoodsId  = TestUtility.Instance.RandomString(6, false);;
            mock.ImpQty   = (decimal)TestUtility.Instance.RandomShort();
            mock.ImpAmt   = (decimal)TestUtility.Instance.RandomShort();
            mock.ExpQty   = (decimal)TestUtility.Instance.RandomShort();
            mock.ExpAmt   = (decimal)TestUtility.Instance.RandomShort();
            mock.Lastwspr = (decimal)TestUtility.Instance.RandomShort();
            mock.LastDate = TestUtility.Instance.RandomDateTime();


            // create a temporary collection and add the item to it
            TList <CustInfo> tempMockCollection = new TList <CustInfo>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((CustInfo)mock);
        }
        public static void Main(string[] args)
        {
            /********************* Post Request Variables ********************************/

            string host = "esqa.moneris.com";
            string store_id = "store5";
            string api_token = "yesguy";

            /********************* Transactional Variables *******************************/

            string order_id = "Need_Unique_Order_ID";
            string amount = "10.00";
            string pan = "4242424242424242";
            string expdate = "0812";
            string crypt = "7";

            /********************* Billing/Shipping Variables ****************************/

            string first_name = "Bob";
            string last_name = "Smith";
            string company_name = "ProLine Inc.";
            string address = "623 Bears Ave";
            string city = "Chicago";
            string province = "Illinois";
            string postal_code = "M1M2M1";
            string country = "Canada";
            string phone = "777-999-7777";
            string fax = "777-999-7778";
            string tax1 = "10.00";
            string tax2 = "5.78";
            string tax3 = "4.56";
            string shipping_cost = "10.00";

            /********************* Order Line Item Variables *****************************/

            string[] item_description = new string[]{"Chicago Bears Helmet", "Soldier Field Poster"};
            string[] item_quantity = new string[]{"1", "1"};
            string[] item_product_code = new string[]{"CB3450", "SF998S"};
            string[] item_extended_amount = new string[]{"150.00", "19.79"};

               	/*****************************************************************************/
               	/*								             */
               	/*			Customer Information Option 1			     */
               	/*									     */
               	/*****************************************************************************/

            /********************** Customer Information Object **************************/

            CustInfo customer = new CustInfo();

            /********************** Set Customer Billing Information **********************/

            customer.SetBilling (first_name, last_name, company_name, address, city,
                         province, postal_code, country, phone, fax, tax1, tax2,
                         tax3, shipping_cost);

            /******************** Set Customer Shipping Information ***********************/

            customer.SetShipping (first_name, last_name, company_name, address, city,
                         province, postal_code, country, phone, fax, tax1, tax2,
                         tax3, shipping_cost);

            /***************************** Order Line Items  ******************************/

            customer.SetItem (item_description[0], item_quantity[0],
                      item_product_code[0], item_extended_amount[0]);

            customer.SetItem (item_description[1], item_quantity[1],
                      item_product_code[1], item_extended_amount[1]);

               	/*****************************************************************************/
               	/*								             */
               	/*			Customer Information Option 2			     */
               	/*									     */
               	/*****************************************************************************/

               	/********************** Customer Information Object **************************/

            CustInfo customer2 = new CustInfo();

                /******************************* Billing Hashtable ***************************/

                Hashtable b = new Hashtable();	//billing hashtable

                b.Add("first_name",first_name);
                b.Add("last_name", last_name);
                b.Add("company_name",company_name);
                b.Add("address", address);
                b.Add("city", city);
                b.Add("province", province);
                b.Add("postal_code", postal_code);
                b.Add("country", country);
                b.Add("phone", phone);
                b.Add("fax", fax);
                b.Add("tax1",tax1);       //federal tax
                b.Add("tax2",tax2);        //prov tax
                b.Add("tax3",tax3);        //luxury tax
                b.Add("shipping_cost", shipping_cost);   //shipping cost

                customer2.SetBilling(b);

                /****************************** Shipping Hashtable ***************************/

                Hashtable s = new Hashtable();	//shipping hashtable

                s.Add("first_name",first_name);
                s.Add("last_name", last_name);
                s.Add("company_name", company_name);
                s.Add("address", address);
                s.Add("city", city);
                s.Add("province", province);
                s.Add("postal_code",postal_code);
                s.Add("country", country);
                s.Add("phone", phone);
                s.Add("fax", fax);
                s.Add("tax1", tax1);       //federal tax
                s.Add("tax2", tax2);        //prov tax
                s.Add("tax3", tax3);        //luxury tax
                s.Add("shipping_cost", shipping_cost);   //shipping cost

                customer2.SetShipping(s);

                /************************* Order Line Item1 Hashtable ************************/

                Hashtable i1 = new Hashtable();		//item hashtable #1

                i1.Add("name", item_description[0]);
                i1.Add("quantity", item_quantity[0]);
                i1.Add("product_code", item_product_code[0]);
                i1.Add("extended_amount", item_extended_amount[0]);

                customer2.SetItem(i1);

            /************************* Order Line Item2 Hashtable **************************/

                Hashtable i2 = new Hashtable();		//item hashtable #2

                i2.Add("name","item2's name");
                i2.Add("quantity","7");
                i2.Add("product_code","item2's product code");
                i2.Add("extended_amount","5.01");

                customer2.SetItem(i2);

                /*************** Miscellaneous Customer Information Methods *******************/

                customer.SetEmail("*****@*****.**");
                customer.SetInstructions("Make it fast!");

            /********************** Transactional Request Object **************************/

                Purchase purchase = new Purchase(order_id, amount, pan, expdate, crypt);

                /************************ Set Customer Information ***************************/

                purchase.SetCustInfo (customer);

            /**************************** Https Post Request ***************************/

            HttpsPostRequest mpgReq =
                new HttpsPostRequest(host, store_id, api_token, purchase);

            /******************************* Receipt ***********************************/

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

             	Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #17
0
 /// <summary>
 /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
 /// </summary>
 /// <param name="mock">Object to be modified</param>
 static private void SetSpecialTestData(CustInfo mock)
 {
     //Code your changes to the data object here.
 }
        public static void Main(string[] args)
        {
            string host      = "esplusqa.moneris.com";
            string order_id  = "dotnetachdebitcustinfotest1";
            string store_id  = "monusqa002";
            string api_token = "qatoken";
            string amount    = "1.00";

            //ACHInfo Variables
            string sec             = "pop";
            string cust_first_name = "Bob";
            string cust_last_name  = "Smith";
            string cust_address1   = "3300 Bloor St W";
            string cust_address2   = "4th floor west tower";
            string cust_city       = "Toronto";
            string cust_state      = "ON";
            string cust_zip        = "M1M1M1";
            string routing_num     = "490000018";
            string account_num     = "222222";
            string check_num       = "11";
            string account_type    = "checking";
            string micr            = "t071000013t742941347o127";
            string dl_num          = "CO-12312312";
            string magstripe       = "no";
            string image_front     = "";
            string image_back      = "";


            ACHInfo achinfo = new ACHInfo(sec, cust_first_name, cust_last_name,
                                          cust_address1, cust_address2, cust_city, cust_state, cust_zip,
                                          routing_num, account_num, check_num, account_type, micr);


            achinfo.SetImgFront(image_front);
            achinfo.SetImgBack(image_back);
            achinfo.SetDlNum(dl_num);
            achinfo.SetMagstripe(magstripe);

            ACHDebit achdebit = new ACHDebit(order_id, amount, achinfo);

            //************************OPTIONAL VARIABLES***************************

            //Cust_id Variable
            string cust_id = "customer1";

            achdebit.SetCustId(cust_id);

            //CustInfo Variables
            CustInfo custInfo = new CustInfo();

            custInfo.SetEmail("*****@*****.**");
            custInfo.SetInstructions("Make it fast!");


            Hashtable b = new Hashtable();

            b.Add("first_name", "Bob");
            b.Add("last_name", "Smith");
            b.Add("company_name", "Widget Company Inc.");
            b.Add("address", "111 Bolts Ave.");
            b.Add("city", "Toronto");
            b.Add("province", "Ontario");
            b.Add("postal_code", "M8T 1T8");
            b.Add("country", "Canada");
            b.Add("phone", "416-555-5555");
            b.Add("fax", "416-555-5555");
            b.Add("tax1", "123.45");          //federal tax
            b.Add("tax2", "12.34");           //prov tax
            b.Add("tax3", "15.45");           //luxury tax
            b.Add("shipping_cost", "456.23"); //shipping cost

            custInfo.SetBilling(b);

            /* OR you can pass the individual args.
             * custInfo.SetBilling(
             *                     "Bob",                  //first name
             *                     "Smith",                //last name
             *                     "Widget Company Inc.",  //company name
             *                     "111 Bolts Ave.",       //address
             *                     "Toronto",              //city
             *                     "Ontario",              //province
             *                     "M8T 1T8",              //postal code
             *                     "Canada",               //country
             *                     "416-555-5555",         //phone
             *                     "416-555-5555",         //fax
             *                     "123.45",               //federal tax
             *                     "12.34",                //prov tax
             *                     "15.45",                //luxury tax
             *                     "456.23"                //shipping cost
             * );
             */

            Hashtable s = new Hashtable();

            s.Add("first_name", "Bob");
            s.Add("last_name", "Smith");
            s.Add("company_name", "Widget Company Inc.");
            s.Add("address", "111 Bolts Ave.");
            s.Add("city", "Toronto");
            s.Add("province", "Ontario");
            s.Add("postal_code", "M8T 1T8");
            s.Add("country", "Canada");
            s.Add("phone", "416-555-5555");
            s.Add("fax", "416-555-5555");
            s.Add("tax1", "123.45");          //federal tax
            s.Add("tax2", "12.34");           //prov tax
            s.Add("tax3", "15.45");           //luxury tax
            s.Add("shipping_cost", "456.23"); //shipping cost

            custInfo.SetShipping(s);

            /* OR you can pass the individual args.
             * custInfo.SetShipping(
             *                     "Bob",                  //first name
             *                     "Smith",                //last name
             *                     "Widget Company Inc.",  //company name
             *                     "111 Bolts Ave.",       //address
             *                     "Toronto",              //city
             *                     "Ontario",              //province
             *                     "M8T 1T8",              //postal code
             *                     "Canada",               //country
             *                     "416-555-5555",         //phone
             *                     "416-555-5555",         //fax
             *                     "123.45",               //federal tax
             *                     "12.34",                //prov tax
             *                     "15.45",                //luxury tax
             *                     "456.23"                //shipping cost
             * );
             */

            Hashtable i1 = new Hashtable();

            i1.Add("name", "item1's name");
            i1.Add("quantity", "5");
            i1.Add("product_code", "item1's product code");
            i1.Add("extended_amount", "1.01");

            custInfo.SetItem(i1);

            /* OR you can pass the individual args.
             * custInfo.SetItem(
             *  "item1's name",         //name
             *  "5",                    //quantity
             *  "item1's product code", //product code
             *  "1.01"                  //extended amount
             * );
             */

            Hashtable i2 = new Hashtable();

            i2.Add("name", "item2's name");
            i2.Add("quantity", "7");
            i2.Add("product_code", "item2's product code");
            i2.Add("extended_amount", "5.01");

            custInfo.SetItem(i2);

            achdebit.SetCustInfo(custInfo);

            ACHHttpsPostRequest mpgReq = new ACHHttpsPostRequest(host, store_id, api_token, achdebit);

            /**********************   REQUEST  ************************/

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #19
0
        public static void Main(string[] args)
        {
            /******************* REQUEST VARIABLES*******************************/

            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            /****************** TRANSACTION VARIABLES *****************************/

            string order_id          = "pinlessdotnettest3";
            string amount            = "1.00";
            string card              = "4496270000164824";
            string exp               = "0411";
            string presentation_type = "X";
            string intended_use      = "0";
            string p_account_number  = "123";

            /********************* Billing/Shipping Variables ****************************/

            string first_name    = "Bob";
            string last_name     = "Smith";
            string company_name  = "ProLine Inc.";
            string address       = "623 Bears Ave";
            string city          = "Chicago";
            string province      = "Illinois";
            string postal_code   = "M1M2M1";
            string country       = "Canada";
            string phone         = "777-999-7777";
            string fax           = "777-999-7778";
            string tax1          = "10.00";
            string tax2          = "5.78";
            string tax3          = "4.56";
            string shipping_cost = "10.00";

            /********************* Order Line Item Variables *****************************/

            string[] item_description     = new string[] { "Chicago Bears Helmet", "Soldier Field Poster" };
            string[] item_quantity        = new string[] { "1", "1" };
            string[] item_product_code    = new string[] { "CB3450", "SF998S" };
            string[] item_extended_amount = new string[] { "150.00", "19.79" };

            /********************** Customer Information Object **************************/

            CustInfo customer = new CustInfo();

            /********************** Set Customer Billing Information **********************/

            customer.SetBilling(first_name, last_name, company_name, address, city,
                                province, postal_code, country, phone, fax, tax1, tax2,
                                tax3, shipping_cost);

            /******************** Set Customer Shipping Information ***********************/

            customer.SetShipping(first_name, last_name, company_name, address, city,
                                 province, postal_code, country, phone, fax, tax1, tax2,
                                 tax3, shipping_cost);

            /***************************** Order Line Items  ******************************/

            customer.SetItem(item_description[0], item_quantity[0],
                             item_product_code[0], item_extended_amount[0]);

            customer.SetItem(item_description[1], item_quantity[1],
                             item_product_code[1], item_extended_amount[1]);


            USPinlessDebitPurchase uspdp = new USPinlessDebitPurchase(order_id, amount, card, exp, presentation_type, intended_use, p_account_number);

            uspdp.SetCustInfo(customer);

            //Console.Write ("Please enter an order ID: ");
            //order_id = Console.ReadLine();

            HttpsPostRequest mpgReq = new HttpsPostRequest(host, store_id, api_token, uspdp);


            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #20
0
        public static void Main(string[] args)
        {
            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            string data_key = "1sZH2p215HdQV6l6909x217";
            string order_id = "res_puchase_ach_2";
            string amount   = "1.00";
            string cust_id  = "customer1";

            USResPurchaseAch usResPurchaseAch = new USResPurchaseAch(data_key, order_id, cust_id, amount);

            //CustInfo Variables
            CustInfo custInfo = new CustInfo();

            custInfo.SetEmail("*****@*****.**");
            custInfo.SetInstructions("Make it fast!");


            Hashtable b = new Hashtable();

            b.Add("first_name", "Bob");
            b.Add("last_name", "Smith");
            b.Add("company_name", "Widget Company Inc.");
            b.Add("address", "111 Bolts Ave.");
            b.Add("city", "Toronto");
            b.Add("province", "Ontario");
            b.Add("postal_code", "M8T 1T8");
            b.Add("country", "Canada");
            b.Add("phone", "416-555-5555");
            b.Add("fax", "416-555-5555");
            b.Add("tax1", "123.45");          //federal tax
            b.Add("tax2", "12.34");           //prov tax
            b.Add("tax3", "15.45");           //luxury tax
            b.Add("shipping_cost", "456.23"); //shipping cost

            custInfo.SetBilling(b);

            /* OR you can pass the individual args.
             * custInfo.SetBilling(
             *                     "Bob",                  //first name
             *                     "Smith",                //last name
             *                     "Widget Company Inc.",  //company name
             *                     "111 Bolts Ave.",       //address
             *                     "Toronto",              //city
             *                     "Ontario",              //province
             *                     "M8T 1T8",              //postal code
             *                     "Canada",               //country
             *                     "416-555-5555",         //phone
             *                     "416-555-5555",         //fax
             *                     "123.45",               //federal tax
             *                     "12.34",                //prov tax
             *                     "15.45",                //luxury tax
             *                     "456.23"                //shipping cost
             * );
             */

            Hashtable s = new Hashtable();

            s.Add("first_name", "Bob");
            s.Add("last_name", "Smith");
            s.Add("company_name", "Widget Company Inc.");
            s.Add("address", "111 Bolts Ave.");
            s.Add("city", "Toronto");
            s.Add("province", "Ontario");
            s.Add("postal_code", "M8T 1T8");
            s.Add("country", "Canada");
            s.Add("phone", "416-555-5555");
            s.Add("fax", "416-555-5555");
            s.Add("tax1", "123.45");          //federal tax
            s.Add("tax2", "12.34");           //prov tax
            s.Add("tax3", "15.45");           //luxury tax
            s.Add("shipping_cost", "456.23"); //shipping cost

            custInfo.SetShipping(s);

            /* OR you can pass the individual args.
             * custInfo.SetShipping(
             *                     "Bob",                  //first name
             *                     "Smith",                //last name
             *                     "Widget Company Inc.",  //company name
             *                     "111 Bolts Ave.",       //address
             *                     "Toronto",              //city
             *                     "Ontario",              //province
             *                     "M8T 1T8",              //postal code
             *                     "Canada",               //country
             *                     "416-555-5555",         //phone
             *                     "416-555-5555",         //fax
             *                     "123.45",               //federal tax
             *                     "12.34",                //prov tax
             *                     "15.45",                //luxury tax
             *                     "456.23"                //shipping cost
             * );
             */

            Hashtable i1 = new Hashtable();

            i1.Add("name", "item1's name");
            i1.Add("quantity", "5");
            i1.Add("product_code", "item1's product code");
            i1.Add("extended_amount", "1.01");

            custInfo.SetItem(i1);

            /* OR you can pass the individual args.
             * custInfo.SetItem(
             *  "item1's name",         //name
             *  "5",                    //quantity
             *  "item1's product code", //product code
             *  "1.01"                  //extended amount
             * );
             */

            Hashtable i2 = new Hashtable();

            i2.Add("name", "item2's name");
            i2.Add("quantity", "7");
            i2.Add("product_code", "item2's product code");
            i2.Add("extended_amount", "5.01");

            custInfo.SetItem(i2);

            usResPurchaseAch.SetCustInfo(custInfo);


            HttpsPostRequest mpgReq = new HttpsPostRequest(host, store_id, api_token, usResPurchaseAch);

            /**********************   REQUEST  ************************/

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("DataKey = " + receipt.GetDataKey());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("ResSuccess = " + receipt.GetResSuccess());
                Console.WriteLine("PaymentType = " + receipt.GetPaymentType());

                //ResolveData
                Console.WriteLine("\nCust ID = " + receipt.GetResDataCustId());
                Console.WriteLine("Phone = " + receipt.GetResDataPhone());
                Console.WriteLine("Email = " + receipt.GetResDataEmail());
                Console.WriteLine("Note = " + receipt.GetResDataNote());
                Console.WriteLine("Sec = " + receipt.GetResDataSec());
                Console.WriteLine("Cust First Name = " + receipt.GetResDataCustFirstName());
                Console.WriteLine("Cust Last Name = " + receipt.GetResDataCustLastName());
                Console.WriteLine("Cust Address 1 = " + receipt.GetResDataCustAddress1());
                Console.WriteLine("Cust Address 2 = " + receipt.GetResDataCustAddress2());
                Console.WriteLine("Cust City = " + receipt.GetResDataCustCity());
                Console.WriteLine("Cust State = " + receipt.GetResDataCustState());
                Console.WriteLine("Cust Zip = " + receipt.GetResDataCustZip());
                Console.WriteLine("Routing Num = " + receipt.GetResDataRoutingNum());
                Console.WriteLine("Masked Account Num = " + receipt.GetResDataMaskedAccountNum());
                Console.WriteLine("Check Num = " + receipt.GetResDataCheckNum());
                Console.WriteLine("Account Type = " + receipt.GetResDataAccountType());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string host = "esqa.moneris.com";
            string store_id = "store5";
            string api_token = "yesguy";
            string order_id = "Need_Unique_Order_ID_Cust_Info_005";
            string cust_id = "Lance_Briggs_55";
            string amount = "5.00";
            string track2 = "5268051119993326=0609AAAAAAAAAAAAA000";

              /********************* Billing/Shipping Variables ****************************/

              string first_name = "Bob";
              string last_name = "Smith";
              string company_name = "ProLine Inc.";
              string address = "623 Bears Ave";
              string city = "Chicago";
              string province = "Illinois";
              string postal_code = "M1M2M1";
              string country = "Canada";
              string phone = "777-999-7777";
              string fax = "777-999-7778";
              string tax1 = "10.00";
              string tax2 = "5.78";
              string tax3 = "4.56";
              string shipping_cost = "10.00";

              /********************* Order Line Item Variables *****************************/

              string[] item_description = new string[]{"Chicago Bears Helmet", "Soldier Field Poster"};
              string[] item_quantity = new string[]{"1", "1"};
              string[] item_product_code = new string[]{"CB3450", "SF998S"};
              string[] item_extended_amount = new string[]{"150.00", "19.79"};

              /********************** Customer Information Object **************************/

              CustInfo customer = new CustInfo();

              /********************** Set Customer Billing Information **********************/

              customer.SetBilling (first_name, last_name, company_name, address, city,
                               province, postal_code, country, phone, fax, tax1, tax2,
                               tax3, shipping_cost);

              /******************** Set Customer Shipping Information ***********************/

              customer.SetShipping (first_name, last_name, company_name, address, city,
                                province, postal_code, country, phone, fax, tax1, tax2,
                                tax3, shipping_cost);

              /***************************** Order Line Items  ******************************/

              customer.SetItem (item_description[0], item_quantity[0],
                            item_product_code[0], item_extended_amount[0]);

              customer.SetItem (item_description[1], item_quantity[1],
                            item_product_code[1], item_extended_amount[1]);

               	/************************** Request *************************/

            IDebitPurchase IOP_Txn = new IDebitPurchase (order_id, cust_id, amount, track2);

            IOP_Txn.SetCustInfo (customer);

            //IOP_Txn.SetDynamicDescriptor("dynamicdescriptor1");

            HttpsPostRequest mpgReq =
                new HttpsPostRequest(host, store_id, api_token, IOP_Txn);

            try
            {
               	Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #22
0
        public static void Main(string[] args)
        {
            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            string data_key   = "E02MUD0Ao1z9154l5fh6309";
            string order_id   = "res_preauth_2";
            string amount     = "1.00";
            string cust_id    = "customer1"; //if sent will be submitted, otherwise cust_id from profile will be used
            string crypt_type = "1";

            USResPreauthCC usResPreauthCC = new USResPreauthCC(data_key, order_id, cust_id, amount, crypt_type);

            //usResPreauthCC.SetExpdate("1601"); //must be YYMM format

            //CustInfo Variables
            CustInfo custInfo = new CustInfo();

            custInfo.SetEmail("*****@*****.**");
            custInfo.SetInstructions("Make it fast!");


            Hashtable b = new Hashtable();

            b.Add("first_name", "Bob");
            b.Add("last_name", "Smith");
            b.Add("company_name", "Widget Company Inc.");
            b.Add("address", "111 Bolts Ave.");
            b.Add("city", "Toronto");
            b.Add("province", "Ontario");
            b.Add("postal_code", "M8T 1T8");
            b.Add("country", "Canada");
            b.Add("phone", "416-555-5555");
            b.Add("fax", "416-555-5555");
            b.Add("tax1", "123.45");          //federal tax
            b.Add("tax2", "12.34");           //prov tax
            b.Add("tax3", "15.45");           //luxury tax
            b.Add("shipping_cost", "456.23"); //shipping cost

            custInfo.SetBilling(b);

            /* OR you can pass the individual args.
             * custInfo.SetBilling(
             *                     "Bob",                  //first name
             *                     "Smith",                //last name
             *                     "Widget Company Inc.",  //company name
             *                     "111 Bolts Ave.",       //address
             *                     "Toronto",              //city
             *                     "Ontario",              //province
             *                     "M8T 1T8",              //postal code
             *                     "Canada",               //country
             *                     "416-555-5555",         //phone
             *                     "416-555-5555",         //fax
             *                     "123.45",               //federal tax
             *                     "12.34",                //prov tax
             *                     "15.45",                //luxury tax
             *                     "456.23"                //shipping cost
             * );
             */

            Hashtable s = new Hashtable();

            s.Add("first_name", "Bob");
            s.Add("last_name", "Smith");
            s.Add("company_name", "Widget Company Inc.");
            s.Add("address", "111 Bolts Ave.");
            s.Add("city", "Toronto");
            s.Add("province", "Ontario");
            s.Add("postal_code", "M8T 1T8");
            s.Add("country", "Canada");
            s.Add("phone", "416-555-5555");
            s.Add("fax", "416-555-5555");
            s.Add("tax1", "123.45");          //federal tax
            s.Add("tax2", "12.34");           //prov tax
            s.Add("tax3", "15.45");           //luxury tax
            s.Add("shipping_cost", "456.23"); //shipping cost

            custInfo.SetShipping(s);

            /* OR you can pass the individual args.
             * custInfo.SetShipping(
             *                     "Bob",                  //first name
             *                     "Smith",                //last name
             *                     "Widget Company Inc.",  //company name
             *                     "111 Bolts Ave.",       //address
             *                     "Toronto",              //city
             *                     "Ontario",              //province
             *                     "M8T 1T8",              //postal code
             *                     "Canada",               //country
             *                     "416-555-5555",         //phone
             *                     "416-555-5555",         //fax
             *                     "123.45",               //federal tax
             *                     "12.34",                //prov tax
             *                     "15.45",                //luxury tax
             *                     "456.23"                //shipping cost
             * );
             */

            Hashtable i1 = new Hashtable();

            i1.Add("name", "item1's name");
            i1.Add("quantity", "5");
            i1.Add("product_code", "item1's product code");
            i1.Add("extended_amount", "1.01");

            custInfo.SetItem(i1);

            /* OR you can pass the individual args.
             * custInfo.SetItem(
             *  "item1's name",         //name
             *  "5",                    //quantity
             *  "item1's product code", //product code
             *  "1.01"                  //extended amount
             * );
             */

            Hashtable i2 = new Hashtable();

            i2.Add("name", "item2's name");
            i2.Add("quantity", "7");
            i2.Add("product_code", "item2's product code");
            i2.Add("extended_amount", "5.01");

            custInfo.SetItem(i2);

            usResPreauthCC.SetCustInfo(custInfo);

            HttpsPostRequest mpgReq = new HttpsPostRequest(host, store_id, api_token, usResPreauthCC);

            /**********************   REQUEST  ************************/

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("DataKey = " + receipt.GetDataKey());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("ResSuccess = " + receipt.GetResSuccess());
                Console.WriteLine("PaymentType = " + receipt.GetPaymentType());

                //ResolveData
                Console.WriteLine("\nCust ID = " + receipt.GetResDataCustId());
                Console.WriteLine("Phone = " + receipt.GetResDataPhone());
                Console.WriteLine("Email = " + receipt.GetResDataEmail());
                Console.WriteLine("Note = " + receipt.GetResDataNote());
                Console.WriteLine("Masked Pan = " + receipt.GetResDataMaskedPan());
                Console.WriteLine("Exp Date = " + receipt.GetResDataExpdate());
                Console.WriteLine("Crypt Type = " + receipt.GetResDataCryptType());
                Console.WriteLine("Avs Street Number = " + receipt.GetResDataAvsStreetNumber());
                Console.WriteLine("Avs Street Name = " + receipt.GetResDataAvsStreetName());
                Console.WriteLine("Avs Zipcode = " + receipt.GetResDataAvsZipcode());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #23
0
        public static void Main(string[] args)
        {
            /******************* REQUEST VARIABLES*******************************/

            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            /****************** TRANSACTION VARIABLES *****************************/

            string order_id;                    //will prompt user for input
            string amount              = "5.00";
            string enc_track2          = "";
            string device_type         = "0812";
            string crypt               = "7";
            string commcard_invoice    = "INVC090";
            string commcard_tax_amount = "1.00";

            Console.Write("Please enter an order ID: ");
            order_id = Console.ReadLine();

            USEncPurchase P = new USEncPurchase(order_id,
                                                amount,
                                                enc_track2,
                                                device_type,
                                                crypt,
                                                commcard_invoice,
                                                commcard_tax_amount);

            /********************* Billing/Shipping Variables ****************************/

            string first_name    = "Bob";
            string last_name     = "Smith";
            string company_name  = "ProLine Inc.";
            string address       = "623 Bears Ave";
            string city          = "Chicago";
            string province      = "Illinois";
            string postal_code   = "M1M2M1";
            string country       = "Canada";
            string phone         = "777-999-7777";
            string fax           = "777-999-7778";
            string tax1          = "10.00";
            string tax2          = "5.78";
            string tax3          = "4.56";
            string shipping_cost = "10.00";

            /********************* Order Line Item Variables *****************************/

            string[] item_description     = new string[] { "Chicago Bears Helmet", "Soldier Field Poster" };
            string[] item_quantity        = new string[] { "1", "1" };
            string[] item_product_code    = new string[] { "CB3450", "SF998S" };
            string[] item_extended_amount = new string[] { "150.00", "19.79" };

            /********************** Customer Information Object **************************/

            CustInfo customer = new CustInfo();

            /********************** Set Customer Billing Information **********************/

            customer.SetBilling(first_name, last_name, company_name, address, city,
                                province, postal_code, country, phone, fax, tax1, tax2,
                                tax3, shipping_cost);

            /******************** Set Customer Shipping Information ***********************/

            customer.SetShipping(first_name, last_name, company_name, address, city,
                                 province, postal_code, country, phone, fax, tax1, tax2,
                                 tax3, shipping_cost);

            /***************************** Order Line Items  ******************************/

            customer.SetItem(item_description[0], item_quantity[0],
                             item_product_code[0], item_extended_amount[0]);

            customer.SetItem(item_description[1], item_quantity[1],
                             item_product_code[1], item_extended_amount[1]);

            P.SetCustInfo(customer);

            HttpsPostRequest mpgReq =
                new HttpsPostRequest(host, store_id, api_token, P);


            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                Console.WriteLine("MaskedPan = " + receipt.GetMaskedPan());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            /************************* Post Request Variables *****************************/

            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            /************************* Transactional Variables ***************************/

            string order_id    = "Need_Unique_Order_IDcc";
            string amount      = "150.00";
            string enc_track2  = "";
            string device_type = "idtech";
            string crypt       = "7";

            /********************* Billing/Shipping Variables ****************************/

            string first_name    = "Bob";
            string last_name     = "Smith";
            string company_name  = "ProLine Inc.";
            string address       = "623 Bears Ave";
            string city          = "Chicago";
            string province      = "Illinois";
            string postal_code   = "M1M2M1";
            string country       = "Canada";
            string phone         = "777-999-7777";
            string fax           = "777-999-7778";
            string tax1          = "10.00";
            string tax2          = "5.78";
            string tax3          = "4.56";
            string shipping_cost = "10.00";

            /********************* Order Line Item Variables *****************************/

            string[] item_description     = new string[] { "Chicago Bears Helmet", "Soldier Field Poster" };
            string[] item_quantity        = new string[] { "1", "1" };
            string[] item_product_code    = new string[] { "CB3450", "SF998S" };
            string[] item_extended_amount = new string[] { "150.00", "19.79" };



            /*****************************************************************************/
            /*								             */
            /*			Customer Information Option 1			     */
            /*									     */
            /*****************************************************************************/

            /********************** Customer Information Object **************************/

            CustInfo customer = new CustInfo();

            /********************** Set Customer Billing Information **********************/

            customer.SetBilling(first_name, last_name, company_name, address, city,
                                province, postal_code, country, phone, fax, tax1, tax2,
                                tax3, shipping_cost);

            /******************** Set Customer Shipping Information ***********************/

            customer.SetShipping(first_name, last_name, company_name, address, city,
                                 province, postal_code, country, phone, fax, tax1, tax2,
                                 tax3, shipping_cost);

            /***************************** Order Line Items  ******************************/

            customer.SetItem(item_description[0], item_quantity[0],
                             item_product_code[0], item_extended_amount[0]);

            customer.SetItem(item_description[1], item_quantity[1],
                             item_product_code[1], item_extended_amount[1]);



            /*****************************************************************************/
            /*								             */
            /*			Customer Information Option 2			     */
            /*									     */
            /*****************************************************************************/



            /********************** Customer Information Object **************************/

            CustInfo customer2 = new CustInfo();

            /******************************* Billing Hashtable ***************************/


            Hashtable b = new Hashtable();      //billing hashtable

            b.Add("first_name", first_name);
            b.Add("last_name", last_name);
            b.Add("company_name", company_name);
            b.Add("address", address);
            b.Add("city", city);
            b.Add("province", province);
            b.Add("postal_code", postal_code);
            b.Add("country", country);
            b.Add("phone", phone);
            b.Add("fax", fax);
            b.Add("tax1", tax1);                   //federal tax
            b.Add("tax2", tax2);                   //prov tax
            b.Add("tax3", tax3);                   //luxury tax
            b.Add("shipping_cost", shipping_cost); //shipping cost

            customer2.SetBilling(b);

            /****************************** Shipping Hashtable ***************************/

            Hashtable s = new Hashtable();      //shipping hashtable

            s.Add("first_name", first_name);
            s.Add("last_name", last_name);
            s.Add("company_name", company_name);
            s.Add("address", address);
            s.Add("city", city);
            s.Add("province", province);
            s.Add("postal_code", postal_code);
            s.Add("country", country);
            s.Add("phone", phone);
            s.Add("fax", fax);
            s.Add("tax1", tax1);                   //federal tax
            s.Add("tax2", tax2);                   //prov tax
            s.Add("tax3", tax3);                   //luxury tax
            s.Add("shipping_cost", shipping_cost); //shipping cost

            customer2.SetShipping(s);

            /************************* Order Line Item1 Hashtable ************************/

            Hashtable i1 = new Hashtable();             //item hashtable #1

            i1.Add("name", item_description[0]);
            i1.Add("quantity", item_quantity[0]);
            i1.Add("product_code", item_product_code[0]);
            i1.Add("extended_amount", item_extended_amount[0]);

            customer2.SetItem(i1);

            /************************* Order Line Item2 Hashtable **************************/

            Hashtable i2 = new Hashtable();             //item hashtable #2

            i2.Add("name", "item2's name");
            i2.Add("quantity", "7");
            i2.Add("product_code", "item2's product code");
            i2.Add("extended_amount", "5.01");

            customer2.SetItem(i2);



            /*************** Miscellaneous Customer Information Methods *******************/

            customer.SetEmail("*****@*****.**");
            customer.SetInstructions("Make it fast!");



            /********************** Transactional Request Object **************************/

            USEncPreauth preauth = new USEncPreauth(order_id, amount, enc_track2, device_type, crypt);

            /************************ Set Customer Information ***************************/

            preauth.SetCustInfo(customer);

            /**************************** Https Post Request ***************************/

            HttpsPostRequest mpgReq =
                new HttpsPostRequest(host, store_id, api_token, preauth);

            /******************************* Receipt ***********************************/

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                Console.WriteLine("MaskedPan = " + receipt.GetMaskedPan());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #25
0
        public static void Test()
        {
            string store_id  = "store5";
            string api_token = "yesguy";
            string order_id  = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string cust_id   = "Lance_Briggs_55";
            string amount    = "5.00";
            string track2    = "5268051119993326=0609AAAAAAAAAAAAA000";
            string processing_country_code = "CA";
            bool   status_check            = false;
            /********************* Billing/Shipping Variables ****************************/
            string first_name    = "Bob";
            string last_name     = "Smith";
            string company_name  = "ProLine Inc.";
            string address       = "623 Bears Ave";
            string city          = "Chicago";
            string province      = "Illinois";
            string postal_code   = "M1M2M1";
            string country       = "Canada";
            string phone         = "777-999-7777";
            string fax           = "777-999-7778";
            string tax1          = "10.00";
            string tax2          = "5.78";
            string tax3          = "4.56";
            string shipping_cost = "10.00";

            /********************* Order Line Item Variables *****************************/
            string[] item_description     = new string[] { "Chicago Bears Helmet", "Soldier Field Poster" };
            string[] item_quantity        = new string[] { "1", "1" };
            string[] item_product_code    = new string[] { "CB3450", "SF998S" };
            string[] item_extended_amount = new string[] { "150.00", "19.79" };
            /********************** Customer Information Object **************************/
            CustInfo customer = new CustInfo();

            /********************** Set Customer Billing Information **********************/
            customer.SetBilling(first_name, last_name, company_name, address, city,
                                province, postal_code, country, phone, fax, tax1, tax2,
                                tax3, shipping_cost);
            /******************** Set Customer Shipping Information ***********************/
            customer.SetShipping(first_name, last_name, company_name, address, city,
                                 province, postal_code, country, phone, fax, tax1, tax2,
                                 tax3, shipping_cost);
            /***************************** Order Line Items ******************************/
            customer.SetItem(item_description[0], item_quantity[0],
                             item_product_code[0], item_extended_amount[0]);
            customer.SetItem(item_description[1], item_quantity[1],
                             item_product_code[1], item_extended_amount[1]);
            /************************** Request *************************/
            IDebitPurchase IOP_Txn = new IDebitPurchase();

            IOP_Txn.SetOrderId(order_id);
            IOP_Txn.SetCustId(cust_id);
            IOP_Txn.SetAmount(amount);
            IOP_Txn.SetIdebitTrack2(track2);
            IOP_Txn.SetCustInfo(customer);
            //IOP_Txn.SetDynamicDescriptor("dynamicdescriptor1");
            HttpsPostRequest mpgReq = new HttpsPostRequest();

            mpgReq.SetProcCountryCode(processing_country_code);
            mpgReq.SetTestMode(true); //false or comment out this line for production transactions
            mpgReq.SetStoreId(store_id);
            mpgReq.SetApiToken(api_token);
            mpgReq.SetTransaction(IOP_Txn);
            mpgReq.SetStatusCheck(status_check);
            mpgReq.Send();
            try
            {
                Receipt receipt = mpgReq.GetReceipt();



                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }