public static TransactionBSA parseJsonToTransaction(string json) { TransactionBSA transaction = new TransactionBSA(); if (json != null && json.Equals("")) { string message = "Response vacio o nulo"; throw new ResponseException(message); } Dictionary <string, object> result = parseJsonToDictionary(json); if (result.ContainsKey(ElementNames.BSA_ERROR_CODE)) { string message = (string)result[ElementNames.BSA_ERROR_CODE] + " - " + (string)result[ElementNames.BSA_ERROR_MESSAGE]; throw new ResponseException(message); } transaction.setChannel((string)result[ElementNames.BSA_CHANNEL]); transaction.setUrlHibridFormResuorces((string)result[ElementNames.BSA_URL_HIBRID_FROM_RESOURCES]); transaction.setPublicRequestKeys((string)result[ElementNames.BSA_PUBLIC_REQUEST_KEY]); transaction.setRequestKey((string)result[ElementNames.BSA_REQUEST_KEY]); transaction.setTransactionID((string)result[ElementNames.BSA_TRANSACTION_ID_RESPONSE]); return(transaction); }
public static string generateTransactionJson(TransactionBSA transaction) { Dictionary<string, object> aux = new Dictionary<string, object> () ; aux.Add(ElementNames.BSA_GENERAL_DATA, transaction.getGeneralData()); aux.Add(ElementNames.BSA_OPERATION_DATA, transaction.getOperationData()); aux.Add(ElementNames.BSA_TECHNICAL_DATA, transaction.getTecnicalData()); string transactionJson = JsonConvert.SerializeObject(aux, Newtonsoft.Json.Formatting.Indented); return transactionJson; }
public static string generateTransactionJson(TransactionBSA transaction) { Dictionary <string, object> aux = new Dictionary <string, object> (); aux.Add(ElementNames.BSA_GENERAL_DATA, transaction.getGeneralData()); aux.Add(ElementNames.BSA_OPERATION_DATA, transaction.getOperationData()); aux.Add(ElementNames.BSA_TECHNICAL_DATA, transaction.getTecnicalData()); string transactionJson = JsonConvert.SerializeObject(aux, Newtonsoft.Json.Formatting.Indented); return(transactionJson); }
public static TransactionBSA parseJsonToTransaction(string json){ TransactionBSA transaction = new TransactionBSA(); if(json != null && json.Equals("")){ string message = "Response vacio o nulo"; throw new ResponseException(message); } Dictionary<string, object> result = parseJsonToDictionary(json); if (result.ContainsKey(ElementNames.BSA_ERROR_CODE)) { string message = (string)result[ElementNames.BSA_ERROR_CODE] + " - " + (string)result[ElementNames.BSA_ERROR_MESSAGE]; throw new ResponseException(message); } transaction.setChannel((string)result[ElementNames.BSA_CHANNEL]); transaction.setUrlHibridFormResuorces((string)result[ElementNames.BSA_URL_HIBRID_FROM_RESOURCES]); transaction.setPublicRequestKeys((string)result[ElementNames.BSA_PUBLIC_REQUEST_KEY]); transaction.setRequestKey((string)result[ElementNames.BSA_REQUEST_KEY]); transaction.setTransactionID((string)result[ElementNames.BSA_TRANSACTION_ID_RESPONSE]); return transaction; }