Ejemplo n.º 1
0
        public async Task UpdatePersonalInformation(string clientId, string firstName, string lastName)
        {
            string fullname = $"{firstName} {lastName}";

            var changes = new KycPersonalDataChanges
            {
                Changer = RecordChanger.Client,
                Items   = new Dictionary <string, JToken>
                {
                    { nameof(IPersonalData.FirstName), firstName },
                    { nameof(IPersonalData.LastName), lastName },
                    { nameof(IPersonalData.FullName), fullname }
                }
            };

            await _kycProfileService.UpdatePersonalDataAsync(clientId, changes);

            var clientAccount = await _clientAccountClient.GetByIdAsync(clientId);

            await _httpContextAccessor.HttpContext.SignOutAsync(OpenIdConnectConstantsExt.Auth.DefaultScheme);

            var identity = await _userManager.CreateUserIdentityAsync(clientAccount.Id, clientAccount.Email, clientAccount.Email, true);

            await _httpContextAccessor.HttpContext.SignInAsync(OpenIdConnectConstantsExt.Auth.DefaultScheme,
                                                               new ClaimsPrincipal(identity),
                                                               new AuthenticationProperties());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> UpdateDateOfBirth([FromBody] DateOfBirthModel model)
        {
            var kycStatusValid = await _kycStatusValidator.ValidatePersonalDataUpdateAsync();

            if (!kycStatusValid)
            {
                throw LykkeApiErrorException.BadRequest(LykkeApiErrorCodes.Service.KycRequired);
            }

            var changes = new KycPersonalDataChanges {
                Changer = Startup.ComponentName, Items = new Dictionary <string, JToken>()
            };

            changes.Items.Add(nameof(model.DateOfBirth), model.DateOfBirth);

            await _kycProfileService.UpdatePersonalDataAsync(_requestContext.ClientId, changes);

            return(Ok());
        }