Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            string host = "esqa.moneris.com";
            string store_id = "store5";
            string api_token = "yesguy";
            string order_id = "Test_P_033333";
            string pan = "4242424242424242";
            string expdate = "0812";
            string crypt = "7";

            /*************** Address Verification Service **********************/

            AvsInfo avsCheck = new AvsInfo();

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

            CardVerification cardverify = new CardVerification(order_id, pan, expdate, crypt);
            cardverify.SetAvsInfo(avsCheck);

            /****************** Card Validation Digits *************************/

            CvdInfo cvdCheck = new CvdInfo();
            cvdCheck.SetCvdIndicator("1");
            cvdCheck.SetCvdValue("099");

            cardverify.SetCvdInfo(cvdCheck);
            HttpsPostRequest mpgReq =
                  new HttpsPostRequest(host, store_id, api_token, cardverify);

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            /******************* REQUEST VARIABLES*******************************/

            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";
            /****************** TRANSACTION VARIABLES *****************************/

            string order_id    = "testenctrack2purchase10";
            string cust_id     = "LBriggs";
            string amount      = "1.00";
            string enc_track2  = "";
            string pos_code    = "00";
            string device_type = "idtech";

            USEncTrack2Purchase P = new USEncTrack2Purchase(order_id, cust_id, amount, enc_track2, pos_code, device_type);

            /*************** Address Verification Service **********************/
            AvsInfo avsCheck = new AvsInfo();

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

            P.SetAvsInfo(avsCheck);

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

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("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("MaskedPan = " + receipt.GetMaskedPan());
                Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                Console.WriteLine("AVS Response = " + receipt.GetAvsResultCode());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 private AvsInfo AssignAVSValidationFieldsFromPaymentMethod(Entity paymentMethod, AvsInfo avsCheck, LocalPluginContext localContext, IOrganizationService service)
 {
     localContext.TracingService.Trace("Entering AssignAVSValidationFieldsFromPaymentMethod().");
     try
     {
         if (!paymentMethod.Contains("msnfp_billing_line1") || !paymentMethod.Contains("msnfp_billing_postalcode"))
         {
             localContext.TracingService.Trace("Customer is missing either msnfp_billing_line1 or msnfp_billing_postalcode fields on their payment method. Exiting plugin.");
             throw new Exception("Customer is missing either msnfp_billing_line1 or msnfp_billing_postalcode fields on their payment method. Exiting plugin.");
         }
         string[] array = ((string)paymentMethod["msnfp_billing_line1"]).Split(' ');
         if (array.Length <= 1)
         {
             localContext.TracingService.Trace("Could not split address for AVS Validation. Please ensure the Street 1 billing address on the payment method is in the form '123 Example Street'. Exiting plugin.");
             throw new ArgumentNullException("msnfp_billing_line1");
         }
         string text = (string)paymentMethod["msnfp_billing_line1"];
         localContext.TracingService.Trace("Unformatted Street Name: " + text);
         text = text.Replace(array[0], "").Trim(' ');
         localContext.TracingService.Trace("Formatted Street Name: " + text);
         localContext.TracingService.Trace("Formatted Street Number: " + array[0]);
         avsCheck.SetAvsStreetNumber(array[0]);
         avsCheck.SetAvsStreetName(text);
         avsCheck.SetAvsZipCode((string)paymentMethod["msnfp_billing_postalcode"]);
         if (paymentMethod.Contains("msnfp_emailaddress1"))
         {
             avsCheck.SetAvsEmail((string)paymentMethod["msnfp_emailaddress1"]);
         }
         avsCheck.SetAvsShipMethod("G");
         if (paymentMethod.Contains("msnfp_telephone1"))
         {
             avsCheck.SetAvsCustPhone((string)paymentMethod["msnfp_telephone1"]);
         }
         localContext.TracingService.Trace("Updated AVS Check variable successfully.");
     }
     catch (Exception ex)
     {
         localContext.TracingService.Trace("AssignAVSValidationFieldsFromPaymentMethod() Error: " + ex.ToString());
         throw new Exception("AssignAVSValidationFieldsFromPaymentMethod() Error: " + ex.ToString());
     }
     return(avsCheck);
 }
        public static void Main(string[] args)
        {
            /******************* REQUEST VARIABLES*******************************/

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

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

            string order_id;                    //will prompt user for input
            string cust_id = "LBriggs";
            string amount  = "1.00";
            string track1;                              //not required for transaction
            string track2;
            string pan                 = null;
            string exp                 = null;  //must send '0000' if swiped
            string pos_code            = "00";
            string commcard_invoice    = "INV98798";
            string commcard_tax_amount = "1.00";

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

            Console.WriteLine("Please swipe card");
            track1 = Console.ReadLine();
            track2 = Console.ReadLine();

            Console.WriteLine("\nThe track1 is " + track1);
            Console.WriteLine("\nThe track2 is " + track2);

            /*************** Address Verification Service **********************/
            AvsInfo avsCheck = new AvsInfo();

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

            /****************** Card Validation Digits *************************/
            CvdInfo cvdCheck = new CvdInfo();

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

            USTrack2Purchase P = new USTrack2Purchase(order_id,
                                                      cust_id,
                                                      amount,
                                                      track2,
                                                      pan,
                                                      exp,
                                                      pos_code,
                                                      commcard_invoice,
                                                      commcard_tax_amount
                                                      );

            P.SetAvsInfo(avsCheck);
            P.SetCvdInfo(cvdCheck);
            HttpsPostRequest mpgReq =
                new HttpsPostRequest(host, store_id, api_token, P);



            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("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());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            /******************* REQUEST VARIABLES*******************************/

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

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

            string order_id;                    //will prompt user for input
            string cust_id = "B_Urlac_54";
            string amount  = "10.42";
            string pan     = "4242424242424242";
            string exp     = "1212";
            string cavv    = "AAABBJg0VhI0VniQEjRWAAAAAAA";

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

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

            USCavvPreAuth cavvPreAuth
                = new USCavvPreAuth(order_id,
                                    cust_id,
                                    amount,
                                    pan,
                                    exp,
                                    cavv);


            /************************ 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", exp);
            cavvParams.Add("cavv", cavv);

            USCavvPreAuth cavvPreAuth2
                = new USCavvPreAuth(cavvParams);                 //single paramater hashtable construtor

            /*************** Address Verification Service **********************/

            AvsInfo avsCheck = new AvsInfo();

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

            cavvPreAuth.SetAvsInfo(avsCheck);

            /****************** Card Validation Digits *************************/

            CvdInfo cvdCheck = new CvdInfo();

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

            cavvPreAuth.SetCvdInfo(cvdCheck);

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

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

            /****************************** 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("Avs Response = " + receipt.GetAvsResultCode());
                Console.WriteLine("Cvd Response = " + receipt.GetCvdResultCode());
                Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                Console.WriteLine("CavvResultCode = " + receipt.GetCavvResultCode());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            /******************* REQUEST VARIABLES*******************************/

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

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

            string order_id;                    //will prompt user for input
            string cust_id     = "customer1";
            string pan         = "4242424242424242";
            string expiry_date = "1212";

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

            /*************** Address Verification Service **********************/

            AvsInfo avsCheck = new AvsInfo();

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

            USCardVerification cardVerification =
                new USCardVerification(order_id, cust_id, pan, expiry_date);

            cardVerification.SetAvsInfo(avsCheck);

            /****************** Card Validation Digits *************************/

            CvdInfo cvdCheck = new CvdInfo();

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

            cardVerification.SetCvdInfo(cvdCheck);


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


            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public PreAuthorizePaymentResponse PreAuthorize(string companyKey, Guid orderId, AccountDetail account, decimal amountToPreAuthorize, bool isReAuth = false, bool isSettlingOverduePayment = false, bool isForPrepaid = false, string cvv = null)
        {
            var      message         = string.Empty;
            var      transactionId   = string.Empty;
            DateTime?transactionDate = null;

            try
            {
                bool isSuccessful;
                var  isCardDeclined = false;
                var  creditCard     = _creditCardDao.FindById(account.DefaultCreditCard.GetValueOrDefault());

                var order = _orderDao.FindOrderStatusById(orderId);

                // We cannot re-use the same id has a previously failed payment
                var shouldGenerateNewOrderId = isReAuth || isSettlingOverduePayment;

                var orderIdentifier = shouldGenerateNewOrderId
                    ? string.Format("{0}-{1}", orderId, GenerateShortUid())
                    : orderId.ToString();

                if (amountToPreAuthorize > 0)
                {
                    // PreAuthorize transaction
                    var monerisSettings = _serverPaymentSettings.MonerisPaymentSettings;

                    var customerId = monerisSettings.UseCarIdInTransaction
                        ? order.SelectOrDefault(o => o.VehicleNumber)
                        : order != null?order.DriverInfos.SelectOrDefault(driverInfos => driverInfos.DriverId) : null;

                    var preAuthorizeCommand = new ResPreauthCC(creditCard.Token, orderIdentifier, customerId, amountToPreAuthorize.ToString("F"), CryptType_SSLEnabledMerchant);
                    AddCvvInfo(preAuthorizeCommand, cvv);

                    var info = new AvsInfo();
                    if (_serverPaymentSettings.EnableAddressVerification)
                    {
                        info.SetAvsStreetName(creditCard.StreetName);
                        info.SetAvsStreetNumber(creditCard.StreetNumber);
                        info.SetAvsZipCode(creditCard.ZipCode);
                        info.SetAvsCustPhone(creditCard.Phone);
                        info.SetAvsEmail(creditCard.Email);
                        preAuthorizeCommand.SetAvsInfo(info);
                    }

                    var preAuthRequest = MonerisHttpRequestWrapper.NewHttpsPostRequest(monerisSettings.Host, monerisSettings.StoreId, monerisSettings.ApiToken, preAuthorizeCommand);
                    var preAuthReceipt = preAuthRequest.GetAndLogReceipt(_logger);

                    isSuccessful    = RequestSuccesful(preAuthReceipt, out message);
                    isCardDeclined  = IsCardDeclined(preAuthReceipt);
                    transactionId   = preAuthReceipt.GetTxnNumber();
                    transactionDate = GetTransactionDate(preAuthReceipt);
                }
                else
                {
                    // if we're preauthorizing $0, we skip the preauth with payment provider
                    // but we still send the InitiateCreditCardPayment command
                    // this should never happen in the case of a real preauth (hence the minimum of $50)
                    isSuccessful = true;
                }

                if (isSuccessful && !isReAuth)
                {
                    var paymentId = Guid.NewGuid();
                    _commandBus.Send(new InitiateCreditCardPayment
                    {
                        PaymentId     = paymentId,
                        Amount        = amountToPreAuthorize,
                        TransactionId = transactionId,
                        OrderId       = orderId,
                        CardToken     = creditCard.Token,
                        Provider      = PaymentProvider.Moneris,
                        IsNoShowFee   = false,
                        CompanyKey    = companyKey
                    });
                }

                return(new PreAuthorizePaymentResponse
                {
                    IsSuccessful = isSuccessful,
                    Message = message,
                    TransactionId = transactionId,
                    ReAuthOrderId = shouldGenerateNewOrderId ? orderIdentifier : null,
                    IsDeclined = isCardDeclined,
                    TransactionDate = transactionDate,
                });
            }
            catch (Exception e)
            {
                _logger.LogMessage(string.Format("Error during preauthorization (validation of the card) for client {0}: {1} - {2}", account.Email, message, e));
                _logger.LogError(e);

                return(new PreAuthorizePaymentResponse
                {
                    IsSuccessful = false,
                    Message = message
                });
            }
        }
        public static void Main(string[] args)
        {
            string host                = "esplusqa.moneris.com";
            string store_id            = "monusqa002";
            string api_token           = "qatoken";
            string data_key            = "X4oSM1d86871eEF20D856u2";
            string order_id            = "nov7test1";
            string amount              = "1.00";
            string cust_id             = "customer1"; //if sent will be submitted, otherwise cust_id from profile will be used
            string crypt_type          = "1";
            string commcard_invoice    = "invoice";
            string commcard_tax_amount = "1.00";

            USResPurchaseCC usResPurchaseCC = new USResPurchaseCC(data_key, order_id, cust_id, amount, crypt_type);

            /**********************   OPTIONAL VARIABLES  ************************/
            usResPurchaseCC.SetCommcardInvoice(commcard_invoice);
            usResPurchaseCC.SetCommcardTaxAmount(commcard_tax_amount);

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

            /*************** Address Verification Service **********************/

            AvsInfo avsCheck = new AvsInfo();

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

            usResPurchaseCC.SetAvsInfo(avsCheck);

            /****************** Card Validation Digits *************************/

            CvdInfo cvdCheck = new CvdInfo();

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

            usResPurchaseCC.SetCvdInfo(cvdCheck);

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

            /**********************   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("AVSResponse = " + receipt.GetAvsResultCode());
                Console.WriteLine("CVDResponse = " + receipt.GetCvdResultCode());
                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);
            }
        }
Ejemplo n.º 9
0
        public static void Main(string[] args)
        {
            string host = "esqa.moneris.com";
              string store_id = "store5";
              string api_token = "yesguy";

              string order_id = "Need_Unique_Order_ID_123456";
              string orig_order_id = "Need_Unique_Order_ID_12345";
              string amount = "304.00";
              string txn_number = "174885-0_7";
              string crypt = "7";

            /*************** Address Verification Service **********************/

               	AvsInfo avsCheck = new AvsInfo();

               	avsCheck.SetAvsStreetNumber ("212");
               	avsCheck.SetAvsStreetName ("Payton Street");
               	avsCheck.SetAvsZipCode ("M1M1M1");
            avsCheck.SetAvsEmail ("*****@*****.**");
            avsCheck.SetAvsHostname ("hostname");
            avsCheck.SetAvsBrowser ("Mozilla");
            avsCheck.SetAvsShipToCountry ("Canada");
            avsCheck.SetAvsShipMethod ("Ground");
            avsCheck.SetAvsMerchProdSku ("123456");
            avsCheck.SetAvsCustIp ("192.168.0.1");
            avsCheck.SetAvsCustPhone ("5556667777");

            ReAuth reauthTxn = new ReAuth(order_id, orig_order_id, txn_number, amount, crypt);
               	reauthTxn.SetAvsInfo (avsCheck);

               	/****************** Card Validation Digits *************************/

               	CvdInfo cvdCheck = new CvdInfo();
               	cvdCheck.SetCvdIndicator ("1");
               	cvdCheck.SetCvdValue ("099");

               	reauthTxn.SetCvdInfo (cvdCheck);

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

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

            /************************** 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("Avs Response = " + receipt.GetAvsResultCode());
                Console.WriteLine("Cvd Response = " + receipt.GetCvdResultCode());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            string order_id      = "reauth_3";
            string orig_order_id = "order_988525431";
            string txn_number    = "178255-0_7";
            string amount        = "304.00";
            string crypt         = "7";

            /*************** Address Verification Service **********************/

            AvsInfo avsCheck = new AvsInfo();

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

            USReAuth reauthTxn = new USReAuth(order_id, orig_order_id, txn_number, amount, crypt);

            reauthTxn.SetAvsInfo(avsCheck);

            /****************** Card Validation Digits *************************/

            CvdInfo cvdCheck = new CvdInfo();

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

            reauthTxn.SetCvdInfo(cvdCheck);

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

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

            /************************** 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("Avs Response = " + receipt.GetAvsResultCode());
                Console.WriteLine("Cvd Response = " + receipt.GetCvdResultCode());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            /********************** Post Request Variables *************************/

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

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

            string order_id;                    //will prompt for user input
            string amount              = "5.00";
            string pan                 = "4242424242424242";
            string expiry_date         = "0812";
            string crypt               = "7";
            string commcard_invoice    = "INV98798";
            string commcard_tax_amount = "1.00";

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

            /*************** Address Verification Service **********************/

            AvsInfo avsCheck = new AvsInfo();

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

            USPurchase purchaseTxn =
                new USPurchase(order_id, amount, pan, expiry_date, crypt, commcard_invoice, commcard_tax_amount);

            purchaseTxn.SetAvsInfo(avsCheck);

            /****************** Card Validation Digits *************************/

            CvdInfo cvdCheck = new CvdInfo();

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

            purchaseTxn.SetCvdInfo(cvdCheck);

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

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

            /*Status Check Example
             * HttpsPostRequest mpgReq =
             *      new HttpsPostRequest(host, store_id, api_token, status, purchaseTxn);
             */

            /************************** 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("Avs Response = " + receipt.GetAvsResultCode());
                Console.WriteLine("Cvd Response = " + receipt.GetCvdResultCode());
                Console.WriteLine("CardLevelResult = " + receipt.GetCardLevelResult());
                //Console.WriteLine("StatusCode = " + receipt.GetStatusCode());
                //Console.WriteLine("StatusMessage = " + receipt.GetStatusMessage());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 12
0
        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 = "Test_eFraud_dotNET_1234";
            string amount = "10.02";
            string pan = "4242424242424242";
            string expiry_date = "1111";
            string crypt = "7";

            /*************** Address Verification Service **********************/

               	AvsInfo avsCheck = new AvsInfo();

               	avsCheck.SetAvsStreetNumber ("212");
               	avsCheck.SetAvsStreetName ("Payton Street");
               	avsCheck.SetAvsZipCode ("M1M1M1");
            avsCheck.SetAvsEmail("*****@*****.**");
            avsCheck.SetAvsHostname("hostname");
            avsCheck.SetAvsBrowser("Mozilla");
            avsCheck.SetAvsShipToCountry("CAN");
            avsCheck.SetAvsShipMethod("G");
            avsCheck.SetAvsMerchProdSku("123456");
            avsCheck.SetAvsCustIp("192.168.0.1");
            avsCheck.SetAvsCustPhone("5556667777");

               	Purchase purchaseTxn = new Purchase(order_id, amount, pan, expiry_date, crypt);
               	purchaseTxn.SetAvsInfo (avsCheck);

               	/****************** Card Validation Digits *************************/

               	CvdInfo cvdCheck = new CvdInfo();
               	cvdCheck.SetCvdIndicator ("1");
               	cvdCheck.SetCvdValue ("099");

               	purchaseTxn.SetCvdInfo (cvdCheck);

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

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

            /************************** 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("Avs Response = " + receipt.GetAvsResultCode());
                Console.WriteLine("Cvd Response = " + receipt.GetCvdResultCode());
                Console.WriteLine("ITD Response = " + receipt.GetITDResponse());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 13
0
        public static void Main(string[] args)
        {
            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            string pan        = "5454545454545454";
            string expdate    = "0909";
            string phone      = "0000000000";
            string email      = "*****@*****.**";
            string note       = "my note";
            string cust_id    = "customer1";
            string crypt_type = "7";

            AvsInfo avsCheck = new AvsInfo();

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


            USResAddCC usResAddCC = new USResAddCC(pan, expdate, crypt_type);

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

            usResAddCC.SetCustId(cust_id);
            usResAddCC.SetPhone(phone);
            usResAddCC.SetEmail(email);
            usResAddCC.SetNote(note);
            usResAddCC.SetAvsInfo(avsCheck);

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

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

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("DataKey = " + receipt.GetDataKey());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("ResSuccess = " + receipt.GetResSuccess());
                Console.WriteLine("PaymentType = " + receipt.GetPaymentType());

                //ResolveData
                Console.WriteLine("\nCust ID = " + receipt.GetResDataCustId());
                Console.WriteLine("Phone = " + receipt.GetResDataPhone());
                Console.WriteLine("Email = " + receipt.GetResDataEmail());
                Console.WriteLine("Note = " + receipt.GetResDataNote());
                Console.WriteLine("MaskedPan = " + 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.º 14
0
        public static void Main(string[] args)
        {
            string host      = "esplusqa.moneris.com";
            string store_id  = "monusqa002";
            string api_token = "qatoken";

            string data_key    = "32b55Q428ySjNBpbXw24128p5";
            string enc_track2  = "";
            string device_type = "idtech";
            string phone       = "0000000000";
            string email       = "*****@*****.**";
            string note        = "my note";
            string cust_id     = "customer1";
            string crypt_type  = "7";

            AvsInfo avsCheck = new AvsInfo();

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

            USEncResUpdateCC usEncResUpdateCC = new USEncResUpdateCC(data_key);

            usEncResUpdateCC.SetAvsInfo(avsCheck);
            usEncResUpdateCC.SetCustId(cust_id);
            usEncResUpdateCC.SetEncTrack2(enc_track2);
            usEncResUpdateCC.SetDeviceType(device_type);
            usEncResUpdateCC.SetPhone(phone);
            usEncResUpdateCC.SetEmail(email);
            usEncResUpdateCC.SetNote(note);
            usEncResUpdateCC.SetCryptType(crypt_type);

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

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

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("DataKey = " + receipt.GetDataKey());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("ResSuccess = " + receipt.GetResSuccess());
                Console.WriteLine("PaymentType = " + receipt.GetPaymentType());

                //ResolveData
                Console.WriteLine("\nCust ID = " + receipt.GetResDataCustId());
                Console.WriteLine("Phone = " + receipt.GetResDataPhone());
                Console.WriteLine("Email = " + receipt.GetResDataEmail());
                Console.WriteLine("Note = " + receipt.GetResDataNote());
                Console.WriteLine("MaskedPan = " + 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.º 15
0
        public Task <PaymentOutput> MakePaymentAsync(MonerisCreditCardPaymentInput input, CancellationToken cancellationToken = default)
        {
            var response = new PaymentOutput();

            var CCD = new CreditCardDetail();

            CCD.CCNumber              = input.CreditCardNo;
            CCD.ExpDate               = input.CcExpMmYy;
            CCD.CryptType             = CreditCardConstants.CRYPTTYPE;
            CCD.ProcessingCountryCode = CreditCardConstants.COUNTRY_CODE_CA;

            // This is currently not used, it gets commented out in MonerisProcess.AddCC function:
            var avsCheck       = new AvsInfo();
            var address1_line1 = input.BillingLine1;

            avsCheck.SetAvsStreetNumber(address1_line1);

            var address1_line2 = input.BillingLine2;

            if (String.IsNullOrEmpty(address1_line2))
            {
                var strArray = address1_line1.Split(' ');
                if (strArray.Length > 1)
                {
                    avsCheck.SetAvsStreetName(strArray[1].ToString());
                }
            }
            else
            {
                avsCheck.SetAvsStreetName(address1_line2);
            }

            var address1_postalcode = input.BillingPostalCode;

            avsCheck.SetAvsZipCode(address1_postalcode);

            var monerisCCInput = new MonerisCCInput()
            {
                StoreId  = input.MonerisStoreId,
                Key      = input.ServiceKey,
                TestMode = input.IsTestMode,
                ServiceModeOptionSetId = input.ServiceModeOptionSetId
            };

            var addCCReceipt = MonerisProcess.AddCC(CCD, avsCheck, monerisCCInput);

            if (addCCReceipt == null)
            {
                return(Task.FromResult(response));
            }


            Int32.TryParse(addCCReceipt.GetResponseCode(), out var addCCResponseCode);

            if (addCCResponseCode != 0 && addCCResponseCode < 50)
            {
                var transaction = new TransactionDetail();

                transaction.DataKey               = addCCReceipt.GetDataKey();
                transaction.Amount                = String.Format("{0:0.00}", input.Amount);
                transaction.CryptType             = CreditCardConstants.CRYPTTYPE;
                transaction.ProcessingCountryCode = CreditCardConstants.COUNTRY_CODE_CA;
                transaction.StoreId               = input.MonerisStoreId;
                transaction.ApiKey                = input.ServiceKey;
                transaction.IsTestMode            = input.IsTestMode;

                var order_id = Guid.NewGuid().ToString();
                response.InvoiceNumber = order_id;
                transaction.Identifier = order_id;

                // If there is no auth id, get it from the added CC receipt:
                if (transaction.CustID == null)
                {
                    transaction.CustID = addCCReceipt.GetDataKey();
                }

                var transactionReceipt = MonerisProcess.PurchaseWithCC(transaction);

                if (transactionReceipt != null)
                {
                    Int32.TryParse(transactionReceipt.GetResponseCode(), out var responseCode);

                    if (responseCode != 0 && responseCode < 50)
                    {
                        response.IsSuccessful = true;
                    }
                    else if (responseCode == 0 || responseCode > 49)
                    {
                        response.IsSuccessful = false;
                    }

                    response.TransactionResult     = $"{transactionReceipt.GetMessage()} - Response Code: {responseCode}";
                    response.TransactionIdentifier = transactionReceipt.GetReferenceNum();
                    response.AuthToken             = transactionReceipt.GetDataKey();
                    response.CardType = transactionReceipt.GetCardType();
                }
            }
            else if (addCCResponseCode == 0 || addCCResponseCode > 49)
            {
                response.IsSuccessful      = false;
                response.TransactionResult = addCCReceipt.GetMessage();
            }

            return(Task.FromResult(response));
        }