Ejemplo n.º 1
0
        public void Test3Auth()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            authorization.orderId     = "3";
            authorization.amount      = 30030;
            authorization.orderSource = orderSourceType.ecommerce;
            contact contact = new contact();

            contact.name                = "Eileen Jones";
            contact.addressLine1        = "3 Main St.";
            contact.city                = "Bloomfield";
            contact.state               = "CT";
            contact.zip                 = "06002";
            contact.country             = countryTypeEnum.US;
            authorization.billToAddress = contact;
            cardType card = new cardType();

            card.type              = methodOfPaymentTypeEnum.DI;
            card.number            = "6011010000000003";
            card.expDate           = "0312";
            card.cardValidationNum = "758";
            authorization.card     = card;

            authorizationResponse response = cnp.Authorize(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            Assert.AreEqual("33333", response.authCode.Trim());
            Assert.AreEqual("10", response.fraudResult.avsResult);
            Assert.AreEqual("M", response.fraudResult.cardValidationResult);

            capture capture = new capture();

            capture.id       = response.id;
            capture.cnpTxnId = response.cnpTxnId;
            captureResponse captureResponse = cnp.Capture(capture);

            Assert.AreEqual("000", captureResponse.response);
            Assert.AreEqual("Approved", captureResponse.message);

            credit credit = new credit();

            credit.id       = captureResponse.id;
            credit.cnpTxnId = captureResponse.cnpTxnId;
            creditResponse creditResponse = cnp.Credit(credit);

            Assert.AreEqual("000", creditResponse.response);
            Assert.AreEqual("Approved", creditResponse.message);

            voidTxn newvoid = new voidTxn();

            newvoid.id       = creditResponse.id;
            newvoid.cnpTxnId = creditResponse.cnpTxnId;
            cnpOnlineResponseTransactionResponseVoidResponse voidResponse = cnp.DoVoid(newvoid);

            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }
Ejemplo n.º 2
0
        public void Test1Auth()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            authorization.orderId     = "1";
            authorization.amount      = 10010;
            authorization.orderSource = orderSourceType.ecommerce;
            contact contact = new contact();

            contact.name                = "John & Mary Smith";
            contact.addressLine1        = "1 Main St.";
            contact.city                = "Burlington";
            contact.state               = "MA";
            contact.zip                 = "01803-3747";
            contact.country             = countryTypeEnum.US;
            authorization.billToAddress = contact;
            cardType card = new cardType();

            card.type              = methodOfPaymentTypeEnum.VI;
            card.number            = "4457010000000009";
            card.expDate           = "0121";
            card.cardValidationNum = "349";
            authorization.card     = card;

            authorizationResponse response = cnp.Authorize(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            Assert.AreEqual("11111 ", response.authCode);
            Assert.AreEqual("01", response.fraudResult.avsResult);
            Assert.AreEqual("M", response.fraudResult.cardValidationResult);

            capture capture = new capture();

            capture.id       = response.id;
            capture.cnpTxnId = response.cnpTxnId;
            captureResponse captureResponse = cnp.Capture(capture);

            Assert.AreEqual("000", captureResponse.response);
            Assert.AreEqual("Approved", captureResponse.message);

            credit credit = new credit();

            credit.id       = captureResponse.id;
            credit.cnpTxnId = captureResponse.cnpTxnId;
            creditResponse creditResponse = cnp.Credit(credit);

            Assert.AreEqual("000", creditResponse.response);
            Assert.AreEqual("Approved", creditResponse.message);

            voidTxn newvoid = new voidTxn();

            newvoid.id       = creditResponse.id;
            newvoid.cnpTxnId = creditResponse.cnpTxnId;
            cnpOnlineResponseTransactionResponseVoidResponse voidResponse = cnp.DoVoid(newvoid);

            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }
Ejemplo n.º 3
0
        public void Test4Auth()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            authorization.orderId     = "4";
            authorization.amount      = 10100;
            authorization.orderSource = orderSourceType.ecommerce;
            contact contact = new contact();

            contact.name                = "Bob Black";
            contact.addressLine1        = "4 Main St.";
            contact.city                = "Laurel";
            contact.state               = "MD";
            contact.zip                 = "20708";
            contact.country             = countryTypeEnum.US;
            authorization.billToAddress = contact;
            cardType card = new cardType();

            card.type    = methodOfPaymentTypeEnum.AX;
            card.number  = "375001000000005";
            card.expDate = "0421";
            //card.cardValidationNum = "758";
            authorization.card = card;

            authorizationResponse response = cnp.Authorize(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            Assert.AreEqual("44444", response.authCode.Trim());
            Assert.AreEqual("13", response.fraudResult.avsResult);

            capture capture = new capture();

            capture.id       = response.id;
            capture.cnpTxnId = response.cnpTxnId;
            captureResponse captureresponse = cnp.Capture(capture);

            Assert.AreEqual("000", captureresponse.response);
            Assert.AreEqual("Approved", captureresponse.message);

            credit credit = new credit();

            credit.id       = captureresponse.id;
            credit.cnpTxnId = captureresponse.cnpTxnId;
            creditResponse creditResponse = cnp.Credit(credit);

            Assert.AreEqual("000", creditResponse.response);
            Assert.AreEqual("Approved", creditResponse.message);

            voidTxn newvoid = new voidTxn();

            newvoid.id       = creditResponse.id;
            newvoid.cnpTxnId = creditResponse.cnpTxnId;
            cnpOnlineResponseTransactionResponseVoidResponse voidResponse = cnp.DoVoid(newvoid);

            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }
