public async Task SavePaymentNotifyAsync(SessionGateway session, NexiNotifyResponse notifyResponse, string configuration) { _logger.LogInformation("Start CreditCardService->SavePaymentNotifyAsync()"); var response = new NotifyDto(); response.Sequence = SequenceTypeEnum.NOTF; response.Status = StatusTypeEnum.PENDING; response.NexiData = notifyResponse; var config = JsonConvert.DeserializeObject(configuration); CheckPayment(session.OrderId); var paymentId = notifyResponse.PaymentId ?? ""; _logger.LogInformation(":: CreditCardService->SavePaymentNotifyAsync->GetByIdAsync()"); var newTransaction = await this._uow.CreditCardDetailsRepository.GetByIdAsync(session.IdCardTransactionDetailsNexi); if (newTransaction == null) { _logger.LogInformation("no credit card detail record found"); throw new ProblemServiceException((int)HttpStatusCode.NotFound, "Not Found", new BehaviorError(ErrorsTypeEnum.VAGP4040003.GetStringValue(), string.Format(_errorMessagesService.Get(ErrorsTypeEnum.VAGP4040003.GetStringValue()), "CreditCard", "Detail"))); } if (config.ResponseCodes.Contains(notifyResponse.ResponseCode)) { var securitytoken = notifyResponse.SecurityToken; _logger.LogInformation(":: CreditCardService->SavePaymentNotifyAsync->Test SecurityToken()"); if (newTransaction.SecurityToken.ToLower().Equals(securitytoken.ToLower())) { response.Status = StatusTypeEnum.OK; _logger.LogInformation(":: CreditCardService->SavePaymentNotifyAsync->UpdateAsync()"); newTransaction.AuthorizationCode = notifyResponse.AuthorizationCode ?? ""; newTransaction.RRN = notifyResponse.Rrn ?? ""; newTransaction.MaskedPan = notifyResponse.MaskedPan ?? ""; newTransaction.CardType = notifyResponse.CardType ?? ""; newTransaction.CardCountry = notifyResponse.CardCountry ?? ""; newTransaction.CustomField = notifyResponse.CustomField ?? ""; newTransaction.SchemaTID = notifyResponse.SchemaTID ?? ""; newTransaction.WalletID = notifyResponse.WalletID ?? ""; newTransaction.CardExpiryDate = notifyResponse.CardExpiryDate ?? ""; } else { _logger.LogInformation("Security token doesnt match"); throw new ProblemServiceException((int)HttpStatusCode.InternalServerError, "Internal Server Error", new BehaviorError(ErrorsTypeEnum.VAGP5000001.GetStringValue(), string.Format(_errorMessagesService.Get(ErrorsTypeEnum.VAGP5000001.GetStringValue()), "SecurityToken"))); } } else { response.Status = StatusTypeEnum.KO; } _logger.LogInformation(":: CreditCardService->SavePaymentNotifyAsync->savingNewStatus"); newTransaction.ErrorCode = notifyResponse.ErrorCode ?? ""; newTransaction.ResponseCode = notifyResponse.ResponseCode ?? ""; newTransaction.ErrorMessage = notifyResponse.ErrorMessage ?? ""; newTransaction.Result = notifyResponse.Result ?? ""; newTransaction.PaymentID = paymentId; newTransaction.ThreedSecure = notifyResponse.ThreedSecure ?? ""; await this._uow.CreditCardDetailsRepository.UpdateAsync(newTransaction); await this._uow.SaveAsync(); response.UrlNotify = $"{newTransaction.MerchantCallbackURL}?orderid={session.OrderId}&paymentId={paymentId}"; _logger.LogInformation("End CreditCardService->SavePaymentNotifyAsync->Response()"); return response; }