public IActionResult GetUserTransactions(long accountId, string registrationId) { ServiceProviderRegistration serviceProviderRegistration = _dataAccessService.GetServiceProviderRegistration(long.Parse(registrationId)); IEnumerable <SpUserTransactionDto> transactionDtos = _consentManagementService.GetUserTransactions(accountId); var result = new ServiceProviderRegistrationDto { ServiceProviderRegistrationId = registrationId, Commitment = serviceProviderRegistration.Commitment.ToHexString(), Transactions = transactionDtos.Where(t => t.RegistrationId == registrationId).ToArray() }; return(Ok(result)); }
public IActionResult GetActionInfo([FromQuery(Name = "t")] int actionType, [FromQuery(Name = "pk")] string publicKey, [FromQuery(Name = "sk")] string sessionKey, [FromQuery(Name = "rk")] string registrationKey) { AccountDescriptor spAccount = _accountsService.GetByPublicKey(publicKey.HexStringToByteArray()); bool isRegistered = false; string extraInfo = null; List <string> validations = new List <string>(); string[] details = Array.Empty <string>(); // Onboarding & Login if (actionType == 0) { ServiceProviderRegistration serviceProviderRegistration = _dataAccessService.GetServiceProviderRegistration(spAccount.AccountId, registrationKey.HexStringToByteArray()); ; isRegistered = serviceProviderRegistration != null; } // Employee registration else if (actionType == 1) { List <SpEmployee> spEmployees = _dataAccessService.GetSpEmployees(spAccount.AccountId, registrationKey.DecodeFromString64()); extraInfo = ""; foreach (SpEmployee spEmployee in spEmployees) { if (!string.IsNullOrEmpty(extraInfo)) { extraInfo += "/"; } extraInfo += $"{spAccount.AccountInfo}|{spEmployee?.SpEmployeeGroup?.GroupName}|{!string.IsNullOrEmpty(spEmployee.RegistrationCommitment)}"; } isRegistered = spEmployees.Count > 0; } // Document sign else if (actionType == 2) { SignedDocumentEntity spDocument = _dataAccessService.GetSpDocument(spAccount.AccountId, registrationKey); if (spDocument != null) { isRegistered = true; extraInfo = $"{spDocument.DocumentName}|{spDocument.Hash}|{spDocument.LastChangeRecordHeight}"; foreach (var allowedSigner in spDocument.AllowedSigners) { validations.Add($"{allowedSigner.GroupIssuer};{allowedSigner.GroupName}"); } } } bool isBiometryRequired = false; if (actionType == 0 || actionType == 1) { IEnumerable <SpIdenitityValidation> spIdenitityValidations = _dataAccessService.GetSpIdenitityValidations(spAccount.AccountId); if (spIdenitityValidations != null && spIdenitityValidations.Count() > 0) { //IEnumerable<Tuple<AttributeType, string>> attributeDescriptions = _identityAttributesService.GetAssociatedAttributeTypes(); //IEnumerable<Tuple<ValidationType, string>> validationDescriptions = _identityAttributesService.GetAssociatedValidationTypes(); foreach (SpIdenitityValidation spIdenitityValidation in spIdenitityValidations) { if (!AttributesSchemes.ATTR_SCHEME_NAME_PASSPORTPHOTO.Equals(spIdenitityValidation.SchemeName)) { validations.Add($"{spIdenitityValidation.SchemeName}:{spIdenitityValidation.ValidationType}"); } else { isBiometryRequired = true; } // if (spIdenitityValidation.AttributeType != AttributeType.DateOfBirth) //{ // validityInfo.Add(attributeDescriptions.FirstOrDefault(d => d.Item1 == spIdenitityValidation.AttributeType)?.Item2 ?? spIdenitityValidation.AttributeType.ToString()); // } // else //{ // validityInfo.Add(validationDescriptions.FirstOrDefault(d => d.Item1 == spIdenitityValidation.ValidationType)?.Item2 ?? spIdenitityValidation.ValidationType.ToString()); //} } } } ServiceProviderActionAndValidationsDto serviceProviderActionAndValidations = new ServiceProviderActionAndValidationsDto { SpInfo = spAccount.AccountInfo, IsRegistered = isRegistered, PublicKey = publicKey, SessionKey = sessionKey, ExtraInfo = extraInfo, IsBiometryRequired = isBiometryRequired, Validations = validations }; return(Ok(serviceProviderActionAndValidations)); }