private static PersonCheckData FormRequest(IPersonalData personalData) { return(new PersonCheckData { residences = Array.Empty <string>(), citizenships = new[] { personalData.CountryFromID }, datesOfBirth = new[] { new IncompleteDate { year = personalData.DateOfBirth?.Year ?? -1, month = personalData.DateOfBirth?.Month ?? -1, day = personalData.DateOfBirth?.Day ?? -1 } }, customerId = personalData.Id, names = new[] { new PersonName { firstName = personalData.FirstName, lastName = personalData.LastName } } }); }
public GrpcApiService( ISessionService sessionService, ISmsVerification smsVerification, ILogger <GrpcApiService> logger, IAuthService authService, IRegistrationTokenService registrationTokenService, IEmailVerification emailVerification, IPersonalData personalData, IClientWalletService clientWalletService, IClientAccountManager accountManager, IMarketDataService marketDataService, IMatchingEngineClient matchingEngineClient) { _sessionService = sessionService; _smsVerification = smsVerification; _logger = logger; _authService = authService; _registrationTokenService = registrationTokenService; _emailVerification = emailVerification; _personalData = personalData; _clientWalletService = clientWalletService; _accountManager = accountManager; _marketDataService = marketDataService; _matchingEngineClient = matchingEngineClient; }
private static int CalculateCompletionPercentage(IPersonalData contactFullInfo, IEnumerable <IKycDocument> documents) { var filledData = 0; if (contactFullInfo != null) { filledData += Convert.ToInt32(!string.IsNullOrEmpty(contactFullInfo.FirstName)) + Convert.ToInt32(!string.IsNullOrEmpty(contactFullInfo.LastName)) + Convert.ToInt32(!string.IsNullOrEmpty(contactFullInfo.ContactPhone)) + Convert.ToInt32(!string.IsNullOrEmpty(contactFullInfo.Country)) + Convert.ToInt32(!string.IsNullOrEmpty(contactFullInfo.City)) + Convert.ToInt32(!string.IsNullOrEmpty(contactFullInfo.Address)) + Convert.ToInt32(!string.IsNullOrEmpty(contactFullInfo.Zip)); } if (documents != null) { var kycDocuments = documents as IList <IKycDocument> ?? documents.ToList(); filledData += Convert.ToInt32(kycDocuments.HasType(KycDocumentTypes.IdCard)) + Convert.ToInt32(kycDocuments.HasType(KycDocumentTypes.ProofOfAddress)) + Convert.ToInt32(kycDocuments.HasType(KycDocumentTypes.ProofOfFunds)) + Convert.ToInt32(kycDocuments.HasType(KycDocumentTypes.BankAccount)) + Convert.ToInt32(kycDocuments.HasType(KycDocumentTypes.AdditionalDocuments)); } var completionPercentage = (int)Math.Round((double)filledData / TotalNumberOfFields * 100); return(completionPercentage); }
public FxPaygatePaymentUrlInputValidationModel( IHttpContextAccessor httpContextAccessor, IAssetsHelper assetHelper, IAssetDisclaimersClient assetDisclaimersClient, IPaymentSystemClient paymentSystemClient, IPersonalDataService personalDataService, IClientAccountClient clientAccountService, IAssetsService assetsService, IKycStatusService kycStatusService, ITierClient tierClient, IRateCalculatorClient rateCalculatorClient) { _assetsHelper = assetHelper; _assetDisclaimersClient = assetDisclaimersClient; _clientAccountService = clientAccountService; _assetsService = assetsService; _kycStatusService = kycStatusService; _tierClient = tierClient; _rateCalculatorClient = rateCalculatorClient; _clientId = httpContextAccessor.HttpContext.User?.Identity?.Name; var paymentLimitsTask = paymentSystemClient.GetPaymentLimitsAsync(); var pdTask = personalDataService.GetAsync(_clientId); Task.WhenAll(paymentLimitsTask, pdTask).GetAwaiter().GetResult(); _paymentLimitsResponse = paymentLimitsTask.Result; _personalData = pdTask.Result; RegisterRules(); }
public async Task <IActionResult> UserInfo() { try { var personalDataTask = _personalDataService.GetAsync(_requestContext.ClientId); var isKycNeededTask = _kycStatusService.IsKycNeededAsync(_requestContext.ClientId); await Task.WhenAll(personalDataTask, isKycNeededTask); IPersonalData personalData = personalDataTask.Result; bool isKycNeeded = isKycNeededTask.Result; return(Ok(new UserInfoResponseModel { Email = personalData?.Email, FirstName = personalData?.FirstName, LastName = personalData?.LastName, KycStatus = (isKycNeeded ? KycStatus.NeedToFillData : KycStatus.Ok).ToApiModel() })); } catch (Exception e) { _log.Error(e, $"clientId = {_requestContext.ClientId}"); return(StatusCode((int)HttpStatusCode.InternalServerError)); } }
public async Task <IActionResult> ConfirmGoogle2FaSetup() { try { if (await _confirmationCodesClient.Google2FaClientHasSetupAsync(_requestContext.ClientId)) { throw LykkeApiErrorException.BadRequest(LykkeApiErrorCodes.Service.SecondFactorAlreadySetup); } IPersonalData client = await _personalDataService.GetAsync(_requestContext.ClientId); SmsConfirmationResponse smsRequestResult = await _confirmationCodesClient.SendSmsConfirmCodeAsync( new SmsConfirmCodeRequest { ClientId = _requestContext.ClientId, Phone = client.ContactPhone, Operation = ConfirmOperations.Google2FaSendSms }); return(Ok(smsRequestResult)); } catch (ApiException e) { switch (e.StatusCode) { case HttpStatusCode.BadRequest: throw LykkeApiErrorException.BadRequest(LykkeApiErrorCodes.Service.InconsistentState); case HttpStatusCode.Forbidden: throw LykkeApiErrorException.BadRequest(LykkeApiErrorCodes.Service.MaxAttemptsReached); } throw; } }
internal void Update(IPersonalData src) { FirstName = src.FirstName; LastName = src.LastName; Country = src.Country; Zip = src.Zip; City = src.City; Address = src.Address; ContactPhone = src.ContactPhone; }
public Task UpdateAsync(IPersonalData personalData) { var partitionKey = PersonalDataEntity.GeneratePartitionKey(); var rowKey = PersonalDataEntity.GenerateRowKey(personalData.Id); return(_tableStorage.ReplaceAsync(partitionKey, rowKey, itm => { itm.Update(personalData); return itm; })); }
public async Task <ISwiftCredentials> GetCredentialsAsync(string assetId, IPersonalData personalData) { var regulatorId = personalData.SpotRegulator ?? (await _regulatorRepository.GetByIdOrDefaultAsync(null)).InternalId; //if no credentials, try to get default for regulator var credentials = await _swiftCredentialsRepository.GetCredentialsAsync(regulatorId, assetId) ?? await _swiftCredentialsRepository.GetCredentialsAsync(regulatorId); return(await BuildCredentials(assetId, credentials, personalData)); }
public async Task UpdatePersonalDataAsync(IPersonalData personalData, string changer) { var dataBefore = await _personalDataRepository.GetAsync(personalData.Id); await _personalDataRepository.UpdateAsync(personalData); var dataAfter = await _personalDataRepository.GetAsync(personalData.Id); await _auditLogRepository.AddAuditRecordAsync(personalData.Id, dataBefore, dataAfter, AuditRecordType.PersonalData, changer); }
internal void Update(IPersonalData src) { Country = src.Country; Zip = src.Zip; City = src.City; Address = src.Address; ContactPhone = src.ContactPhone; FullName = src.FullName; FirstName = src.FirstName; LastName = src.LastName; SpotRegulator = src.SpotRegulator; }
private static ISpiderCheckResult MapResult(IPersonalData personalData, checkPersonResponse response) { var profiles = [email protected] ?? Array.Empty <PersonProfile>(); return(new SpiderCheckResult { CustomerId = personalData.Id, VerificationId = [email protected], CheckDateTime = DateTime.UtcNow, PersonProfiles = profiles.Select(MapProfile).ToArray() }); }
public static PersonalDataEntity Create(IPersonalData src) { var result = new PersonalDataEntity { PartitionKey = GeneratePartitionKey(), RowKey = GenerateRowKey(src.Id), Email = src.Email, Regitered = src.Regitered }; result.Update(src); return result; }
internal static PaymentTransactionResponse Create(IPersonalData personalData) { return(new PaymentTransactionResponse { Address = personalData.Address, City = personalData.City, Phone = personalData.ContactPhone, Country = personalData.CountryFromPOA ?? personalData.Country, Email = personalData.Email, FirstName = personalData.FirstName, LastName = personalData.LastName, Zip = personalData.Zip }); }
public static PersonalDataEntity Create(IPersonalData src) { var result = new PersonalDataEntity { PartitionKey = GeneratePartitionKey(), RowKey = GenerateRowKey(src.Id), Email = src.Email, Regitered = src.Regitered }; result.Update(src); return(result); }
public ClientAccountManager(IPersonalData personalData, IAuthService authService, IClientWalletService clientWalletService, IMyNoSqlServerDataWriter <ClientProfileEntity> clientProfileDataWriter, IMarketDataService marketDataService, IMyNoSqlServerDataReader <ClientProfileEntity> clientProfileDataReader, ICashInOutProcessor cashInOutProcessor, ILogger <ClientAccountManager> logger) { _personalData = personalData; _authService = authService; _clientWalletService = clientWalletService; _clientProfileDataWriter = clientProfileDataWriter; _marketDataService = marketDataService; _clientProfileDataReader = clientProfileDataReader; _cashInOutProcessor = cashInOutProcessor; _logger = logger; }
public async Task <TierInfoResponse> GetClientTierInfoAsync(string clientId) { var clientTask = _clientAccountClient.ClientAccountInformation.GetByIdAsync(clientId); var pdTask = _personalDataService.GetAsync(clientId); await Task.WhenAll(clientTask, pdTask); ClientInfo client = clientTask.Result; IPersonalData pd = pdTask.Result; if (pd == null) { throw new ValidationApiException(HttpStatusCode.NotFound, "Client not found"); } var tierInfo = await _tiersService.GetClientTierInfoAsync(client.Id, client.Tier, pd.CountryFromPOA); return(_mapper.Map <TierInfoResponse>(tierInfo)); }
public async Task <EmailMessage> GenerateUserRegisteredMsg(IPersonalData personalData) { var templateVm = new UserRegisteredTemplate { ContactPhone = personalData.ContactPhone, Country = personalData.Country, DateTime = personalData.Regitered, Email = personalData.Email, FullName = personalData.FullName, UserId = personalData.Id }; return(new EmailMessage { Body = await _localTemplateGenerator.GenerateAsync("UserRegisteredTemplate", templateVm, TemplateType.Email), Subject = EmailResources.UserRegistered_Subject, IsHtml = true }); }
private async Task <ISwiftCredentials> BuildCredentials(string assetId, ISwiftCredentials sourceCredentials, IPersonalData personalData) { if (sourceCredentials == null) { return(null); } var asset = await _assetsService.TryGetAssetAsync(assetId); var assetTitle = asset?.DisplayId ?? assetId; var clientIdentity = personalData != null?personalData.Email.Replace("@", ".") : "{1}"; var purposeOfPayment = string.Format(sourceCredentials.PurposeOfPayment, assetTitle, clientIdentity); if (!purposeOfPayment.Contains(assetId) && !purposeOfPayment.Contains(assetTitle)) { purposeOfPayment += assetTitle; } if (!purposeOfPayment.Contains(clientIdentity)) { purposeOfPayment += clientIdentity; } return(new Core.Domain.SwiftCredentials.SwiftCredentials { AssetId = assetId, RegulatorId = sourceCredentials.RegulatorId, BIC = sourceCredentials.BIC, PurposeOfPayment = purposeOfPayment, CompanyAddress = sourceCredentials.CompanyAddress, AccountNumber = sourceCredentials.AccountNumber, BankAddress = sourceCredentials.BankAddress, AccountName = sourceCredentials.AccountName }); }
public Task UpdateAsync(IPersonalData personalData) { return(PutDataAsync(personalData, "")); }
public PersonalInfoController(IPersonalData personalData) { _ipersonaldata = personalData; }
public Task UpdateAsync(IPersonalData personalData) { var partitionKey = PersonalDataEntity.GeneratePartitionKey(); var rowKey = PersonalDataEntity.GenerateRowKey(personalData.Id); return _tableStorage.ReplaceAsync(partitionKey, rowKey, itm => { itm.Update(personalData); return itm; }); }
public async Task Handle(ClientDepositedEvent evt, ICommandSender commandSender) { var clientAccountTask = _clientAccountClient.ClientAccountInformation.GetByIdAsync(evt.ClientId); var pdTask = _personalDataService.GetAsync(evt.ClientId); await Task.WhenAll(clientAccountTask, pdTask); ClientInfo clientAccount = clientAccountTask.Result; IPersonalData pd = pdTask.Result; if (clientAccount == null) { return; } await _limitsService.SaveDepositOperationAsync(_mapper.Map <DepositOperation>(evt)); LimitSettings currentLimitSettings = await _limitsService.GetClientLimitSettingsAsync(evt.ClientId, clientAccount.Tier, pd.CountryFromPOA); if (currentLimitSettings?.MaxLimit == null) { return; } var checkAmountTask = _limitsService.GetClientDepositAmountAsync(evt.ClientId); var pushSettingsTask = _clientAccountClient.ClientSettings.GetPushNotificationAsync(evt.ClientId); await Task.WhenAll(checkAmountTask, pushSettingsTask); var checkAmount = checkAmountTask.Result; var pushSettings = pushSettingsTask.Result; if (checkAmount > currentLimitSettings.MaxLimit.Value) { await _limitsService.SetLimitReachedAsync(evt.ClientId, checkAmount, currentLimitSettings.MaxLimit.Value, evt.BaseAsset); if (pushSettings.Enabled && !string.IsNullOrEmpty(clientAccount.NotificationsId)) { await SendPushNotificationAsync(clientAccount.PartnerId, clientAccount.NotificationsId, "PushLimitReachedTemplate", new { }, commandSender); } } if (checkAmount <= currentLimitSettings.MaxLimit.Value) { bool needNotification = _settingsService.IsLimitReachedForNotification(checkAmount, currentLimitSettings.MaxLimit.Value); if (!needNotification) { return; } if (pushSettings.Enabled && !string.IsNullOrEmpty(clientAccount.NotificationsId)) { await SendPushNotificationAsync(clientAccount.PartnerId, clientAccount.NotificationsId, "PushLimitPercentReachedTemplate", new { CurrentAmount = checkAmount, Limit = currentLimitSettings.MaxLimit.Value, Percent = Math.Round(checkAmount / currentLimitSettings.MaxLimit.Value * 100), FullName = pd.FullName, Asset = evt.BaseAsset }, commandSender); } } }
public Task SaveAsync(IPersonalData personalData) { var newEntity = PersonalDataEntity.Create(personalData); return _tableStorage.InsertAsync(newEntity); }
public static PaymentTransactionResponse Create(IPaymentTransaction lastPaymentTransaction, IPersonalData personalData) { if (lastPaymentTransaction.PaymentSystem != CashInPaymentSystem.CreditVoucher && lastPaymentTransaction.PaymentSystem != CashInPaymentSystem.Fxpaygate) { throw new ArgumentException("Credit voucher payment system is expect for transactionID:" + lastPaymentTransaction.Id); } var info = lastPaymentTransaction.GetInfo <OtherPaymentInfo>(); return(new PaymentTransactionResponse { Address = info.Address, Amount = lastPaymentTransaction.Amount, AssetId = lastPaymentTransaction.AssetId, City = info.City, Country = info.Country, Phone = personalData.ContactPhone, Email = personalData.Email, FirstName = info.FirstName, LastName = info.LastName, Zip = info.Zip }); }
public Task SaveAsync(IPersonalData personalData) { var newEntity = PersonalDataEntity.Create(personalData); return(_tableStorage.InsertAsync(newEntity)); }