Example #1
0
        public void TestOrderSource_Set()
        {
            credit credit = new credit();

            credit.orderId     = "12344";
            credit.amount      = 2;
            credit.orderSource = orderSourceType.ecommerce;
            credit.reportGroup = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<credit.*<amount>2</amount>.*<orderSource>ecommerce</orderSource>.*</credit>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><creditResponse><litleTxnId>123</litleTxnId></creditResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.Credit(credit);
        }
        public void TestSurchargeAmount()
        {
            transactionReversal reversal = new transactionReversal();

            reversal.cnpTxnId        = 3;
            reversal.amount          = 2;
            reversal.surchargeAmount = 1;
            reversal.reportGroup     = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<surchargeAmount>1</surchargeAmount>\r\n.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='12.16' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><transactionReversalResponse><cnpTxnId>3</cnpTxnId></transactionReversalResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.TransactionReversal(reversal);
        }
Example #3
0
        public void TestSurchargeAmount_TiedOptional()
        {
            credit credit = new credit();

            credit.amount                 = 2;
            credit.cnpTxnId               = 3;
            credit.reportGroup            = "Planets";
            credit.processingInstructions = new processingInstructions();

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<cnpTxnId>3</cnpTxnId>\r\n<amount>2</amount>\r\n<processi.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><creditResponse><cnpTxnId>123</cnpTxnId></creditResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.Credit(credit);
        }
Example #4
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)))
            .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);
            voidResponse response = cnp.DoVoid(voidTxn);

            Assert.AreEqual(123, response.cnpTxnId);
            Assert.IsNull(response.recyclingResponse);
        }
        public void TestSurchargeAmount()
        {
            forceCapture capture = new forceCapture();

            capture.amount          = 2;
            capture.surchargeAmount = 1;
            capture.orderSource     = orderSourceType.ecommerce;
            capture.reportGroup     = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<surchargeAmount>1</surchargeAmount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><forceCaptureResponse><litleTxnId>123</litleTxnId></forceCaptureResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.ForceCapture(capture);
        }
Example #6
0
        public void TestSurchargeAmount_Optional()
        {
            authReversal reversal = new authReversal();

            reversal.cnpTxnId    = 3;
            reversal.amount      = 2;
            reversal.payPalNotes = "note";
            reversal.reportGroup = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<payPalNotes>note</payPalNotes>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authReversalResponse><cnpTxnId>123</cnpTxnId></authReversalResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.AuthReversal(reversal);
        }
Example #7
0
        public void TestEcheckCredit()
        {
            echeckCredit echeckcredit = new echeckCredit();

            echeckcredit.amount   = 12;
            echeckcredit.cnpTxnId = 123456789101112;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<echeckCredit.*?<cnpTxnId>123456789101112</cnpTxnId>.*?</echeckCredit>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><echeckCreditResponse><cnpTxnId>123</cnpTxnId></echeckCreditResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            echeckCreditResponse echeckcreditresponse = cnp.EcheckCredit(echeckcredit);

            Assert.AreEqual(123, echeckcreditresponse.cnpTxnId);
        }
        public void TestOriginalTransaction()
        {
            authorization auth = new authorization();

            auth.originalNetworkTransactionId = "123456789";
            auth.originalTransactionAmount    = 12;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<originalNetworkTransactionId>123456789</originalNetworkTransactionId>.*?<originalTransactionAmount>12</originalTransactionAmount>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.18' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            authorizationResponse authorizationResponse = litle.Authorize(auth);

            Assert.AreEqual(123, authorizationResponse.litleTxnId);
        }
Example #9
0
        public void TestSurchargeAmount_Optional()
        {
            capture capture = new capture();

            capture.litleTxnId  = 3;
            capture.amount      = 2;
            capture.payPalNotes = "note";
            capture.reportGroup = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<payPalNotes>note</payPalNotes>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><captureResponse><litleTxnId>123</litleTxnId></captureResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.Capture(capture);
        }
Example #10
0
        public void TestSurchargeAmount_OrphanOptional()
        {
            credit credit = new credit();

            credit.amount      = 2;
            credit.orderId     = "3";
            credit.orderSource = orderSourceType.ecommerce;
            credit.reportGroup = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<orderId>3</orderId>\r\n<amount>2</amount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><creditResponse><cnpTxnId>123</cnpTxnId></creditResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.Credit(credit);
        }
