Adding
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
||||
|
||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Requests
|
||||
{
|
||||
public class DnaAuditProcessRequest : ReturnResponse
|
||||
{
|
||||
public DnaAuditProcessType DnaAuditProcessType { get; set; }
|
||||
public int LookBackMinutes { get; set; }
|
||||
public int NumberOfAllowedConsecutiveFailures { get; set; }
|
||||
}
|
||||
}
|
||||
+36
-35
@@ -3,56 +3,57 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Requests;
|
||||
|
||||
public class MemberOptinRequest : IValidatableObject
|
||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Requests
|
||||
{
|
||||
[Required] public string UserId { get; set; }
|
||||
public string Email { get; set; }
|
||||
[Required] public string Value { get; set; }
|
||||
[Required] public string LegalReference { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
public class MemberOptinRequest : IValidatableObject
|
||||
{
|
||||
var results = new List<ValidationResult>();
|
||||
[Required] public string UserId { get; set; }
|
||||
public string Email { get; set; }
|
||||
[Required] public string Value { get; set; }
|
||||
[Required] public string LegalReference { get; set; }
|
||||
|
||||
if (!string.Equals(Value, DeliveryPreference.Electronic, StringComparison.InvariantCultureIgnoreCase) &&
|
||||
!string.Equals(Value, DeliveryPreference.Paper, StringComparison.InvariantCultureIgnoreCase))
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
results.Add(new ValidationResult(
|
||||
$"Invalid Option for Unified Opt-In Preference",
|
||||
new[] { "Value" }));
|
||||
}
|
||||
var results = new List<ValidationResult>();
|
||||
|
||||
if (string.Equals(Value, DeliveryPreference.Electronic, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Email))
|
||||
if (!string.Equals(Value, DeliveryPreference.Electronic, StringComparison.InvariantCultureIgnoreCase) &&
|
||||
!string.Equals(Value, DeliveryPreference.Paper, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
results.Add(new ValidationResult("Email is required when Opting in", new[] { "Email" }));
|
||||
results.Add(new ValidationResult(
|
||||
$"Invalid Option for Unified Opt-In Preference",
|
||||
new[] { "Value" }));
|
||||
}
|
||||
else
|
||||
|
||||
if (string.Equals(Value, DeliveryPreference.Electronic, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
try
|
||||
if (string.IsNullOrWhiteSpace(Email))
|
||||
{
|
||||
var unused = new System.Net.Mail.MailAddress(Email);
|
||||
results.Add(new ValidationResult("Email is required when Opting in", new[] { "Email" }));
|
||||
}
|
||||
catch
|
||||
else
|
||||
{
|
||||
results.Add(new ValidationResult("Invalid Email Format", new[] { "Email" }));
|
||||
try
|
||||
{
|
||||
var unused = new System.Net.Mail.MailAddress(Email);
|
||||
}
|
||||
catch
|
||||
{
|
||||
results.Add(new ValidationResult("Invalid Email Format", new[] { "Email" }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
public bool IsElectronicRequest()
|
||||
{
|
||||
return string.Equals(Value, DeliveryPreference.Electronic, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public bool IsElectronicRequest()
|
||||
{
|
||||
return string.Equals(Value, DeliveryPreference.Electronic, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public bool IsPaperRequest()
|
||||
{
|
||||
return string.Equals(Value, DeliveryPreference.Paper, StringComparison.InvariantCultureIgnoreCase);
|
||||
public bool IsPaperRequest()
|
||||
{
|
||||
return string.Equals(Value, DeliveryPreference.Paper, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-12
@@ -2,17 +2,18 @@ using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Requests;
|
||||
|
||||
public class MemberPreferenceRequest
|
||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Requests
|
||||
{
|
||||
[Required]
|
||||
public string UserId { get; set; }
|
||||
[Required]
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public PreferenceType Preference { get; set; }
|
||||
[Required]
|
||||
public string Value { get; set; }
|
||||
[Required]
|
||||
public string LegalReference { get; set; }
|
||||
public class MemberPreferenceRequest
|
||||
{
|
||||
[Required]
|
||||
public string UserId { get; set; }
|
||||
[Required]
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public PreferenceType Preference { get; set; }
|
||||
[Required]
|
||||
public string Value { get; set; }
|
||||
[Required]
|
||||
public string LegalReference { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
|
||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Requests
|
||||
{
|
||||
public class XdiBatchProcessRequest : ReturnResponse
|
||||
{
|
||||
public string XdiAppendFileRootBasePath { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user