예제 #1
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);
        }
        public void TestGiftCardAuthReversal()
        {
            var giftCard = new giftCardAuthReversal
            {
                id          = "1",
                reportGroup = "Planets",
                litleTxnId  = 123,
                card        = new giftCardCardType
                {
                    type    = methodOfPaymentTypeEnum.GC,
                    number  = "414100000000000000",
                    expDate = "1210"
                },

                originalRefCode        = "abc123",
                originalAmount         = 500,
                originalTxnTime        = DateTime.Now,
                originalSystemTraceId  = 123,
                originalSequenceNumber = "123456"
            };

            var response = _litle.GiftCardAuthReversal(giftCard);

            Assert.AreEqual("000", response.response);
        }