public async Task <ApiResponse> Inquiry(ClientInquiryRequest inquiryRequest) { var requestMap = _mapper.Map(inquiryRequest, new InquirePaymentRequest()); requestMap.MerchantId = _qfPayConfiguration.MerchantId; //signature generation var toSign = $"{requestMap.ToDictionary().GetDataString()}{_qfPayConfiguration.ApiKey}"; _logger.Log(LogLevel.Information, $"Hashing input: {toSign.HideKey(_qfPayConfiguration.ApiKey)}, key: {_qfPayConfiguration.ApiKey.HideKey(_qfPayConfiguration.ApiKey)}"); var sha256Hash = toSign.ToSha256Hash(); //header authentication var headers = new Dictionary <string, string> { { "X-QF-APPCODE", _qfPayConfiguration.AppCode }, { "X-QF-SIGN", sha256Hash }, { "X-QF-SIGNTYPE", "SHA256" } }; //request to qfpay api var requestToQfPayResponse = await _qfPayApiConnect.PostFormDataAsync <InquirePaymentResponse>("/trade/v1/query", requestMap.ToDictionary(), headers).ConfigureAwait(false); _logger.Log(LogLevel.Information, "Response from QFPayApi Inquire Payment", requestToQfPayResponse); ////temporary disable in order to see actual response from QFPay ////map result for client return //var responseToClient = _mapper.Map<InquirePaymentResponseToClient>(requestToQfPayResponse); //_logger.Log(LogLevel.Information, "Return to Client Response", responseToClient); return(new ApiResponse(requestToQfPayResponse)); }
public async Task <ApiResponse> Inquiry([FromBody] ClientInquiryRequest inquiryRequest) { if (!ModelState.IsValid) { throw new ApiProblemDetailsException(ModelState); } var handler = _vendorHandlerManager.GetHandler(inquiryRequest.PaymentType); return(await handler.Inquiry(inquiryRequest).ConfigureAwait(false)); }