Ejemplo n.º 1
0
        public void TestReserveDebitAsync()
        {
            var vendorDebit = new vendorDebit
            {
                // attributes.
                id          = "1",
                reportGroup = "Default Report Group",
                // required child elements.
                accountInfo = new echeckType()
                {
                    accType    = echeckAccountTypeEnum.Savings,
                    accNum     = "1234",
                    routingNum = "12345678"
                },
                amount = 1500,
                fundingSubmerchantId = "value for fundingSubmerchantId",
                fundsTransferId      = "value for fundsTransferId",
                vendorName           = "WorldPay"
            };

            CancellationToken cancellationToken = new CancellationToken(false);
            var response = _cnp.VendorDebitAsync(vendorDebit, cancellationToken);

            Assert.AreEqual("000", response.Result.response);
        }
Ejemplo n.º 2
0
        public void TestAddVendorDebit()
        {
            var vendorDebit = new vendorDebit();

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

            echeck.accType          = echeckAccountTypeEnum.Checking;
            echeck.accNum           = "12345657890";
            echeck.routingNum       = "123456789";
            echeck.checkNum         = "123455";
            vendorDebit.accountInfo = echeck;

            batchRequest.addVendorDebit(vendorDebit);

            Assert.AreEqual(1, batchRequest.getNumVendorDebit());
            Assert.AreEqual(106L, batchRequest.getVendorDebitAmount());
            Assert.AreEqual("\r\n<vendorDebit reportGroup=\"Default Report Group\">\r\n<fundingSubmerchantId>123456</fundingSubmerchantId>\r\n<vendorName>merchant</vendorName>\r\n<fundsTransferId>123467</fundsTransferId>\r\n<amount>106</amount>\r\n<accountInfo>\r\n<accType>Checking</accType>\r\n<accNum>12345657890</accNum>\r\n<routingNum>123456789</routingNum>\r\n<checkNum>123455</checkNum></accountInfo>\r\n</vendorDebit>",
                            vendorDebit.Serialize());

            mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object));
            mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, vendorDebit.Serialize()));
        }
Ejemplo n.º 3
0
        public void ReserveDebitWithFundingCustomerId()
        {
            var vendorDebit = new vendorDebit
            {
                // attributes.
                id          = "1",
                reportGroup = "Default Report Group",
                // required child elements.
                accountInfo = new echeckType()
                {
                    accType    = echeckAccountTypeEnum.Savings,
                    accNum     = "1234",
                    routingNum = "12345678"
                },
                amount = 1500,
                fundingSubmerchantId = "value for fundingSubmerchantId",
                fundsTransferId      = "value for fundsTransferId",
                fundingCustomerId    = "value for fundingCustomerId",
                vendorName           = "WorldPay"
            };

            var response = _cnp.VendorDebit(vendorDebit);

            Assert.AreEqual("000", response.response);
        }
        public void testAddVendorDebit()
        {
            var vendorDebit = new vendorDebit();

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

            echeck.accType          = echeckAccountTypeEnum.Checking;
            echeck.accNum           = "12345657890";
            echeck.routingNum       = "123456789";
            echeck.checkNum         = "123455";
            vendorDebit.accountInfo = echeck;

            batchRequest.addVendorDebit(vendorDebit);

            Assert.AreEqual(1, batchRequest.getNumVendorDebit());
            Assert.AreEqual(106L, batchRequest.getVendorDebitAmount());

            mockLitleFile.Verify(
                litleFile =>
                litleFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                           mockLitleTime.Object));
            mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, vendorDebit.Serialize()));
        }
Ejemplo n.º 5
0
        public void TestVendorDebit()
        {
            var transaction = new vendorDebit
            {
                id          = "1",
                accountInfo = new echeckType()
                {
                    accType    = echeckAccountTypeEnum.Savings,
                    accNum     = "1234",
                    routingNum = "12345678"
                },
                amount = 1500,
                fundingSubmerchantId = "value for fundingSubmerchantId",
                fundsTransferId      = "value for fundsTransferId",
                vendorName           = "WorldPay"
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "9.2");
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedUnpopulated("customerId", null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("fundsTransferId", transaction.fundsTransferId, "9.2", null);
            test.SetExpectedPopulated("response", "000", "9.2", null);
            test.SetExpectedPopulated("responseTime", "9.2", null);
            test.SetExpectedPopulated("message", "Approved", "9.2", null);
            test.SetExpectedPopulated("litleTxnId", "9.2", "12.0");
            test.RunCnpTestThreaded <vendorDebitResponse>(transaction);
        }
Ejemplo n.º 6
0
 public Task <vendorDebitResponse> VendorDebitAsync(vendorDebit transaction, CancellationToken cancellationToken)
 {
     return(this.SendTransactionAsync <vendorDebitResponse>(transaction, cancellationToken));
 }
Ejemplo n.º 7
0
 public vendorDebitResponse VendorDebit(vendorDebit transaction)
 {
     return(this.SendTransaction <vendorDebitResponse>(transaction));
 }
Ejemplo n.º 8
0
 public vendorDebitResponse VendorDebit(vendorDebit vendorDebit)
 {
     return(SendRequest(response => response.vendorDebitResponse, vendorDebit));
 }
Ejemplo n.º 9
0
 public Task <vendorDebitResponse> VendorDebitAsync(vendorDebit vendorDebit, CancellationToken cancellationToken)
 {
     return(SendRequestAsync(response => response.vendorDebitResponse, vendorDebit, cancellationToken));
 }
        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 testAddVendorDebit()
        {
            var vendorDebit = new vendorDebit();
            vendorDebit.fundingSubmerchantId = "123456";
            vendorDebit.vendorName = "merchant";
            vendorDebit.fundsTransferId = "123467";
            vendorDebit.amount = 106L;
            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Checking;
            echeck.accNum = "12345657890";
            echeck.routingNum = "123456789";
            echeck.checkNum = "123455";
            vendorDebit.accountInfo = echeck;

            batchRequest.addVendorDebit(vendorDebit);

            Assert.AreEqual(1, batchRequest.getNumVendorDebit());
            Assert.AreEqual(106L, batchRequest.getVendorDebitAmount());

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