/// <summary>
        /// Method for builiding Transaction with Json Request,call the actual transaction execution method and call for Deseralize Json 
        /// and Return the object.
        /// Returns the PayTraceExternalTransResponse Type 
        /// </summary>
        public PayTraceExternalTransResponse CaptureTransactionTrans(string token, CaptureTransactionRequest captureTransactionRequest)
		{

			// Header details are available at Authentication header page.
			string methodUrl = ApiEndPointConfiguration.UrlCapture ;

			//converting request into JSON string
			var requestJSON = JsonSerializer.GetSeralizedString(captureTransactionRequest);

			//Optional - Display Json Request 
			//System.Web.HttpContext.Current.Response.Write ("<br>" + "Json Request: " + requestJSON + "<br>");

			//call for actual request and response
			var payTraceResponse = new PayTraceResponse();
			var tempResponse = payTraceResponse.ProcessTransaction(methodUrl, token, requestJSON);

			//Create and assign the deseralized object to appropriate response type
			var payTraceExternalTransResponse = new PayTraceExternalTransResponse();
			payTraceExternalTransResponse = JsonSerializer.DeserializeResponse<PayTraceExternalTransResponse>(tempResponse);

			//Assign the http error if any
			JsonSerializer.AssignError(tempResponse,(PayTraceBasicResponse)payTraceExternalTransResponse);

			//Return the Desearlized object
			return payTraceExternalTransResponse;
		}
Exemple #2
0
        public void BuildTransaction(string oAuth)
        {
            // Capture Transaction Request
            CaptureTransactionRequest requestCaptureTransaction = new CaptureTransactionRequest();

            // for Cature Transaction Request execuation
            CaptureTransactionGenerator CaptureTransactionGenerator = new CaptureTransactionGenerator();

            // Assign the values to the void Transaction Request.
            requestCaptureTransaction = BuildRequestFromFields(requestCaptureTransaction);

            // To make Void Transaction Request and store the response
            var result = CaptureTransactionGenerator.CaptureTransactionTrans(oAuth, requestCaptureTransaction);

            //display the void Transaction Response
            WriteResults(result);
        }
Exemple #3
0
        protected CaptureTransactionRequest BuildRequestFromFields(CaptureTransactionRequest requestCaptureTransaction)
        {
            // Build Capture Transaction fields from the input sources.
            // Transaction_id should be collected from previously Authorised API response - Transaction ID or if you have stored anywhere in DB or in any Variables.
            // Optional - it shows how to get value from the form text box.

            // requestCaptureTransaction.Amount= 1.0 ;


            var transactionId = Request.Form["TransactionNumber"];

            //following IF statement is optional if you already have input validation for Empty Transaction number textbox
            if (string.IsNullOrEmpty(transactionId))
            {
                transactionId = new Random().Next().ToString();
            }

            requestCaptureTransaction.TransactionId = Convert.ToInt64(transactionId);

            return(requestCaptureTransaction);
        }