Skip to content

Commit

Permalink
Merge pull request #6 from IliyanIlievPH/2
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
PaterSantyago committed Apr 6, 2020
2 parents d2ae482 + 61f7214 commit 9653ee3
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autofac;
using Autofac;
using JetBrains.Annotations;
using Lykke.HttpClientGenerator;
using Lykke.HttpClientGenerator.Infrastructure;
Expand Down Expand Up @@ -30,7 +30,7 @@ public static class AutofacExtension
if (string.IsNullOrWhiteSpace(settings.ServiceUrl))
throw new ArgumentException("Value cannot be null or whitespace.", nameof(CustomerManagementServiceClientSettings.ServiceUrl));

var clientBuilder = HttpClientGenerator.HttpClientGenerator.BuildForUrl(settings.ServiceUrl)
var clientBuilder = HttpClientGenerator.BuildForUrl(settings.ServiceUrl)
.WithAdditionalCallsWrapper(new ExceptionHandlerCallsWrapper());

clientBuilder = builderConfigure?.Invoke(clientBuilder) ?? clientBuilder.WithoutRetries();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
Expand All @@ -14,9 +14,10 @@
using Lykke.Service.CustomerProfile.Client;
using Lykke.Service.CustomerProfile.Client.Models.Enums;
using Lykke.Service.CustomerProfile.Client.Models.Requests;
using Lykke.Service.CustomerProfile.Client.Models.Responses;
using Lykke.Service.Sessions.Client;
using Lykke.Service.Sessions.Client.Models;
using LoginProvider = Lykke.Service.CustomerManagement.Domain.Enums.LoginProvider;
using LoginProvider = MAVN.Service.CustomerManagement.Domain.Enums.LoginProvider;

namespace MAVN.Service.CustomerManagement.DomainServices
{
Expand Down Expand Up @@ -105,7 +106,7 @@ public async Task<AuthResultModel> SocialAuthAsync(string email, LoginProvider l
if (customerProfileResult.ErrorCode == CustomerProfileErrorCodes.CustomerProfileDoesNotExist)
return new AuthResultModel { Error = ServicesError.LoginNotFound };

var customerProfileLoginProvider = (CustomerProfile.Client.Models.Enums.LoginProvider)loginProvider;
var customerProfileLoginProvider = (Lykke.Service.CustomerProfile.Client.Models.Enums.LoginProvider)loginProvider;

if (!customerProfileResult.Profile.LoginProviders.Contains(customerProfileLoginProvider))
return new AuthResultModel { Error = ServicesError.LoginExistsWithDifferentProvider };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using System.Web;
Expand Down Expand Up @@ -77,7 +77,7 @@ public async Task<PasswordResetError> RequestPasswordResetAsync(string email)
var identifierResponse =
await _credentialsClient.Api.GenerateResetIdentifierAsync(customer.Profile.CustomerId);

if (identifierResponse.ErrorCode != Credentials.Client.Enums.PasswordResetError.None)
if (identifierResponse.ErrorCode != Lykke.Service.Credentials.Client.Enums.PasswordResetError.None)
return _mapper.Map<PasswordResetError>(identifierResponse);

await SendPasswordResetEmailAsync(customer.Profile.CustomerId, identifierResponse.Identifier,
Expand Down Expand Up @@ -111,7 +111,7 @@ public async Task<PasswordResetError> RequestPasswordResetAsync(string email)
var result = await _credentialsClient.Api.PasswordResetAsync(new PasswordResetRequest
{CustomerEmail = customerEmail, ResetIdentifier = identifier, Password = newPassword});

if (result.Error == Credentials.Client.Enums.PasswordResetError.None)
if (result.Error == Lykke.Service.Credentials.Client.Enums.PasswordResetError.None)
{
await _postProcessService.ClearSessionsAndSentEmailAsync(customer.Profile?.CustomerId,
_passwordSuccessfulResetEmailTemplateId, _passwordSuccessfulResetEmailSubjectTemplateId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
Expand All @@ -19,7 +19,7 @@
using Lykke.Service.CustomerProfile.Client.Models.Requests;
using Lykke.Service.PrivateBlockchainFacade.Client;
using Lykke.Service.PrivateBlockchainFacade.Client.Models;
using LoginProvider = Lykke.Service.CustomerManagement.Domain.Enums.LoginProvider;
using LoginProvider = MAVN.Service.CustomerManagement.Domain.Enums.LoginProvider;
using CPLoginProvider = Lykke.Service.CustomerProfile.Client.Models.Enums.LoginProvider;

namespace MAVN.Service.CustomerManagement.DomainServices
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/MAVN.Service.CustomerManagement.Tests/AuthServiceTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
Expand Down Expand Up @@ -147,7 +147,7 @@ public async Task UserTriesToLogIn_CustomerIsBlocked_CustomerBlockedErrorReturne
customersProfileClient.Setup(x => x.CustomerProfiles.GetByCustomerIdAsync(It.IsAny<string>(),true,true ))
.ReturnsAsync(new CustomerProfileResponse
{
Profile = new CustomerProfile.Client.Models.Responses.CustomerProfile
Profile = new CustomerProfile
{
Status = CustomerProfileStatus.Active
}
Expand Down Expand Up @@ -262,7 +262,7 @@ public async Task UserTriesToLogIn_WithValidCredentials_SuccessfullyAuthenticate
customerProfileClient.Setup(x => x.CustomerProfiles.GetByCustomerIdAsync(It.IsAny<string>(), true, true))
.ReturnsAsync(new CustomerProfileResponse
{
Profile = new CustomerProfile.Client.Models.Responses.CustomerProfile
Profile = new CustomerProfile
{
Status = CustomerProfileStatus.Active
}
Expand Down Expand Up @@ -310,7 +310,7 @@ public async Task UserTriesToLogInWithGoogle_WithValidEmail_SuccessfullyAuthenti
customerProfileClient.Setup(x => x.CustomerProfiles.GetByEmailAsync(It.IsAny<GetByEmailRequestModel>()))
.ReturnsAsync(new CustomerProfileResponse
{
Profile = new CustomerProfile.Client.Models.Responses.CustomerProfile
Profile = new CustomerProfile
{
CustomerId = customerId,
LoginProviders = new List<LoginProvider>() {LoginProvider.Google},
Expand Down Expand Up @@ -380,7 +380,7 @@ public async Task UserTriesToLogInWithGoogle_ProfileExistsButWithAnotherProvider
customerProfileClient.Setup(x => x.CustomerProfiles.GetByEmailAsync(It.IsAny<GetByEmailRequestModel>()))
.ReturnsAsync(new CustomerProfileResponse
{
Profile = new CustomerProfile.Client.Models.Responses.CustomerProfile
Profile = new CustomerProfile
{
LoginProviders = new List<LoginProvider>()
{
Expand Down Expand Up @@ -421,7 +421,7 @@ public async Task UserTriesToLogInWithGoogle_CustomerIsBlocked_CustomerBlockedEr
customerProfileClient.Setup(x => x.CustomerProfiles.GetByEmailAsync(It.IsAny<GetByEmailRequestModel>()))
.ReturnsAsync(new CustomerProfileResponse
{
Profile = new CustomerProfile.Client.Models.Responses.CustomerProfile
Profile = new CustomerProfile
{
CustomerId = customerId,
LoginProviders = new List<LoginProvider>()
Expand Down
Loading

0 comments on commit 9653ee3

Please sign in to comment.