Example #11
0
        public void TestSaleWithMCC()
        {
            sale sale = new sale();

            sale.amount = 2;
            sale.merchantCategoryCode = "0111";
            sale.orderSource          = orderSourceType.ecommerce;
            sale.reportGroup          = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<orderSource>ecommerce</orderSource>\r\n<merchantCategoryCode>0111</merchantCategoryCode>.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><saleResponse><cnpTxnId>123</cnpTxnId></saleResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.Sale(sale);
        }
Example #12
0
        public void TestPos_TiedOptional()
        {
            credit credit = new credit();

            credit.amount      = 2;
            credit.cnpTxnId    = 3;
            credit.reportGroup = "Planets";
            credit.payPalNotes = "notes";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<cnpTxnId>3</cnpTxnId>\r\n<amount>2</amount>\r\n<payPalNotes>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><creditResponse><cnpTxnId>123</cnpTxnId></creditResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.Credit(credit);
        }
Example #13
0
        public void TestSecondaryAmount()
        {
            captureGivenAuth capture = new captureGivenAuth();

            capture.amount          = 2;
            capture.secondaryAmount = 1;
            capture.orderSource     = orderSourceType.ecommerce;
            capture.reportGroup     = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<secondaryAmount>1</secondaryAmount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><captureGivenAuthResponse><cnpTxnId>123</cnpTxnId></captureGivenAuthResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.CaptureGivenAuth(capture);
        }
