Example #1
0
        public void TestAddReserveDebit()
        {
            var reserveDebit = new reserveDebit();

            reserveDebit.fundingSubmerchantId = "123456";
            reserveDebit.fundsTransferId      = "123467";
            reserveDebit.amount = 107L;

            _batchRequest.addReserveDebit(reserveDebit);

            Assert.AreEqual(1, _batchRequest.getNumReserveDebit());
            Assert.AreEqual(107L, _batchRequest.getReserveDebitAmount());

            _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), _mockLitleTime.Object));
            _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, reserveDebit.Serialize()));
        }
Example #2
0
        public void ReserveDebit()
        {
            var reserveDebit = new reserveDebit
            {
                // attributes.
                id          = "1",
                reportGroup = "Planets",
                // required child elements.
                amount = 1500,
                fundingSubmerchantId = "value for fundingSubmerchantId",
                fundsTransferId      = "value for fundsTransferId"
            };

            var response = _cnp.ReserveDebit(reserveDebit);

            Assert.AreEqual("000", response.response);
        }
Example #3
0
        public void ReserveDebitXMLCharacters()
        {
            var reserveDebit = new reserveDebit
            {
                // attributes.
                id          = "1",
                reportGroup = "Default Report Group",
                // required child elements.
                amount            = 1512l,
                fundingCustomerId = "value <for> fundingCustomerId",
                fundsTransferId   = "value for fundsTransferId"
            };

            var response = _cnp.ReserveDebit(reserveDebit);

            Assert.AreEqual("000", response.response);
        }
Example #4
0
        public void TestAddReserveDebit()
        {
            var reserveDebit = new reserveDebit();

            reserveDebit.fundingSubmerchantId = "123456";
            reserveDebit.fundsTransferId      = "123467";
            reserveDebit.amount = 107L;

            batchRequest.addReserveDebit(reserveDebit);

            Assert.AreEqual(1, batchRequest.getNumReserveDebit());
            Assert.AreEqual(107L, batchRequest.getReserveDebitAmount());
            Assert.AreEqual("\r\n<reserveDebit reportGroup=\"Default Report Group\">\r\n<fundingSubmerchantId>123456</fundingSubmerchantId>\r\n<fundsTransferId>123467</fundsTransferId>\r\n<amount>107</amount>\r\n</reserveDebit>",
                            reserveDebit.Serialize());

            mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object));
            mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, reserveDebit.Serialize()));
        }
        public void TestReserveDebitAsync()
        {
            var reserveDebit = new reserveDebit
            {
                // attributes.
                id          = "1",
                reportGroup = "Planets",
                // required child elements.
                amount = 1500,
                fundingSubmerchantId = "value for fundingSubmerchantId",
                fundsTransferId      = "value for fundsTransferId"
            };

            CancellationToken cancellationToken = new CancellationToken(false);
            var response = _cnp.ReserveDebitAsync(reserveDebit, cancellationToken);

            Assert.AreEqual("000", response.Result.response);
        }
Example #6
0
 public Task <reserveDebitResponse> ReserveDebitAsync(reserveDebit transaction, CancellationToken cancellationToken)
 {
     return(this.SendTransactionAsync <reserveDebitResponse>(transaction, cancellationToken));
 }
Example #7
0
 public reserveDebitResponse ReserveDebit(reserveDebit transaction)
 {
     return(this.SendTransaction <reserveDebitResponse>(transaction));
 }
Example #8
0
 public Task <reserveDebitResponse> ReserveDebitAsync(reserveDebit reserveDebit, CancellationToken cancellationToken)
 {
     return(SendRequestAsync(response => response.reserveDebitResponse, reserveDebit, cancellationToken));
 }
