Skip to content

Commit

Permalink
Merge pull request #50 from QuantozTechnology/customer-prop
Browse files Browse the repository at this point in the history
NXS-6251 : Add new properties and methods to Customer classes
  • Loading branch information
WJRobert authored Oct 4, 2024
2 parents 9d0a7e6 + c0031c8 commit 0e301e6
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 5 deletions.
92 changes: 92 additions & 0 deletions Nexus.Sdk.Shared.Tests/CustomerRequestBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,98 @@ public void CustomerRequestBuilderTests_Build_IsReviewRecommended()
});
}

[Test]
public void CustomerRequestBuilderTests_Build_PortfolioCode()
{
var request = new CreateCustomerRequestBuilder(
"MOCK_CUSTOMER", "Trusted", "EUR")
.SetIsBusiness(true)
.SetEmail("[email protected]")
.SetCountry("NL")
.SetStatus(CustomerStatus.ACTIVE)
.SetCompanyName("XYZ")
.SetPortfolioCode("PORTFOLIO")
.Build();

Assert.Multiple(() =>
{
Assert.That(request, Is.Not.Null);
Assert.That(request.Email, Is.EqualTo("[email protected]"));
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.EqualTo(expected: "NL"));
Assert.That(request.CompanyName, Is.EqualTo("XYZ"));
Assert.That(request.PortFolioCode, Is.EqualTo("PORTFOLIO"));
Assert.That(request.IsBusiness, Is.True);
Assert.That(request.BankAccounts, Is.Null);
Assert.That(request.Data, Is.Null);
});
}

[Test]
public void CustomerRequestBuilderTests_Build_IsReviewed()
{
var request = new CreateCustomerRequestBuilder(
"MOCK_CUSTOMER", "Trusted", "EUR")
.SetIsBusiness(true)
.SetEmail("[email protected]")
.SetCountry("NL")
.SetStatus(CustomerStatus.ACTIVE)
.SetCompanyName("XYZ")
.SetIsReviewRecommended(true)
.SetIsReviewed(true)
.Build();

Assert.Multiple(() =>
{
Assert.That(request, Is.Not.Null);
Assert.That(request.Email, Is.EqualTo("[email protected]"));
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.EqualTo(expected: "NL"));
Assert.That(request.CompanyName, Is.EqualTo("XYZ"));
Assert.That(request.IsReviewRecommended, Is.True);
Assert.That(request.IsReviewed, Is.True);
Assert.That(request.IsBusiness, Is.True);
Assert.That(request.BankAccounts, Is.Null);
Assert.That(request.Data, Is.Null);
});
}

[Test]
public void CustomerRequestBuilderTests_Build_IsPEP()
{
var request = new CreateCustomerRequestBuilder(
"MOCK_CUSTOMER", "Trusted", "EUR")
.SetIsBusiness(true)
.SetEmail("[email protected]")
.SetCountry("NL")
.SetStatus(CustomerStatus.ACTIVE)
.SetCompanyName("XYZ")
.SetIsPEP(true)
.Build();

Assert.Multiple(() =>
{
Assert.That(request, Is.Not.Null);
Assert.That(request.Email, Is.EqualTo("[email protected]"));
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.EqualTo(expected: "NL"));
Assert.That(request.CompanyName, Is.EqualTo("XYZ"));
Assert.That(request.IsPEP, Is.True);
Assert.That(request.IsBusiness, Is.True);
Assert.That(request.BankAccounts, Is.Null);
Assert.That(request.Data, Is.Null);
});
}