Example #14
0
        public void TestFraudFilterOverride()
        {
            echeckVoid echeckVoid = new echeckVoid();

            echeckVoid.cnpTxnId = 123456789;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<echeckVoid.*<cnpTxnId>123456789.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.13' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><echeckVoidResponse><cnpTxnId>123</cnpTxnId><location>sandbox</location></echeckVoidResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            var response = cnp.EcheckVoid(echeckVoid);

            Assert.NotNull(response);
            Assert.AreEqual("sandbox", response.location);
        }
        public void TestSimple()
        {
            var update = new updateSubscription();

            update.billingDate = new DateTime(2002, 10, 9);
            var billToAddress = new contact();

            billToAddress.name   = "Greg Dake";
            billToAddress.city   = "Lowell";
            billToAddress.state  = "MA";
            billToAddress.email  = "*****@*****.**";
            update.billToAddress = billToAddress;
            var card = new cardType();

            card.number           = "4100000000000001";
            card.expDate          = "1215";
            card.type             = methodOfPaymentTypeEnum.VI;
            update.card           = card;
            update.planCode       = "abcdefg";
            update.subscriptionId = 12345;

            var mock = new Mock <Communications>(_memoryStreams);

            mock.Setup(
                Communications =>
                Communications.HttpPost(
                    It.IsRegex(
                        ".*<litleOnlineRequest.*?<updateSubscription>\r\n<subscriptionId>12345</subscriptionId>\r\n<planCode>abcdefg</planCode>\r\n<billToAddress>\r\n<name>Greg Dake</name>.*?</billToAddress>\r\n<card>\r\n<type>VI</type>.*?</card>\r\n<billingDate>2002-10-09</billingDate>\r\n</updateSubscription>\r\n</litleOnlineRequest>.*?.*",
                        RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >()))
            .Returns(
                "<litleOnlineResponse version='8.20' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><updateSubscriptionResponse ><litleTxnId>456</litleTxnId><response>000</response><message>Approved</message><responseTime>2013-09-04</responseTime><subscriptionId>12345</subscriptionId></updateSubscriptionResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            var response = litle.UpdateSubscription(update);

            Assert.AreEqual("12345", response.subscriptionId);
            Assert.AreEqual("456", response.litleTxnId);
            Assert.AreEqual("000", response.response);
            Assert.NotNull(response.responseTime);
        }
        public void TestUndefinedProcessingType()
        {
            forceCapture capture = new forceCapture();

            capture.amount         = 2;
            capture.orderSource    = orderSourceType.ecommerce;
            capture.reportGroup    = "Planets";
            capture.processingType = processingType.undefined;


            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><forceCaptureResponse><cnpTxnId>123</cnpTxnId></forceCaptureResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.ForceCapture(capture);
        }
Example #17
0
        public void TestSurchargeAmount()
        {
            capture capture = new capture();

            capture.cnpTxnId        = 3;
            capture.amount          = 2;
            capture.surchargeAmount = 1;
            capture.payPalNotes     = "note";
            capture.reportGroup     = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<surchargeAmount>1</surchargeAmount>\r\n<payPalNotes>note</payPalNotes>.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><captureResponse><cnpTxnId>123</cnpTxnId></captureResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.Capture(capture);
        }
        public void TestUnload()
        {
            unload unload = new unload();

            unload.orderId     = "2";
            unload.orderSource = orderSourceType.ecommerce;
            unload.card        = new giftCardCardType();

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<unload.*?<orderId>2</orderId>.*?</unload>.*?", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><unloadResponse><cnpTxnId>123</cnpTxnId></unloadResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            unloadResponse unloadResponse = cnp.Unload(unload);

            Assert.AreEqual(123, unloadResponse.cnpTxnId);
        }
        public void TestSimpleRequest()
        {
            registerTokenRequestType register = new registerTokenRequestType();

            register.orderId       = "12344";
            register.accountNumber = "4100000000000001";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<registerTokenRequest.*<accountNumber>4100000000000001</accountNumber>.*</registerTokenRequest>.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><registerTokenResponse><cnpTxnId>4</cnpTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime><location>sandbox</location></registerTokenResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            var response = cnp.RegisterToken(register);

            Assert.NotNull(response);
            Assert.AreEqual("sandbox", response.location);
        }
Example #20
0
        public void TestSimpleRequest()
        {
            updateCardValidationNumOnToken update = new updateCardValidationNumOnToken();

            update.orderId           = "12344";
            update.litleToken        = "1111222233334444";
            update.cardValidationNum = "321";
            update.id          = "123";
            update.reportGroup = "Default Report Group";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<updateCardValidationNumOnToken id=\"123\" reportGroup=\"Default Report Group\".*<orderId>12344</orderId>.*<litleToken>1111222233334444</litleToken>.*<cardValidationNum>321</cardValidationNum>.*</updateCardValidationNumOnToken>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><updateCardValidationNumOnTokenResponse><litleTxnId>4</litleTxnId><orderId>12344</orderId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></updateCardValidationNumOnTokenResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.UpdateCardValidationNumOnToken(update);
        }
        public void TestMerchantData()
        {
            echeckRedeposit echeckRedeposit = new echeckRedeposit();

            echeckRedeposit.litleTxnId                      = 1;
            echeckRedeposit.merchantData                    = new merchantDataType();
            echeckRedeposit.merchantData.campaign           = "camp";
            echeckRedeposit.merchantData.affiliate          = "affil";
            echeckRedeposit.merchantData.merchantGroupingId = "mgi";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<echeckRedeposit.*<litleTxnId>1</litleTxnId>.*<merchantData>.*<campaign>camp</campaign>.*<affiliate>affil</affiliate>.*<merchantGroupingId>mgi</merchantGroupingId>.*</merchantData>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.13' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><echeckRedepositResponse><litleTxnId>123</litleTxnId></echeckRedepositResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.EcheckRedeposit(echeckRedeposit);
        }
Example #22
0
        public void testUnload()
        {
            unload unload = new unload();

            unload.orderId     = "2";
            unload.orderSource = orderSourceType.ecommerce;
            unload.card        = new cardType();

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<unload.*?<orderId>2</orderId>.*?</unload>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><unloadResponse><litleTxnId>123</litleTxnId></unloadResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            unloadResponse unloadResponse = litle.Unload(unload);

            Assert.AreEqual("123", unloadResponse.litleTxnId);
        }
Example #23
0
        public void TestBalanceInquiry()
        {
            balanceInquiry balanceInquiry = new balanceInquiry();

            balanceInquiry.orderId     = "2";
            balanceInquiry.orderSource = orderSourceType.ecommerce;
            balanceInquiry.card        = new giftCardCardType();

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<balanceInquiry.*?<orderId>2</orderId>.*?</balanceInquiry>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><balanceInquiryResponse><cnpTxnId>123</cnpTxnId></balanceInquiryResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            balanceInquiryResponse balanceInquiryResponse = cnp.BalanceInquiry(balanceInquiry);

            Assert.AreEqual(123, balanceInquiryResponse.cnpTxnId);
        }
        public void TestFraudFilterOverride()
        {
            sale sale = new sale();

            sale.orderId             = "12344";
            sale.amount              = 2;
            sale.orderSource         = orderSourceType.ecommerce;
            sale.reportGroup         = "Planets";
            sale.fraudFilterOverride = false;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<fraudFilterOverride>false</fraudFilterOverride>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><saleResponse><cnpTxnId>123</cnpTxnId></saleResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.Sale(sale);
        }
        public void TestSecondaryAmount_Tied()
        {
            credit credit = new credit();

            credit.amount                 = 2;
            credit.secondaryAmount        = 1;
            credit.litleTxnId             = 3;
            credit.processingInstructions = new processingInstructions();
            credit.reportGroup            = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleTxnId>3</litleTxnId>\r\n<amount>2</amount>\r\n<secondaryAmount>1</secondaryAmount>\r\n<process.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><creditResponse><litleTxnId>123</litleTxnId></creditResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.Credit(credit);
        }
Example #26
0
        public void TestActionReasonOnOrphanedRefund()
        {
            credit credit = new credit();

            credit.orderId      = "12344";
            credit.amount       = 2;
            credit.orderSource  = orderSourceType.ecommerce;
            credit.reportGroup  = "Planets";
            credit.actionReason = "SUSPECT_FRAUD";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<actionReason>SUSPECT_FRAUD</actionReason>.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><creditResponse><cnpTxnId>123</cnpTxnId></creditResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.Credit(credit);
        }
Example #27
0
        public void testToken()
        {
            registerTokenRequestType token = new registerTokenRequestType();

            token.orderId       = "12344";
            token.accountNumber = "1233456789103801";


            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<registerTokenRequest.*?<accountNumber>1233456789103801</accountNumber>.*?</registerTokenRequest>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>123</litleTxnId></registerTokenResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            registerTokenResponse registertokenresponse = litle.RegisterToken(token);

            Assert.AreEqual(123, registertokenresponse.litleTxnId);
        }
        public void TestSimple()
        {
            refundReversal refundReversal = new refundReversal();

            refundReversal.id          = "a";
            refundReversal.reportGroup = "b";
            refundReversal.litleTxnId  = "123";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleTxnId>123</litleTxnId>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.22' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><refundReversalResponse><litleTxnId>123</litleTxnId></refundReversalResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            refundReversalResponse response = litle.RefundReversal(refundReversal);

            Assert.AreEqual("123", response.litleTxnId);
        }
Example #29
0
        public void testDeactivate()
        {
            deactivate deactivate = new deactivate();

            deactivate.orderId     = "2";
            deactivate.orderSource = orderSourceType.ecommerce;
            deactivate.card        = new giftCardCardType();

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<deactivate.*?<orderId>2</orderId>.*?</deactivate>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><deactivateResponse><litleTxnId>123</litleTxnId></deactivateResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            deactivateResponse deactivateResponse = litle.Deactivate(deactivate);

            Assert.AreEqual(123, deactivateResponse.litleTxnId);
        }
        public void TestApplepayAndWallet()
        {
            var sale = new sale();

            sale.applepay = new applepayType();
            var applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            sale.applepay.header    = applepayHeaderType;
            sale.applepay.data      = "user";
            sale.applepay.signature = "sign";
            sale.applepay.version   = "1";
            sale.orderId            = "12344";
            sale.amount             = 2;
            sale.orderSource        = orderSourceType.ecommerce;
            var wallet = new wallet();

            wallet.walletSourceTypeId = "123";
            sale.wallet = wallet;

            var mock = new Mock <Communications>(_memoryStreams);

            ;

            mock.Setup(
                Communications =>
                Communications.HttpPost(
                    It.IsRegex(
                        ".*?<litleOnlineRequest.*?<sale.*?<applepay>.*?<data>user</data>.*?</applepay>.*?<walletSourceTypeId>123</walletSourceTypeId>.*?</wallet>.*?</sale>.*?",
                        RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >()))
            .Returns(
                "<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><saleResponse><litleTxnId>123</litleTxnId></saleResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.Sale(sale);
        }