Ejemplo n.º 4
0
        public void Test2Sale()
        {
            sale sale = new sale();

            sale.id          = "1";
            sale.orderId     = "2";
            sale.amount      = 20020;
            sale.orderSource = orderSourceType.ecommerce;
            contact contact = new contact();

            contact.name         = "Mike J. Hammer";
            contact.addressLine1 = "2 Main St.";
            contact.addressLine2 = "Apt. 222";
            contact.city         = "Riverside";
            contact.state        = "RI";
            contact.zip          = "02915";
            contact.country      = countryTypeEnum.US;
            sale.billToAddress   = contact;
            cardType card = new cardType();

            card.type              = methodOfPaymentTypeEnum.MC;
            card.number            = "5112010000000003";
            card.expDate           = "0212";
            card.cardValidationNum = "261";
            sale.card              = card;
            fraudCheckType authenticationvalue = new fraudCheckType();

            authenticationvalue.authenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            sale.cardholderAuthentication           = authenticationvalue;

            saleResponse response = cnp.Sale(sale);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            Assert.AreEqual("22222", response.authCode.Trim());
            Assert.AreEqual("10", response.fraudResult.avsResult);
            Assert.AreEqual("M", response.fraudResult.cardValidationResult);

            credit credit = new credit();

            credit.id       = response.id;
            credit.cnpTxnId = response.cnpTxnId;
            creditResponse creditResponse = cnp.Credit(credit);

            Assert.AreEqual("000", creditResponse.response);
            Assert.AreEqual("Approved", creditResponse.message);

            voidTxn newvoid = new voidTxn();

            newvoid.id       = creditResponse.id;
            newvoid.cnpTxnId = creditResponse.cnpTxnId;
            cnpOnlineResponseTransactionResponseVoidResponse voidResponse = cnp.DoVoid(newvoid);

            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }
Ejemplo n.º 5
0
        public void Test5Auth()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            authorization.orderId     = "5";
            authorization.amount      = 50050;
            authorization.orderSource = orderSourceType.ecommerce;
            cardType card = new cardType();

            card.type              = methodOfPaymentTypeEnum.VI;
            card.number            = "4457010200000007";
            card.expDate           = "0512";
            card.cardValidationNum = "463";
            authorization.card     = card;
            fraudCheckType authenticationvalue = new fraudCheckType();

            authenticationvalue.authenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.cardholderAuthentication  = authenticationvalue;

            authorizationResponse response = cnp.Authorize(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            Assert.AreEqual("55555 ", response.authCode);
            Assert.AreEqual("32", response.fraudResult.avsResult);
            Assert.AreEqual("M", response.fraudResult.cardValidationResult);

            capture capture = new capture();

            capture.id       = response.id;
            capture.cnpTxnId = response.cnpTxnId;
            captureResponse captureresponse = cnp.Capture(capture);

            Assert.AreEqual("000", captureresponse.response);
            Assert.AreEqual("Approved", captureresponse.message);

            credit credit = new credit();

            credit.id       = captureresponse.id;
            credit.cnpTxnId = captureresponse.cnpTxnId;
            creditResponse creditResponse = cnp.Credit(credit);

            Assert.AreEqual("000", creditResponse.response);
            Assert.AreEqual("Approved", creditResponse.message);

            voidTxn newvoid = new voidTxn();

            newvoid.id       = creditResponse.id;
            newvoid.cnpTxnId = creditResponse.cnpTxnId;
            cnpOnlineResponseTransactionResponseVoidResponse voidResponse = cnp.DoVoid(newvoid);

            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }
Ejemplo n.º 6
0
        public void TestRecyclingDataOnVoidResponseIsOptional()
        {
            voidTxn voidTxn = new voidTxn();

            voidTxn.cnpTxnId = 123;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.16' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><voidResponse><cnpTxnId>123</cnpTxnId><response>000</response><responseTime>2013-01-31T15:48:09</responseTime><postDate>2013-01-31</postDate><message>Approved</message></voidResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnpOnlineResponseTransactionResponseVoidResponse response = cnp.DoVoid(voidTxn);

            Assert.AreEqual(123, response.cnpTxnId);
            Assert.IsNull(response.recycling);
        }
Ejemplo n.º 7
0
        public void Test6Sale()
        {
            sale sale = new sale();

            sale.id          = "1";
            sale.orderId     = "6";
            sale.amount      = 60060;
            sale.orderSource = orderSourceType.ecommerce;
            contact contact = new contact();

            contact.name         = "Joe Green";
            contact.addressLine1 = "6 Main St.";
            contact.city         = "Derry";
            contact.state        = "NH";
            contact.zip          = "03038";
            contact.country      = countryTypeEnum.US;
            sale.billToAddress   = contact;
            cardType card = new cardType();

            card.type              = methodOfPaymentTypeEnum.VI;
            card.number            = "4457010100000008";
            card.expDate           = "0612";
            card.cardValidationNum = "992";
            sale.card              = card;

            saleResponse response = cnp.Sale(sale);

            Assert.AreEqual("110", response.response);
            Assert.AreEqual("Insufficient Funds", response.message);
            Assert.AreEqual("34", response.fraudResult.avsResult);
            Assert.AreEqual("P", response.fraudResult.cardValidationResult);

            voidTxn newvoid = new voidTxn();

            newvoid.id       = response.id;
            newvoid.cnpTxnId = response.cnpTxnId;
            cnpOnlineResponseTransactionResponseVoidResponse voidResponse = cnp.DoVoid(newvoid);

            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }