internal EncompassApiClient(IClientParameters parameters, IEncompassApiClient encompassApiService) { _encompassApiSerice = encompassApiService; ApiResponse = parameters.ApiResponse; CommonCache = (parameters.CommonCache ??= new CommonCache()); UndefinedCustomFieldHandling = parameters.UndefinedCustomFieldHandling; }
internal Cursor(ApiObject apiObject, IEncompassApiClient client, string?cursorId, int count, IEnumerable <string>?fields) { _apiObject = apiObject; Client = client; CursorId = cursorId; Count = count; Fields = fields ?? Array <string> .Empty; }
/// <summary> /// Refreshes the custom fields cache. /// </summary> /// <param name="client">The client to use to retrieve the custom fields.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None"/>.</param> /// <returns></returns> public async Task RefreshCustomFieldsAsync(IEncompassApiClient client, CancellationToken cancellationToken = default) { Preconditions.NotNull(client, nameof(client)); var retrievedCustomFields = new Dictionary <string, FieldDescriptor>(StringComparer.OrdinalIgnoreCase); var customFieldsList = await client.Settings.Loan.CustomFields.GetCustomFieldsAsync(cancellationToken).ConfigureAwait(false); foreach (var customField in customFieldsList) { var modelPath = $"Loan.CustomFields[(FieldName == '{customField.Id}')].StringValue"; retrievedCustomFields[customField.Id !] = new NonStandardFieldDescriptor(customField.Id !, LoanFieldDescriptors.CreateModelPath(modelPath) !, modelPath, customField.Description !, customField.Format, customField.Options?.Select(o => new FieldOption(o)).ToList(), false);
private static async Task BorrowerPairsTest(IEncompassApiClient client, Loan loan, string loanId, ILoanApis loanApis) { try { var borrowerPairs = await loanApis.BorrowerPairs.GetBorrowerPairsAsync(); Assert.AreEqual($@"{{""encompassId"":""{loan.EncompassId}""}}", loan.ToString(SerializationOptions.Dirty)); Assert.AreEqual(0, loan.Applications.Count); var application = new Application(); var applicationId = await loanApis.BorrowerPairs.CreateBorrowerPairAsync(application); Assert.AreEqual($@"{{""encompassId"":""{loan.EncompassId}""}}", loan.ToString(SerializationOptions.Dirty)); Assert.AreEqual(0, loan.Applications.Count); var newApplication = new Application { Id = applicationId, ApplicationSignedDate = DateTime.Now.AddDays(2) }; await loanApis.BorrowerPairs.UpdateBorrowerPairAsync(newApplication); Assert.AreEqual($@"{{""encompassId"":""{loan.EncompassId}""}}", loan.ToString(SerializationOptions.Dirty)); Assert.AreEqual(0, loan.Applications.Count); await loanApis.BorrowerPairs.DeleteBorrowerPairAsync(applicationId); Assert.AreEqual($@"{{""encompassId"":""{loan.EncompassId}""}}", loan.ToString(SerializationOptions.Dirty)); Assert.AreEqual(0, loan.Applications.Count); } finally { try { await client.Loans.DeleteLoanAsync(loanId); } catch { } } }
internal BatchUpdate(IEncompassApiClient client) : base(client, "encompass/v1/loanBatch/updateRequests") { }
internal LoanCustomDataObjects(IEncompassApiClient client, string loanId) : base(client, $"encompass/v1/loans/{loanId}/customObjects") { LoanId = loanId; }
internal BorrowerContactSelector(IEncompassApiClient client) : base(client, "encompass/v1/borrowerContactSelector") { }
internal LoanApiObject(IEncompassApiClient client, string loanId, string?baseApiPath) : base(client, $"encompass/v1/loans/{loanId}{baseApiPath?.PrecedeWith("/")}") { LoanId = loanId; }
internal CustomDataObjects(IEncompassApiClient client, string baseApiPath) : base(client, baseApiPath) { }
internal LoanRateLocks(IEncompassApiClient client, string loanId) : base(client, loanId, "ratelockRequests") { }
internal Webhook(IEncompassApiClient client) : base(client, "webhook/v1") { }
internal BorrowerPairs(IEncompassApiClient client, LoanObjectBoundApis?loanObjectBoundApis, string loanId) : base(client, loanObjectBoundApis, loanId, "applications") { }
internal Company(IEncompassApiClient client) : base(client, "encompass/v1/company") { }
internal GlobalCustomDataObjects(IEncompassApiClient client) : base(client, "encompass/v1/company/customObjects") { }
internal BorrowerContactsSettings(IEncompassApiClient client) : base(client, "encompass/v1/settings/borrowerContacts") { }
internal ContactNotes(IEncompassApiClient client, string contactId, string baseApiPath) : base(client, contactId, $"{baseApiPath}/{contactId}/notes") { }
internal LoanAttachments(IEncompassApiClient client, string loanId) : base(client, loanId, "attachments") { }
internal ContactCursor(ApiObject apiObject, IEncompassApiClient client, string?cursorId, int count, IEnumerable <string>?fields) : base(apiObject, client, cursorId, count, fields) { }
internal LoanUnderwritingConditions(IEncompassApiClient client, string loanId) : base(client, loanId, "underwriting") { }
internal BusinessContactsSettings(IEncompassApiClient client) : base(client, "encompass/v1/settings/businessContacts") { }
/// <summary> /// Initializes the export job object with the specified <paramref name="client"/>. This allows the use of the Refresh and Download methods. /// </summary> /// <param name="client"></param> public void Initialize(IEncompassApiClient client) { Preconditions.NotNull(client, nameof(client)); Client = client; }
internal UsersRights(IEncompassApiClient client, string userId) : base(client, userId, null) { }
internal LoanTemplateSet(IEncompassApiClient client) : base(client, "loanTemplateSet") { }
internal UserCompensationPlans(IEncompassApiClient client, string userId) : base(client, userId, "compensation") { }
internal LoanSettings(IEncompassApiClient client) : base(client, "encompass/v1/settings/loan") { }
internal LoanObjectBoundApis(IEncompassApiClient client, Loan loan) : base(client, loan.EncompassId !) { Loan = loan; }
internal UserLicenseDetails(IEncompassApiClient client, string userId) : base(client, userId, "licenses") { }
internal LoanFolders(IEncompassApiClient client) : base(client, "encompass/v1/loanfolders") { }
internal UserGroups(IEncompassApiClient client, string userId) : base(client, userId, "groups") { }
internal LoanMilestones(IEncompassApiClient client, string loanId) : base(client, loanId, "milestones") { }