private string ParseCreditCardResult(XmlDocument response) { string result = "Unknown Error Occured"; string resultCode = ""; if (response.SelectSingleNode("/Response/purchaseResult") != null) { result = response.SelectSingleNode("/Response/purchaseResult").InnerText; if (response.SelectSingleNode("/Response/purchaseResult").Attributes["error"] != null) { result = response.SelectSingleNode("/Response/purchaseResult").Attributes["error"].InnerText; resultCode = response.SelectSingleNode("/Response/purchaseResult").Attributes["errorCode"].InnerText; if (resultCode == "210003") { Dictionary <string, string> resultErrorInfo = ParseErrorInfoIntoDictionay(result); string[] resultArray = GetPurchaseOrderResult(resultErrorInfo, "purchaseOrderState"); resultCode = resultArray[0]; result = resultArray[1]; } else { result = result.Replace("FundRequestException", "").Trim(); result = PaymentItemResourceHandler.GetErrorMessageFromResourceFile(result, resultCode); if (result.Contains("does not pass custom validation")) { result = PaymentItemResourceHandler.GetErrorMessageFromResourceFile("", "DefaultCCError"); } } } } return(result); }
private string[] GetPurchaseOrderResult(Dictionary <string, string> InfoArray, string Key) { string[] resultArray = new string[2]; string purchaseOrderState = GetDictionaryValue(InfoArray, "purchaseOrderState"); resultArray[0] = GetDictionaryValue(InfoArray, "resultCode"); resultArray[1] = GetDictionaryValue(InfoArray, "responseText"); if (String.IsNullOrEmpty(resultArray[1])) { resultArray[1] = PaymentItemResourceHandler.GetErrorMessageFromResourceFile("", "DefaultCCError"); } return(resultArray); }
private string CreateResponseString(string status, string redirectURL, string errorMessage, string errorCode) { string response = "Unknown Error Occured"; switch (status) { case "OK": response = redirectURL; break; case "Error": response = PaymentItemResourceHandler.GetErrorMessageFromResourceFile(errorMessage, errorCode); break; default: break; } return(response); }