public virtual IGatewayResponse Send(IGatewayRequest request, string description) { var serviceUrl = TEST_URL; if (!string.IsNullOrEmpty(_customUrl)) { serviceUrl = _customUrl; } else if (!TestMode) { serviceUrl = LIVE_URL; } LoadAuthorization(request); if (String.IsNullOrEmpty(request.Description)) { request.Queue(ApiFields.Description, description); } #if debug request.DuplicateWindow = "0"; #endif var response = SendRequest(serviceUrl, request); return(DecideResponse(response.Split('|'))); }
public IGatewayResponse Send(IGatewayRequest request, string description) { var serviceUrl = TEST_URL; if (!TestMode) { serviceUrl = LIVE_URL; } request.Queue(ApiFields.ApiLogin, ApiLogin); request.Queue(ApiFields.TransactionKey, TransactionKey); request.Queue(ApiFields.Description, description); //validate the inputs Validate(request); var result = ""; var postData = request.ToPostString(); //override the local cert policy ServicePointManager.CertificatePolicy = new PolicyOverride(); var webRequest = (HttpWebRequest)WebRequest.Create(serviceUrl); webRequest.Method = "POST"; webRequest.ContentLength = postData.Length; webRequest.ContentType = "application/x-www-form-urlencoded"; // post data is sent as a stream StreamWriter myWriter = null; myWriter = new StreamWriter(webRequest.GetRequestStream()); myWriter.Write(postData); myWriter.Close(); // returned values are returned as a stream, then read into a string var response = (HttpWebResponse)webRequest.GetResponse(); using (StreamReader responseStream = new StreamReader(response.GetResponseStream())) { result = responseStream.ReadToEnd(); responseStream.Close(); } // the response string is broken into an array // The split character specified here must match the delimiting character specified above var response_array = result.Split('|'); return(DecideResponse(response_array)); }
/// <summary> /// Loops the form request and pushes the data into the request, if preset. /// </summary> static void SerializeForm(IGatewayRequest request, NameValueCollection collection) { var api = new ApiFields (); foreach (string item in collection.Keys) { //always send the keys to the API - this allows for Merchant Custom Keys request.Queue(item, collection[item]); } }
/// <summary> /// Sends the specified request. /// </summary> /// <param name="request">The request.</param> /// <param name="description">The description.</param> /// <returns></returns> public override IGatewayResponse Send(IGatewayRequest request, string description) { var device = (int)_deviceType; //make sure to send in the API version request.Queue("x_cpversion", "1.0"); request.Queue("x_market_type", _marketType); request.Queue("x_device_type", device.ToString()); request.Queue("x_response_format", "1"); LoadAuthorization(request); request.Queue(ApiFields.Description, description); var response = SendRequest(_serviceUrl, request); return(new CardPresentResponse(response.Split('|'))); }
/// <summary> /// Loops the form request and pushes the data into the request, if preset. /// </summary> static void SerializeForm(IGatewayRequest request, NameValueCollection collection) { var api = new ApiFields(); foreach (string item in collection.Keys) { //always send the keys to the API - this allows for Merchant Custom Keys request.Queue(item, collection[item]); } }
public virtual IGatewayResponse Send(IGatewayRequest request, string description) { var serviceUrl = TEST_URL; if (!TestMode) { serviceUrl = LIVE_URL; } LoadAuthorization(request); request.Queue(ApiFields.Description, description); var response = SendRequest(serviceUrl, request); return(DecideResponse(response.Split('|'))); }
public virtual IGatewayResponse Send(IGatewayRequest request, string description) { string serviceUrl = "https://test.authorize.net/gateway/transact.dll"; if (!this.TestMode) { serviceUrl = "https://secure.authorize.net/gateway/transact.dll"; } this.LoadAuthorization(request); if (string.IsNullOrEmpty(request.Description)) { request.Queue("x_description", description); } return(this.DecideResponse(this.SendRequest(serviceUrl, request).Split(new char[1] { '|' }))); }
protected void LoadAuthorization(IGatewayRequest request) { request.Queue(ApiFields.ApiLogin, ApiLogin); request.Queue(ApiFields.TransactionKey, TransactionKey); }
public virtual IGatewayResponse Send (IGatewayRequest request, string description) { var serviceUrl = TEST_URL; if (!TestMode) serviceUrl = LIVE_URL; LoadAuthorization(request); if(String.IsNullOrEmpty(request.Description)) request.Queue(ApiFields.Description, description); #if debug request.DuplicateWindow = "0"; #endif var response = SendRequest(serviceUrl, request); return DecideResponse(response.Split('|')); }
/// <summary> /// Sends the specified request. /// </summary> /// <param name="request">The request.</param> /// <param name="description">The description.</param> /// <returns></returns> public override IGatewayResponse Send(IGatewayRequest request, string description) { var device = (int)_deviceType; //make sure to send in the API version request.Queue("x_cpversion", "1.0"); request.Queue("x_market_type", _marketType); request.Queue("x_device_type", device.ToString()); request.Queue("x_response_format", "1"); LoadAuthorization(request); request.Queue(ApiFields.Description, description); //make sure this is empty request.RelayResponse = ""; var response = SendRequest(_serviceUrl, request); return new CardPresentResponse(response.Split('|')); }
protected void LoadAuthorization(IGatewayRequest request) { request.Queue("x_login", this.ApiLogin); request.Queue("x_tran_key", this.TransactionKey); }