public DynamicDataWebMethodReturnType TestConnection() { DynamicDataWebMethodReturnType ret = new DynamicDataWebMethodReturnType(); ret.Status = "OFX Check"; var financialAccount = GetAccount(); if (financialAccount.LedgerType == LedgerType.Checking.ToString() || financialAccount.LedgerType == LedgerType.Savings.ToString()) { nsoftware.InEBank.Account account = new nsoftware.InEBank.Account(); account.Firewall.AutoDetect = false; account.Firewall.FirewallType = nsoftware.InEBank.FirewallTypes.fwNone; account.FIUrl = Url; account.FIOrganization = FinancialInstitutionName; account.FIId = FinancialInstitutionId.ToString(); account.OFXAppId = "QWIN"; account.OFXAppVersion = "1800"; account.OFXUser = Username; account.OFXPassword = Password; try { account.GetInfo(); ret.Message = "The connection succeeded."; } catch (Exception ex) { ret.Message = "The OFX connection failed: " + ex.Message; } } if (financialAccount.LedgerType == LedgerType.CreditCard.ToString()) { Accounting_Accounts ccAccount = GetAccount(); nsoftware.InEBank.Ccstatement ccStatement = new nsoftware.InEBank.Ccstatement(); ccStatement.OFXAppId = "QWIN"; ccStatement.OFXAppVersion = "1800"; ccStatement.FIUrl = Url; ccStatement.FIId = FinancialInstitutionId.ToString(); ccStatement.FIOrganization = FinancialInstitutionName; ccStatement.CardNumber = ccAccount.AccountNumber; ccStatement.OFXUser = Username; ccStatement.OFXPassword = Password; ccStatement.StartDate = DateTime.Now.Subtract(TimeSpan.FromDays(40)).ToString("MM/dd/yyyy hh:mm:ss"); try { ccStatement.GetStatement(); ret.Message = "The connection succeeded."; } catch (Exception ex) { ret.Message = "The test connection failed: " + ex.Message; } } return ret; }
//------------------------------------------------------------------------------------------- public Ccstatement GetCreditCardStatement(Accounting_Accounts acct, DateTime startDate, DateTime endDate) { nsoftware.InEBank.Ccstatement item = new nsoftware.InEBank.Ccstatement(); item.OFXAppId = "QWIN"; item.OFXAppVersion = "1800"; item.FIUrl = Url; item.FIId = FinancialInstitutionId.ToString(); item.FIOrganization = FinancialInstitutionName; item.CardNumber = acct.AccountNumber; item.OFXUser = Username; item.OFXPassword = Password; item.StartDate = startDate.ToString("MM/dd/yyyy hh:mm:ss"); item.EndDate = endDate.ToString("MM/dd/yyyy hh:mm:ss"); item.GetStatement(); return item; }