public async Task UpdateAsync(IPayAuth payauth)
        {
            var client = await _payAuthRepository.GetAsync(payauth.ClientId, payauth.SystemId);

            if (client == null)
            {
                throw new ClientNotFoundException(payauth.ClientId);
            }

            await _payAuthRepository.UpdateAsync(payauth);
        }
 public static PayAuthEntity Create(IPayAuth src)
 {
     return(new PayAuthEntity
     {
         ApiKey = src.ApiKey,
         Certificate = src.Certificate,
         ClientId = src.ClientId,
         SystemId = src.SystemId,
         PartitionKey = GeneratePartitionKey(src.ClientId),
         RowKey = GenerateRowKey(src.SystemId)
     });
 }
        public async Task UpdateAsync(IPayAuth payauth)
        {
            await _tableStorage.MergeAsync(
                PayAuthEntity.ByClientId.GeneratePartitionKey(payauth.ClientId),
                PayAuthEntity.ByClientId.GenerateRowKey(payauth.SystemId),
                entity =>
            {
                if (!string.IsNullOrEmpty(payauth.ApiKey))
                {
                    entity.ApiKey = payauth.ApiKey;
                }

                if (!string.IsNullOrEmpty(payauth.Certificate))
                {
                    entity.Certificate = payauth.Certificate;
                }

                return(entity);
            });
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> VerifySignature([FromBody] VerifySignatureModel request)
        {
            try
            {
                IPayAuth payAuth = await _payAuthService.GetAsync(request.ClientId, request.SystemId);

                var validationResult = _securityHelper.CheckRequest(request.Text, request.ClientId, request.Signature,
                                                                    payAuth.Certificate, payAuth.ApiKey);

                return(Ok(new SignatureValidationResponse {
                    Description = validationResult.ToString(), ErrorType = validationResult
                }));
            }
            catch (ClientNotFoundException e)
            {
                _log.Error(e, $"{e.Message}, request: {request.ToJson()}");

                return(NotFound(ErrorResponse.Create(e.Message)));
            }
        }
        public async Task AddAsync(IPayAuth payauth)
        {
            var newItem = PayAuthEntity.ByClientId.Create(payauth);

            await _tableStorage.InsertOrMergeAsync(newItem);
        }
 public async Task AddAsync(IPayAuth payauth)
 {
     await _payAuthRepository.AddAsync(payauth);
 }