public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id        = "Test20170112020548";
            string amount          = "5.00";
            string txn_number      = "660117311792017012140548199-0_11";
            string crypt           = "7";
            string merchant_ref_no = "319038";

            McRefund mcRefund = new McRefund();

            mcRefund.SetOrderId(order_id);
            mcRefund.SetAmount(amount);
            mcRefund.SetTxnNumber(txn_number);
            mcRefund.SetCryptType(crypt);
            mcRefund.SetMerchantRefNo(merchant_ref_no);

            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(mcRefund);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string host      = "esqa.moneris.com";
            string store_id  = "moneris";
            string api_token = "hurgle";
            string data_key  = "5KTgKraj7prRJ3yFxUi1eFrt5";
            string order_id  = "may8test3";
            string amount    = "1.00";
            string cust_id   = "customer1"; //if sent will be submitted, otherwise cust_id from profile will be used
            string cavv      = "AAABBJg0VhI0VniQEjRWAAAAAAA";

            ResCavvPreauthCC resCavvPreauthCC = new ResCavvPreauthCC(data_key, order_id, cust_id, amount, cavv);

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

            /**********************   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());
                Console.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());

                //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);
            }
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            string store_id  = "store1";
            string api_token = "yesguy";
            string data_key  = "4INQR1A8ocxD0oafSz50LADXy";
            string order_id  = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string amount    = "1.00";
            string cust_id   = "customer1"; //if sent will be submitted, otherwise cust_id from profile will be used
            string cavv      = "AAABBJg0VhI0VniQEjRWAAAAAAA";
            string expdate   = "1911";
            string processing_country_code = "CA";
            bool   status_check            = false;

            CofInfo cof = new CofInfo();

            cof.SetPaymentIndicator("U");
            cof.SetPaymentInformation("2");
            cof.SetIssuerId("168451306048014");

            ResCavvPreauthCC resCavvPreauthCC = new ResCavvPreauthCC();

            resCavvPreauthCC.SetOrderId(order_id);
            resCavvPreauthCC.SetDataKey(data_key);
            resCavvPreauthCC.SetCustId(cust_id);
            resCavvPreauthCC.SetAmount(amount);
            resCavvPreauthCC.SetCavv(cavv);
            //resCavvPreauthCC.SetExpDate(expdate); //mandatory for temp token only
            resCavvPreauthCC.SetThreeDSVersion("2");                                          //Mandatory for 3DS Version 2.0+
            resCavvPreauthCC.SetThreeDSServerTransId("e11d4985-8d25-40ed-99d6-c3803fe5e68f"); //Mandatory for 3DS Version 2.0+ - obtained from MpiCavvLookup or MpiThreeDSAuthentication
            resCavvPreauthCC.SetCofInfo(cof);

            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(resCavvPreauthCC);
            mpgReq.SetStatusCheck(status_check);
            mpgReq.Send();

            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());
                Console.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.WriteLine("IssuerId = " + receipt.GetIssuerId());
                Console.WriteLine("ThreeDSVersion = " + receipt.GetThreeDSVersion());

                //ResolveData
                Console.WriteLine("Cust 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());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id    = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string cust_id     = "CUST13343";
            string amount      = "62.37";
            string pan         = "373269005095005";
            string expiry_date = "2012";           //YYMM
            string auth_code   = "123456";
            string crypt       = "7";

            //Create Table 1 with details
            string n101 = "R6";                           //Entity ID Code
            string n102 = "Retailing Inc. International"; //Name
            string n301 = "919 Oriole Rd.";               //Address Line 1
            string n401 = "Toronto";                      //City
            string n402 = "On";                           //State or Province
            string n403 = "H1T6W3";                       //Postal Code

            string[] ref01 = { "4C", "CR" };              //Reference ID Qualifier
            string[] ref02 = { "M5T3A5", "16802309004" }; //Reference ID


            string big04 = "PO7758545";                 //Purchase Order Number
            string big05 = "RN0049858";                 //Release Number
            string big10 = "INV99870E";                 //Invoice Number

            AxRef axRef1 = new AxRef();

            axRef1.SetRef(ref01[0], ref02[0]);
            axRef1.SetRef(ref01[1], ref02[1]);

            AxN1Loop n1Loop = new AxN1Loop();

            n1Loop.SetN1Loop(n101, n102, n301, n401, n402, n403, axRef1);

            AxTable1 table1 = new AxTable1();

            table1.SetBig04(big04);
            table1.SetBig05(big05);
            table1.SetBig10(big10);
            table1.SetN1Loop(n1Loop);

            //Create Table 2 with details
            //the sum of the extended amount field (pam05) must equal the level 1 amount field

            string[] it102 = { "1", "1", "1", "1", "1" };                                        //Line item quantity invoiced
            string[] it103 = { "EA", "EA", "EA", "EA", "EA" };                                   //Line item unit or basis of measurement code
            string[] it104 = { "10.00", "25.00", "8.62", "10.00", "-10.00" };                    //Line item unit price
            string[] it105 = { "", "", "", "", "" };                                             //Line item basis of unit price code

            string[] it10618 = { "MG", "MG", "MG", "MG", "MG" };                                 //Product/Service ID qualifier
            string[] it10719 = { "DJFR4", "JFJ49", "FEF33", "FEE43", "DISCOUNT" };               //Product/Service ID (corresponds to it10618)

            string[] txi01_GST = { "GS", "GS", "GS", "GS", "GS" };                               //Tax type code
            string[] txi02_GST = { "0.70", "1.75", "1.00", "0.80", "0.00" };                     //Monetary amount
            string[] txi03_GST = { "", "", "", "", "" };                                         //Percent
            string[] txi06_GST = { "", "", "", "", "" };                                         //Tax exempt code

            string[] txi01_PST = { "PG", "PG", "PG", "PG", "PG" };                               //Tax type code
            string[] txi02_PST = { "0.80", "2.00", "1.00", "0.80", "0.00" };                     //Monetary amount
            string[] txi03_PST = { "", "", "", "", "" };                                         //Percent
            string[] txi06_PST = { "", "", "", "", "" };                                         //Tax exempt code

            string[] pam05 = { "11.50", "28.75", "10.62", "11.50", "-10.00" };                   //Extended line-item amount
            string[] pid05 = { "Stapler", "Lamp", "Bottled Water", "Fountain Pen", "DISCOUNT" }; //Line item description

            AxIt106s[] it106s = { new AxIt106s(), new AxIt106s(), new AxIt106s(), new AxIt106s(), new AxIt106s() };

            it106s[0].SetIt10618(it10618[0]);
            it106s[0].SetIt10719(it10719[0]);

            it106s[1].SetIt10618(it10618[1]);
            it106s[1].SetIt10719(it10719[1]);

            it106s[2].SetIt10618(it10618[2]);
            it106s[2].SetIt10719(it10719[2]);

            it106s[3].SetIt10618(it10618[3]);
            it106s[3].SetIt10719(it10719[3]);

            it106s[4].SetIt10618(it10618[4]);
            it106s[4].SetIt10719(it10719[4]);

            AxTxi[] txi = { new AxTxi(), new AxTxi(), new AxTxi(), new AxTxi(), new AxTxi() };

            txi[0].SetTxi(txi01_GST[0], txi02_GST[0], txi03_GST[0], txi06_GST[0]);
            txi[0].SetTxi(txi01_PST[0], txi02_PST[0], txi03_PST[0], txi06_PST[0]);

            txi[1].SetTxi(txi01_GST[1], txi02_GST[1], txi03_GST[1], txi06_GST[1]);
            txi[1].SetTxi(txi01_PST[1], txi02_PST[1], txi03_PST[1], txi06_PST[1]);

            txi[2].SetTxi(txi01_GST[2], txi02_GST[2], txi03_GST[2], txi06_GST[2]);
            txi[2].SetTxi(txi01_PST[2], txi02_PST[2], txi03_PST[2], txi06_PST[2]);

            txi[3].SetTxi(txi01_GST[3], txi02_GST[3], txi03_GST[3], txi06_GST[3]);
            txi[3].SetTxi(txi01_PST[3], txi02_PST[3], txi03_PST[3], txi06_PST[3]);

            txi[4].SetTxi(txi01_GST[4], txi02_GST[4], txi03_GST[4], txi06_GST[4]);
            txi[4].SetTxi(txi01_PST[4], txi02_PST[4], txi03_PST[4], txi06_PST[4]);

            AxIt1Loop it1Loop = new AxIt1Loop();

            it1Loop.SetIt1Loop(it102[0], it103[0], it104[0], it105[0], it106s[0], txi[0], pam05[0], pid05[0]);
            it1Loop.SetIt1Loop(it102[1], it103[1], it104[1], it105[1], it106s[1], txi[1], pam05[1], pid05[1]);
            it1Loop.SetIt1Loop(it102[2], it103[2], it104[2], it105[2], it106s[2], txi[2], pam05[2], pid05[2]);
            it1Loop.SetIt1Loop(it102[3], it103[3], it104[3], it105[3], it106s[3], txi[3], pam05[3], pid05[3]);
            it1Loop.SetIt1Loop(it102[4], it103[4], it104[4], it105[4], it106s[4], txi[4], pam05[4], pid05[4]);

            AxTable2 table2 = new AxTable2();

            table2.SetIt1Loop(it1Loop);

            //Create Table 3 with details

            AxTxi taxTbl3 = new AxTxi();

            taxTbl3.SetTxi("GS", "4.25", "", "");               //sum of GST taxes
            taxTbl3.SetTxi("PG", "4.60", "", "");               //sum of PST taxes
            taxTbl3.SetTxi("TX", "8.85", "", "");               //sum of all taxes

            AxTable3 table3 = new AxTable3();

            table3.SetTxi(taxTbl3);

            AxLevel23 level23 = new AxLevel23();

            level23.SetTable1(table1);
            level23.SetTable2(table2);
            level23.SetTable3(table3);


            AxForcePost axForcePost = new AxForcePost();

            axForcePost.SetOrderId(order_id);
            axForcePost.SetCustId(cust_id);
            axForcePost.SetAmount(amount);
            axForcePost.SetPan(pan);
            axForcePost.SetExpDate(expiry_date);
            axForcePost.SetAuthCode(auth_code);
            axForcePost.SetCryptType(crypt);
            axForcePost.SetAxLevel23(level23);

            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(axForcePost);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id   = "ord-200916-13:29:27";
            string txn_number = "66011731632016264132927986-0_11";

            string customer_code1_c          = "CustomerCode123";
            string card_acceptor_tax_id_c    = "UrTaxId";        //Merchant tax id which is mandatory
            string corporation_vat_number_c  = "cvn123";
            string freight_amount_c          = "1.23";
            string duty_amount_c             = "2.34";
            string ship_to_pos_code_c        = "M1R 1W5";
            string order_date_c              = "141211";
            string customer_vat_number_c     = "customervn231";
            string unique_invoice_number_c   = "uin567";
            string authorized_contact_name_c = "John Walker";

            //Tax Details
            string[] tax_amount_c            = { "1.19", "1.29" };
            string[] tax_rate_c              = { "6.0", "7.0" };
            string[] tax_type_c              = { "GST", "PST" };
            string[] tax_id_c                = { "gst1298", "pst1298" };
            string[] tax_included_in_sales_c = { "Y", "N" };

            //Item Details
            string[] customer_code1_l = { "customer code", "customer code2" };
            string[] line_item_date_l = { "150114", "150114" };
            string[] ship_date_l      = { "150120", "150122" };
            string[] order_date1_l    = { "150114", "150114" };
            string[] medical_services_ship_to_health_industry_number_l = { null, null };
            string[] contract_number_l             = { null, null };
            string[] medical_services_adjustment_l = { null, null };
            string[] medical_services_product_number_qualifier_l = { null, null };
            string[] product_code1_l     = { "pc11", "pc12" };
            string[] item_description_l  = { "Good item", "Better item" };
            string[] item_quantity_l     = { "4", "5" };
            string[] unit_cost_l         = { "1.25", "10.00" };
            string[] item_unit_measure_l = { "EA", "EA" };
            string[] ext_item_amount_l   = { "5.00", "50.00" };
            string[] discount_amount_l   = { "1.00", "50.00" };
            string[] commodity_code_l    = { "cCode11", "cCode12" };
            string[] type_of_supply_l    = { null, null };
            string[] vat_ref_num_l       = { null, null };

            //Tax Details for Items
            string[] tax_amount_l            = { "0.52", "1.48" };
            string[] tax_rate_l              = { "13.0", "13.0" };
            string[] tax_type_l              = { "HST", "HST" };
            string[] tax_id_l                = { "hst1298", "hst1298" };
            string[] tax_included_in_sales_l = { "Y", "Y" };

            //Create and set Tax for McCorpac
            McTax tax_c = new McTax();

            tax_c.SetTax(tax_amount_c[0], tax_rate_c[0], tax_type_c[0], tax_id_c[0], tax_included_in_sales_c[0]);
            tax_c.SetTax(tax_amount_c[1], tax_rate_c[1], tax_type_c[1], tax_id_c[1], tax_included_in_sales_c[1]);

            //Create and set McCorpac for common data - only set values that you know
            McCorpac mcCorpac = new McCorpac();

            mcCorpac.SetCustomerCode1(customer_code1_c);
            mcCorpac.SetCardAcceptorTaxTd(card_acceptor_tax_id_c);
            mcCorpac.SetCorporationVatNumber(corporation_vat_number_c);
            mcCorpac.SetFreightAmount1(freight_amount_c);
            mcCorpac.SetDutyAmount1(duty_amount_c);
            mcCorpac.SetShipToPosCode(ship_to_pos_code_c);
            mcCorpac.SetOrderDate(order_date_c);
            mcCorpac.SetCustomerVatNumber(customer_vat_number_c);
            mcCorpac.SetUniqueInvoiceNumber(unique_invoice_number_c);
            mcCorpac.SetAuthorizedContactName(authorized_contact_name_c);
            mcCorpac.SetTax(tax_c);

            //Create and set Tax for McCorpal
            McTax[] tax_l = new McTax[2];
            tax_l[0] = new McTax();
            tax_l[0].SetTax(tax_amount_l[0], tax_rate_l[0], tax_type_l[0], tax_id_l[0], tax_included_in_sales_l[0]);
            tax_l[1] = new McTax();
            tax_l[1].SetTax(tax_amount_l[1], tax_rate_l[1], tax_type_l[1], tax_id_l[1], tax_included_in_sales_l[1]);

            //Create and set McCorpal for each item
            McCorpal mcCorpal = new McCorpal();

            mcCorpal.SetMcCorpal(customer_code1_l[0], line_item_date_l[0], ship_date_l[0], order_date1_l[0], medical_services_ship_to_health_industry_number_l[0], contract_number_l[0],
                                 medical_services_adjustment_l[0], medical_services_product_number_qualifier_l[0], product_code1_l[0], item_description_l[0], item_quantity_l[0],
                                 unit_cost_l[0], item_unit_measure_l[0], ext_item_amount_l[0], discount_amount_l[0], commodity_code_l[0], type_of_supply_l[0], vat_ref_num_l[0], tax_l[0]);
            mcCorpal.SetMcCorpal(customer_code1_l[1], line_item_date_l[1], ship_date_l[1], order_date1_l[1], medical_services_ship_to_health_industry_number_l[1], contract_number_l[1],
                                 medical_services_adjustment_l[1], medical_services_product_number_qualifier_l[1], product_code1_l[1], item_description_l[1], item_quantity_l[1],
                                 unit_cost_l[1], item_unit_measure_l[1], ext_item_amount_l[1], discount_amount_l[1], commodity_code_l[1], type_of_supply_l[1], vat_ref_num_l[1], tax_l[1]);

            McCorpais mcCorpais = new McCorpais();

            mcCorpais.SetOrderId(order_id);
            mcCorpais.SetTxnNumber(txn_number);
            mcCorpais.SetMcCorpac(mcCorpac);
            mcCorpais.SetMcCorpal(mcCorpal);

            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(mcCorpais);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id   = "ord-160916-15:31:39";
            string txn_number = "18306-0_11";

            string ticket_number               = "X9831083193";
            string passenger_name              = "John Williams";
            string total_fee                   = "0.23";
            string exchange_ticket_number      = "1234567890001";
            string exchange_ticket_amount      = "0.24";
            string travel_agency_code          = "XH1";
            string travel_agency_name          = "AIR FLY";
            string internet_indicator          = "Y";
            string electronic_ticket_indicator = "Y";
            string vat_ref_num                 = "XH13983189";

            string[] conjunction_ticket_number = { "1234567890100", "1234567890101" };

            string[] coupon_number          = { "1", "3", "2" };
            string[] carrier_code1          = { "2R", "2R", "2R" };
            string[] flight_number          = { "1234", "5678", "3456" };
            string[] service_class          = { "A", "B", "C" };
            string[] orig_city_airport_code = { "YVR", "BOS", "NYC" };
            string[] stop_over_code         = { "O", "O", "X" };
            string[] dest_city_airport_code = { "BOS", "NYC", "EWR" };
            string[] fare_basis_code        = { "FClass", "Business", "Business" };
            string[] departure_date1        = { "030113", "030213", "030313" };
            string[] departure_time         = { "1110", "1120", "1130" };
            string[] arrival_time           = { "1210", "1220", "1230" };

            string[] control_id = { "1234567890300", "1234567890301" };

            //Create and set VsCorpai
            VsCorpai vsCorpai = new VsCorpai();

            vsCorpai.SetTicketNumber(ticket_number);
            vsCorpai.SetPassengerName1(passenger_name);
            vsCorpai.SetTotalFee(total_fee);
            vsCorpai.SetExchangeTicketNumber(exchange_ticket_number);
            vsCorpai.SetExchangeTicketAmount(exchange_ticket_amount);
            vsCorpai.SetTravelAgencyCode(travel_agency_code);
            vsCorpai.SetTravelAgencyName(travel_agency_name);
            vsCorpai.SetInternetIndicator(internet_indicator);
            vsCorpai.SetElectronicTicketIndicator(electronic_ticket_indicator);
            vsCorpai.SetVatRefNum(vat_ref_num);

            //Create and set VsCorpais
            //Every Corpas can only have up to 2 TripLegInfo
            VsTripLegInfo[] vsTripLegInfo = { new VsTripLegInfo(), new VsTripLegInfo() };
            vsTripLegInfo[0].SetTripLegInfo(coupon_number[0], carrier_code1[0], flight_number[0], service_class[0], orig_city_airport_code[0], stop_over_code[0], dest_city_airport_code[0], fare_basis_code[0], departure_date1[0], departure_time[0], arrival_time[0]);
            vsTripLegInfo[0].SetTripLegInfo(coupon_number[1], carrier_code1[1], flight_number[1], service_class[1], orig_city_airport_code[1], stop_over_code[1], dest_city_airport_code[1], fare_basis_code[1], departure_date1[1], departure_time[1], arrival_time[1]);

            vsTripLegInfo[1].SetTripLegInfo(coupon_number[2], carrier_code1[2], flight_number[2], service_class[2], orig_city_airport_code[2], stop_over_code[2], dest_city_airport_code[2], fare_basis_code[2], departure_date1[2], departure_time[2], arrival_time[2]);

            VsCorpas vsCorpas = new VsCorpas();

            vsCorpas.SetCorpas(conjunction_ticket_number[0], vsTripLegInfo[0], control_id[0]);
            vsCorpas.SetCorpas(conjunction_ticket_number[1], vsTripLegInfo[1], control_id[1]);

            VsCorpais vsCorpais = new VsCorpais();

            vsCorpais.SetOrderId(order_id);
            vsCorpais.SetTxnNumber(txn_number);
            vsCorpais.SetVsCorpa(vsCorpai, vsCorpas);

            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(vsCorpais);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id        = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string cust_id         = "CUST13343";
            string amount          = "5.00";
            string pan             = "5454545442424242";
            string expiry_date     = "1912";         //YYMM
            string crypt           = "7";
            string merchant_ref_no = "319038";

            McIndependentRefund mcindrefund = new McIndependentRefund();

            mcindrefund.SetOrderId(order_id);
            mcindrefund.SetCustId(cust_id);
            mcindrefund.SetAmount(amount);
            mcindrefund.SetPan(pan);
            mcindrefund.SetExpDate(expiry_date);
            mcindrefund.SetCryptType(crypt);
            mcindrefund.SetMerchantRefNo(merchant_ref_no);

            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(mcindrefund);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 8
0
        public static void Main(string[] args)
        {
            string store_id                = "store5";
            string api_token               = "yesguy";
            string order_id                = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string cust_id                 = "CUS887H67";
            string amount                  = "10.42";
            string pan                     = "4242424242424242";
            string expdate                 = "1911"; //YYMM format
            string cavv                    = "AAABBJg0VhI0VniQEjRWAAAAAAA=";
            string dynamic_descriptor      = "123456";
            string wallet_indicator        = "APP";
            string processing_country_code = "CA";
            string crypt_type              = "5";
            bool   status_check            = false;

            CofInfo cof = new CofInfo();

            cof.SetPaymentIndicator("U");
            cof.SetPaymentInformation("2");
            cof.SetIssuerId("168451306048014");

            CavvPreAuth cavvPreauth = new CavvPreAuth();

            cavvPreauth.SetOrderId(order_id);
            cavvPreauth.SetCustId(cust_id);
            cavvPreauth.SetAmount(amount);
            cavvPreauth.SetPan(pan);
            cavvPreauth.SetExpDate(expdate);
            cavvPreauth.SetCavv(cavv);
            cavvPreauth.SetCryptType(crypt_type);             //Mandatory for AMEX cards only
            cavvPreauth.SetDynamicDescriptor(dynamic_descriptor);
            //cavvPreauth.SetWalletIndicator(wallet_indicator); //set only wallet transactions e.g. APPLE PAY
            //cavvPreauth.SetCmId("8nAK8712sGaAkls56"); //set only for usage with Offlinx - Unique max 50 alphanumeric characters transaction id generated by merchant
            cavvPreauth.SetCofInfo(cof);

            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(cavvPreauth);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.WriteLine("IssuerId = " + receipt.GetIssuerId());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 9
0
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id    = "ord-210916-12:06:38";
            string comp_amount = "62.37";
            string txn_number  = "18924-0_11";
            string crypt       = "7";

            string airline_process_id  = "000";               //Airline three-digit IATA code, Mandatory, Alphanumberic/3
            string invoice_batch       = "580";               //Three-digit code that specifies processing options, Mandatory, Numeric/3
            string establishment_name  = "TestEstablishment"; //Name of the ticket issuer, Mandatory, Alphanumberic/21
            string carrier_name        = "M AIR";             //Name of the ticketing airline, Mandatory, Alphanumberic/8
            string ticket_id           = "83060915430001";    //Ticket or document number, Mandatory, Numeric/14
            string issue_city          = "Toronto";           //Name of the city, Mandatory, Alphanumberic/13
            string establishment_state = "ON";                //State or province code, Mandatory, Alphanumberic/2
            string number_in_party     = "2";                 //Number of the people, Optional, Numeric/3
            string passenger_name      = "TestPassenger";     //Passenger name, Mandatory, Alphanumberic/20
            string taa_routing         = "YYZ";               //Flight stopover and city/airport codes, Mandatory, Alphanumberic/20
            string carrier_code        = "ClassA";            //Carrier designator codes, Mandatory, Alphanumberic/8
            string fare_basis          = "Regular";           //Primary and secondary discount codes, Mandatory, Alphanumberic/24
            string document_type       = "00";                //Airline document type code, Mandatory, Numeric/2
            string doc_number          = "5908";              //Number assigned to the airline document, Mandatory, Numeric/4
            string departure_date      = "0916";              //Departure date, Mandatory, Numeric/4 (MMDD)

            AxRaLevel23 raLevel23 = new AxRaLevel23();

            raLevel23.SetAirlineProcessId(airline_process_id);
            raLevel23.SetInvoiceBatch(invoice_batch);
            raLevel23.SetEstablishmentName(establishment_name);
            raLevel23.SetCarrierName(carrier_name);
            raLevel23.SetTicketId(ticket_id);
            raLevel23.SetIssueCity(issue_city);
            raLevel23.SetEstablishmentState(establishment_state);
            raLevel23.SetNumberInParty(number_in_party);
            raLevel23.SetPassengerName(passenger_name);
            raLevel23.SetTaaRouting(taa_routing);
            raLevel23.SetCarrierCode(carrier_code);
            raLevel23.SetFareBasis(fare_basis);
            raLevel23.SetDocumentType(document_type);
            raLevel23.SetDocNumber(doc_number);
            raLevel23.SetDepartureDate(departure_date);

            AxRaCompletion axRaCompletion = new AxRaCompletion();

            axRaCompletion.SetOrderId(order_id);
            axRaCompletion.SetCompAmount(comp_amount);
            axRaCompletion.SetTxnNumber(txn_number);
            axRaCompletion.SetCryptType(crypt);
            axRaCompletion.SetAxRaLevel23(raLevel23);

            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(axRaCompletion);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 10
0
        public static void Main(string[] args)
        {
            string store_id                = "monca00392";
            string api_token               = "qYdISUhHiOdfTr1CLNpN";
            string order_id                = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string cust_id                 = "B_Urlac_54";
            string amount                  = "10.42";
            string pan                     = "4005554444444403";
            string expdate                 = "1901"; //YYMM format
            string cavv                    = "AAABBJg0VhI0VniQEjRWAAAAAAA";
            string crypt_type              = "5";
            string convenience_fee         = "1.00";
            string dynamic_descriptor      = "my descriptor";
            string processing_country_code = "CA";
            bool   status_check            = false;

            AvsInfo avsCheck = new AvsInfo();

            avsCheck.SetAvsStreetNumber("212");
            avsCheck.SetAvsStreetName("Payton Street");
            avsCheck.SetAvsZipCode("M1M1M1");

            CvdInfo cvdCheck = new CvdInfo();

            cvdCheck.SetCvdIndicator("1");
            cvdCheck.SetCvdValue("099");

            ConvFeeInfo convFeeInfo = new ConvFeeInfo();

            convFeeInfo.SetConvenienceFee(convenience_fee);

            CavvPurchase cavvPurchase = new CavvPurchase();

            cavvPurchase.SetOrderId(order_id);
            cavvPurchase.SetCustId(cust_id);
            cavvPurchase.SetAmount(amount);
            cavvPurchase.SetPan(pan);
            cavvPurchase.SetExpDate(expdate);
            cavvPurchase.SetCavv(cavv);
            cavvPurchase.SetCryptType(crypt_type);             //Mandatory for AMEX cards only
            cavvPurchase.SetDynamicDescriptor(dynamic_descriptor);
            cavvPurchase.SetAvsInfo(avsCheck);
            cavvPurchase.SetCvdInfo(cvdCheck);
            cavvPurchase.SetConvFeeInfo(convFeeInfo);

            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(cavvPurchase);
            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.WriteLine("Avs Response = " + receipt.GetAvsResultCode());
                Console.WriteLine("Cvd Response = " + receipt.GetCvdResultCode());
                //Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                Console.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.WriteLine("CfSuccess = " + receipt.GetCfSuccess());
                Console.WriteLine("CfStatus = " + receipt.GetCfStatus());
                Console.WriteLine("FeeAmount = " + receipt.GetFeeAmount());
                Console.WriteLine("FeeRate = " + receipt.GetFeeRate());
                Console.WriteLine("FeeType = " + receipt.GetFeeType());
                //Console.WriteLine("StatusCode = " + receipt.GetStatusCode());
                //Console.WriteLine("StatusMessage = " + receipt.GetStatusMessage());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id                = "store5";
            string api_token               = "yesguy";
            string order_id                = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string cust_id                 = "CUS887H67";
            string amount                  = "10.42";
            string pan                     = "4242424242424242";
            string expdate                 = "1901"; //YYMM
            string cavv                    = "AAABBJg0VhI0VniQEjRWAAAAAAA=";
            string dynamic_descriptor      = "123456";
            string wallet_indicator        = "APP";
            string processing_country_code = "CA";
            string crypt_type              = "5";
            bool   status_check            = false;

            /************************* Recur Variables **********************************/

            string recur_unit   = "month"; //eom = end of month
            string start_now    = "true";
            string start_date   = "2018/02/25";
            string num_recurs   = "12";
            string period       = "1";
            string recur_amount = "30.00";

            /************************* Recur Object Option1 ******************************/

            Recur recurring_cycle = new Recur(recur_unit, start_now, start_date,
                                              num_recurs, period, recur_amount);

            /************************* Recur Object Option2 ******************************/

            Hashtable recur_hash = new Hashtable();

            recur_hash.Add("recur_unit", recur_unit);
            recur_hash.Add("start_now", start_now);
            recur_hash.Add("start_date", start_date);
            recur_hash.Add("num_recurs", num_recurs);
            recur_hash.Add("period", period);
            recur_hash.Add("recur_amount", recur_amount);

            Recur recurring_cycle2 = new Recur(recur_hash);

            CofInfo cof = new CofInfo();

            cof.SetPaymentIndicator("R");
            cof.SetPaymentInformation("2");
            cof.SetIssuerId("168451306048014");

            CavvPurchase cavvPurchase = new CavvPurchase();

            cavvPurchase.SetOrderId(order_id);
            cavvPurchase.SetCustId(cust_id);
            cavvPurchase.SetAmount(amount);
            cavvPurchase.SetPan(pan);
            cavvPurchase.SetExpDate(expdate);
            cavvPurchase.SetCavv(cavv);
            cavvPurchase.SetCryptType(crypt_type);                                        //Mandatory for AMEX cards only
            cavvPurchase.SetDynamicDescriptor(dynamic_descriptor);
            cavvPurchase.SetThreeDSVersion("2");                                          //Mandatory for 3DS Version 2.0+
            cavvPurchase.SetThreeDSServerTransId("e11d4985-8d25-40ed-99d6-c3803fe5e68f"); //Mandatory for 3DS Version 2.0+ - obtained from MpiCavvLookup or MpiThreeDSAuthentication
            //cavvPurchase.SetNetwork("Interac");  //set only for Interac e-commerce
            //cavvPurchase.SetDataType("3DSecure"); //set only for Interac e-commerce
            //cavvPurchase.SetWalletIndicator(wallet_indicator); //set only wallet transactions e.g. APPLE PAY

            cavvPurchase.SetRecur(recurring_cycle);
            cavvPurchase.SetCofInfo(cof);

            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(cavvPurchase);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.WriteLine("IssuerId = " + receipt.GetIssuerId());
                Console.WriteLine("ThreeDSVersion = " + receipt.GetThreeDSVersion());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        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_12345";
            string cust_id            = "CUS887H67";
            string amount             = "1.00";
            string pan                = "4242424242424242";
            string expiry_date        = "1111";
            string cavv               = "AAABBJg0VhI0VniQEjRWAAAAAAA=";
            string dynamic_descriptor = "123456";

            /************************ Transaction Object Option1 *************************/

            CavvPreAuth cavvPreauth
                = new CavvPreAuth(order_id, cust_id, amount, pan, expiry_date, cavv);

            cavvPreauth.SetDynamicDescriptor(dynamic_descriptor);

            /************************ Transaction Object Option2 *************************/

            Hashtable cavvParams = new Hashtable();     //transaction hashtable option

            cavvParams.Add("order_id", order_id);
            cavvParams.Add("cust_id", cust_id);
            cavvParams.Add("amount", amount);
            cavvParams.Add("pan", pan);
            cavvParams.Add("expdate", expiry_date);
            cavvParams.Add("cavv", cavv);

            CavvPreAuth cavvPreauth2
                = new CavvPreAuth(cavvParams);                 //single paramater hashtable construtor

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

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

            /****************************** 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("CavvResultCode = " + receipt.GetCavvResultCode());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id   = "ord-041016-17:35:35";
            string txn_number = "66011731772016278173536680-0_11";

            //Common Data
            string customer_code1_c = "CustomerCode123";
            string additional_card_acceptor_data_c = "acad1";
            string austin_tetra_number_c           = "atn1";
            string naics_code_c                     = "nc1";
            string card_acceptor_type_c             = "0000nnnn";
            string card_acceptor_tax_id_c           = "Moneristaxid1";
            string corporation_vat_number_c         = "cvn123";
            string card_acceptor_reference_number_c = "carn1";
            string freight_amount1_c                = "1.23";
            string duty_amount1_c                   = "2.34";
            string destination_province_code_c      = "ONT";
            string destination_country_code_c       = "CAN";
            string ship_from_pos_code_c             = "M8X 2X2";
            string ship_to_pos_code_c               = "_M1R 1R5";
            string order_date_c                     = "141211";
            string card_acceptor_vat_number_c       = "cavn1";
            string customer_vat_number_c            = "customervn231";
            string unique_invoice_number_c          = "uin567";
            string commodity_code_c                 = "paCCC1";
            string authorized_contact_name_c        = "John Walker";
            string authorized_contact_phone_c       = "416-734-1000";

            //Common Tax Details
            string[] tax_amount_c            = { "1.19", "1.29" };
            string[] tax_rate_c              = { "6.0", "7.0" };
            string[] tax_type_c              = { "GST", "PST" };
            string[] tax_id_c                = { "gst1298", "pst1298" };
            string[] tax_included_in_sales_c = { "Y", "N" };

            //General Passenger Ticket Information
            string passenger_name1_i           = "MCC Tester";
            string ticket_number1_i            = "1234567890001";
            string travel_agency_name_i        = "Moneris Travel";
            string travel_agency_code_i        = "MC322";
            string issuing_carrier_i           = "2R";
            string customer_code1_i            = "passengerabc";
            string issue_date_i                = "141210";
            string total_fare_i                = "129.45";
            string travel_authorization_code_i = "sde-erdsz-452112";
            string total_fee_i   = "10.34";
            string total_taxes_i = "11.56";
            string restricted_ticket_indicator_i = "1";
            string exchange_ticket_amount_i      = "13.98";
            string exchange_fee_amount_i         = "1.78";
            string iata_client_code_i            = "icc2";

            //Tax Details for passenger
            string[] tax_amount_i            = { "3.28" };
            string[] tax_rate_i              = { "13.00" };
            string[] tax_type_i              = { "HST" };
            string[] tax_id_i                = { "hst1298" };
            string[] tax_included_in_sales_i = { "Y" };

            //Passenger Air Travel Details
            string[] travel_date_s                = { "150101", "150102" };
            string[] carrier_code1_s              = { "3R", "4R" };
            string[] service_class_s              = { "E", "B" };
            string[] orig_city_airport_code_s     = { "Toron", "Montr" };
            string[] dest_city_airport_code_s     = { "Montr", "Halif" };
            string[] stop_over_code_s             = { "", "X" };
            string[] coupon_number1_s             = { "1", "2" };
            string[] fare_basis_code1_s           = { "FClass", "SClass" };
            string[] flight_number_s              = { "56786", "54386" };
            string[] departure_time_s             = { "1920", "1120" };
            string[] arrival_time_s               = { "0620", "1620" };
            string[] conjunction_ticket_number1_s = { "123456789054367", null };
            string[] exchange_ticket_number1_s    = { "123456789067892", null };
            string[] fare_s  = { "1.69", null };
            string[] fee_s   = { "1.48", null };
            string[] taxes_s = { "3.91", null };
            string[] endorsement_restrictions_s = { "er6", null };

            //Tax Details for Air Travel
            string[] tax_amount_s            = { "4.67", "7.43" };
            string[] tax_rate_s              = { "5.0", "9.975" };
            string[] tax_type_s              = { "GST", "QST" };
            string[] tax_id_s                = { "gst1298", "qst1298" };
            string[] tax_included_in_sales_s = { "Y", "Y" };

            //Passenger Rail Details
            string[] passenger_name1_r                 = { "Passenger Namer", "Passenger Namer1" };
            string[] ticket_number1_r                  = { "1234567890002", "1234567890003" };
            string[] travel_agency_code_r              = { "TAC1", "TAC2" };
            string[] travel_agency_name_r              = { "Daily Travel", "Daily Travel" };
            string[] travel_date_r                     = { "141223", "141222" };
            string[] sequence_number_r                 = { "001", "002" };
            string[] service_type_r                    = { "01", "02" };
            string[] service_nature_r                  = { "01", "02" };
            string[] service_amount_r                  = { "788.34", "56.34" };
            string[] full_vat_gross_amount_r           = { "68.12", null };
            string[] start_station_r                   = { "Vanco", "Calgr" };
            string[] destination_station_r             = { "Calgr", "Winpg" };
            string[] number_of_adults_r                = { "2", "4" };
            string[] number_of_children_r              = { "3", "6" };
            string[] class_of_ticket_r                 = { "E", "B" };
            string[] procedure_id_r                    = { "RS-23IVTY", null };
            string[] full_vat_tax_amount_r             = { "4.49", null };
            string[] half_vat_gross_amount_r           = { "1.08", null };
            string[] half_vat_tax_amount_r             = { "0.87", null };
            string[] traffic_code_r                    = { "665", null };
            string[] sample_number_r                   = { "125", null };
            string[] generic_code_r                    = { "66", null };
            string[] generic_number_r                  = { "gn2", null };
            string[] generic_other_code_r              = { "13", null };
            string[] generic_other_number_r            = { "gon2", null };
            string[] reduction_code_r                  = { "14", null };
            string[] reduction_number_r                = { "rn2", null };
            string[] reduction_other_code_r            = { "17", null };
            string[] reduction_other_number_r          = { "ron2", null };
            string[] transportation_other_code_r       = { "115", null };
            string[] transportation_service_provider_r = { "tsp2", null };
            string[] transportation_service_offered_r  = { "tso2", null };

            //Create and set Tax for McCorpac
            McTax mcTax_c = new McTax();

            mcTax_c.SetTax(tax_amount_c[0], tax_rate_c[0], tax_type_c[0], tax_id_c[0], tax_included_in_sales_c[0]);
            mcTax_c.SetTax(tax_amount_c[1], tax_rate_c[1], tax_type_c[1], tax_id_c[1], tax_included_in_sales_c[1]);

            //Create and set McCorpac for common data - only set values that you know
            McCorpac mcCorpac = new McCorpac();

            mcCorpac.SetCustomerCode1(customer_code1_c);
            mcCorpac.SetAdditionalCardAcceptorData(additional_card_acceptor_data_c);
            mcCorpac.SetAustinTetraNumber(austin_tetra_number_c);
            mcCorpac.SetNaicsCode(naics_code_c);
            mcCorpac.SetCardAcceptorType(card_acceptor_type_c);
            mcCorpac.SetCardAcceptorTaxTd(card_acceptor_tax_id_c);
            mcCorpac.SetCorporationVatNumber(corporation_vat_number_c);
            mcCorpac.SetCardAcceptorReferenceNumber(card_acceptor_reference_number_c);
            mcCorpac.SetFreightAmount1(freight_amount1_c);
            mcCorpac.SetDutyAmount1(duty_amount1_c);
            mcCorpac.SetDestinationProvinceCode(destination_province_code_c);
            mcCorpac.SetDestinationCountryCode(destination_country_code_c);
            mcCorpac.SetShipFromPosCode(ship_from_pos_code_c);
            mcCorpac.SetShipToPosCode(ship_to_pos_code_c);
            mcCorpac.SetOrderDate(order_date_c);
            mcCorpac.SetCardAcceptorVatNumber(card_acceptor_vat_number_c);
            mcCorpac.SetCustomerVatNumber(customer_vat_number_c);
            mcCorpac.SetUniqueInvoiceNumber(unique_invoice_number_c);
            mcCorpac.SetCommodityCode(commodity_code_c);
            mcCorpac.SetAuthorizedContactName(authorized_contact_name_c);
            mcCorpac.SetAuthorizedContactPhone(authorized_contact_phone_c);
            mcCorpac.SetTax(mcTax_c);

            //Create and set Tax for McCorpai
            McTax mcTax_i = new McTax();

            mcTax_i.SetTax(tax_amount_i[0], tax_rate_i[0], tax_type_i[0], tax_id_i[0], tax_included_in_sales_i[0]);

            //Create and set McCorpai
            McCorpai mcCorpai = new McCorpai();

            mcCorpai.SetPassengerName1(passenger_name1_i);
            mcCorpai.SetTicketNumber1(ticket_number1_i);
            mcCorpai.SetTravelAgencyName(travel_agency_name_i);
            mcCorpai.SetTravelAgencyCode(travel_agency_code_i);
            mcCorpai.SetIssuingCarrier(issuing_carrier_i);
            mcCorpai.SetCustomerCode1(customer_code1_i);
            mcCorpai.SetIssueDate(issue_date_i);
            mcCorpai.SetTotalFare(total_fare_i);
            mcCorpai.SetTravelAuthorizationCode(travel_authorization_code_i);
            mcCorpai.SetTotalFee(total_fee_i);
            mcCorpai.SetTotalTaxes(total_taxes_i);
            mcCorpai.SetRestrictedTicketIndicator(restricted_ticket_indicator_i);
            mcCorpai.SetExchangeTicketAmount(exchange_ticket_amount_i);
            mcCorpai.SetExchangeFeeAmount(exchange_fee_amount_i);
            mcCorpai.SetIataClientCode(iata_client_code_i);
            mcCorpai.SetTax(mcTax_i);

            //Create and set Tax for McCorpas
            McTax[] mcTax_s = new McTax[2];
            mcTax_s[0] = new McTax();
            mcTax_s[0].SetTax(tax_amount_s[0], tax_rate_s[0], tax_type_s[0], tax_id_s[0], tax_included_in_sales_s[0]);
            mcTax_s[1] = new McTax();
            mcTax_s[1].SetTax(tax_amount_s[1], tax_rate_s[1], tax_type_s[1], tax_id_s[1], tax_included_in_sales_s[1]);

            //Create and set McCorpas for Air Travel Details only
            McCorpas mcCorpas = new McCorpas();

            mcCorpas.SetMcCorpas(travel_date_s[0], carrier_code1_s[0], service_class_s[0], orig_city_airport_code_s[0], dest_city_airport_code_s[0], stop_over_code_s[0],
                                 conjunction_ticket_number1_s[0], exchange_ticket_number1_s[0], coupon_number1_s[0], fare_basis_code1_s[0], flight_number_s[0], departure_time_s[0],
                                 arrival_time_s[0], fare_s[0], fee_s[0], taxes_s[0], endorsement_restrictions_s[0], mcTax_s[0]);
            mcCorpas.SetMcCorpas(travel_date_s[1], carrier_code1_s[1], service_class_s[1], orig_city_airport_code_s[1], dest_city_airport_code_s[1], stop_over_code_s[1],
                                 conjunction_ticket_number1_s[1], exchange_ticket_number1_s[1], coupon_number1_s[1], fare_basis_code1_s[1], flight_number_s[1], departure_time_s[1],
                                 arrival_time_s[1], fare_s[1], fee_s[1], taxes_s[1], endorsement_restrictions_s[1], mcTax_s[1]);

            //Create and set McCorpar for Rail Travel Details only
            McCorpar mcCorpar = new McCorpar();

            mcCorpar.SetMcCorpar(passenger_name1_r[0], ticket_number1_r[0], travel_agency_code_r[0], travel_agency_name_r[0], travel_date_r[0], sequence_number_r[0], procedure_id_r[0], service_type_r[0],
                                 service_nature_r[0], service_amount_r[0], full_vat_gross_amount_r[0], full_vat_tax_amount_r[0], half_vat_gross_amount_r[0], half_vat_tax_amount_r[0], traffic_code_r[0],
                                 sample_number_r[0], start_station_r[0], destination_station_r[0], generic_code_r[0], generic_number_r[0], generic_other_code_r[0], generic_other_number_r[0], reduction_code_r[0],
                                 reduction_number_r[0], reduction_other_code_r[0], reduction_other_number_r[0], transportation_other_code_r[0], number_of_adults_r[0], number_of_children_r[0],
                                 class_of_ticket_r[0], transportation_service_provider_r[0], transportation_service_offered_r[0]);
            mcCorpar.SetMcCorpar(passenger_name1_r[1], ticket_number1_r[1], travel_agency_code_r[1], travel_agency_name_r[1], travel_date_r[1], sequence_number_r[1], procedure_id_r[1], service_type_r[1],
                                 service_nature_r[1], service_amount_r[1], full_vat_gross_amount_r[1], full_vat_tax_amount_r[1], half_vat_gross_amount_r[1], half_vat_tax_amount_r[1], traffic_code_r[1],
                                 sample_number_r[1], start_station_r[1], destination_station_r[1], generic_code_r[1], generic_number_r[1], generic_other_code_r[1], generic_other_number_r[1], reduction_code_r[1],
                                 reduction_number_r[1], reduction_other_code_r[1], reduction_other_number_r[1], transportation_other_code_r[1], number_of_adults_r[1], number_of_children_r[1],
                                 class_of_ticket_r[1], transportation_service_provider_r[1], transportation_service_offered_r[1]);

            McCorpais mcCorpais = new McCorpais();

            mcCorpais.SetOrderId(order_id);
            mcCorpais.SetTxnNumber(txn_number);
            mcCorpais.SetMcCorpac(mcCorpac);
            mcCorpais.SetMcCorpai(mcCorpai);
            mcCorpais.SetMcCorpas(mcCorpas);
            mcCorpais.SetMcCorpar(mcCorpar);

            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(mcCorpais);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id        = "Test20170116043144";
            string amount          = "5.00";
            string txn_number      = "39011-0_11";
            string crypt           = "7";
            string national_tax    = "1.23";
            string merchant_vat_no = "gstno111";
            string local_tax       = "2.34";
            string customer_vat_no = "gstno999";
            string cri             = "CUST-REF-002";
            string customer_code   = "ccvsfp";
            string invoice_number  = "invsfp";
            string local_tax_no    = "ltaxno";

            VsRefund vsRefund = new VsRefund();

            vsRefund.SetOrderId(order_id);
            vsRefund.SetAmount(amount);
            vsRefund.SetTxnNumber(txn_number);
            vsRefund.SetCryptType(crypt);
            vsRefund.SetNationalTax(national_tax);
            vsRefund.SetMerchantVatNo(merchant_vat_no);
            vsRefund.SetLocalTax(local_tax);
            vsRefund.SetCustomerVatNo(customer_vat_no);
            vsRefund.SetCri(cri);
            vsRefund.SetCustomerCode(customer_code);
            vsRefund.SetInvoiceNumber(invoice_number);
            vsRefund.SetLocalTaxNo(local_tax_no);

            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(vsRefund);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 15
0
        public static void Main(string[] args)
        {
            string store_id  = "moneris";
            string api_token = "hurgle";
            string processing_country_code = "CA";
            bool   status_check            = false;

            string order_id   = "ord-160916-15:31:39";
            string txn_number = "18306-0_11";

            string buyer_name             = "Buyer Manager";
            string local_tax_rate         = "13.00";
            string duty_amount            = "0.00";
            string discount_treatment     = "0";
            string discount_amt           = "0.00";
            string freight_amount         = "0.20";
            string ship_to_pos_code       = "M8X 2W8";
            string ship_from_pos_code     = "M1K 2Y7";
            string des_cou_code           = "CAN";
            string vat_ref_num            = "VAT12345";
            string tax_treatment          = "3";   //3 = Gross prices given with tax information provided at invoice level
            string gst_hst_freight_amount = "0.00";
            string gst_hst_freight_rate   = "13.00";

            string[] item_com_code       = { "X3101", "X84802" };
            string[] product_code        = { "CHR123", "DDSK200" };
            string[] item_description    = { "Office Chair", "Disk Drive" };
            string[] item_quantity       = { "3", "1" };
            string[] item_uom            = { "EA", "EA" };
            string[] unit_cost           = { "0.20", "0.40" };
            string[] vat_tax_amt         = { "0.00", "0.00" };
            string[] vat_tax_rate        = { "13.00", "13.00" };
            string[] discount_treatmentL = { "0", "0" };
            string[] discount_amtL       = { "0.00", "0.00" };

            //Create and set VsPurcha
            VsPurcha vsPurcha = new VsPurcha();

            vsPurcha.SetBuyerName(buyer_name);
            vsPurcha.SetLocalTaxRate(local_tax_rate);
            vsPurcha.SetDutyAmount(duty_amount);
            vsPurcha.SetDiscountTreatment(discount_treatment);
            vsPurcha.SetDiscountAmt(discount_amt);
            vsPurcha.SetFreightAmount(freight_amount);
            vsPurcha.SetShipToPostalCode(ship_to_pos_code);
            vsPurcha.SetShipFromPostalCode(ship_from_pos_code);
            vsPurcha.SetDesCouCode(des_cou_code);
            vsPurcha.SetVatRefNum(vat_ref_num);
            vsPurcha.SetTaxTreatment(tax_treatment);
            vsPurcha.SetGstHstFreightAmount(gst_hst_freight_amount);
            vsPurcha.SetGstHstFreightRate(gst_hst_freight_rate);

            //Create and set VsPurchl
            VsPurchl vsPurchl = new VsPurchl();

            vsPurchl.SetVsPurchl(item_com_code[0], product_code[0], item_description[0], item_quantity[0], item_uom[0], unit_cost[0], vat_tax_amt[0], vat_tax_rate[0], discount_treatmentL[0], discount_amtL[0]);
            vsPurchl.SetVsPurchl(item_com_code[1], product_code[1], item_description[1], item_quantity[1], item_uom[1], unit_cost[1], vat_tax_amt[1], vat_tax_rate[1], discount_treatmentL[1], discount_amtL[1]);

            VsCorpais vsCorpais = new VsCorpais();

            vsCorpais.SetOrderId(order_id);
            vsCorpais.SetTxnNumber(txn_number);
            vsCorpais.SetVsPurch(vsPurcha, vsPurchl);

            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(vsCorpais);
            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.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }