コード例 #1
0
 public void AddSubmerchantCredit(SubmerchantCredit submerchantCredit)
 {
     if (_numAccountUpdates == 0)
     {
         _numSubmerchantCredit++;
         if (submerchantCredit.Amount != null) _submerchantCreditAmount += (long) submerchantCredit.Amount;
         FillInReportGroup(submerchantCredit);
         _tempBatchFilePath = SaveElement(_litleFile, _litleTime, _tempBatchFilePath, submerchantCredit);
     }
     else
     {
         throw new LitleOnlineException(AccountUpdateErrorMessage);
     }
 }
        public void testAddSubmerchantCredit()
        {
            SubmerchantCredit submerchantCredit = new SubmerchantCredit();
            submerchantCredit.FundingSubmerchantId = "123456";
            submerchantCredit.SubmerchantName = "merchant";
            submerchantCredit.FundsTransferId = "123467";
            submerchantCredit.Amount = 106L;
            EcheckType echeck = new EcheckType();
            echeck.AccType = EcheckAccountTypeEnum.Checking;
            echeck.AccNum = "12345657890";
            echeck.RoutingNum = "123456789";
            echeck.CheckNum = "123455";
            submerchantCredit.AccountInfo = echeck;

            batchRequest.AddSubmerchantCredit(submerchantCredit);

            Assert.AreEqual(1, batchRequest.GetNumSubmerchantCredit());
            Assert.AreEqual(106L, batchRequest.GetSubmerchantCreditAmount());

            mockLitleFile.Verify(litleFile => litleFile.CreateRandomFile(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>(), mockLitleTime.Object));
            mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, submerchantCredit.Serialize()));
        }
        public void PFIFInstructionTxnTest()
        {
            Dictionary<string, string> configOverride = new Dictionary<string, string>();
            configOverride["url"] = Properties.Settings.Default.url;
            configOverride["reportGroup"] = Properties.Settings.Default.reportGroup;
            configOverride["username"] = "******";
            configOverride["printxml"] = Properties.Settings.Default.printxml;
            configOverride["timeout"] = Properties.Settings.Default.timeout;
            configOverride["proxyHost"] = Properties.Settings.Default.proxyHost;
            configOverride["merchantId"] = "0180";
            configOverride["password"] = "******";
            configOverride["proxyPort"] = Properties.Settings.Default.proxyPort;
            configOverride["sftpUrl"] = Properties.Settings.Default.sftpUrl;
            configOverride["sftpUsername"] = Properties.Settings.Default.sftpUsername;
            configOverride["sftpPassword"] = Properties.Settings.Default.sftpPassword;
            configOverride["knownHostsFile"] = Properties.Settings.Default.knownHostsFile;
            configOverride["onlineBatchUrl"] = Properties.Settings.Default.onlineBatchUrl;
            configOverride["onlineBatchPort"] = Properties.Settings.Default.onlineBatchPort;
            configOverride["requestDirectory"] = Properties.Settings.Default.requestDirectory;
            configOverride["responseDirectory"] = Properties.Settings.Default.responseDirectory;

            LitleRequest litleOverride = new LitleRequest(configOverride);

            BatchRequest litleBatchRequest = new BatchRequest(configOverride);

            EcheckType echeck = new EcheckType();
            echeck.AccType = EcheckAccountTypeEnum.Corporate;
            echeck.AccNum = "1092969901";
            echeck.RoutingNum = "011075150";
            echeck.CheckNum = "123455";

            SubmerchantCredit submerchantCredit = new SubmerchantCredit();
            submerchantCredit.FundingSubmerchantId = "123456";
            submerchantCredit.SubmerchantName = "merchant";
            submerchantCredit.FundsTransferId = "123467";
            submerchantCredit.Amount = 106L;
            submerchantCredit.AccountInfo = echeck;
            litleBatchRequest.AddSubmerchantCredit(submerchantCredit);

            PayFacCredit payFacCredit = new PayFacCredit();
            payFacCredit.FundingSubmerchantId = "123456";
            payFacCredit.FundsTransferId = "123467";
            payFacCredit.Amount = 107L;
            litleBatchRequest.AddPayFacCredit(payFacCredit);

            ReserveCredit reserveCredit = new ReserveCredit();
            reserveCredit.FundingSubmerchantId = "123456";
            reserveCredit.FundsTransferId = "123467";
            reserveCredit.Amount = 107L;
            litleBatchRequest.AddReserveCredit(reserveCredit);

            VendorCredit vendorCredit = new VendorCredit();
            vendorCredit.FundingSubmerchantId = "123456";
            vendorCredit.VendorName = "merchant";
            vendorCredit.FundsTransferId = "123467";
            vendorCredit.Amount = 106L;
            vendorCredit.AccountInfo = echeck;
            litleBatchRequest.AddVendorCredit(vendorCredit);

            PhysicalCheckCredit physicalCheckCredit = new PhysicalCheckCredit();
            physicalCheckCredit.FundingSubmerchantId = "123456";
            physicalCheckCredit.FundsTransferId = "123467";
            physicalCheckCredit.Amount = 107L;
            litleBatchRequest.AddPhysicalCheckCredit(physicalCheckCredit);

            SubmerchantDebit submerchantDebit = new SubmerchantDebit();
            submerchantDebit.FundingSubmerchantId = "123456";
            submerchantDebit.SubmerchantName = "merchant";
            submerchantDebit.FundsTransferId = "123467";
            submerchantDebit.Amount = 106L;
            submerchantDebit.AccountInfo = echeck;
            litleBatchRequest.AddSubmerchantDebit(submerchantDebit);

            PayFacDebit payFacDebit = new PayFacDebit();
            payFacDebit.FundingSubmerchantId = "123456";
            payFacDebit.FundsTransferId = "123467";
            payFacDebit.Amount = 107L;
            litleBatchRequest.AddPayFacDebit(payFacDebit);

            ReserveDebit reserveDebit = new ReserveDebit();
            reserveDebit.FundingSubmerchantId = "123456";
            reserveDebit.FundsTransferId = "123467";
            reserveDebit.Amount = 107L;
            litleBatchRequest.AddReserveDebit(reserveDebit);

            VendorDebit vendorDebit = new VendorDebit();
            vendorDebit.FundingSubmerchantId = "123456";
            vendorDebit.VendorName = "merchant";
            vendorDebit.FundsTransferId = "123467";
            vendorDebit.Amount = 106L;
            vendorDebit.AccountInfo = echeck;
            litleBatchRequest.AddVendorDebit(vendorDebit);

            PhysicalCheckDebit physicalCheckDebit = new PhysicalCheckDebit();
            physicalCheckDebit.FundingSubmerchantId = "123456";
            physicalCheckDebit.FundsTransferId = "123467";
            physicalCheckDebit.Amount = 107L;
            litleBatchRequest.AddPhysicalCheckDebit(physicalCheckDebit);

            litleOverride.AddBatch(litleBatchRequest);

            LitleResponse litleResponse = litleOverride.SendToLitleWithStream();

            Assert.NotNull(litleResponse);
            Assert.AreEqual("0", litleResponse.Response);
            Assert.AreEqual("Valid Format", litleResponse.Message);

            BatchResponse litleBatchResponse = litleResponse.NextBatchResponse();
            while (litleBatchResponse != null)
            {
                SubmerchantCreditResponse submerchantCreditResponse = litleBatchResponse.NextSubmerchantCreditResponse();
                while (submerchantCreditResponse != null)
                {
                    Assert.AreEqual("000", submerchantCreditResponse.Response);
                    submerchantCreditResponse = litleBatchResponse.NextSubmerchantCreditResponse();
                }

                PayFacCreditResponse payFacCreditResponse = litleBatchResponse.NextPayFacCreditResponse();
                while (payFacCreditResponse != null)
                {
                    Assert.AreEqual("000", payFacCreditResponse.Response);
                    payFacCreditResponse = litleBatchResponse.NextPayFacCreditResponse();
                }

                VendorCreditResponse vendorCreditResponse = litleBatchResponse.NextVendorCreditResponse();
                while (vendorCreditResponse != null)
                {
                    Assert.AreEqual("000", vendorCreditResponse.Response);
                    vendorCreditResponse = litleBatchResponse.NextVendorCreditResponse();
                }

                ReserveCreditResponse reserveCreditResponse = litleBatchResponse.NextReserveCreditResponse();
                while (reserveCreditResponse != null)
                {
                    Assert.AreEqual("000", reserveCreditResponse.Response);
                    reserveCreditResponse = litleBatchResponse.NextReserveCreditResponse();
                }

                PhysicalCheckCreditResponse physicalCheckCreditResponse = litleBatchResponse.NextPhysicalCheckCreditResponse();
                while (physicalCheckCreditResponse != null)
                {
                    Assert.AreEqual("000", physicalCheckCreditResponse.Response);
                    physicalCheckCreditResponse = litleBatchResponse.NextPhysicalCheckCreditResponse();
                }

                SubmerchantDebitResponse submerchantDebitResponse = litleBatchResponse.NextSubmerchantDebitResponse();
                while (submerchantDebitResponse != null)
                {
                    Assert.AreEqual("000", submerchantDebitResponse.Response);
                    submerchantDebitResponse = litleBatchResponse.NextSubmerchantDebitResponse();
                }

                PayFacDebitResponse payFacDebitResponse = litleBatchResponse.NextPayFacDebitResponse();
                while (payFacDebitResponse != null)
                {
                    Assert.AreEqual("000", payFacDebitResponse.Response);
                    payFacDebitResponse = litleBatchResponse.NextPayFacDebitResponse();
                }

                VendorDebitResponse vendorDebitResponse = litleBatchResponse.NextVendorDebitResponse();
                while (vendorDebitResponse != null)
                {
                    Assert.AreEqual("000", vendorDebitResponse.Response);
                    vendorDebitResponse = litleBatchResponse.NextVendorDebitResponse();
                }

                ReserveDebitResponse reserveDebitResponse = litleBatchResponse.NextReserveDebitResponse();
                while (reserveDebitResponse != null)
                {
                    Assert.AreEqual("000", reserveDebitResponse.Response);
                    reserveDebitResponse = litleBatchResponse.NextReserveDebitResponse();
                }

                PhysicalCheckDebitResponse physicalCheckDebitResponse = litleBatchResponse.NextPhysicalCheckDebitResponse();
                while (physicalCheckDebitResponse != null)
                {
                    Assert.AreEqual("000", physicalCheckDebitResponse.Response);
                    physicalCheckDebitResponse = litleBatchResponse.NextPhysicalCheckDebitResponse();
                }

                litleBatchResponse = litleResponse.NextBatchResponse();
            }
        }