Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Fixes for evaluations #97

Merged
merged 4 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/FaluSdk/EvaluationReports/AbstractEvaluationReport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Falu.EvaluationReports;

///
public abstract class AbstractEvaluationReport
{
/// <summary>
/// Details on the evalution error.
/// Present when not completed.
/// </summary>
public EvaluationReportError? Error { get; set; }

/// <summary>
/// Whether the check resulted in a successful evaluation.
/// </summary>
public bool Completed { get; set; }
}
62 changes: 62 additions & 0 deletions src/FaluSdk/EvaluationReports/EvaluationReport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Falu.Core;
using Falu.Evaluations;

namespace Falu.EvaluationReports;

/// <summary>An evaluation report.</summary>
public class EvaluationReport : IHasId, IHasCreated, IHasUpdated, IHasWorkspace, IHasLive, IHasEtag
{
/// <inheritdoc/>
public string? Id { get; set; }

/// <inheritdoc/>
public DateTimeOffset Created { get; set; }

/// <inheritdoc/>
public DateTimeOffset Updated { get; set; }

/// <summary>
/// Identifier of the evaluation that created this report.
/// </summary>
public string? Evaluation { get; set; }

/// <summary>
/// The options that initiated this report.
/// </summary>
public EvaluationScoringOptions? Options { get; set; }

/// <summary>
/// Details on the user’s acceptance of the Services Agreement.
/// </summary>
public EvaluationReportConsent? Consent { get; set; }

/// <summary>
/// Result from a bureau in the relevant jurisdiction.
/// </summary>
public EvaluationReportBureau? Bureau { get; set; }

/// <summary>
/// Result from a financial statement.
/// </summary>
public EvaluationReportStatement? Statement { get; set; }

/// <summary>
/// Result from an anti-money laundering check.
/// </summary>
public EvaluationReportAml? Aml { get; set; }

/// <inheritdoc/>
public string? Workspace { get; set; }

/// <inheritdoc/>
public bool Live { get; set; }

/// <inheritdoc/>
public string? Etag { get; set; }
}

///
public class EvaluationReportBureau : AbstractEvaluationReport { }

///
public class EvaluationReportAml : AbstractEvaluationReport { }
20 changes: 20 additions & 0 deletions src/FaluSdk/EvaluationReports/EvaluationReportConsent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Falu.EvaluationReports;

///
public class EvaluationReportConsent
{
/// <summary>
/// Time at which the user gave consent for the evaluation to be done.
/// </summary>
public DateTimeOffset Date { get; set; }

/// <summary>
/// IP address from which the user gave consent for the evaluation to be done.
/// </summary>
public string? IP { get; set; }

/// <summary>
/// User agent of the device (e.g. browser) from which the user gave consent for the evaluation to be done.
/// </summary>
public string? UserAgent { get; set; }
}
16 changes: 16 additions & 0 deletions src/FaluSdk/EvaluationReports/EvaluationReportError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Falu.EvaluationReports;

///
public class EvaluationReportError
{
/// <summary>
/// A short machine-readable string giving the reason for the evaluation failure.
/// </summary>
public string? Code { get; set; }

/// <summary>
/// A human-readable message giving the reason for the failure.
/// These message can be shown to your user.
/// </summary>
public string? Description { get; set; }
}
51 changes: 51 additions & 0 deletions src/FaluSdk/EvaluationReports/EvaluationReportStatement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Falu.Core;

namespace Falu.EvaluationReports;

///
public class EvaluationReportStatement : AbstractEvaluationReport
{
/// <summary>Provider of the uploaded document.</summary>
public string? Provider { get; set; }

/// <summary>
/// Identifier of the file holding the uploaded document used.
/// </summary>
public string? Document { get; set; }

/// <summary>
/// Password for the uploaded document.
/// Present for password-protected files.
/// </summary>
public string? Password { get; set; }

/// <summary>Email of the owner as it appears in the document.</summary>
public string? Email { get; set; }

/// <summary>Name of the owner as it appears in the document.</summary>
public string? Name { get; set; }

/// <summary>Phone number of the owner as it appears in the document.</summary>
public string? Phone { get; set; }

/// <summary>Time at which the document was generated.</summary>
public DateTimeOffset? Generated { get; set; }

/// <summary>Period for which the uploaded document covers.</summary>
public Period? Period { get; set; }

/// <summary>
/// Risk probability. The higher the value, the higher the risk
/// </summary>
public float? Risk { get; set; }

/// <summary>
/// Limit advised for lending in the smallest currency unit.
/// </summary>
public long? Limit { get; set; }

/// <summary>
/// Time till when the score is deemed valid.
/// </summary>
public DateTimeOffset? Expires { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Falu.Core;

namespace Falu.Evaluations;
namespace Falu.EvaluationReports;

/// <summary>Options for filtering and pagination of evaluation reports.</summary>
public record EvaluationReportsListOptions : BasicListOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Falu.Core;

namespace Falu.Evaluations;
namespace Falu.EvaluationReports;

///
public class EvaluationReportsServiceClient : BaseServiceClient<EvaluationReport>,
Expand Down
7 changes: 0 additions & 7 deletions src/FaluSdk/Evaluations/Evaluation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ public class Evaluation : EvaluationPatchModel, IHasId, IHasCurrency, IHasCreate
[Obsolete("Moved to Reports or Outputs")]
public Statement? Statement { get; set; }

/// <summary>
/// The secret to use when generating <see cref="Url"/> and <see cref="ClientSecret"/>.
/// The values generated are used for authentication on clients and the browser.
/// Every time the document is updated a new value is generated which is random.
/// </summary>
public string? Secret { get; set; }

/// <summary>
/// The short-lived client secret used by front-end libraries to show an evaluation modal inside your app.
/// This client secret expires after 24 hours and can only be used once.
Expand Down
158 changes: 0 additions & 158 deletions src/FaluSdk/Evaluations/EvaluationReport.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/FaluSdk/Evaluations/EvaluationsServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public virtual Task<ResourceResponse<Evaluation>> UpdateAsync(string id,
}

/// <summary>
/// Initiate an evaluation.
/// Create an evaluation.
/// </summary>
/// <param name="request"></param>
/// <param name="options">Options to use for the request.</param>
Expand Down Expand Up @@ -94,7 +94,7 @@ public virtual Task<ResourceResponse<Evaluation>> ScoreAsync(string id,
return RequestAsync<Evaluation>(uri, HttpMethod.Post, new { }, options, cancellationToken);
}

/// <summary>Redact a evaluation to remove all collected information from Falu.</summary>
/// <summary>Redact an evaluation to remove all collected information from Falu.</summary>
/// <param name="id">Unique identifier for the evaluation.</param>
/// <param name="options">Options to use for the request.</param>
/// <param name="cancellationToken"></param>
Expand Down
5 changes: 3 additions & 2 deletions src/FaluSdk/FaluClient.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Falu.Evaluations;
using Falu.EvaluationReports;
using Falu.Evaluations;
using Falu.Events;
using Falu.FileLinks;
using Falu.Files;
using Falu.Identity;
using Falu.IdentityVerifications;
using Falu.IdentityVerificationReports;
using Falu.IdentityVerifications;
using Falu.Messages;
using Falu.MessageStreams;
using Falu.MessageTemplates;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Falu.Core;
using Falu.Evaluations;
using Falu.EvaluationReports;
using System.Net;
using Xunit;

Expand Down
Loading