/// <summary> /// SendFdCreditCardRequest /// </summary> /// <param name="req"></param> /// <param name="resp"></param> /// <param name="errorResp"></param> /// <returns></returns> public bool SendFdCreditCardRequest(FdCreditCardReq req, out FdCreditCardResp resp, out string errorResp) { errorResp = ""; resp = null; string result = String.Empty; string jsonPayload = String.Empty; try { jsonPayload = JsonConvert.SerializeObject(req); } catch (Exception ex) { errorResp = ex.Message; return false; } if (Version != ApiVersion.V11) { throw new Exception(String.Format("Version {0} is not supported", Version)); } if (SendRequestV11(jsonPayload, out result)) { try { resp = JsonConvert.DeserializeObject<FdCreditCardResp>(result); return true; } catch (Exception exception) { try { JObject jobj = JObject.Parse(result); resp = new FdCreditCardResp(); resp.transaction_approved = (jobj["transaction_approved"].ToString() == "1") ? true : false; resp.bank_message = jobj["bank_message"].ToString(); resp.exact_resp_code = jobj["exact_resp_code"].ToString(); return true; } catch (Exception ex) { errorResp = exception.Message; return false; } } } else { errorResp = result; return false; } }
/// <summary> /// SendFdCreditCardRequest /// </summary> /// <param name="req"></param> /// <param name="resp"></param> /// <param name="errorResp"></param> /// <returns></returns> public bool SendFdCreditCardRequest(FdCreditCardReq req, out FdCreditCardResp resp, out string errorResp) { errorResp = ""; resp = null; string result = String.Empty; string jsonPayload = String.Empty; try { jsonPayload = JsonConvert.SerializeObject(req); } catch (Exception ex) { errorResp = ex.Message; return(false); } if (Version != ApiVersion.V11) { throw new Exception(String.Format("Version {0} is not supported", Version)); } if (SendRequestV11(jsonPayload, out result)) { try { resp = JsonConvert.DeserializeObject <FdCreditCardResp>(result); return(true); } catch (Exception exception) { try { JObject jobj = JObject.Parse(result); resp = new FdCreditCardResp(); resp.transaction_approved = (jobj["transaction_approved"].ToString() == "1") ? true : false; resp.bank_message = jobj["bank_message"].ToString(); resp.exact_resp_code = jobj["exact_resp_code"].ToString(); return(true); } catch (Exception ex) { errorResp = exception.Message; return(false); } } } else { errorResp = result; return(false); } }