[Test]
public void CustomerRequestBuilderTests_Build_Address_State_ZipCode_City()
{
Expand Down
15 changes: 15 additions & 0 deletions Nexus.Sdk.Shared/Requests/CustomerRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class CustomerRequest
[JsonPropertyName("riskQualification")]
public string? RiskQualification { get; set; }

[JsonPropertyName("created")]
public string? Created { get; set; }

[JsonPropertyName("address")]
[StringLength(100)]
public string? Address { get; set; }
Expand All @@ -66,6 +69,18 @@ public class CustomerRequest
[JsonPropertyName("isReviewRecommended")]
public bool IsReviewRecommended { get; set; } = false;

[JsonPropertyName("portfolioCode")]
public string? PortFolioCode { get; set; }

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

[JsonPropertyName("IsReviewed")]
public bool? IsReviewed { get; set; }

[JsonPropertyName("isPEP")]
public bool? IsPEP { get; set; }

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

Expand Down
18 changes: 18 additions & 0 deletions Nexus.Sdk.Shared/Requests/CustomerRequestBuilders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,24 @@ public CustomerRequestBuilder<T> SetIsReviewRecommended(bool isReviewRecommended
return this;
}

public CustomerRequestBuilder<T> SetPortfolioCode(string portfolioCode)
{
_request.PortFolioCode = portfolioCode;
return this;
}

public CustomerRequestBuilder<T> SetIsReviewed(bool isReviewed)
{
_request.IsReviewed = isReviewed;
return this;
}

public CustomerRequestBuilder<T> SetIsPEP(bool isPEP)
{
_request.IsPEP = isPEP;
return this;
}

public CustomerRequestBuilder<T> SetCustomData(IDictionary<string, string> data)
{
_request.Data = data;
Expand Down
29 changes: 24 additions & 5 deletions Nexus.Sdk.Shared/Responses/CustomerResponses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ namespace Nexus.Sdk.Shared.Responses;
public record CustomerResponse
{
[JsonConstructor]
public CustomerResponse(string customerCode,string? name, string firstName, string lastName, string dateOfBirth, string phone, string companyName, string trustLevel,
string currencyCode, string? address, string? city, string? zipCode, string? state, string countryCode, string? email, string status, string bankAccount, bool isBusiness, string riskQualification, IDictionary<string, string> data)
public CustomerResponse(string customerCode, string? name, string? firstName, string? lastName, string? dateOfBirth, string? phone, string? companyName, string trustLevel, string currencyCode, string? address, string? city, string? zipCode, string? state, string countryCode, string? email, string status, string bankAccount, bool isBusiness, string? riskQualification, string? created, string? portFolioCode, string? externalCustomerCode, bool? isReviewRecommended, bool? isPEP, IDictionary<string, string> data)
{
CustomerCode = customerCode;
Name = name;
Expand All @@ -27,6 +26,11 @@ public CustomerResponse(string customerCode,string? name, string firstName, stri
BankAccount = bankAccount;
IsBusiness = isBusiness;
RiskQualification = riskQualification;
Created = created;
PortFolioCode = portFolioCode;
ExternalCustomerCode = externalCustomerCode;
IsReviewRecommended = isReviewRecommended;
IsPEP = isPEP;
Data = data;
}

Expand Down Expand Up @@ -56,16 +60,16 @@ public CustomerResponse(string customerCode,string? name, string firstName, stri

[JsonPropertyName("currencyCode")]
public string CurrencyCode { get; set; }

[JsonPropertyName("address")]
public string? Address { get; set; }

[JsonPropertyName("city")]
public string? City { get; set; }

[JsonPropertyName("zipCode")]
public string? ZipCode { get; set; }

[JsonPropertyName("state")]
public string? State { get; set; }

Expand All @@ -87,6 +91,21 @@ public CustomerResponse(string customerCode,string? name, string firstName, stri
[JsonPropertyName("riskQualification")]
public string? RiskQualification { get; set; }

[JsonPropertyName(name: "created")]
public string? Created { get; set; }

[JsonPropertyName("portfolioCode")]
public string? PortFolioCode { get; set; }

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

[JsonPropertyName("isReviewRecommended")]
public bool? IsReviewRecommended { get; set; }

[JsonPropertyName("isPEP")]
public bool? IsPEP { get; set; }

[JsonPropertyName("data")]
public IDictionary<string, string> Data { get; set; }
}
Expand Down
5 changes: 5 additions & 0 deletions Nexus.Sdk.Token.Tests/Helpers/MockTokenServerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public Task<CustomerResponse> CreateCustomer(CreateCustomerRequest request, stri
bankAccountNumber,
request.IsBusiness!,
request.RiskQualification!,
request.Created!,
request.PortFolioCode!,
request.ExternalCustomerCode!,
request.IsReviewRecommended,
request.IsPEP!,
request.Data!
));
}
Expand Down

0 comments on commit 0e301e6

Please sign in to comment.