Skip to content
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
45 changes: 45 additions & 0 deletions Nexus.Sdk.Shared.Tests/CustomerRequestBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,51 @@ public void CustomerRequestBuilderTests_Build_BankAccount()
});
}

[Test]
public void CustomerRequestBuilderTests_Build_Reason()
{
var request = new CreateCustomerRequestBuilder(
"MOCK_CUSTOMER", "Trusted", "EUR")
.SetBankAccounts(new CustomerBankAccountRequest[]
{
new()
{
IdentifiedBankAccountName = "Test_Name",
BankAccountNumber = "NLABN12345",
Bank = new BankRequest()
{
BankIBANCode = "123",
}
}
})
.SetEmail("test@test.com")
.SetIsReviewRecommended(true)
.SetReason("Review needed.")
.SetStatus(CustomerStatus.ACTIVE)
.Build();

Assert.Multiple(() =>
{
Assert.That(request, Is.Not.Null);
Assert.That(request.Email, Is.EqualTo("test@test.com"));
Assert.That(request.CustomerCode, Is.EqualTo("MOCK_CUSTOMER"));
Assert.That(request.TrustLevel, Is.EqualTo("Trusted"));
Assert.That(request.Status, Is.EqualTo("ACTIVE"));
Assert.That(request.CurrencyCode, Is.EqualTo("EUR"));
Assert.That(request.CountryCode, Is.Null);
Assert.That(request.ExternalCustomerCode, Is.Null);
Assert.That(request.IsBusiness, Is.False);
Assert.That(request.IsReviewRecommended, Is.True);
Assert.That(request.Reason, Is.EqualTo("Review needed."));
Assert.That(request.BankAccounts, Is.Not.Null);
Assert.That(request.BankAccounts, Has.One.Property("IdentifiedBankAccountName").EqualTo("Test_Name"));
Assert.That(request.BankAccounts, Has.One.Property("BankAccountNumber").EqualTo("NLABN12345"));
Assert.That(request.BankAccounts, Has.One.Property("Bank").Property("BankIBANCode").EqualTo("123"));

Assert.That(request.Data, Is.Null);
});
}

[Test]
public void CustomerRequestBuilderTests_Build_CustomData()
{
Expand Down
8 changes: 4 additions & 4 deletions Nexus.Sdk.Shared/Requests/CustomerRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[JsonPropertyName("customerCode")]
[StringLength(40)]
[Required]
public string CustomerCode { get; set; }

Check warning on line 11 in Nexus.Sdk.Shared/Requests/CustomerRequest.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'CustomerCode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[JsonPropertyName("Name")]
[StringLength(80)]
Expand Down Expand Up @@ -81,12 +81,16 @@
[JsonPropertyName("isPEP")]
public bool? IsPEP { get; set; } = false;

[JsonPropertyName("reason")]
[StringLength(1024)]
public string? Reason { get; set; }

public IDictionary<string, string>? Data { get; set; }
}

public class CreateCustomerRequest : CustomerRequest
{
public CreateCustomerRequest() { }

Check warning on line 93 in Nexus.Sdk.Shared/Requests/CustomerRequest.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'CurrencyCode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 93 in Nexus.Sdk.Shared/Requests/CustomerRequest.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'TrustLevel' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[JsonPropertyName("trustLevel")]
[Required]
Expand All @@ -98,7 +102,7 @@

[JsonPropertyName("externalCustomerCode")]
[StringLength(40)]
public string? ExternalCustomerCode { get; set; }

Check warning on line 105 in Nexus.Sdk.Shared/Requests/CustomerRequest.cs

View workflow job for this annotation

GitHub Actions / build

'CreateCustomerRequest.ExternalCustomerCode' hides inherited member 'CustomerRequest.ExternalCustomerCode'. Use the new keyword if hiding was intended.

[JsonPropertyName("isBusiness")]
public bool IsBusiness { get; set; } = false;
Expand All @@ -118,10 +122,6 @@
[StringLength(100)]
public string? ReasonCode { get; set; }

[JsonPropertyName("reason")]
[StringLength(1024)]
public string? Reason { get; set; }

[JsonPropertyName("bankAccounts")]
public UpdateCustomerBankAccountRequest[]? BankAccounts { get; set; }
}
Expand Down Expand Up @@ -204,5 +204,5 @@
{
[JsonPropertyName("customerCode")]
[Required]
public string CustomerCode { get; set; }

Check warning on line 207 in Nexus.Sdk.Shared/Requests/CustomerRequest.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'CustomerCode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
}
12 changes: 6 additions & 6 deletions Nexus.Sdk.Shared/Requests/CustomerRequestBuilders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ public CustomerRequestBuilder<T> SetCountry(string countryCode)
return this;
}

public CustomerRequestBuilder<T> SetReason(string reason)
{
_request.Reason = reason;
return this;
}

public T Build()
{
return _request;
Expand Down Expand Up @@ -205,12 +211,6 @@ public UpdateCustomerRequestBuilder SetReasonCode(string reasonCode)
return this;
}

public UpdateCustomerRequestBuilder SetReason(string reason)
{
_request.Reason = reason;
return this;
}

public UpdateCustomerRequestBuilder SetBankAccounts(UpdateCustomerBankAccountRequest[] bankAccounts)
{
_request.BankAccounts = bankAccounts;
Expand Down
Loading