예제 #1
0
        public static void Main(string[] args)
        {
            string order_id   = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string store_id   = "store1";
            string api_token  = "yesguy";
            string data_key   = "eLqsADfwqHDxIpJG9vLnELx01";
            string amount     = "1.00";
            string cust_id    = "customer1"; //if sent will be submitted, otherwise cust_id from profile will be used
            string crypt_type = "2";
            string processing_country_code = "CA";
            bool   status_check            = false;

            ResPurchaseCC resPurchaseCC = new ResPurchaseCC();

            resPurchaseCC.SetDataKey(data_key);
            resPurchaseCC.SetOrderId(order_id);
            resPurchaseCC.SetCustId(cust_id);
            resPurchaseCC.SetAmount(amount);
            resPurchaseCC.SetCryptType(crypt_type);

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

            string recur_unit   = "month";
            string start_now    = "true";
            string start_date   = "2019/12/01";
            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);

            resPurchaseCC.SetRecur(recurring_cycle);

            /********************* Credential on File *****************************************/
            CofInfo cof = new CofInfo();

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

            resPurchaseCC.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(resPurchaseCC);
            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("AVSResponse = " + receipt.GetAvsResultCode());
                Console.WriteLine("CVDResponse = " + receipt.GetCvdResultCode());
                Console.WriteLine("RecurSuccess = " + receipt.GetRecurSuccess());
                Console.WriteLine("ResSuccess = " + receipt.GetResSuccess());
                Console.WriteLine("PaymentType = " + receipt.GetPaymentType());
                Console.WriteLine("IssuerId = " + receipt.GetIssuerId());

                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 order_id  = "dotnetaschdebitrecurtest12323";
            string store_id  = "monusqa002";
            string api_token = "qatoken";
            string amount    = "1.00";

            //ACHInfo Variables
            string sec                     = "ppd";
            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                    = "t071000013t742941347o128";
            string dl_num                  = "CO-12312312";
            string magstripe               = "no";
            string image_front             = "";
            string image_back              = "";
            string processing_country_code = "US";
            bool   status_check            = false;

            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();

            achdebit.SetOrderId(order_id);
            achdebit.SetAmount(amount);
            achdebit.SetAchInfo(achinfo);

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

            //Cust_id Variable
            string cust_id = "customer1";

            achdebit.SetCustId(cust_id);

            //Recur Variables
            //hard coded values for testing
            string recur_unit   = "month"; //valid values are (day,week,month)
            string start_now    = "true";  //valid values are (true,false)
            string start_date   = "2018/10/01";
            string num_recurs   = "12";
            string period       = "1";
            string recur_amount = "1.01";

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

            achdebit.SetRecurInfo(recurInfo);

            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(achdebit);
            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("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());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string store_id                = "monusqa002";
            string api_token               = "qatoken";
            string order_id                = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string amount                  = "5.00";
            string crypt                   = "7";
            string commcard_invoice        = "INVC090";
            string commcard_tax_amount     = "1.00";
            string processing_country_code = "US";
            bool   status_check            = false;
            string enc_track2              = "028400850000000004142348E7643B2599ACC00517C5AB6FB164486B1A4A83E7A81048D6CBA51604FDD12B72C228028E727AF6664C7A0431393035FFFF3141594047A0009E79C903";
            string device_type             = "idtech";

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

            string recur_unit   = "month";
            string start_now    = "true";
            string start_date   = "2018/12/01";
            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);

            EncPurchase encpurchase = new EncPurchase();

            encpurchase.SetOrderId(order_id);
            encpurchase.SetAmount(amount);
            encpurchase.SetEncTrack2(enc_track2);
            encpurchase.SetDeviceType(device_type);
            encpurchase.SetCryptType(crypt);
            encpurchase.SetCommcardInvoice(commcard_invoice);
            encpurchase.SetCommcardTaxAmount(commcard_tax_amount);
            encpurchase.SetRecur(recurring_cycle);

            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(encpurchase);
            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("Recur Success = " + receipt.GetRecurSuccess());
                Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                Console.WriteLine("MaskedPan = " + receipt.GetMaskedPan());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            /********************** Request Variables ****************************/

            string store_id  = "monusqa002";
            string api_token = "qatoken";

            /********************** Transaction Variables ************************/

            string data_key = "QMlFZodHBk5K102EKnoyobs1N";
            string order_id = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string cust_id  = "Hilton_1";
            string amount   = "1.00";
            string processing_country_code = "US";

            /*********************** Recur Varables ******************************/

            string recur_unit   = "month";
            string start_now    = "true";
            string start_date   = "2019/12/12";
            string num_recurs   = "12";
            string period       = "1";
            string recur_amount = "1.00";

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

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

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

            ResPurchaseAch resPurchaseAch = new ResPurchaseAch();

            resPurchaseAch.SetDataKey(data_key);
            resPurchaseAch.SetOrderId(order_id);
            resPurchaseAch.SetCustId(cust_id);
            resPurchaseAch.SetAmount(amount);
            resPurchaseAch.SetRecur(monthlyPayment);

            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(resPurchaseAch);
            mpgReq.Send();

            /************************ Receipt Object ******************************/

            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("RecurSuccess = " + receipt.GetRecurSuccess());
                Console.WriteLine("ResSuccess = " + receipt.GetResSuccess());
                Console.WriteLine("PaymentType = " + receipt.GetPaymentType() + "\n");

                Console.WriteLine("Cust ID = " + receipt.GetResCustId());
                Console.WriteLine("Phone = " + receipt.GetResPhone());
                Console.WriteLine("Email = " + receipt.GetResEmail());
                Console.WriteLine("Note = " + receipt.GetResNote());
                Console.WriteLine("Sec = " + receipt.GetResSec());
                Console.WriteLine("Cust First Name = " + receipt.GetResCustFirstName());
                Console.WriteLine("Cust Last Name = " + receipt.GetResCustLastName());
                Console.WriteLine("Cust Address1 = " + receipt.GetResCustAddress1());
                Console.WriteLine("Cust Address2 = " + receipt.GetResCustAddress2());
                Console.WriteLine("Cust City = " + receipt.GetResCustCity());
                Console.WriteLine("Cust State = " + receipt.GetResCustState());
                Console.WriteLine("Cust Zip = " + receipt.GetResCustZip());
                Console.WriteLine("Routing Num = " + receipt.GetResRoutingNum());
                Console.WriteLine("Account Num = " + receipt.GetResAccountNum());
                Console.WriteLine("Masked Account Num = " + receipt.GetResMaskedAccountNum());
                Console.WriteLine("Check Num = " + receipt.GetResCheckNum());
                Console.WriteLine("Account Type = " + receipt.GetResAccountType());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 public void SetRecur(Recur recur)
 {
     recurInfo = recur;
 }
        public static void Main(string[] args)
        {
            string store_id    = "store5";
            string api_token   = "yesguy";
            string order_id    = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string amount      = "10.00";
            string pan         = "4242424242424242";
            string expiry_date = "1901"; //YYMM format
            string crypt       = "7";

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

            string recur_unit              = "month"; //eom = end of month
            string start_now               = "true";
            string start_date              = "2016/07/28";
            string num_recurs              = "12";
            string period                  = "1";
            string recur_amount            = "30.00";
            string processing_country_code = "CA";
            bool   status_check            = false;

            /************************* 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);

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

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

            /******************************* Set Recur ***********************************/

            purchase.SetRecur(recurring_cycle);

            CofInfo cof = new CofInfo();

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

            purchase.SetCofInfo(cof);

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

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

            /******************************* 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("Recur Success = " + receipt.GetRecurSuccess());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());
                Console.WriteLine("IssuerId = " + receipt.GetIssuerId());
                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);
            }
        }
예제 #8
0
        public static void Main(string[] args)
        {
            string store_id                = "monusqa002";
            string api_token               = "qatoken";
            string order_id                = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string amount                  = "5.00";
            string pan                     = "4242424242424242";
            string expdate                 = "1902"; //YYMM format
            string crypt                   = "7";
            string commcard_invoice        = "INVC090";
            string commcard_tax_amount     = "1.00";
            string processing_country_code = "US";
            bool   status_check            = false;

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

            string recur_unit   = "month";
            string start_now    = "true";
            string start_date   = "2016/12/01";
            string num_recurs   = "12";
            string period       = "1";
            string recur_amount = "30.00";
            string cust_id      = "my customer id";

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

            Purchase purchase = new Purchase();

            purchase.SetOrderId(order_id);
            purchase.SetCustId(cust_id);
            purchase.SetAmount(amount);
            purchase.SetPan(pan);
            purchase.SetExpDate(expdate);
            purchase.SetCryptType(crypt);
            purchase.SetCommcardInvoice(commcard_invoice);
            purchase.SetCommcardTaxAmount(commcard_tax_amount);
            purchase.SetRecur(recurring_cycle);

            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(purchase);
            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("Recur Success = " + receipt.GetRecurSuccess());
                //Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                //Console.WriteLine("StatusCode = " + receipt.GetStatusCode());
                //Console.WriteLine("StatusMessage = " + receipt.GetStatusMessage());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #9
0
 public void SetRecurInfo(Recur recur_info)
 {
     recurInfo = recur_info;
 }
        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 expiry_date = "0812";
            string crypt       = "7";

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

            string recur_unit   = "month";   //eom = end of month
            string start_now    = "true";
            string start_date   = "2006/07/28";
            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);

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

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

            /******************************* Set Recur ***********************************/

            purchase.SetRecur(recurring_cycle);

            /**************************** 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("Recur Success = " + receipt.GetRecurSuccess());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());
            }
            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 data_key   = "g90io5hS63qXu10Pu51512M8G";
            string order_id   = "res_purchase_7";
            string amount     = "1.00";
            string cust_id    = "customer1"; //if sent will be submitted, otherwise cust_id from profile will be used
            string crypt_type = "2";

            ResPurchaseCC resPurchaseCC = new ResPurchaseCC(data_key, order_id, cust_id, amount, crypt_type);

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

            string recur_unit   = "month";
            string start_now    = "true";
            string start_date   = "2009/12/01";
            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);

            resPurchaseCC.SetRecur(recurring_cycle);

            /**********************   REQUEST  ************************/
            HttpsPostRequest mpgReq = new HttpsPostRequest(host, store_id, api_token, resPurchaseCC);

            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("AVSResponse = " + receipt.GetAvsResultCode());
                Console.WriteLine("CVDResponse = " + receipt.GetCvdResultCode());
                Console.WriteLine("RecurSuccess = " + receipt.GetRecurSuccess());
                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);
            }
        }
        public static void Main(string[] args)
        {
            string store_id                = "monusqa002";
            string api_token               = "qatoken";
            string order_id                = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string data_key                = "AhcyWhamRPNnhyU8RYPxM3saK";
            string amount                  = "1.00";
            string cust_id                 = "customer1"; //if sent will be submitted, otherwise cust_id from profile will be used
            string intended_use            = "1";
            string p_account_number        = "23456789";
            string processing_country_code = "US";

            ResPurchasePinless resPurchasePinless = new ResPurchasePinless();

            resPurchasePinless.SetDataKey(data_key);
            resPurchasePinless.SetOrderId(order_id);
            resPurchasePinless.SetCustId(cust_id);
            resPurchasePinless.SetAmount(amount);
            resPurchasePinless.SetIntendedUse(intended_use);
            resPurchasePinless.SetPAccountNumber(p_account_number);

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

            string recur_unit   = "month";
            string start_now    = "true";
            string start_date   = "2018/12/01";
            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);

            resPurchasePinless.SetRecur(recurring_cycle);

            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(resPurchasePinless);
            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("RecurSuccess = " + receipt.GetRecurSuccess());
                Console.WriteLine("ResSuccess = " + receipt.GetResSuccess());
                Console.WriteLine("PaymentType = " + receipt.GetPaymentType());
                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("Presentation Type = " + receipt.GetResDataPresentationType());
                Console.WriteLine("P Account Number = " + receipt.GetResDataPAccountNumber());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }