Commit 7d84f33a by 陶然

init

parent d655ed6d
...@@ -67,7 +67,20 @@ namespace Com.Bocom.OpenApi ...@@ -67,7 +67,20 @@ namespace Com.Bocom.OpenApi
/// </summary> /// </summary>
internal static string MPNG210001RequestV1 = "/api/pmssMpng/MPNG210001/v1"; internal static string MPNG210001RequestV1 = "/api/pmssMpng/MPNG210001/v1";
/// <summary>
/// 2.10 查询订单@MPNG-MAPIMPNG020702
/// </summary>
internal static string MPNG020702RequestV1 = "/api/pmssMpng/MPNG020702/v1"; internal static string MPNG020702RequestV1 = "/api/pmssMpng/MPNG020702/v1";
/// <summary>
/// 2.7 交易关闭@MPNG-CIPPMPNG020705
/// </summary>
internal static string MPNG020705RequestV1 = "/api/pmssMpng/MPNG020705/v1";
/// <summary>
/// 2.8 撤销订单@MPNG-CIPPMPNG020706
/// </summary>
internal static string MPNG020706RequestV1 = "/api/pmssMpng/MPNG020706/v1";
} }
} }
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\..\k5-njzj\appextend\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
...@@ -82,6 +82,8 @@ ...@@ -82,6 +82,8 @@
<Compile Include="Sdk\request\IntegralExchangeCheckRequestV1.cs" /> <Compile Include="Sdk\request\IntegralExchangeCheckRequestV1.cs" />
<Compile Include="Sdk\request\IntegralExchangeCreateUrlRequestV1.cs" /> <Compile Include="Sdk\request\IntegralExchangeCreateUrlRequestV1.cs" />
<Compile Include="Sdk\request\MPNG020702RequestV1.cs" /> <Compile Include="Sdk\request\MPNG020702RequestV1.cs" />
<Compile Include="Sdk\request\MPNG020705RequestV1.cs" />
<Compile Include="Sdk\request\MPNG020706RequestV1.cs" />
<Compile Include="Sdk\request\MPNG210001RequestV1.cs" /> <Compile Include="Sdk\request\MPNG210001RequestV1.cs" />
<Compile Include="Sdk\request\QueryContractOrderRequestV2.cs" /> <Compile Include="Sdk\request\QueryContractOrderRequestV2.cs" />
<Compile Include="Sdk\request\ScfCreateUrlRequestV1.cs" /> <Compile Include="Sdk\request\ScfCreateUrlRequestV1.cs" />
...@@ -96,6 +98,8 @@ ...@@ -96,6 +98,8 @@
<Compile Include="Sdk\response\IntegralExchangeCreateUrlResponseV1.cs" /> <Compile Include="Sdk\response\IntegralExchangeCreateUrlResponseV1.cs" />
<Compile Include="Sdk\response\IntegralExchangeNotifyResponseV1.cs" /> <Compile Include="Sdk\response\IntegralExchangeNotifyResponseV1.cs" />
<Compile Include="Sdk\response\MPNG020702ResponseV1.cs" /> <Compile Include="Sdk\response\MPNG020702ResponseV1.cs" />
<Compile Include="Sdk\response\MPNG020705ResponseV1.cs" />
<Compile Include="Sdk\response\MPNG020706ResponseV1.cs" />
<Compile Include="Sdk\response\MPNG210001ResponseV1.cs" /> <Compile Include="Sdk\response\MPNG210001ResponseV1.cs" />
<Compile Include="Sdk\response\QueryContractOrderResponseV2.cs" /> <Compile Include="Sdk\response\QueryContractOrderResponseV2.cs" />
<Compile Include="Sdk\response\ScfCreateUrlResponseV1.cs" /> <Compile Include="Sdk\response\ScfCreateUrlResponseV1.cs" />
......
...@@ -315,7 +315,7 @@ namespace Com.Bocom.OpenApi ...@@ -315,7 +315,7 @@ namespace Com.Bocom.OpenApi
throw new Exception("only support json format, current format is not supported. format: " + format); throw new Exception("only support json format, current format is not supported. format: " + format);
} }
private BocomResponse ParseJsonWithBocomSign<T>(BocomRequest<T> request, string respStr, string encryptType, public BocomResponse ParseJsonWithBocomSign<T>(BocomRequest<T> request, string respStr, string encryptType,
string encryptKey) where T : BocomResponse string encryptKey) where T : BocomResponse
{ {
if (request is BocomDownloadRequest<T> || request is BocomDownloadEncryptRequest<T>) if (request is BocomDownloadRequest<T> || request is BocomDownloadEncryptRequest<T>)
......
...@@ -7,6 +7,9 @@ using System.Threading.Tasks; ...@@ -7,6 +7,9 @@ using System.Threading.Tasks;
namespace Com.Bocom.OpenApi namespace Com.Bocom.OpenApi
{ {
/// <summary>
/// 2.10 查询订单@MPNG-MAPIMPNG020702
/// </summary>
public class MPNG020702RequestV1 : BocomRequest<MPNG020702ResponseV1> public class MPNG020702RequestV1 : BocomRequest<MPNG020702ResponseV1>
{ {
public override Type GetResponseClass() public override Type GetResponseClass()
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Com.Bocom.OpenApi
{
/// <summary>
/// 2.7 交易关闭@MPNG-CIPPMPNG020705
/// </summary>
public class MPNG020705RequestV1 : BocomRequest<MPNG020705ResponseV1>
{
public override Type GetResponseClass()
{
return typeof(MPNG020705ResponseV1);
}
public override bool IsNeedEncrypt()
{
return false;
}
public override string GetMethod()
{
return "POST";
}
public override Type GetBizContentClass()
{
return typeof(MPNG020705RequestV1Biz);
}
[DataContract]
public class MPNG020705RequestV1Biz : BizContent
{
/// <summary>
/// "req_head" </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("req_head") private ReqHead reqHead;
[DataMember]
public ReqHead req_head { get; set; }
[DataMember]
public ReqBody req_body { get; set; }
public class ReqHead
{
/// <summary>
/// 交易时间 yyyymmddhhmmss </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("trans_time") private String transTime;
//internal string transTime;
public string trans_time { get; set; }
/// <summary>
/// 版本信息 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("version") private String version;
public string version { get; set; }
}
public class ReqBody
{
/// <summary>
/// 商户侧原交易日期 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("mer_trade_date") private String merTradeDate;
//internal string merTradeDate;
public string mer_trade_date { get; set; }
/// <summary>
/// 服务商编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("partner_id") private String partnerId;
//internal string partnerId;
public string partner_id { get; set; }
/// <summary>
/// 支付交易商户交易编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("pay_mer_tran_no") private String payMerTranNo;
//internal string payMerTranNo;
public string pay_mer_tran_no { get; set; }
/// <summary>
/// 商户编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("mer_ptc_id") private String merPtcId;
//internal string merPtcId;
public string mer_ptc_id { get; set; }
/// <summary>
/// 商户交易编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("close_mer_tran_no") private String closeMerTranNo;
//internal string closeMerTranNo;
public string close_mer_tran_no { get; set; }
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using static Com.Bocom.OpenApi.MPNG020702RequestV1;
using static Com.Bocom.OpenApi.MPNG020705RequestV1;
namespace Com.Bocom.OpenApi
{
/// <summary>
/// 2.8 撤销订单@MPNG-CIPPMPNG020706
/// </summary>
public class MPNG020706RequestV1 : BocomRequest<MPNG020706ResponseV1>
{
public override Type GetResponseClass()
{
return typeof(MPNG020706ResponseV1);
}
public override bool IsNeedEncrypt()
{
return false;
}
public override string GetMethod()
{
return "POST";
}
public override Type GetBizContentClass()
{
return typeof(MPNG020706RequestV1Biz);
}
[DataContract]
public class MPNG020706RequestV1Biz : BizContent
{
/// <summary>
/// "req_head" </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("req_head") private ReqHead reqHead;
//internal ReqHead reqHead;
[DataMember]
public ReqHead req_head { get; set; }
public class ReqHead
{
/// <summary>
/// 交易时间 yyyymmddhhmmss </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("trans_time") private String transTime;
//internal string transTime;
public string trans_time { get; set; }
/// <summary>
/// 终端版本信息 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("version") private String version;
//internal string version;
public string version { get; set; }
}
//* "req_body"
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("req_body") private ReqBody reqBody;
[DataMember]
public ReqBody req_body { get; set; }
public class ReqBody
{
/// <summary>
/// 商户交易编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("cancel_mer_tran_no") private String cancelMerTranNo;
//internal string cancelMerTranNo;
public string cancel_mer_tran_no { get; set; }
/// <summary>
/// 商户侧原交易日期 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotatio ns will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("mer_trade_date") private String merTradeDate;
//internal string merTradeDate;
public string mer_trade_date { get; set; }
/// <summary>
/// 服务商编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("partner_id") private String partnerId;
//internal string partnerId;
public string partner_id { get; set; }
/// <summary>
/// 商户支付交易编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("pay_mer_tran_no") private String payMerTranNo;
//internal string payMerTranNo;
public string pay_mer_tran_no { get; set; }
/// <summary>
/// 交易金额,与原交易金额一致 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("refund_amount") private String refundAmount;
//internal string refundAmount;
public string refund_amount { get; set; }
/// <summary>
/// 商户编号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("mer_ptc_id") private String merPtcId;
//internal string merPtcId;
public string mer_ptc_id { get; set; }
/// <summary>
/// 订单号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("sys_order_no") private String sysOrderNo;
//internal string sysOrderNo;
public string sys_order_no { get; set; }
}
}
}
}
...@@ -7,6 +7,9 @@ using System.Threading.Tasks; ...@@ -7,6 +7,9 @@ using System.Threading.Tasks;
namespace Com.Bocom.OpenApi namespace Com.Bocom.OpenApi
{ {
/// <summary>
/// 2.4 主扫聚合码接口@MPNG-CIPPMPNG210001
/// </summary>
public class MPNG210001RequestV1 : BocomRequest<MPNG210001ResponseV1> public class MPNG210001RequestV1 : BocomRequest<MPNG210001ResponseV1>
{ {
......
...@@ -6,6 +6,9 @@ using System.Threading.Tasks; ...@@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace Com.Bocom.OpenApi namespace Com.Bocom.OpenApi
{ {
/// <summary>
/// 2.10 查询订单@MPNG-MAPIMPNG020702
/// </summary>
public class MPNG020702ResponseV1 : BocomResponse public class MPNG020702ResponseV1 : BocomResponse
{ {
/// <summary> /// <summary>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Com.Bocom.OpenApi
{
/// <summary>
/// 2.7 交易关闭@MPNG-CIPPMPNG020705
/// </summary>
public class MPNG020705ResponseV1: BocomResponse
{
public RspBody rsp_body { get; set; }
public RspHead rsp_head { get; set; }
public class RspHead
{
/// <summary>
/// 交易标识 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("trans_code") private String transCode;
//internal string transCode;
public string trans_code { get; set; }
/// <summary>
/// 返回码 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_code") private String responseCode;
//internal string responseCode;
public string response_code { get; set; }
/// <summary>
/// 交易状态 P-处理中 F-失败 S-成功 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_status") private String responseStatus;
//internal string responseStatus;
public string response_status { get; set; }
/// <summary>
/// 响应时间 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_time") private String responseTime;
//internal string responseTime;
public string response_time { get; set; }
/// <summary>
/// 返回码描述 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_msg") private String responseMsg;
//internal string responseMsg;
public string response_msg { get; set; }
}
public class RspBody
{
/// <summary>
/// 订单号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("close_mer_tran_no") private String closeMerTranNo;
//internal string closeMerTranNo;
public string close_mer_tran_no { get; set; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Com.Bocom.OpenApi
{
/// <summary>
/// 2.8 撤销订单@MPNG-CIPPMPNG020706
/// </summary>
public class MPNG020706ResponseV1 : BocomResponse
{
public RspBody rsp_body { get; set; }
public RspHead rsp_head { get; set; }
public class RspBody
{
/// <summary>
/// 订单号 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("cancel_mer_tran_no") private String cancelMerTranNo;
//internal string cancelMerTranNo;
public string cancel_mer_tran_no { get; set; }
}
public class RspHead
{
/// <summary>
/// 交易标识 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("trans_code") private String transCode;
//internal string transCode;
public string trans_code { get; set; }
/// <summary>
/// 返回码 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_code") private String responseCode;
//internal string responseCode;
public string response_code { get; set; }
/// <summary>
/// 交易状态 P-处理中 F-失败 S-成功 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_status") private String responseStatus;
//internal string responseStatus;
public string response_status { get; set; }
/// <summary>
/// 响应时间 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_time") private String responseTime;
//internal string responseTime;
public string response_time { get; set; }
/// <summary>
/// 返回码描述 </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @JsonProperty("response_msg") private String responseMsg;
//internal string responseMsg;
public string response_msg { get; set; }
}
}
}
...@@ -6,6 +6,9 @@ using System.Threading.Tasks; ...@@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace Com.Bocom.OpenApi namespace Com.Bocom.OpenApi
{ {
/// <summary>
/// 2.4 主扫聚合码接口@MPNG-CIPPMPNG210001
/// </summary>
public class MPNG210001ResponseV1 : BocomResponse public class MPNG210001ResponseV1 : BocomResponse
{ {
/// <summary> /// <summary>
......
using Com.Bocom.OpenApi; using Com.Bocom.OpenApi;
using Kivii;
using Kivii.DataAnnotations; using Kivii.DataAnnotations;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -599,4 +600,68 @@ namespace Com.Bocom.OpenApi ...@@ -599,4 +600,68 @@ namespace Com.Bocom.OpenApi
} }
} }
[Alias("BCOM_WriteOffResultNotifys")]
public class WriteOffResultNotify:EntityWithMetadata
{
public WriteOffBizContent biz_content { get; set; }
[StringLength(2000)]
public string encrypt_key { get; set; }
[StringLength(2000)]
public string msg_id { get; set; }
[StringLength(2000)]
public string timestamp { get; set; }
[StringLength(2000)]
public string sign { get; set; }
//public Dictionary<string, string> Metadata { get; set; }
}
public class WriteOffBizContent
{
public string transcode { get; set; }
/// <summary>
///
/// </summary>
public string term_trans_time { get; set; }
/// <summary>
///
/// </summary>
public string requester_type { get; set; }
/// <summary>
///
/// </summary>
public string trace_no { get; set; }
/// <summary>
///
/// </summary>
public string version { get; set; }
/// <summary>
///
/// </summary>
public string mer_ptc_id { get; set; }
/// <summary>
///
/// </summary>
public string mobile_no { get; set; }
/// <summary>
///
/// </summary>
public string cert_type { get; set; }
/// <summary>
///
/// </summary>
public string cert_no { get; set; }
/// <summary>
///
/// </summary>
public string cus_name { get; set; }
/// <summary>
///
/// </summary>
public string reserved { get; set; }
/// <summary>
///
/// </summary>
public string communication_url { get; set; }
}
} }
...@@ -36,8 +36,7 @@ namespace Com.Bocom.OpenApi ...@@ -36,8 +36,7 @@ namespace Com.Bocom.OpenApi
{ {
try try
{ {
//byte[] contentBytes = Encoding.GetEncoding(charset).GetBytes(content); byte[] contentBytes = Encoding.GetEncoding(charset).GetBytes(content);
return RSACryptor.RSAFromPkcs8.VerifySHA256(content, sign, publicKey, charset); return RSACryptor.RSAFromPkcs8.VerifySHA256(content, sign, publicKey, charset);
} }
catch (Exception e) catch (Exception e)
......
...@@ -3,6 +3,7 @@ using System.Text; ...@@ -3,6 +3,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Runtime.Serialization.Json; using System.Runtime.Serialization.Json;
using Com.Bocom.OpenApi.Security.Sign; using Com.Bocom.OpenApi.Security.Sign;
using System.Collections.Generic;
namespace Com.Bocom.OpenApi namespace Com.Bocom.OpenApi
{ {
...@@ -57,6 +58,48 @@ namespace Com.Bocom.OpenApi ...@@ -57,6 +58,48 @@ namespace Com.Bocom.OpenApi
T, e); T, e);
} }
} }
public static Object ParseCommunicationJsonWithBocomSign(string respStr, string charset, string MY_PRIVATE_KEY, string APIGW_PUBLIC_KEY)
{
string bizContentStr;
string sign;
try
{
//int indexOfRootStart = respStr.IndexOf(BocomConstants.BIZ_CONTENT) + BocomConstants.BIZ_CONTENT.Length + 2;
int indexOfRootEnd = respStr.LastIndexOf(",");
int indexOfSignStart = respStr.LastIndexOf(BocomConstants.SIGN + "\"") + BocomConstants.SIGN.Length + 3;
int indexOfSignEnd = respStr.LastIndexOf("\"");
bizContentStr = respStr.Substring(1, indexOfRootEnd - 1);
sign = respStr.Substring(indexOfSignStart, indexOfSignEnd - indexOfSignStart);
}
catch (Exception e)
{
throw new Exception("response is not format json. respStr :\n" + respStr, e);
}
Boolean passed = BocomSignature.Verify(BocomConstants.ENCRYPT_TYPE_RSA_AND_AES, bizContentStr, APIGW_PUBLIC_KEY, charset, sign);
if (!passed)
{
throw new Exception("Bocom sign verify not passed.");
}
try
{
var jsonDic = Kivii.Text.JsonSerializer.DeserializeFromString<Dictionary<string, string>>(respStr);
var encryptKeyEncrypt = jsonDic["encrypt_key"];
var reqBizContentEncrypt = jsonDic["biz_content"];
var encryptKey = BocomEncrypt.AsymmetricalDecrypt(encryptKeyEncrypt, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES, MY_PRIVATE_KEY, charset);
var reqBizContent = BocomEncrypt.SymmetricalDecrypt(reqBizContentEncrypt, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES, encryptKey, charset);
jsonDic["encrypt_key"] = encryptKey;
jsonDic["biz_content"] = reqBizContent;
//var rtns=Kivii.Text.JsonSerializer.SerializeToString(jsonDic);
return jsonDic;
}
catch (Exception e)
{
throw new Exception("Bocom decrypt not success.", e);
}
}
} }
} }
} }
\ No newline at end of file
using Com.Bocom.OpenApi; using Com.Bocom.OpenApi;
using Com.Bocom.OpenApi.Utils; using Com.Bocom.OpenApi.Utils;
using Kivii; using Kivii;
using Kivii.Finances.Entities;
using Kivii.Linq;
using Kivii.Text; using Kivii.Text;
using Kivii.Web; using Kivii.Web;
using Org.BouncyCastle.Asn1.Ocsp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq; using System.Linq;
using System.Net;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using static Com.Bocom.OpenApi.AddContractOrderRequestV2.AddContractOrderRequestV2Biz; using static Com.Bocom.OpenApi.AddContractOrderRequestV2.AddContractOrderRequestV2Biz;
namespace Njzj.Bocoms.Openapis.Transforms namespace Njzj.Bocoms.Openapis.Transforms
...@@ -19,8 +27,8 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -19,8 +27,8 @@ namespace Njzj.Bocoms.Openapis.Transforms
{ {
DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES); DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/** /**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略 * 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/ */
client.IgnoreSslHostnameVerifier(); client.IgnoreSslHostnameVerifier();
var request = new QueryContractOrderRequestV2(); var request = new QueryContractOrderRequestV2();
...@@ -55,8 +63,8 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -55,8 +63,8 @@ namespace Njzj.Bocoms.Openapis.Transforms
{ {
DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY); DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY);
/** /**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略 * 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/ */
client.IgnoreSslHostnameVerifier(); client.IgnoreSslHostnameVerifier();
WriteOffResultRequestV2 request = new WriteOffResultRequestV2(); WriteOffResultRequestV2 request = new WriteOffResultRequestV2();
request.SetServiceUrl(Configs.APIGW_URL_ADDRESS + Configs.WriteOffResultRequestV2); request.SetServiceUrl(Configs.APIGW_URL_ADDRESS + Configs.WriteOffResultRequestV2);
...@@ -91,8 +99,8 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -91,8 +99,8 @@ namespace Njzj.Bocoms.Openapis.Transforms
{ {
DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES); DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/** /**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略 * 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/ */
client.IgnoreSslHostnameVerifier(); client.IgnoreSslHostnameVerifier();
var request = new AddContractOrderRequestV2(); var request = new AddContractOrderRequestV2();
...@@ -103,7 +111,7 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -103,7 +111,7 @@ namespace Njzj.Bocoms.Openapis.Transforms
bizContent.org_id = Configs.ORG_ID; bizContent.org_id = Configs.ORG_ID;
bizContent.bat_id = bizId; bizContent.bat_id = bizId;
bizContent.cont_order_list = new List<ContOrder>(); bizContent.cont_order_list = new List<ContOrder>();
var contorder=new ContOrder(); var contorder = new ContOrder();
contorder.cont_id = bizId; contorder.cont_id = bizId;
contorder.org_id = bizContent.org_id; contorder.org_id = bizContent.org_id;
contorder.ori_payer = "业务测试公司"; contorder.ori_payer = "业务测试公司";
...@@ -150,8 +158,8 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -150,8 +158,8 @@ namespace Njzj.Bocoms.Openapis.Transforms
{ {
DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES); DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/** /**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略 * 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/ */
client.IgnoreSslHostnameVerifier(); client.IgnoreSslHostnameVerifier();
var request = new DelContractOrderRequestV1(); var request = new DelContractOrderRequestV1();
request.SetServiceUrl(Configs.APIGW_URL_ADDRESS + Configs.DelContractOrderRequestV1); request.SetServiceUrl(Configs.APIGW_URL_ADDRESS + Configs.DelContractOrderRequestV1);
...@@ -184,8 +192,8 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -184,8 +192,8 @@ namespace Njzj.Bocoms.Openapis.Transforms
{ {
DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES); DefaultBocomClient client = new DefaultBocomClient(Configs.APP_ID, Configs.MY_PRIVATE_KEY, Configs.APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/** /**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略 * 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/ */
client.IgnoreSslHostnameVerifier(); client.IgnoreSslHostnameVerifier();
var request = new UnWriteOffRequestV1(); var request = new UnWriteOffRequestV1();
request.SetServiceUrl(Configs.APIGW_URL_ADDRESS + Configs.DelContractOrderRequestV1); request.SetServiceUrl(Configs.APIGW_URL_ADDRESS + Configs.DelContractOrderRequestV1);
...@@ -216,12 +224,14 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -216,12 +224,14 @@ namespace Njzj.Bocoms.Openapis.Transforms
public string BizId { get; set; } public string BizId { get; set; }
public string TotalAmount { get; set; } public string TotalAmount { get; set; }
public string Remark { get; set; }
public override object OnExecution(IRequest req, IResponse res) public override object OnExecution(IRequest req, IResponse res)
{ {
DefaultBocomClient client = new DefaultBocomClient(Configs.QR_CODE_APP_ID, Configs.QR_CODE_MY_PRIVATE_KEY, Configs.QR_CODE_APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES); DefaultBocomClient client = new DefaultBocomClient(Configs.QR_CODE_APP_ID, Configs.QR_CODE_MY_PRIVATE_KEY, Configs.QR_CODE_APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/** /**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略 * 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/ */
client.IgnoreSslHostnameVerifier(); client.IgnoreSslHostnameVerifier();
var request = new MPNG210001RequestV1(); var request = new MPNG210001RequestV1();
...@@ -235,11 +245,17 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -235,11 +245,17 @@ namespace Njzj.Bocoms.Openapis.Transforms
bizContent.req_body.mer_ptc_id = Configs.mer_ptc_id;//"301310063009501";//商户号,需要配置信息到位 bizContent.req_body.mer_ptc_id = Configs.mer_ptc_id;//"301310063009501";//商户号,需要配置信息到位
bizContent.req_body.mer_trade_time = DateTime.Now.ToString("HHmmss"); bizContent.req_body.mer_trade_time = DateTime.Now.ToString("HHmmss");
bizContent.req_body.mer_trade_date = DateTime.Now.ToString("yyyyMMdd"); bizContent.req_body.mer_trade_date = DateTime.Now.ToString("yyyyMMdd");
//bizContent.req_body.fee_split_info = new MPNG210001RequestV1.MPNG210001RequestV1Biz.ReqBody.FeeSplitInfo();
//bizContent.req_body.fee_split_info.partner_amount = "";
//bizContent.req_body.fee_split_info.mer_amount = "";
//bizContent.req_body.pay_mer_tran_no = "121809690390929234836"; //bizContent.req_body.pay_mer_tran_no = "121809690390929234836";
bizContent.req_body.pay_mer_tran_no = BizId;// Guid.NewGuid().ToString(); bizContent.req_body.pay_mer_tran_no = Guid.NewGuid().ToString();
bizContent.req_body.total_amount = TotalAmount; bizContent.req_body.total_amount = TotalAmount;
bizContent.req_body.location = "ONLINE"; bizContent.req_body.location = "ONLINE";
bizContent.req_body.currency = "CNY"; bizContent.req_body.currency = "CNY";
bizContent.req_body.jump_url = "http://k5.kivii.org";
bizContent.req_body.tran_content = BizId;
bizContent.req_body.mer_memo = Remark;
request.SetBizContent(bizContent); request.SetBizContent(bizContent);
var response = client.Execute(request, Guid.NewGuid().ToString().Replace("-", "")); var response = client.Execute(request, Guid.NewGuid().ToString().Replace("-", ""));
...@@ -260,13 +276,13 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -260,13 +276,13 @@ namespace Njzj.Bocoms.Openapis.Transforms
public class MPNG020702ResponseV1Test : RestfulExecution<MPNG020702ResponseV1> public class MPNG020702ResponseV1Test : RestfulExecution<MPNG020702ResponseV1>
{ {
public string BizId { get; set; } public string PayMerTranNo { get; set; }
public override object OnExecution(IRequest req, IResponse res) public override object OnExecution(IRequest req, IResponse res)
{ {
DefaultBocomClient client = new DefaultBocomClient(Configs.QR_CODE_APP_ID, Configs.QR_CODE_MY_PRIVATE_KEY, Configs.QR_CODE_APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES); DefaultBocomClient client = new DefaultBocomClient(Configs.QR_CODE_APP_ID, Configs.QR_CODE_MY_PRIVATE_KEY, Configs.QR_CODE_APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/** /**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略 * 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/ */
client.IgnoreSslHostnameVerifier(); client.IgnoreSslHostnameVerifier();
var request = new MPNG020702RequestV1(); var request = new MPNG020702RequestV1();
...@@ -279,8 +295,13 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -279,8 +295,13 @@ namespace Njzj.Bocoms.Openapis.Transforms
bizContent.req_body.tran_scene = "B2C-API-DISPLAYCODE"; bizContent.req_body.tran_scene = "B2C-API-DISPLAYCODE";
bizContent.req_body.mer_ptc_id = Configs.mer_ptc_id;//"301310063009501";//商户号,需要配置信息到位 bizContent.req_body.mer_ptc_id = Configs.mer_ptc_id;//"301310063009501";//商户号,需要配置信息到位
bizContent.req_body.mer_trade_date = DateTime.Now.ToString("yyyyMMdd"); bizContent.req_body.mer_trade_date = DateTime.Now.ToString("yyyyMMdd");
bizContent.req_body.pay_mer_tran_no = PayMerTranNo;// Guid.NewGuid().ToString();
bizContent.req_body.require_fields = new List<MPNG020702RequestV1.MPNG020702RequestV1Biz.ReqBody.RequireFields>();
var require_field = new MPNG020702RequestV1.MPNG020702RequestV1Biz.ReqBody.RequireFields();
require_field.require_field = "bank_tran_no,third_party,third_party_tran_no,payment_info,refund_info";
bizContent.req_body.require_fields.Add(require_field);
bizContent.req_body.pay_mer_tran_no = BizId;// Guid.NewGuid().ToString();
request.SetBizContent(bizContent); request.SetBizContent(bizContent);
var response = client.Execute(request, Guid.NewGuid().ToString().Replace("-", "")); var response = client.Execute(request, Guid.NewGuid().ToString().Replace("-", ""));
...@@ -298,4 +319,188 @@ namespace Njzj.Bocoms.Openapis.Transforms ...@@ -298,4 +319,188 @@ namespace Njzj.Bocoms.Openapis.Transforms
return rtns; return rtns;
} }
} }
public class MPNG020705ResponseV1Test : RestfulExecution<MPNG020705ResponseV1>
{
public string PayMerTranNo { get; set; }
public override object OnExecution(IRequest req, IResponse res)
{
DefaultBocomClient client = new DefaultBocomClient(Configs.QR_CODE_APP_ID, Configs.QR_CODE_MY_PRIVATE_KEY, Configs.QR_CODE_APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/
client.IgnoreSslHostnameVerifier();
var request = new MPNG020705RequestV1();
request.SetServiceUrl(Configs.QR_CODE_APIGW_URL_ADDRESS + Configs.MPNG020705RequestV1);
var bizContent = new MPNG020705RequestV1.MPNG020705RequestV1Biz();
bizContent.req_head = new MPNG020705RequestV1.MPNG020705RequestV1Biz.ReqHead();
bizContent.req_head.trans_time = DateTime.Now.ToString("yyyyMMddHHmmss");
bizContent.req_head.version = "V-1.0";
bizContent.req_body = new MPNG020705RequestV1.MPNG020705RequestV1Biz.ReqBody();
bizContent.req_body.mer_ptc_id = Configs.mer_ptc_id;//"301310063009501";//商户号,需要配置信息到位
bizContent.req_body.mer_trade_date = DateTime.Now.ToString("yyyyMMdd");
//bizContent.req_body.pay_mer_tran_no = "121809690390929234836";
//bizContent.req_body.pay_mer_tran_no = BizId;// Guid.NewGuid().ToString();
bizContent.req_body.pay_mer_tran_no = PayMerTranNo;
bizContent.req_body.close_mer_tran_no = PayMerTranNo;
request.SetBizContent(bizContent);
var response = client.Execute(request, Guid.NewGuid().ToString().Replace("-", ""));
var rtns = new RestfulExecutionResponse<MPNG020705ResponseV1>();
rtns.Results = new List<MPNG020705ResponseV1>();
if (response.IsSuccess())
{
var resp = response as MPNG020705ResponseV1;
rtns.Results.Add(resp);
}
else
{
throw new Exception($"ReturnCode:{response.GetRspCode()}{Environment.NewLine}ReturnMsg:{response.GetRspMsg()}");
}
return rtns;
}
}
public class MPNG020706ResponseV1Test : RestfulExecution<MPNG020706ResponseV1>
{
//public string BizId { get; set; }
public string PayMerTranNo { get; set; }
public override object OnExecution(IRequest req, IResponse res)
{
DefaultBocomClient client = new DefaultBocomClient(Configs.QR_CODE_APP_ID, Configs.QR_CODE_MY_PRIVATE_KEY, Configs.QR_CODE_APIGW_PUBLIC_KEY, BocomConstants.ENCRYPT_TYPE_RSA_AND_AES);
/**
* 测试环境可以忽略SSL证书告警,生产环境不可忽略
*/
client.IgnoreSslHostnameVerifier();
var request = new MPNG020706RequestV1();
request.SetServiceUrl(Configs.QR_CODE_APIGW_URL_ADDRESS + Configs.MPNG020706RequestV1);
var bizContent = new MPNG020706RequestV1.MPNG020706RequestV1Biz();
bizContent.req_head = new MPNG020706RequestV1.MPNG020706RequestV1Biz.ReqHead();
bizContent.req_head.trans_time = DateTime.Now.ToString("yyyyMMddHHmmss");
bizContent.req_head.version = "V-1.0";
bizContent.req_body = new MPNG020706RequestV1.MPNG020706RequestV1Biz.ReqBody();
bizContent.req_body.mer_ptc_id = Configs.mer_ptc_id;//"301310063009501";//商户号,需要配置信息到位
bizContent.req_body.mer_trade_date = DateTime.Now.ToString("yyyyMMdd");
//bizContent.req_body.pay_mer_tran_no = "121809690390929234836";
//bizContent.req_body.pay_mer_tran_no = BizId;// Guid.NewGuid().ToString();
bizContent.req_body.pay_mer_tran_no = PayMerTranNo;
bizContent.req_body.cancel_mer_tran_no = PayMerTranNo;
request.SetBizContent(bizContent);
var response = client.Execute(request, Guid.NewGuid().ToString().Replace("-", ""));
var rtns = new RestfulExecutionResponse<MPNG020706ResponseV1>();
rtns.Results = new List<MPNG020706ResponseV1>();
if (response.IsSuccess())
{
var resp = response as MPNG020706ResponseV1;
rtns.Results.Add(resp);
}
else
{
throw new Exception($"ReturnCode:{response.GetRspCode()}{Environment.NewLine}ReturnMsg:{response.GetRspMsg()}");
}
return rtns;
}
}
public class WriteOffResultNotifyCallBack : RestfulExecution<WriteOffResultNotify>
{
public string biz_content { get; set; }
public string msg_id { get; set; }
public string timestamp { get; set; }
public string encrypt_key { get; set; }
public string sign { get; set; }
public override object OnExecution(IRequest req, IResponse res)
{
var rtns = new RestfulExecutionResponse<WriteOffResultNotify>();
rtns.Results = new List<WriteOffResultNotify>();
if (biz_content.IsNullOrEmpty()) return rtns;
if (msg_id.IsNullOrEmpty()) return rtns;
if (timestamp.IsNullOrEmpty()) return rtns;
if (encrypt_key.IsNullOrEmpty()) return rtns;
if (sign.IsNullOrEmpty()) return rtns;
var dic=new Dictionary<string, string>();
dic.Add("biz_content", biz_content);
dic.Add("msg_id", msg_id);
dic.Add("timestamp", timestamp);
dic.Add("encrypt_key", encrypt_key);
dic.Add("sign", sign);
var json = Kivii.Text.JsonSerializer.SerializeToString(dic);
Console.WriteLine("-----------------------------------------------------------------------------------------------------");
Console.WriteLine("-----------------------------------------------------------------------------------------------------");
Console.WriteLine("------------------------------------WriteOffResultNotifyCallBack-----------------------------------------");
Console.WriteLine("------------------------------------Start-----------------------------------------");
try
{
var conn = KiviiContext.GetOpenedDbConnection<WriteOffResultNotify>();
conn.InitEntityType<EntityLog<WriteOffResultNotify>>();
var log = new EntityLog<WriteOffResultNotify>();
//log.OwnerKvid = item.PolicyKvid;
//log.BizId = item.TargetName;
//log.BizKvid = item.Kvid;
//log.BizType = typeof(PolicyDetail).FullName;
log.Type = "WriteOffResultNotify";
log.Title = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
log.Metadata = new Dictionary<string, string>();
log.Metadata.Add("biz_content", biz_content);
log.Metadata.Add("msg_id", msg_id);
log.Metadata.Add("timestamp", timestamp);
log.Metadata.Add("encrypt_key", encrypt_key);
log.Metadata.Add("sign", sign);
conn.Insert(log);
//var ori = "{\"biz_content\":\"j9nVLg7i45oHvnMC4l4JUoK0gERudB+iwD5r77jBlHiDQuIsch3jnl2K8Xhx19ugcpPrMwLcVTxsZLGjM1ueGeE+WpxDtXIvcAEpwPyNrSgOLChdq5iWcpXBNCahPPOu3zp9cjZse29g20cMmpexSMZgodT5D+66DU9LTi0CsbpsZg0HhEM2tLnDUhs+GnS8SoLbqUXFgyhZ8hdEirmJR6g+3OhN9GuZj2+Yy8U4cicBT8T1swWtSvvMnfBaCit8PgJsELy+NhvXOibSt8sB3rubIdB+8/MCzbxnwWLMn7xspx0trQmfviwiUKktdlkNwjqRYGNha8Z2544xdvhTHGEQGe/nr2bFgnVJdh8CmtpuuzaJBB8PCbjRlAhwCVJFNsCq4R+/SFGPU5TuaEDJy6Oqa7ALvywWekTEnDL+LmMZtxj07om3CRFER0FWBLjd\",\"msg_id\":\"c37170fb8e5b4d7b9374fae6b16334f9\",\"timestamp\":\"2020-10-26 15:11:54\",\"encrypt_key\":\"UgjDtW1VUP9pz4hMu9r7/dJ8ciQ3mEMRvdMpMlVLOWC9eF+otpUh2aN9nRQMn0KxXDnM7+ZTXmTDOwgsBsARqWt6R1i3xkFq5Hz8XvZAPpqMniR9AgNLzgWEscsAChjgAuhkmN6XVO3AKeqxGLo82NoDh5gGJ0yzVg2uS3hQRSLhiWkmY5f1nT5M4Hp3h1hPXL9e1bUBY/Zhs1IzWL2r7p5BAaQjUsCgt+CggKl8oa6zXfKiaTG9Z+l7tDa1lLqn5Hbkl83TMLEdebmzjv38X+lJCHO3lwvxKdaHr091nQUxXLH7p5hyoRBEieoyd5jpcwabB/ChTsKvHWiixjf1hw==\",\"sign\":\"EWqfUedqP2LdPFH7ekT6klCu5VqVEyWMIrOUyRLXhRIqC856qSVrq1LPNKIjpip53cT1J7V5GBCTv77HwXA7jcoYWIUK0GDIAYIDk5LcLOtXcVQKJ9aIqoUOS8NHIYSlx3wt41GoSsVZgWg8o4c5+qh2BxO1QkG/LrvsXSv5hBDssAztfWvwu2bcitSRPBFAuAyBs5ETLjcfSYFP7fPN9g1FG93McuvzPqJVHWEnKW4EfaLXDeI0FUNAgmH9xCcjYw7pbbxZTl3QdNrhSTOrBHnI0XZFNp9woF9YpyaSfKVCmtaL27M2RnLxyOnjffS9qSJP64xzpI9DRrsw0/EQAA==\"}";
var MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCER3xnjjYb4na9yf49wJIE/ykXuk9q4QKYJk/+LQuVUmf3HYUmVvngB2jwrMWr0x+Asg3XFyoctmZBDci3mgElQW6u1jNBUEUqbU+9oHT496D1g7KRVZZOWqaSZmFkPYf6Kr+uZgUtQEHeKiTuG3wIR2COSzuEsBvW8Q0RobHiCXXVmKpfpkB2cktwHzfu4sgTNrnvru5EDRFUMk72sMa5M9gasmY8XIVF711LWFreqVTKZPTuMTTIbZuVUd+vADWB7Y48IIEEsdIbbH8qwnTrEIvvWEJkhRYMpPvioLzqlepXZ8xNPD3Hu/SxHRRS+rQHiQvIpkqUK0JxOG+JpD8NAgMBAAECggEAczzrzjOARA6or3K3wQhwrVW1cOxon43i+rX13lNT0gR2ejwHcX04Nsl9zJ5XnvdQbIexsv6FO3pT3rypbfoGoXQ9fqcxA+dwOiP84hBVl0fzu6+98wsC5MPodYYntnI8cd6oGsDaJa/jMi64+Y6MIZI9NfmoolHiDwD1B7U8CNRAZR4XSTd22kmaF222cipgjpxrJozsJWSlwXsaw6ZEYsSraP76ZU1GiKZPKayLxQtTmHmqL/1SgVb2gBnW2FpTTdeanxjhnvE1Ikg28bfZPpA8c0jItjNpFvmyaf/3C2pKJBYKkAuyQSjMexS6anBX4G4LRfcDzrJzY12eHWrb6QKBgQC5iOg9JqxOmDCBN4I7hd3ax9bFPKQe7NO1Hs2cgyOCp3Ph/yK8/OIlGSBDHVlXPOpq80OwmOGU5AXJTBRpgDLC7gF9gphd9l+sIkHtQ5+mWld+jr7qFlW95y+H51PDk0nSg2GIkyID3t3G0NBooDM/XaXyndljBOQwMVpVBdqAWwKBgQC2hKwRCb2C6ZAssw8Cq5LWR2psFONbqAmA6aO9GgFKF0mBsyq0sstz/nE/XBURc+zOnYr72WFMMaoVkNPTxwqXNcHu4vbyepfBSWBDSJxndlMKXcld5+GZCyl9nUFLHGjYbNUsMgahaR5l9eNiMbHzKHdRNw7Trf2gLnvWlH/atwKBgHaP3pj1VbcD2js41ahj61obyktQbTC19rQPcyVJSC/+AjexaumKUJmUbOF2p9jvvH2L5v27NKyI6omwbHreyZF3tswV4HhrMMg3PBn61NLheHgPkEDW9QPd8KnQUd7xCIPWIUW9gEco7GBYoFW7ygP8PEfGR1zXi1qgrzEWBINxAoGBAIe3h6rzrzOVMVvLmbHGmt0zJXNQ5O7WuJpfIR4QJD1Pq50B+RN8j8Skwtj2Q8RCiyfoBdzX+32IwIxgsOKc8scVdiuIIVCU0Bst0KK3b3WPipf+vSlSr3H51tRNBqwvZ9bmtmyyljOX0r7GZFoz0bqZsH93jVLh4eImLneU3K1pAoGAMUCNCHIpMSd+d5ewR9VxXY1DjGHvIC98EdsjL0S7QcVrWb9mh6Br5G6zvlIJcMhIaQm3C1ETLaHG+K9XRrA+HcJo1ApeMT7MgBmIC+cG1aepZREDruNI3G8r4bDS6pHSDKk+Iu8shpEUurxZCzjBX2n5OeMJx+xDgYUq5H4Bn5I=";
var APIGW_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxSJrF8T/5rKB4NnwMjIxUer+ELf1PQXO2GSdZ/fvuQCclOR9tBlNWL4jFOftebeL+bvMVOJ+JHm/aSes1AN8YNIDGiFUpF6aDkSCaLynDdjK/mQTWhSNa2fO0GGO+ywOBTdYUjVjVtzJ48bbyG3NSylf1EdnBWnMpFa8qpXJXR4ELpVpMkPDC+93HBAlxEgUjhcIJlP5VdKIiudsmhE2T07qtpIQSuE5hntXP6X6GKJReCk+yek2QJITvIBq3cHPw8KDsHHCs7MaR81KI3onJRWyqFtTfVYTiKsd9EcYSxv+Gx5MOF8B/P4iJCD8uzx0FrqoB3k5OYGcz4tXs+h+9wIDAQAB";
var reqMap = ApiUtils.ParseCommunicationJsonWithBocomSign(json, "utf-8", MY_PRIVATE_KEY, APIGW_PUBLIC_KEY);
var results = reqMap as Dictionary<string, string>;
var rtn = new WriteOffResultNotify();
rtn.Metadata = new Dictionary<string, string>();
var cultureeInfo = Thread.CurrentThread.CurrentCulture;
var textInfo = cultureeInfo.TextInfo;
foreach (var item in results)
{
if (item.Key == "biz_content")
{
var value = Kivii.Text.JsonSerializer.DeserializeFromString<WriteOffBizContent>(item.Value);
rtn.GetType().GetProperty(item.Key).SetValue(rtn, value);
}
else
{
try
{
var key = textInfo.ToTitleCase(item.Key);
var property = rtn.GetType().GetProperty(item.Key);
if (property != null) property.SetValue(rtn, item.Value);
else rtn.Metadata[item.Key] = item.Value;
}
catch (Exception ex)
{
continue;
}
}
}
rtns.Results.Add(rtn);
return rtns;
}
catch (Exception ex)
{
throw ex;
}
finally
{
Console.WriteLine("------------------------------------WriteOffResultNotifyCallBack-----------------------------------------");
Console.WriteLine("------------------------------------End-----------------------------------------");
Console.WriteLine("-----------------------------------------------------------------------------------------------------");
Console.WriteLine("-----------------------------------------------------------------------------------------------------");
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment