public void GenerateTextFileTestValid() { var outgoingSingleCreditController = new OutgoingSingleCreditController(connectionString); var outgoingSingleCredit = new OutgoingSingleCredit() { TRN = "AL-004", Sequence = 136, Date = "151019", Amount = "IDR150000000,00", OrderingCustomerAccount = "1000063463456", OrderingCustomerName = "PUTU SURYA SUDARMADI", OrderingInstitutionAccount = "523466000990", OrderingInstitutionBank = "RIPAIDJ1", SenderCorrespondentAccount = "523466000990", SenderCorrespondentBank = "RIPAIDJ1", BeneficiaryInstitutionAccount = "520002000990", BeneficiaryInstitutionBank = "BRINIDJA", BeneficiaryCustomerAccount = "156789000002", BeneficiaryCustomerName = "RUDY ARTHA", Details = "SIT RTGS Gen II" }; var transactionData = outgoingSingleCreditController.ConvertToRTGSTextFileFormat(outgoingSingleCredit); var ftpServerRtgs = "ftp://10.1.10.24/"; var ftpUser = "******"; var ftpPassword = "******"; var fileName = outgoingSingleCredit.TRN + ".txt"; var actual = outgoingSingleCreditController.GenerateTextFile(transactionData: transactionData, ftpServerRtgs: ftpServerRtgs, ftpUser: ftpUser, ftpPassword: ftpPassword, fileName: fileName); Assert.AreEqual(0, actual.MessageList.Count()); using (WebClient client = new WebClient()) { client.Credentials = new NetworkCredential(ftpUser, ftpPassword); var fileExists = client.DownloadString(ftpServerRtgs + "/" + fileName); Assert.IsNotNull(fileExists); } }
private void ProcessGenerateTextFile(OutgoingSingleCredit outgoingSingleCredit) { var outgoingSingleCreditController = new OutgoingSingleCreditController(config.T24ConnectionString()); var transactionData = outgoingSingleCreditController.ConvertToRTGSTextFileFormat(outgoingSingleCredit); var fileName = outgoingSingleCredit.TRN + ".txt"; var result = outgoingSingleCreditController.GenerateTextFile(transactionData: transactionData, ftpServerRtgs: config.FtpServerRTGS, ftpUser: config.FtpUser, ftpPassword: config.FtpPassword, fileName: fileName); if (result.Success) { UpdateGeneratedTransactionStatus(outgoingSingleCreditController, outgoingSingleCredit.TRN, result); } else { log.WriteErrorLog("Generate text file failed.", result); } }