/// <summary>
        ///     Sends a cancellation request to the URL specified in Configuration.AcquirerUrl_TransactionReq
        /// </summary>
        /// <param name="cancellationRequest">A CancellationRequest object</param>
        /// <returns>
        ///     A CancellationResponse object which contains the response from the server (transaction id, issuer authentication URL), or error information when an error occurs
        /// </returns>
        public CancellationResponse Cancel(CancellationRequest cancellationRequest)
        {
            try
            {
                Logger.LogDebug("sending new eMandate transaction");
                Logger.LogDebug("building eMandate");

                var document = new EMandateMessageBuilder(LocalConfiguration, LocalInstrumentCode).GetCancel(cancellationRequest);

                Logger.LogDebug("building idx message");

                var request =
                    new IDxMessageBuilder(LocalConfiguration, LocalInstrumentCode).GetTransactionRequest(cancellationRequest, document);

                Logger.LogDebug("signing message");
                var xml = Sign(request);

                var content = PerformRequest(xml, LocalConfiguration.Acquirer.TransactionRequestUrl);

                return(CancellationResponse.Parse(content, Logger));
            }
            catch (Exception e)
            {
                Logger.LogError(e, e.Message);

                return(CancellationResponse.Get(e));
            }
        }
Exemple #2
0
        /// <summary>
        ///     Sends an amendment request to the URL specified in Configuration.AcquirerUrl_TransactionReq
        /// </summary>
        /// <param name="amendmentRequest">An AmendmentRequest object</param>
        /// <returns>
        ///     An AmendmentResponse object which contains the response from the server (transaction id, issuer authentication URL), or error information when an error occurs
        /// </returns>
        public AmendmentResponse Amend(AmendmentRequest amendmentRequest)
        {
            try
            {
                Logger.Log("sending new amend request");

                Logger.Log("building eMandate");
                var document = new EMandateMessageBuilder(LocalConfiguration, LocalInstrumentCode).GetAmend(amendmentRequest);

                Logger.Log("building idx message");
                var acquirertrxreq =
                    new IDxMessageBuilder(LocalConfiguration, LocalInstrumentCode).GetTransactionRequest(amendmentRequest, document);

                Logger.Log("signing message");
                var xml = Sign(acquirertrxreq);

                var content = PerformRequest(xml, LocalConfiguration.AcquirerUrlTransactionReq);

                return(AmendmentResponse.Parse(content, Logger));
            }
            catch (Exception e)
            {
                Logger.Log("error : {0}", e);
                return(AmendmentResponse.Get(e));
            }
        }