using InABox.Core; using InABox.Poster.MYOB; using MYOB.AccountRight.SDK.Services.GeneralLedger; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MYOBAccount = MYOB.AccountRight.SDK.Contracts.Version2.GeneralLedger.Account; namespace PRS.Shared.Posters.MYOB; public static class AccountMYOBUtils { public static Result GetAccount(MYOBConnectionData data, string glCode) { if (!data.GetUID( new Filter(x => x.DisplayID).IsEqualTo(glCode)) .Get(out var accountID, out var error)) { return Result.Error(new Exception($"Failed to find Account in MYOB with code {glCode}", error)); } else if (accountID == Guid.Empty) { return Result.Error(new Exception($"Failed to find Account in MYOB with code {glCode}")); } else { return Result.Ok(accountID); } } }