public void TestgiftCardAuthReversalResponseCanContainGiftCardResponse()
        {
            String        xml        = @"
<giftCardAuthReversalResponse xmlns=""http://www.vantivcnp.com/schema"" id=""theId"" customerId=""theCustomerId"" reportGroup=""theReportGroup"">
<cnpTxnId>1</cnpTxnId>
<orderId>2</orderId>
<response>000</response>
<responseTime>2013-09-05T14:23:45</responseTime>
<postDate>2013-09-05</postDate>
<message>Foo</message>
<giftCardResponse>
<availableBalance>5</availableBalance>
</giftCardResponse>
</giftCardAuthReversalResponse>";
            XmlSerializer serializer = new XmlSerializer(typeof(giftCardAuthReversalResponse));
            StringReader  reader     = new StringReader(xml);
            giftCardAuthReversalResponse giftCardAuthReversalResponse = (giftCardAuthReversalResponse)serializer.Deserialize(reader);

            Assert.AreEqual("theId", giftCardAuthReversalResponse.id);
            Assert.AreEqual("theCustomerId", giftCardAuthReversalResponse.customerId);
            Assert.AreEqual("theReportGroup", giftCardAuthReversalResponse.reportGroup);
            Assert.AreEqual(1, giftCardAuthReversalResponse.cnpTxnId);
            Assert.AreEqual("000", giftCardAuthReversalResponse.response);
            Assert.AreEqual(new DateTime(2013, 9, 5, 14, 23, 45), giftCardAuthReversalResponse.responseTime);
            Assert.AreEqual(new DateTime(2013, 9, 5), giftCardAuthReversalResponse.postDate);
            Assert.AreEqual("Foo", giftCardAuthReversalResponse.message);
            Assert.AreEqual("5", giftCardAuthReversalResponse.giftCardResponse.availableBalance);
        }
Пример #2
0
        public void TestGiftCardAuthReversalSimple()
        {
            giftCardAuthReversal giftCard = new giftCardAuthReversal();

            giftCard.id                     = "1";
            giftCard.reportGroup            = "Planets";
            giftCard.litleTxnId             = 123456789;
            giftCard.originalRefCode        = "abc123";
            giftCard.originalAmount         = 500;
            giftCard.originalTxnTime        = new DateTime(2017, 01, 01);
            giftCard.originalSystemTraceId  = 123;
            giftCard.originalSequenceNumber = "123456";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleTxnId>123456789</litleTxnId>\r\n<originalRefCode>abc123</originalRefCode>\r\n<originalAmount>500</originalAmount>\r\n<originalTxnTime>2017-01-01T00:00:00Z</originalTxnTime>\r\n<originalSystemTraceId>123</originalSystemTraceId>\r\n<originalSequenceNumber>123456</originalSequenceNumber>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.18' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><giftCardAuthReversalResponse><litleTxnId>123</litleTxnId></giftCardAuthReversalResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            giftCardAuthReversalResponse giftCardAuthReversalResponse = litle.GiftCardAuthReversal(giftCard);

            Assert.AreEqual(123, giftCardAuthReversalResponse.litleTxnId);
        }
Пример #3
0
        public void TestGiftCardAuthReversalWithCard()
        {
            giftCardAuthReversal giftCard = new giftCardAuthReversal();

            giftCard.id          = "1";
            giftCard.reportGroup = "Planets";
            giftCard.litleTxnId  = 123456789;
            giftCardCardType card = new giftCardCardType();

            card.type     = methodOfPaymentTypeEnum.GC;
            card.number   = "414100000000000000";
            card.expDate  = "1210";
            giftCard.card = card;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<card>\r\n<type>GC</type>\r\n<number>414100000000000000</number>\r\n<expDate>1210</expDate>\r\n</card>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.18' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><giftCardAuthReversalResponse><litleTxnId>123</litleTxnId></giftCardAuthReversalResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            giftCardAuthReversalResponse giftCardAuthReversalResponse = litle.GiftCardAuthReversal(giftCard);

            Assert.AreEqual(123, giftCardAuthReversalResponse.litleTxnId);
        }
        public void TestgiftCardAuthReversalResponseContainsGiftCardResponse()
        {
            String        xml        = "<giftCardAuthReversalResponse xmlns=\"http://www.vantivcnp.com/schema\"><giftCardResponse></giftCardResponse></giftCardAuthReversalResponse>";
            XmlSerializer serializer = new XmlSerializer(typeof(giftCardAuthReversalResponse));
            StringReader  reader     = new StringReader(xml);
            giftCardAuthReversalResponse giftCardAuthReversalResponse = (giftCardAuthReversalResponse)serializer.Deserialize(reader);

            Assert.NotNull(giftCardAuthReversalResponse.giftCardResponse);
        }
        public giftCardAuthReversalResponse GiftCardAuthReversal(giftCardAuthReversal giftCard)
        {
            litleOnlineRequest request = createLitleOnlineRequest();

            fillInReportGroup(giftCard);
            request.giftCardAuthReversal = giftCard;

            litleOnlineResponse          response = sendToLitle(request);
            giftCardAuthReversalResponse giftCardAuthReversalResponse = (giftCardAuthReversalResponse)response.giftCardAuthReversalResponse;

            return(giftCardAuthReversalResponse);
        }