public void testAccountUpdateFileRequestData()
        {
            var mockConfig = new Dictionary <string, string>();

            mockConfig["url"]               = "https://www.mockurl.com";
            mockConfig["reportGroup"]       = "Mock Report Group";
            mockConfig["username"]          = "******";
            mockConfig["printxml"]          = "false";
            mockConfig["timeout"]           = "35";
            mockConfig["proxyHost"]         = "www.mockproxy.com";
            mockConfig["merchantId"]        = "MOCKID";
            mockConfig["password"]          = "******";
            mockConfig["proxyPort"]         = "3000";
            mockConfig["sftpUrl"]           = "www.mockftp.com";
            mockConfig["sftpUsername"]      = "******";
            mockConfig["sftpPassword"]      = "******";
            mockConfig["knownHostsFile"]    = "C:\\MockKnownHostsFile";
            mockConfig["onlineBatchUrl"]    = "www.mockbatch.com";
            mockConfig["onlineBatchPort"]   = "4000";
            mockConfig["requestDirectory"]  = "C:\\MockRequests";
            mockConfig["responseDirectory"] = "C:\\MockResponses";

            var accountUpdateFileRequest        = new accountUpdateFileRequestData(mockConfig);
            var accountUpdateFileRequestDefault = new accountUpdateFileRequestData();

            Assert.AreEqual(accountUpdateFileRequestDefault.merchantId, Settings.Default.merchantId);
            Assert.AreEqual(accountUpdateFileRequest.merchantId, mockConfig["merchantId"]);
        }
        public void testAccountUpdateFileRequestData()
        {
            var mockConfig = new Dictionary<string, string>();

            mockConfig["url"] = "https://www.mockurl.com";
            mockConfig["reportGroup"] = "Mock Report Group";
            mockConfig["username"] = "******";
            mockConfig["printxml"] = "false";
            mockConfig["timeout"] = "35";
            mockConfig["proxyHost"] = "www.mockproxy.com";
            mockConfig["merchantId"] = "MOCKID";
            mockConfig["password"] = "******";
            mockConfig["proxyPort"] = "3000";
            mockConfig["sftpUrl"] = "www.mockftp.com";
            mockConfig["sftpUsername"] = "******";
            mockConfig["sftpPassword"] = "******";
            mockConfig["knownHostsFile"] = "C:\\MockKnownHostsFile";
            mockConfig["onlineBatchUrl"] = "www.mockbatch.com";
            mockConfig["onlineBatchPort"] = "4000";
            mockConfig["requestDirectory"] = "C:\\MockRequests";
            mockConfig["responseDirectory"] = "C:\\MockResponses";

            var accountUpdateFileRequest = new accountUpdateFileRequestData(mockConfig);
            var accountUpdateFileRequestDefault = new accountUpdateFileRequestData();

            Assert.AreEqual(accountUpdateFileRequestDefault.merchantId, Settings.Default.merchantId);
            Assert.AreEqual(accountUpdateFileRequest.merchantId, mockConfig["merchantId"]);
        }
        public void RFRBatch()
        {
            var litleBatchRequest = new batchRequest(memoryStreams);
            litleBatchRequest.id = "1234567A";

            var accountUpdate1 = new accountUpdate();
            accountUpdate1.orderId = "1111";
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4242424242424242";
            card.expDate = "1210";
            accountUpdate1.card = card;

            litleBatchRequest.addAccountUpdate(accountUpdate1);

            var accountUpdate2 = new accountUpdate();
            accountUpdate2.orderId = "1112";
            accountUpdate2.card = card;

            litleBatchRequest.addAccountUpdate(accountUpdate2);

            litle.addBatch(litleBatchRequest);
            var litleResponse = litle.sendToLitleWithStream();

            Assert.NotNull(litleResponse);

            var litleBatchResponse = litleResponse.nextBatchResponse();
            Assert.NotNull(litleBatchResponse);
            while (litleBatchResponse != null)
            {
                var accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse();
                Assert.NotNull(accountUpdateResponse);
                while (accountUpdateResponse != null)
                {
                    Assert.AreEqual("000", accountUpdateResponse.response);

                    accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse();
                }
                litleBatchResponse = litleResponse.nextBatchResponse();
            }

            var litleRfr = new litleRequest(memoryStreams);
            var rfrRequest = new RFRRequest(memoryStreams);
            var accountUpdateFileRequestData = new accountUpdateFileRequestData();
            accountUpdateFileRequestData.merchantId = Settings.Default.merchantId;
            accountUpdateFileRequestData.postDay = DateTime.Now;
            rfrRequest.accountUpdateFileRequestData = accountUpdateFileRequestData;

            litleRfr.addRFRRequest(rfrRequest);

            try
            {
                var litleRfrResponse = litleRfr.sendToLitleWithStream();
                Assert.NotNull(litleRfrResponse);

                var rfrResponse = litleRfrResponse.nextRFRResponse();
                Assert.NotNull(rfrResponse);
                while (rfrResponse != null)
                {
                    Assert.AreEqual("1", rfrResponse.response);
                    Assert.AreEqual("The account update file is not ready yet.  Please try again later.",
                        rfrResponse.message);
                    rfrResponse = litleResponse.nextRFRResponse();
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 4
0
        public void RFRBatch()
        {
            batchRequest litleBatchRequest = new batchRequest();

            litleBatchRequest.id = "1234567A";

            accountUpdate accountUpdate1 = new accountUpdate();

            accountUpdate1.orderId = "1111";
            cardType card = new cardType();

            card.type           = methodOfPaymentTypeEnum.VI;
            card.number         = "4242424242424242";
            card.expDate        = "1210";
            accountUpdate1.card = card;

            litleBatchRequest.addAccountUpdate(accountUpdate1);

            accountUpdate accountUpdate2 = new accountUpdate();

            accountUpdate2.orderId = "1112";
            accountUpdate2.card    = card;

            litleBatchRequest.addAccountUpdate(accountUpdate2);

            litle.addBatch(litleBatchRequest);
            litleResponse litleResponse = litle.sendToLitleWithStream();

            Assert.NotNull(litleResponse);

            batchResponse litleBatchResponse = litleResponse.nextBatchResponse();

            Assert.NotNull(litleBatchResponse);
            while (litleBatchResponse != null)
            {
                accountUpdateResponse accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse();
                Assert.NotNull(accountUpdateResponse);
                while (accountUpdateResponse != null)
                {
                    Assert.AreEqual("000", accountUpdateResponse.response);

                    accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse();
                }
                litleBatchResponse = litleResponse.nextBatchResponse();
            }

            litleRequest litleRfr   = new litleRequest();
            RFRRequest   rfrRequest = new RFRRequest();
            accountUpdateFileRequestData accountUpdateFileRequestData = new accountUpdateFileRequestData();

            accountUpdateFileRequestData.merchantId = Properties.Settings.Default.merchantId;
            accountUpdateFileRequestData.postDay    = DateTime.Now;
            rfrRequest.accountUpdateFileRequestData = accountUpdateFileRequestData;

            litleRfr.addRFRRequest(rfrRequest);
            litleResponse litleRfrResponse = litleRfr.sendToLitleWithStream();

            Assert.NotNull(litleRfrResponse);

            RFRResponse rfrResponse = litleRfrResponse.nextRFRResponse();

            Assert.NotNull(rfrResponse);
            while (rfrResponse != null)
            {
                Assert.AreEqual("1", rfrResponse.response);
                Assert.AreEqual("The account update file is not ready yet.  Please try again later.", rfrResponse.message);

                rfrResponse = litleResponse.nextRFRResponse();
            }
        }