Example #9
0
 public reserveDebitResponse ReserveDebit(reserveDebit reserveDebit)
 {
     return(SendRequest(response => response.reserveDebitResponse, reserveDebit));
 }
        public void PFIFInstructionTxnTest()
        {
            var memoryStream = new Dictionary<string, StringBuilder>();
            var configOverride = new Dictionary<string, string>();
            configOverride["url"] = Settings.Default.url;
            configOverride["reportGroup"] = Settings.Default.reportGroup;
            configOverride["username"] = "******";
            configOverride["printxml"] = Settings.Default.printxml;
            configOverride["timeout"] = Settings.Default.timeout;
            configOverride["proxyHost"] = Settings.Default.proxyHost;
            configOverride["merchantId"] = "0180";
            configOverride["password"] = "******";
            configOverride["proxyPort"] = Settings.Default.proxyPort;
            configOverride["sftpUrl"] = Settings.Default.sftpUrl;
            configOverride["sftpUsername"] = Settings.Default.sftpUsername;
            configOverride["sftpPassword"] = Settings.Default.sftpPassword;
            configOverride["knownHostsFile"] = Settings.Default.knownHostsFile;
            configOverride["onlineBatchUrl"] = Settings.Default.onlineBatchUrl;
            configOverride["onlineBatchPort"] = Settings.Default.onlineBatchPort;
            configOverride["requestDirectory"] = Settings.Default.requestDirectory;
            configOverride["responseDirectory"] = Settings.Default.responseDirectory;

            var litleOverride = new litleRequest(memoryStream, configOverride);

            var litleBatchRequest = new batchRequest(memoryStream, configOverride);

            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Corporate;
            echeck.accNum = "1092969901";
            echeck.routingNum = "011075150";
            echeck.checkNum = "123455";

            var submerchantCredit = new submerchantCredit();
            submerchantCredit.fundingSubmerchantId = "123456";
            submerchantCredit.submerchantName = "merchant";
            submerchantCredit.fundsTransferId = "123467";
            submerchantCredit.amount = 106L;
            submerchantCredit.accountInfo = echeck;
            litleBatchRequest.addSubmerchantCredit(submerchantCredit);

            var payFacCredit = new payFacCredit();
            payFacCredit.fundingSubmerchantId = "123456";
            payFacCredit.fundsTransferId = "123467";
            payFacCredit.amount = 107L;
            litleBatchRequest.addPayFacCredit(payFacCredit);

            var reserveCredit = new reserveCredit();
            reserveCredit.fundingSubmerchantId = "123456";
            reserveCredit.fundsTransferId = "123467";
            reserveCredit.amount = 107L;
            litleBatchRequest.addReserveCredit(reserveCredit);

            var vendorCredit = new vendorCredit();
            vendorCredit.fundingSubmerchantId = "123456";
            vendorCredit.vendorName = "merchant";
            vendorCredit.fundsTransferId = "123467";
            vendorCredit.amount = 106L;
            vendorCredit.accountInfo = echeck;
            litleBatchRequest.addVendorCredit(vendorCredit);

            var physicalCheckCredit = new physicalCheckCredit();
            physicalCheckCredit.fundingSubmerchantId = "123456";
            physicalCheckCredit.fundsTransferId = "123467";
            physicalCheckCredit.amount = 107L;
            litleBatchRequest.addPhysicalCheckCredit(physicalCheckCredit);

            var submerchantDebit = new submerchantDebit();
            submerchantDebit.fundingSubmerchantId = "123456";
            submerchantDebit.submerchantName = "merchant";
            submerchantDebit.fundsTransferId = "123467";
            submerchantDebit.amount = 106L;
            submerchantDebit.accountInfo = echeck;
            litleBatchRequest.addSubmerchantDebit(submerchantDebit);

            var payFacDebit = new payFacDebit();
            payFacDebit.fundingSubmerchantId = "123456";
            payFacDebit.fundsTransferId = "123467";
            payFacDebit.amount = 107L;
            litleBatchRequest.addPayFacDebit(payFacDebit);

            var reserveDebit = new reserveDebit();
            reserveDebit.fundingSubmerchantId = "123456";
            reserveDebit.fundsTransferId = "123467";
            reserveDebit.amount = 107L;
            litleBatchRequest.addReserveDebit(reserveDebit);

            var vendorDebit = new vendorDebit();
            vendorDebit.fundingSubmerchantId = "123456";
            vendorDebit.vendorName = "merchant";
            vendorDebit.fundsTransferId = "123467";
            vendorDebit.amount = 106L;
            vendorDebit.accountInfo = echeck;
            litleBatchRequest.addVendorDebit(vendorDebit);

            var physicalCheckDebit = new physicalCheckDebit();
            physicalCheckDebit.fundingSubmerchantId = "123456";
            physicalCheckDebit.fundsTransferId = "123467";
            physicalCheckDebit.amount = 107L;
            litleBatchRequest.addPhysicalCheckDebit(physicalCheckDebit);

            litleOverride.addBatch(litleBatchRequest);

            var litleResponse = litleOverride.sendToLitleWithStream();

            Assert.NotNull(litleResponse);
            Assert.AreEqual("0", litleResponse.response);
            Assert.AreEqual("Valid Format", litleResponse.message);

            var litleBatchResponse = litleResponse.nextBatchResponse();
            while (litleBatchResponse != null)
            {
                var submerchantCreditResponse = litleBatchResponse.nextSubmerchantCreditResponse();
                while (submerchantCreditResponse != null)
                {
                    Assert.AreEqual("000", submerchantCreditResponse.response);
                    submerchantCreditResponse = litleBatchResponse.nextSubmerchantCreditResponse();
                }

                var payFacCreditResponse = litleBatchResponse.nextPayFacCreditResponse();
                while (payFacCreditResponse != null)
                {
                    Assert.AreEqual("000", payFacCreditResponse.response);
                    payFacCreditResponse = litleBatchResponse.nextPayFacCreditResponse();
                }

                var vendorCreditResponse = litleBatchResponse.nextVendorCreditResponse();
                while (vendorCreditResponse != null)
                {
                    Assert.AreEqual("000", vendorCreditResponse.response);
                    vendorCreditResponse = litleBatchResponse.nextVendorCreditResponse();
                }

                var reserveCreditResponse = litleBatchResponse.nextReserveCreditResponse();
                while (reserveCreditResponse != null)
                {
                    Assert.AreEqual("000", reserveCreditResponse.response);
                    reserveCreditResponse = litleBatchResponse.nextReserveCreditResponse();
                }

                var physicalCheckCreditResponse = litleBatchResponse.nextPhysicalCheckCreditResponse();
                while (physicalCheckCreditResponse != null)
                {
                    Assert.AreEqual("000", physicalCheckCreditResponse.response);
                    physicalCheckCreditResponse = litleBatchResponse.nextPhysicalCheckCreditResponse();
                }

                var submerchantDebitResponse = litleBatchResponse.nextSubmerchantDebitResponse();
                while (submerchantDebitResponse != null)
                {
                    Assert.AreEqual("000", submerchantDebitResponse.response);
                    submerchantDebitResponse = litleBatchResponse.nextSubmerchantDebitResponse();
                }

                var payFacDebitResponse = litleBatchResponse.nextPayFacDebitResponse();
                while (payFacDebitResponse != null)
                {
                    Assert.AreEqual("000", payFacDebitResponse.response);
                    payFacDebitResponse = litleBatchResponse.nextPayFacDebitResponse();
                }

                var vendorDebitResponse = litleBatchResponse.nextVendorDebitResponse();
                while (vendorDebitResponse != null)
                {
                    Assert.AreEqual("000", vendorDebitResponse.response);
                    vendorDebitResponse = litleBatchResponse.nextVendorDebitResponse();
                }

                var reserveDebitResponse = litleBatchResponse.nextReserveDebitResponse();
                while (reserveDebitResponse != null)
                {
                    Assert.AreEqual("000", reserveDebitResponse.response);
                    reserveDebitResponse = litleBatchResponse.nextReserveDebitResponse();
                }

                var physicalCheckDebitResponse = litleBatchResponse.nextPhysicalCheckDebitResponse();
                while (physicalCheckDebitResponse != null)
                {
                    Assert.AreEqual("000", physicalCheckDebitResponse.response);
                    physicalCheckDebitResponse = litleBatchResponse.nextPhysicalCheckDebitResponse();
                }

                litleBatchResponse = litleResponse.nextBatchResponse();
            }
        }
        public void SimpleBatch()
        {
            batchRequest litleBatchRequest = new batchRequest();

            var payFacCredit = new payFacCredit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                fundsTransferId      = "123467",
                amount = 107L
            };

            litleBatchRequest.addPayFacCredit(payFacCredit);

            var payFacDebit = new payFacDebit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                fundsTransferId      = "123467",
                amount = 107L
            };

            litleBatchRequest.addPayFacDebit(payFacDebit);

            var submerchantCredit = new submerchantCredit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                submerchantName      = "Test",
                fundsTransferId      = "123467",
                amount      = 107L,
                accountInfo = new echeckType
                {
                    accType               = echeckAccountTypeEnum.Corporate,
                    accNum                = "1092969901",
                    routingNum            = "011075150",
                    checkNum              = "123456789",
                    ccdPaymentInformation = "description"
                },
                customIdentifier = "abc123"
            };

            litleBatchRequest.addSubmerchantCredit(submerchantCredit);

            var submerchantDebit = new submerchantDebit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                submerchantName      = "Test",
                fundsTransferId      = "123467",
                amount      = 107L,
                accountInfo = new echeckType
                {
                    accType               = echeckAccountTypeEnum.Corporate,
                    accNum                = "1092969901",
                    routingNum            = "011075150",
                    checkNum              = "123456789",
                    ccdPaymentInformation = "description"
                },
                customIdentifier = "abc123"
            };

            litleBatchRequest.addSubmerchantDebit(submerchantDebit);

            var reserveCredit = new reserveCredit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                fundsTransferId      = "123467",
                amount = 107L
            };

            litleBatchRequest.addReserveCredit(reserveCredit);

            var reserveDebit = new reserveDebit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                fundsTransferId      = "123467",
                amount = 107L
            };

            litleBatchRequest.addReserveDebit(reserveDebit);

            var vendorCredit = new vendorCredit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                vendorName           = "Test",
                fundsTransferId      = "123467",
                amount      = 107L,
                accountInfo = new echeckType
                {
                    accType               = echeckAccountTypeEnum.Corporate,
                    accNum                = "1092969901",
                    routingNum            = "011075150",
                    checkNum              = "123456789",
                    ccdPaymentInformation = "description"
                }
            };

            litleBatchRequest.addVendorCredit(vendorCredit);

            var vendorDebit = new vendorDebit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                vendorName           = "Test",
                fundsTransferId      = "123467",
                amount      = 107L,
                accountInfo = new echeckType
                {
                    accType               = echeckAccountTypeEnum.Corporate,
                    accNum                = "1092969901",
                    routingNum            = "011075150",
                    checkNum              = "123456789",
                    ccdPaymentInformation = "description"
                }
            };

            litleBatchRequest.addVendorDebit(vendorDebit);

            var physicalCheckCredit = new physicalCheckCredit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                fundsTransferId      = "123467",
                amount = 107L
            };

            litleBatchRequest.addPhysicalCheckCredit(physicalCheckCredit);

            var physicalCheckDebit = new physicalCheckDebit
            {
                id = "id",
                fundingSubmerchantId = "123456789",
                fundsTransferId      = "123467",
                amount = 107L
            };

            litleBatchRequest.addPhysicalCheckDebit(physicalCheckDebit);

            litle.addBatch(litleBatchRequest);

            string batchName = litle.sendToLitle();

            litle.blockAndWaitForResponse(batchName, estimatedResponseTime(2 * 2, 10 * 2));

            litleResponse litleResponse = litle.receiveFromLitle(batchName);

            Assert.NotNull(litleResponse);
            Assert.AreEqual("0", litleResponse.response);
            Assert.AreEqual("Valid Format", litleResponse.message);

            batchResponse litleBatchResponse = litleResponse.nextBatchResponse();

            while (litleBatchResponse != null)
            {
                payFacCreditResponse payFacCreditResponse = litleBatchResponse.nextPayFacCreditResponse();
                while (payFacCreditResponse != null)
                {
                    Assert.AreEqual("000", payFacCreditResponse.response);

                    payFacCreditResponse = litleBatchResponse.nextPayFacCreditResponse();
                }

                payFacDebitResponse payFacDebitResponse = litleBatchResponse.nextPayFacDebitResponse();
                while (payFacDebitResponse != null)
                {
                    Assert.AreEqual("000", payFacDebitResponse.response);

                    payFacDebitResponse = litleBatchResponse.nextPayFacDebitResponse();
                }

                submerchantCreditResponse submerchantCreditResponse = litleBatchResponse.nextSubmerchantCreditResponse();
                while (submerchantCreditResponse != null)
                {
                    Assert.AreEqual("000", submerchantCreditResponse.response);

                    submerchantCreditResponse = litleBatchResponse.nextSubmerchantCreditResponse();
                }

                submerchantDebitResponse submerchantDebitResponse = litleBatchResponse.nextSubmerchantDebitResponse();
                while (submerchantDebitResponse != null)
                {
                    Assert.AreEqual("000", submerchantDebitResponse.response);

                    submerchantDebitResponse = litleBatchResponse.nextSubmerchantDebitResponse();
                }

                reserveCreditResponse reserveCreditResponse = litleBatchResponse.nextReserveCreditResponse();
                while (reserveCreditResponse != null)
                {
                    Assert.AreEqual("000", reserveCreditResponse.response);

                    reserveCreditResponse = litleBatchResponse.nextReserveCreditResponse();
                }

                reserveDebitResponse reserveDebitResponse = litleBatchResponse.nextReserveDebitResponse();
                while (reserveDebitResponse != null)
                {
                    Assert.AreEqual("000", reserveDebitResponse.response);

                    reserveDebitResponse = litleBatchResponse.nextReserveDebitResponse();
                }

                vendorCreditResponse vendorCreditResponse = litleBatchResponse.nextVendorCreditResponse();
                while (vendorCreditResponse != null)
                {
                    Assert.AreEqual("000", vendorCreditResponse.response);

                    vendorCreditResponse = litleBatchResponse.nextVendorCreditResponse();
                }

                vendorDebitResponse vendorDebitResponse = litleBatchResponse.nextVendorDebitResponse();
                while (vendorDebitResponse != null)
                {
                    Assert.AreEqual("000", vendorDebitResponse.response);

                    vendorDebitResponse = litleBatchResponse.nextVendorDebitResponse();
                }

                physicalCheckCreditResponse physicalCheckCreditResponse = litleBatchResponse.nextPhysicalCheckCreditResponse();
                while (physicalCheckCreditResponse != null)
                {
                    Assert.AreEqual("000", physicalCheckCreditResponse.response);

                    physicalCheckCreditResponse = litleBatchResponse.nextPhysicalCheckCreditResponse();
                }

                physicalCheckDebitResponse physicalCheckDebitResponse = litleBatchResponse.nextPhysicalCheckDebitResponse();
                while (physicalCheckDebitResponse != null)
                {
                    Assert.AreEqual("000", physicalCheckDebitResponse.response);

                    physicalCheckDebitResponse = litleBatchResponse.nextPhysicalCheckDebitResponse();
                }

                litleBatchResponse = litleResponse.nextBatchResponse();
            }
        }
        public void testAddReserveDebit()
        {
            var reserveDebit = new reserveDebit();
            reserveDebit.fundingSubmerchantId = "123456";
            reserveDebit.fundsTransferId = "123467";
            reserveDebit.amount = 107L;

            batchRequest.addReserveDebit(reserveDebit);

            Assert.AreEqual(1, batchRequest.getNumReserveDebit());
            Assert.AreEqual(107L, batchRequest.getReserveDebitAmount());

            mockLitleFile.Verify(
                litleFile =>
                    litleFile.createRandomFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),
                        mockLitleTime.Object));
            mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, reserveDebit.Serialize()));
        }