Esempio n. 1
0
        /// <summary>
        ///     Sends a transaction status request to the URL specified in Configuration.AcquirerUrl_TransactionReq
        /// </summary>
        /// <param name="statusRequest">A StatusRequest object</param>
        /// <returns>
        ///     A StatusResponse object which contains the response from the server (transaction id, status message), or error information when an error occurs
        /// </returns>
        public StatusResponse GetResponse(StatusRequest statusRequest)
        {
            try
            {
                _logger.Log("sending new status request");

                _logger.Log("building idx message");
                var acquirerstsreq =
                    new IDxMessageBuilder(_configuration).GetStatusRequest(statusRequest);

                _logger.Log("signing message");
                var xml = Sign(acquirerstsreq);

                var content = PerformRequest(xml, _configuration.AcquirerStatusUrl);

                return(StatusResponse.Parse(content, _configuration));
            }
            catch (Exception e)
            {
                _logger.Log(e.ToString());
                return(new StatusResponse(e));
            }
        }
        /// <summary>
        ///     Sends a transaction status request to the URL specified in Configuration.AcquirerUrl_TransactionReq
        /// </summary>
        /// <param name="statusRequest">A StatusRequest object</param>
        /// <returns>
        ///     A StatusResponse object which contains the response from the server (transaction id, status message), or error information when an error occurs
        /// </returns>
        public async Task <StatusResponse> GetResponseAsync(StatusRequest statusRequest)
        {
            try
            {
                _logger.Log("sending new status request");

                _logger.Log("building idx message");
                var acquirerStatusRequest =
                    _iDxMessageBuilder.GetStatusRequest(statusRequest);

                _logger.Log("signing message");
                var xml = Sign(acquirerStatusRequest);

                var content = await PerformRequestAsync(xml, _configuration.AcquirerStatusUrl);

                return(StatusResponse.Parse(content, _configuration));
            }
            catch (Exception e)
            {
                _logger.Log(e.ToString());
                return(new StatusResponse(e));
            }
        }