/** * API Call to search for events * @param URL * @param queryMap * @param requestOptions * @return * @throws Exception */ public PayeezyResponse getEvents(string URL, Dictionary <string, string> queryMap, PayeezyRequestOptions requestOptions) { URL = URL + APIResourceConstants.SECURE_TOKEN_URL; PayeezyResponse payeezyResponse = payeezyClient.execute(URL, RequestMethod.GET, requestOptions, queryMap); return(payeezyResponse); }
/** * Dynamic Pricing look up * @param transactionRequest * @return * @throws Exception */ public PayeezyResponse doExchangeRate(TransactionRequest transactionRequest) { string URL = appSettings["url"] + APIResourceConstants.EXCHANGE_RATE; string payload = new JSONHelper <TransactionRequest>().getJSONObject(transactionRequest); PayeezyResponse payeezyResponse = payeezyClient.execute(URL, RequestMethod.POST, getRequestOptions(), payload); return(payeezyResponse); }
/** * Use this for Secondary transactions like void, refund, capture etc */ public PayeezyResponse doSecondaryTransaction(string id, TransactionRequest transactionRequest) { string URL = appSettings["url"]; URL = URL + APIResourceConstants.PRIMARY_TRANSACTIONS + "/" + id; string payload = new JSONHelper <TransactionRequest>().getJSONObject(transactionRequest); PayeezyResponse payeezyResponse = payeezyClient.execute(URL, RequestMethod.POST, getRequestOptions(), payload); return(payeezyResponse); }
/** * Execute a POST Request * @param uri * @param payload * @param requestOptions * @return * @throws Exception */ // protected PayeezyResponse executePostRequest(string uri, string payload, PayeezyRequestOptions requestOptions) // { // HttpClient httpClient = payeezyHttpClient.getHttpClient(); // HttpPost httpPost = createPostConnection(uri, payload, requestOptions); // stringEntity entity = new stringEntity(payload); // httpPost.setEntity(entity); // // Create a custom response handler // ResponseHandler<PayeezyResponse> responseHandler = new ResponseHandler<PayeezyResponse>() // { // public PayeezyResponse handleResponse(HttpResponse response) // { // return getResponse(response); // } //}; // return HttpClient.execute(httpPost, responseHandler); //} /** * Execute a PUT Request * @param uri * @param payload * @param requestOptions * @return * @throws Exception */ //protected PayeezyResponse executePutRequest(string uri, string payload, PayeezyRequestOptions requestOptions) //{ // HttpClient httpClient = payeezyHttpClient.getHttpClient(); // HttpPut httpPost = createPutConnection(uri, payload, requestOptions); // stringEntity entity = new stringEntity(payload); // httpPost.setEntity(entity); // // Create a custom response handler // ResponseHandler<PayeezyResponse> responseHandler = new ResponseHandler<PayeezyResponse>() // { // public PayeezyResponse handleResponse(final HttpResponse response) //{ // return getResponse(response); //} // }; // return httpClient.execute(httpPost, responseHandler); // } /** * Execute a Get Request * @param uri * @param queryParams * @return * @throws Exception */ protected override PayeezyResponse executeGetRequest(string uri, Dictionary <string, string> queryParams) { // URI buildURI = buildGetURI(uri, queryParams); //// HttpGet httpGet = new HttpGet(buildURI); //var httpClient = payeezyHttpClient.getHttpClient(); //// ResponseHandler<PayeezyResponse> responseHandler = new HttpWebRequest<PayeezyResponse>() //// { //// public PayeezyResponse handleResponse(HttpResponse response) //// { //// return getResponse(response); //// } ////}; //return httpClient.(httpGet, responseHandler); // Create a request for the URL. WebRequest request = WebRequest.Create(uri); // If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials; // Get the response. WebResponse response = request.GetResponse(); // Display the status. Console.WriteLine(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. Stream dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. StreamReader reader = new StreamReader(dataStream); // Read the content. string responseFromServer = reader.ReadToEnd(); // Display the content. Console.WriteLine(responseFromServer); var httpClient = payeezyHttpClient.getHttpClient(); var sss = new PayeezyResponse(); response.Close(); return(sss); }
/** * Get Token Call to tokenize a credit card * @param queryMap * @return * @throws Exception */ public PayeezyResponse doGetTokenCall(Dictionary <string, string> queryMap) { string URL = appSettings["url"] + APIResourceConstants.SECURE_TOKEN_URL; if (URL.Contains("http://")) { URL.Replace("https://", ""); } if (!queryMap.ContainsKey(APIResourceConstants.SecurityConstants.APIKEY)) { String apikey = appSettings[APIResourceConstants.SecurityConstants.APIKEY]; queryMap.Add(APIResourceConstants.SecurityConstants.APIKEY, apikey); } if (!queryMap.ContainsKey(APIResourceConstants.SecurityConstants.JS_SECURITY_KEY)) { String jsSecurityKey = appSettings[APIResourceConstants.SecurityConstants.JS_SECURITY_KEY]; queryMap.Add(APIResourceConstants.SecurityConstants.JS_SECURITY_KEY, jsSecurityKey); } PayeezyResponse payeezyResponse = payeezyClient.execute(URL, RequestMethod.GET, null, queryMap); return(payeezyResponse); }