Ejemplo n.º 1
0
        public void SendTest_PriorAuthCap_Approved()
        {
            //check login / password
            string sError = CheckLoginPassword();
            Assert.IsTrue(sError == "", sError);

            //setup
            decimal amount = getValidAmount();
            string transID = SendAuthOnly(amount + 1, true);
            Assert.IsTrue(transID.Trim().Length > 0);
            Assert.IsTrue(long.Parse(transID) > 0);

            //start testing
            string responseString = "1.0|1|1|This transaction has been approved.||P||2207397444|37887CB02372C5074386923E7E33BB3C||||||||||||XXXX1111|Visa";
            LocalRequestObject.ResponseString = responseString;
            IGatewayResponse expected = new CardPresentResponse(responseString.Split('|'));

            CardPresentGateway target = new CardPresentGateway(ApiLogin, TransactionKey, true);

            IGatewayRequest request = new CardPresentPriorAuthCapture(transID, amount);
            string description = "CP PriorAuthCap transaction approved testing";

            IGatewayResponse actual = target.Send(request, description);

            Assert.AreEqual(expected.Amount, actual.Amount);
            Assert.AreEqual(expected.Approved, actual.Approved);
            Assert.AreEqual(expected.CardNumber, actual.CardNumber);
            Assert.AreEqual(expected.Message, actual.Message);
            Assert.AreEqual(expected.ResponseCode, actual.ResponseCode);

            Assert.IsTrue(actual.TransactionID.Trim().Length > 0);
            Assert.IsTrue(long.Parse(actual.TransactionID) > 0);
        }
Ejemplo n.º 2
0
        public void SendTest_PriorAuthCap_LessAmount_Failed()
        {
            //check login / password
            string sError = CheckLoginPassword();
            Assert.IsTrue(sError == "", sError);

            //setup
            decimal amount = getValidAmount();
            string transID = SendAuthOnly(amount - 1, true);
            Assert.IsTrue(transID.Trim().Length > 0);
            Assert.IsTrue(long.Parse(transID) > 0);

            //start testing
            string responseString = "1.0|3|47|The amount requested for settlement cannot be greater than the original amount authorized.||P||0|723B86547E0A4F9D9A2293081DA46A70|||||||||||||Visa";
            LocalRequestObject.ResponseString = responseString;
            IGatewayResponse expected = new CardPresentResponse(responseString.Split('|'));

            CardPresentGateway target = new CardPresentGateway(ApiLogin, TransactionKey, true);

            IGatewayRequest request = new CardPresentPriorAuthCapture(transID, amount);
            string description = "CP PriorAuthCap transaction approved testing";

            IGatewayResponse actual = target.Send(request, description);

            Assert.AreEqual(expected.Amount, actual.Amount);
            Assert.AreEqual(expected.Approved, actual.Approved);
            Assert.AreEqual(expected.CardNumber, actual.CardNumber);
            Assert.AreEqual(expected.Message, actual.Message);
            Assert.AreEqual(expected.ResponseCode, actual.ResponseCode);

            Assert.IsTrue(actual.TransactionID.Trim().Length > 0);
            Assert.IsTrue(long.Parse(actual.TransactionID) == 0);
        }