public OfxAccount(string bankId, string branchId, string accountId, string accountKey, OfxAccountType accountType, OfxBankAccountType bankAccountType) { BankId = bankId; BranchId = branchId; AccountId = accountId; AccountKey = accountKey; AccountType = accountType; BankAccountType = bankAccountType; }
/// <summary> /// Returns the correct xpath to specified section for given account type /// </summary> /// <param name="type">Account type</param> /// <param name="section">Section of OFX document, e.g. Transaction Section</param> /// <exception cref="OfxException">Thrown in account type not supported</exception> private static string GetXPath(OfxAccountType type, OfxSection section) { string xpath, accountInfo; switch (type) { case OfxAccountType.BANK: xpath = Resources.BankAccount; accountInfo = "/BANKACCTFROM"; break; case OfxAccountType.CC: xpath = Resources.CCAccount; accountInfo = "/CCACCTFROM"; break; default: throw new OfxException("Account Type not supported. Account type " + type); } switch (section) { case OfxSection.ACCOUNTINFO: return(xpath + accountInfo); case OfxSection.BALANCE: return(xpath); case OfxSection.TRANSACTIONS: return(xpath + "/BANKTRANLIST"); case OfxSection.SIGNON: return(Resources.SignOn); case OfxSection.CURRENCY: return(xpath + "/CURDEF"); default: throw new OfxException("Unknown section found when retrieving XPath. Section " + section); } }
public static OfxAccount FromXmlNode(XmlNode node, OfxAccountType accountType) { var accountId = node.GetValue("//ACCTID"); var accountKey = node.GetValue("//ACCTKEY"); if (accountType == OfxAccountType.BANK) { var bankId = node.GetValue("//BANKID"); var branchId = node.GetValue("//BRANCHID"); var bankAccountType = OfxHelperMethods.GetBankAccountType(node.GetValue("//ACCTTYPE")); return(new OfxAccount(bankId, branchId, accountId, accountKey, accountType, bankAccountType)); } if (accountType == OfxAccountType.CC) { return(new OfxAccount(null, null, accountId, accountKey, OfxAccountType.CC, OfxBankAccountType.CREDITLINE)); } throw new OfxParseException($"{accountType} is not supported"); }