public ExecuteResponse execute(ExecuteData exe) { try { using (client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, authorizationKey; string enc = exe.getEncodingMethod(); Object pay = exe.getPayload(); var statusCode = client.Execute( exe.getSecurity(), exe.getSession(), exe.getMerchant(), exe.getOperation(), ref enc, ref pay, out statusMessage, out authorizationKey); ExecuteResponse response = new ExecuteResponse(statusCode, statusMessage, authorizationKey, enc, pay); return(response); } } catch (Exception ex) { ExecuteResponse response = new ExecuteResponse(0, ex.Message, "", "", null); return(response); } }
public GetAuthorizeAnswerResponse getAuthorizeAnswer(GetAuthorizeAnswerData gaa) { try { using (client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { Console.WriteLine(client.Endpoint.Address); HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, authorizationKey, encodingMethod; object payload; var statusCode = client.GetAuthorizeAnswer( gaa.getSecurity(), gaa.getSession(), gaa.getMerchant(), gaa.getRequestKey(), gaa.getAnswerKey(), out statusMessage, out authorizationKey, out encodingMethod, out payload); GetAuthorizeAnswerResponse response = new GetAuthorizeAnswerResponse(statusCode, statusMessage, authorizationKey, encodingMethod, payload.ToString()); return(response); } } catch (Exception ex) { GetAuthorizeAnswerResponse response = new GetAuthorizeAnswerResponse(0, ex.Message, "", "", ""); return(response); } }
public SendAuthorizeRequestResponse sendAuthorizeRequest(SendAuthorizeRequestData sar) { try { using (client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, URL_Request, RequestKey, PublicRequestKey; var statusCode = client.SendAuthorizeRequest(sar.getSecurity(), sar.getSession(), sar.getMerchant(), sar.getUrl_ok(), sar.getUrl_error(), sar.getEncodingMethod(), sar.getPayload(), out statusMessage, out URL_Request, out RequestKey, out PublicRequestKey); SendAuthorizeRequestResponse response = new SendAuthorizeRequestResponse(statusCode, statusMessage, URL_Request, RequestKey, PublicRequestKey); return(response); } } catch (Exception ex) { SendAuthorizeRequestResponse response = new SendAuthorizeRequestResponse(0, ex.Message, "", "", ""); return(response); } }
protected virtual Dictionary <string, object> ExecuteGetAuthorizeAnswer(Dictionary <string, string> request) { Dictionary <string, object> result = new Dictionary <string, object>(); using (var client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, authorizationKey, encodingMethod; object payload; var statusCode = client.GetAuthorizeAnswer( request[ElementNames.SECURITY], request[ElementNames.SESSION], request[ElementNames.MERCHANT], request[ElementNames.REQUESTKEY], request[ElementNames.ANSWERKEY], out statusMessage, out authorizationKey, out encodingMethod, out payload); result.Add(ElementNames.STATUS_CODE, statusCode); result.Add(ElementNames.STATUS_MESSAGE, statusMessage); result.Add(ElementNames.AUTHORIZATIONKEY, authorizationKey); result.Add(ElementNames.ENCODINGMETHOD, encodingMethod); result.Add(ElementNames.PAYLOAD, payload); } return(result); }
protected virtual Dictionary <string, object> ExecuteSendAuthorizeRequest(Dictionary <string, string> request, string payloadTAG) { Dictionary <string, object> result = new Dictionary <string, object>(); using (var client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, URL_Request, RequestKey, PublicRequestKey; var statusCode = client.SendAuthorizeRequest( request[ElementNames.SECURITY], request[ElementNames.SESSION], request[ElementNames.MERCHANT], request[ElementNames.URL_OK], request[ElementNames.URL_ERROR], request[ElementNames.ENCODING_METHOD], payloadTAG, out statusMessage, out URL_Request, out RequestKey, out PublicRequestKey); result.Add(ElementNames.STATUS_CODE, statusCode); result.Add(ElementNames.STATUS_MESSAGE, statusMessage); result.Add(ElementNames.URL_REQUEST, URL_Request); result.Add(ElementNames.REQUEST_KEY, RequestKey); result.Add(ElementNames.PUBLIC_REQUEST_KEY, PublicRequestKey); } return(result); }
public Dictionary <string, object> SendAuthorizeRequest(Dictionary <string, string> request, Dictionary <string, string> payloads) { var result = new Dictionary <string, object>(); string payloadTAG = String.Empty; payloadTAG = "<Request>"; foreach (var payload in payloads.Keys) { payloadTAG += "<" + payload.ToUpper() + ">" + payloads[payload] + "</" + payload.ToUpper() + ">"; } payloadTAG += "</Request>"; try { using (var client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, URL_Request, RequestKey, PublicRequestKey; var statusCode = client.SendAuthorizeRequest( request[SECURITY], request[SESSION], request[MERCHANT], request[URL_OK], request[URL_ERROR], request[ENCODING_METHOD], payloadTAG, out statusMessage, out URL_Request, out RequestKey, out PublicRequestKey); result.Add("StatusCode", statusCode); result.Add("StatusMessage", statusMessage); result.Add("URL_Request", URL_Request); result.Add("RequestKey", RequestKey); result.Add("PublicRequestKey", PublicRequestKey); } } catch (Exception ex) { ///TODO: ACA VA EL MANEJO DE EXCEPCIONES result.Add("ErrorMessage", ex.Message); throw ex; } return(result); }
public object[] GetByOperationId(GetByOperationData gbo) { try { using (client = new OperationService.OperationPortTypeClient(this.OperationsBinding, this.OperationsEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); object[] ret = client.Get(gbo.getIDSITE(), gbo.getIDTRANSACTIONSIT()); return(ret); } } catch (Exception ex) { //ExecuteResponse response = new ExecuteResponse(0, ex.Message, "", "", null); object[] ret = new object[1]; ret[0] = ex; return(ret); } }
public Dictionary <string, object> GetAuthorizeAnswer(Dictionary <string, string> request) { var result = new Dictionary <string, object>(); try { using (var client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, authorizationKey, encodingMethod; object payload; var statusCode = client.GetAuthorizeAnswer( request[ElementNames.SECURITY], request[ElementNames.SESSION], request[ElementNames.MERCHANT], request[ElementNames.REQUESTKEY], request[ElementNames.ANSWERKEY], out statusMessage, out authorizationKey, out encodingMethod, out payload); result.Add(ElementNames.STATUS_CODE, statusCode); result.Add(ElementNames.STATUS_MESSAGE, statusMessage); result.Add(ElementNames.AUTHORIZATIONKEY, authorizationKey); result.Add(ElementNames.ENCODINGMETHOD, encodingMethod); result.Add(ElementNames.PAYLOAD, payload); } } catch (Exception ex) { ///TODO: ACA VA EL MANEJO DE EXCEPCIONES result.Add("ErrorMessage", ex.Message); throw ex; } return(result); }
public Dictionary <string, object> SendAuthorizeRequest(Dictionary <string, string> request, Dictionary <string, string> payloads) { //Add version to payload dictionary // string val = ""; // if (payloads.TryGetValue("SDK", out val)) //{ // payloads["SDK"] = ".NET"; //} // else //{ //payloads.Add("SDK", ".NET"); //} //if (payloads.TryGetValue("SDKVERSION", out val)) //{ // payloads["SDKVERSION"] = versionTodoPago; //} //else //{ //payloads.Add("SDKVERSION", versionTodoPago); //} // if (payloads.TryGetValue("LENGUAGEVERSION", out val)) //{ //payloads["LENGUAGEVERSION"] = Environment.Version.ToString(); //} //else //{ // payloads.Add("LENGUAGEVERSION", Environment.Version.ToString()); //} var result = new Dictionary <string, object>(); string payloadTAG = String.Empty; payloadTAG = "<Request>"; //FraudControlValidate fc = new FraudControlValidate(); //payloads = fc.validate(payloads); //if (!payloads.ContainsKey(ElementNames.ERROR)) //{ foreach (var payload in payloads.Keys) { payloadTAG += "<" + payload.ToUpper() + ">" + payloads[payload] + "</" + payload.ToUpper() + ">"; } payloadTAG += "</Request>"; //Console.WriteLine(payloadTAG); try { using (var client = new AuthorizeService.AuthorizePortTypeClient(this.AuthorizeBinding, this.AuthorizeEndpoint)) { HeaderHttpExtension.AddCustomHeaderUserInformation(new OperationContextScope(client.InnerChannel), this.Headers); string statusMessage, URL_Request, RequestKey, PublicRequestKey; var statusCode = client.SendAuthorizeRequest( request[ElementNames.SECURITY], request[ElementNames.SESSION], request[ElementNames.MERCHANT], request[ElementNames.URL_OK], request[ElementNames.URL_ERROR], request[ElementNames.ENCODING_METHOD], payloadTAG, out statusMessage, out URL_Request, out RequestKey, out PublicRequestKey); result.Add(ElementNames.STATUS_CODE, statusCode); result.Add(ElementNames.STATUS_MESSAGE, statusMessage); result.Add(ElementNames.URL_REQUEST, URL_Request); result.Add(ElementNames.REQUEST_KEY, RequestKey); result.Add(ElementNames.PUBLIC_REQUEST_KEY, PublicRequestKey); } } catch (Exception ex) { ///TODO: ACA VA EL MANEJO DE EXCEPCIONES result.Add("ErrorMessage", ex.Message); throw ex; } //} //else //{ // result = setResult(payloads); //} return(result); }