public static BCBill handlePayResult(string respString, BCBill bill)
{
JsonData responseData = JsonMapper.ToObject(respString);
if (bill.channel == "WX_NATIVE")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
bill.codeURL = responseData["url"].ToString();
}
else
{
bill.codeURL = responseData["code_url"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "WX_JSAPI")
{
if (BCCache.Instance.testMode)
{
throw new BCException("微信公众号内支付不支持测试模式");
}
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
bill.appId = responseData["app_id"].ToString();
bill.package = responseData["package"].ToString();
bill.noncestr = responseData["nonce_str"].ToString();
bill.timestamp = responseData["timestamp"].ToString();
bill.paySign = responseData["pay_sign"].ToString();
bill.signType = responseData["sign_type"].ToString();
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "ALI_WEB" || bill.channel == "ALI_WAP")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
bill.html = string.Format("<html><head></head><body><script>location.href='{0}'</script></body></html>", responseData["url"].ToString());
}
else
{
bill.html = responseData["html"].ToString();
}
bill.url = responseData["url"].ToString();
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "ALI_QRCODE")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
bill.url = responseData["url"].ToString();
if (BCCache.Instance.testMode)
{
bill.html = string.Format("<html><head></head><body><script>location.href='{0}'</script></body></html>", responseData["url"].ToString());
}
else
{
bill.html = responseData["html"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "JD_WAP" || bill.channel == "JD_WEB" || bill.channel == "KUAIQIAN_WAP" || bill.channel == "KUAIQIAN_WEB" || bill.channel == "UN_WEB" || bill.channel == "UN_WAP")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
bill.html = string.Format("<html><head></head><body><script>location.href='{0}'</script></body></html>", responseData["url"].ToString());
}
else
{
bill.html = responseData["html"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "BD_WEB" || bill.channel == "BD_WAP" || bill.channel == "YEE_WEB" || bill.channel == "YEE_WAP")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
bill.html = string.Format("<html><head></head><body><script>location.href='{0}'</script></body></html>", responseData["url"].ToString());
}
else
{
bill.url = responseData["url"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "BC_GATEWAY")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
bill.html = string.Format("<html><head></head><body><script>location.href='{0}'</script></body></html>", responseData["url"].ToString());
}
else
{
bill.html = responseData["html"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "BC_EXPRESS")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
bill.html = string.Format("<html><head></head><body><script>location.href='{0}'</script></body></html>", responseData["url"].ToString());
}
else
{
bill.html = responseData["html"].ToString();
bill.url = responseData["url"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "BC_NATIVE")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
//bill.codeURL = responseData["url"].ToString();
}
else
{
bill.codeURL = responseData["code_url"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "BC_WX_WAP")
{
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
if (BCCache.Instance.testMode)
{
//bill.codeURL = responseData["url"].ToString();
}
else
{
bill.url = responseData["url"].ToString();
}
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
if (bill.channel == "BC_WX_JSAPI")
{
if (BCCache.Instance.testMode)
{
throw new BCException("微信公众号内支付不支持测试模式");
}
if (responseData["result_code"].ToString() == "0")
{
bill.id = responseData["id"].ToString();
bill.appId = responseData["app_id"].ToString();
bill.package = responseData["package"].ToString();
bill.noncestr = responseData["nonce_str"].ToString();
bill.timestamp = responseData["timestamp"].ToString();
bill.paySign = responseData["pay_sign"].ToString();
bill.signType = responseData["sign_type"].ToString();
return bill;
}
else
{
var ex = new BCException(responseData["err_detail"].ToString());
throw ex;
}
}
return bill;
}