初始化仓库

This commit is contained in:
wangxiaowei
2025-04-22 14:09:52 +08:00
commit 8b100110bb
5155 changed files with 664201 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class AlipayOpenPublicLifeMsgRecallResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
}
}

View File

@ -0,0 +1,45 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class AlipayOpenPublicMessageContentCreateResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("content_id")]
[Validation(Required=true)]
public string ContentId { get; set; }
[NameInMap("content_url")]
[Validation(Required=true)]
public string ContentUrl { get; set; }
}
}

View File

@ -0,0 +1,45 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class AlipayOpenPublicMessageContentModifyResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("content_id")]
[Validation(Required=true)]
public string ContentId { get; set; }
[NameInMap("content_url")]
[Validation(Required=true)]
public string ContentUrl { get; set; }
}
}

View File

@ -0,0 +1,37 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class AlipayOpenPublicMessageSingleSendResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
}
}

View File

@ -0,0 +1,41 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class AlipayOpenPublicMessageTotalSendResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("message_id")]
[Validation(Required=true)]
public string MessageId { get; set; }
}
}

View File

@ -0,0 +1,45 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class AlipayOpenPublicSettingCategoryQueryResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("primary_category")]
[Validation(Required=true)]
public string PrimaryCategory { get; set; }
[NameInMap("secondary_category")]
[Validation(Required=true)]
public string SecondaryCategory { get; set; }
}
}

View File

@ -0,0 +1,37 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class AlipayOpenPublicTemplateMessageIndustryModifyResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
}
}

View File

@ -0,0 +1,34 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class Article : TeaModel {
[NameInMap("title")]
[Validation(Required=false)]
public string Title { get; set; }
[NameInMap("desc")]
[Validation(Required=true)]
public string Desc { get; set; }
[NameInMap("image_url")]
[Validation(Required=false)]
public string ImageUrl { get; set; }
[NameInMap("url")]
[Validation(Required=true)]
public string Url { get; set; }
[NameInMap("action_name")]
[Validation(Required=false)]
public string ActionName { get; set; }
}
}

View File

@ -0,0 +1,42 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class Context : TeaModel {
[NameInMap("head_color")]
[Validation(Required=true)]
public string HeadColor { get; set; }
[NameInMap("url")]
[Validation(Required=true)]
public string Url { get; set; }
[NameInMap("action_name")]
[Validation(Required=true)]
public string ActionName { get; set; }
[NameInMap("keyword1")]
[Validation(Required=false)]
public Keyword Keyword1 { get; set; }
[NameInMap("keyword2")]
[Validation(Required=false)]
public Keyword Keyword2 { get; set; }
[NameInMap("first")]
[Validation(Required=false)]
public Keyword First { get; set; }
[NameInMap("remark")]
[Validation(Required=false)]
public Keyword Remark { get; set; }
}
}

View File

@ -0,0 +1,22 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class Keyword : TeaModel {
[NameInMap("color")]
[Validation(Required=true)]
public string Color { get; set; }
[NameInMap("value")]
[Validation(Required=true)]
public string Value { get; set; }
}
}

View File

@ -0,0 +1,22 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class Template : TeaModel {
[NameInMap("template_id")]
[Validation(Required=true)]
public string TemplateId { get; set; }
[NameInMap("context")]
[Validation(Required=true)]
public Context Context { get; set; }
}
}

View File

@ -0,0 +1,22 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.OpenLife.Models
{
public class Text : TeaModel {
[NameInMap("title")]
[Validation(Required=true)]
public string Title { get; set; }
[NameInMap("content")]
[Validation(Required=true)]
public string Content { get; set; }
}
}

View File

@ -0,0 +1,964 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Tea;
using Tea.Utils;
using Alipay.EasySDK.Marketing.Pass.Models;
namespace Alipay.EasySDK.Marketing.Pass
{
public class Client
{
protected Alipay.EasySDK.Kernel.Client _kernel;
public Client(Alipay.EasySDK.Kernel.Client kernel)
{
this._kernel = kernel;
}
public AlipayPassTemplateAddResponse CreateTemplate(string uniqueId, string tplContent)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.template.add"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"unique_id", uniqueId},
{"tpl_content", tplContent},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = TeaCore.DoAction(request_, runtime_);
Dictionary<string, object> respMap = this._kernel.ReadAsJson(response_, "alipay.pass.template.add");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassTemplateAddResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassTemplateAddResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public async Task<AlipayPassTemplateAddResponse> CreateTemplateAsync(string uniqueId, string tplContent)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.template.add"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"unique_id", uniqueId},
{"tpl_content", tplContent},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = await TeaCore.DoActionAsync(request_, runtime_);
Dictionary<string, object> respMap = await this._kernel.ReadAsJsonAsync(response_, "alipay.pass.template.add");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassTemplateAddResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassTemplateAddResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public AlipayPassTemplateUpdateResponse UpdateTemplate(string tplId, string tplContent)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.template.update"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"tpl_id", tplId},
{"tpl_content", tplContent},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = TeaCore.DoAction(request_, runtime_);
Dictionary<string, object> respMap = this._kernel.ReadAsJson(response_, "alipay.pass.template.update");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassTemplateUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassTemplateUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public async Task<AlipayPassTemplateUpdateResponse> UpdateTemplateAsync(string tplId, string tplContent)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.template.update"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"tpl_id", tplId},
{"tpl_content", tplContent},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = await TeaCore.DoActionAsync(request_, runtime_);
Dictionary<string, object> respMap = await this._kernel.ReadAsJsonAsync(response_, "alipay.pass.template.update");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassTemplateUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassTemplateUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public AlipayPassInstanceAddResponse AddInstance(string tplId, string tplParams, string recognitionType, string recognitionInfo)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.instance.add"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"tpl_id", tplId},
{"tpl_params", tplParams},
{"recognition_type", recognitionType},
{"recognition_info", recognitionInfo},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = TeaCore.DoAction(request_, runtime_);
Dictionary<string, object> respMap = this._kernel.ReadAsJson(response_, "alipay.pass.instance.add");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassInstanceAddResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassInstanceAddResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public async Task<AlipayPassInstanceAddResponse> AddInstanceAsync(string tplId, string tplParams, string recognitionType, string recognitionInfo)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.instance.add"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"tpl_id", tplId},
{"tpl_params", tplParams},
{"recognition_type", recognitionType},
{"recognition_info", recognitionInfo},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = await TeaCore.DoActionAsync(request_, runtime_);
Dictionary<string, object> respMap = await this._kernel.ReadAsJsonAsync(response_, "alipay.pass.instance.add");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassInstanceAddResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassInstanceAddResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public AlipayPassInstanceUpdateResponse UpdateInstance(string serialNumber, string channelId, string tplParams, string status, string verifyCode, string verifyType)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.instance.update"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"serial_number", serialNumber},
{"channel_id", channelId},
{"tpl_params", tplParams},
{"status", status},
{"verify_code", verifyCode},
{"verify_type", verifyType},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = TeaCore.DoAction(request_, runtime_);
Dictionary<string, object> respMap = this._kernel.ReadAsJson(response_, "alipay.pass.instance.update");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassInstanceUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassInstanceUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public async Task<AlipayPassInstanceUpdateResponse> UpdateInstanceAsync(string serialNumber, string channelId, string tplParams, string status, string verifyCode, string verifyType)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.pass.instance.update"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"serial_number", serialNumber},
{"channel_id", channelId},
{"tpl_params", tplParams},
{"status", status},
{"verify_code", verifyCode},
{"verify_type", verifyType},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = await TeaCore.DoActionAsync(request_, runtime_);
Dictionary<string, object> respMap = await this._kernel.ReadAsJsonAsync(response_, "alipay.pass.instance.update");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayPassInstanceUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayPassInstanceUpdateResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
/// <summary>
/// ISV代商户代用指定appAuthToken
/// </summary>
/// <param name="appAuthToken">代调用token</param>
/// <returns>本客户端,便于链式调用</returns>
public Client Agent(string appAuthToken)
{
_kernel.InjectTextParam("app_auth_token", appAuthToken);
return this;
}
/// <summary>
/// 用户授权调用指定authToken
/// </summary>
/// <param name="authToken">用户授权token</param>
/// <returns>本客户端,便于链式调用</returns>
public Client Auth(string authToken)
{
_kernel.InjectTextParam("auth_token", authToken);
return this;
}
/// <summary>
/// 设置异步通知回调地址此处设置将在本调用中覆盖Config中的全局配置
/// </summary>
/// <param name="url">异步通知回调地址例如https://www.test.com/callback </param>
/// <returns>本客户端,便于链式调用</returns>
public Client AsyncNotify(string url)
{
_kernel.InjectTextParam("notify_url", url);
return this;
}
/// <summary>
/// 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
/// </summary>
/// <param name="testUrl">后端系统测试地址</param>
/// <returns>本客户端,便于链式调用</returns>
public Client Route(string testUrl)
{
_kernel.InjectTextParam("ws_service_url", testUrl);
return this;
}
/// <summary>
/// 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
/// </summary>
/// <param name="key">业务请求参数名称biz_content下的字段名比如timeout_express</param>
/// <param name="value">
/// 业务请求参数的值一个可以序列化成JSON的对象
/// 如果该字段是一个字符串类型String、Price、Date在SDK中都是字符串请使用string储存
/// 如果该字段是一个数值型类型比如Number请使用long储存
/// 如果该字段是一个复杂类型请使用嵌套的Dictionary指定各下级字段的值
/// 如果该字段是一个数组请使用List储存各个值
/// 对于更复杂的情况也支持Dictionary和List的各种组合嵌套比如参数是值是个ListList中的每种类型是一个复杂对象
/// </param>
/// <returns>本客户端,便于链式调用</returns>
public Client Optional(string key, object value)
{
_kernel.InjectBizParam(key, value);
return this;
}
/// <summary>
/// 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
/// optional方法的批量版本
/// </summary>
/// <param name="optionalArgs">可选参数集合每个参数由key和value组成key和value的格式请参见optional方法的注释</param>
/// <returns>本客户端,便于链式调用</returns>
public Client BatchOptional(Dictionary<string, object> optionalArgs)
{
foreach (var pair in optionalArgs)
{
_kernel.InjectBizParam(pair.Key, pair.Value);
}
return this;
}
}
}

View File

@ -0,0 +1,45 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.Pass.Models
{
public class AlipayPassInstanceAddResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("success")]
[Validation(Required=true)]
public bool? Success { get; set; }
[NameInMap("result")]
[Validation(Required=true)]
public string Result { get; set; }
}
}

View File

@ -0,0 +1,45 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.Pass.Models
{
public class AlipayPassInstanceUpdateResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("success")]
[Validation(Required=true)]
public bool? Success { get; set; }
[NameInMap("result")]
[Validation(Required=true)]
public string Result { get; set; }
}
}

View File

@ -0,0 +1,45 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.Pass.Models
{
public class AlipayPassTemplateAddResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("success")]
[Validation(Required=true)]
public bool? Success { get; set; }
[NameInMap("result")]
[Validation(Required=true)]
public string Result { get; set; }
}
}

View File

@ -0,0 +1,45 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.Pass.Models
{
public class AlipayPassTemplateUpdateResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
[NameInMap("success")]
[Validation(Required=true)]
public bool? Success { get; set; }
[NameInMap("result")]
[Validation(Required=true)]
public string Result { get; set; }
}
}

View File

@ -0,0 +1,322 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Tea;
using Tea.Utils;
using Alipay.EasySDK.Marketing.TemplateMessage.Models;
namespace Alipay.EasySDK.Marketing.TemplateMessage
{
public class Client
{
protected Alipay.EasySDK.Kernel.Client _kernel;
public Client(Alipay.EasySDK.Kernel.Client kernel)
{
this._kernel = kernel;
}
public AlipayOpenAppMiniTemplatemessageSendResponse Send(string toUserId, string formId, string userTemplateId, string page, string data)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.open.app.mini.templatemessage.send"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"to_user_id", toUserId},
{"form_id", formId},
{"user_template_id", userTemplateId},
{"page", page},
{"data", data},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = TeaCore.DoAction(request_, runtime_);
Dictionary<string, object> respMap = this._kernel.ReadAsJson(response_, "alipay.open.app.mini.templatemessage.send");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayOpenAppMiniTemplatemessageSendResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayOpenAppMiniTemplatemessageSendResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
public async Task<AlipayOpenAppMiniTemplatemessageSendResponse> SendAsync(string toUserId, string formId, string userTemplateId, string page, string data)
{
Dictionary<string, object> runtime_ = new Dictionary<string, object>
{
{"ignoreSSL", this._kernel.GetConfig("ignoreSSL")},
{"httpProxy", this._kernel.GetConfig("httpProxy")},
{"connectTimeout", 15000},
{"readTimeout", 15000},
{"retry", new Dictionary<string, int?>
{
{"maxAttempts", 0},
}},
};
TeaRequest _lastRequest = null;
Exception _lastException = null;
long _now = System.DateTime.Now.Millisecond;
int _retryTimes = 0;
while (TeaCore.AllowRetry((IDictionary) runtime_["retry"], _retryTimes, _now))
{
if (_retryTimes > 0)
{
int backoffTime = TeaCore.GetBackoffTime((IDictionary)runtime_["backoff"], _retryTimes);
if (backoffTime > 0)
{
TeaCore.Sleep(backoffTime);
}
}
_retryTimes = _retryTimes + 1;
try
{
TeaRequest request_ = new TeaRequest();
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.open.app.mini.templatemessage.send"},
{"app_id", this._kernel.GetConfig("appId")},
{"timestamp", this._kernel.GetTimestamp()},
{"format", "json"},
{"version", "1.0"},
{"alipay_sdk", this._kernel.GetSdkVersion()},
{"charset", "UTF-8"},
{"sign_type", this._kernel.GetConfig("signType")},
{"app_cert_sn", this._kernel.GetMerchantCertSN()},
{"alipay_root_cert_sn", this._kernel.GetAlipayRootCertSN()},
};
Dictionary<string, object> bizParams = new Dictionary<string, object>
{
{"to_user_id", toUserId},
{"form_id", formId},
{"user_template_id", userTemplateId},
{"page", page},
{"data", data},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
request_.Protocol = this._kernel.GetConfig("protocol");
request_.Method = "POST";
request_.Pathname = "/gateway.do";
request_.Headers = new Dictionary<string, string>
{
{"host", this._kernel.GetConfig("gatewayHost")},
{"content-type", "application/x-www-form-urlencoded;charset=utf-8"},
};
request_.Query = this._kernel.SortMap(TeaConverter.merge<string>
(
new Dictionary<string, string>()
{
{"sign", this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"))},
},
systemParams,
textParams
));
request_.Body = TeaCore.BytesReadable(this._kernel.ToUrlEncodedRequestBody(bizParams));
_lastRequest = request_;
TeaResponse response_ = await TeaCore.DoActionAsync(request_, runtime_);
Dictionary<string, object> respMap = await this._kernel.ReadAsJsonAsync(response_, "alipay.open.app.mini.templatemessage.send");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayOpenAppMiniTemplatemessageSendResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayOpenAppMiniTemplatemessageSendResponse>(this._kernel.ToRespModel(respMap));
}
}
throw new TeaException(new Dictionary<string, string>
{
{"message", "验签失败,请检查支付宝公钥设置是否正确。"},
});
}
catch (Exception e)
{
if (TeaCore.IsRetryable(e))
{
_lastException = e;
continue;
}
throw e;
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}
/// <summary>
/// ISV代商户代用指定appAuthToken
/// </summary>
/// <param name="appAuthToken">代调用token</param>
/// <returns>本客户端,便于链式调用</returns>
public Client Agent(string appAuthToken)
{
_kernel.InjectTextParam("app_auth_token", appAuthToken);
return this;
}
/// <summary>
/// 用户授权调用指定authToken
/// </summary>
/// <param name="authToken">用户授权token</param>
/// <returns>本客户端,便于链式调用</returns>
public Client Auth(string authToken)
{
_kernel.InjectTextParam("auth_token", authToken);
return this;
}
/// <summary>
/// 设置异步通知回调地址此处设置将在本调用中覆盖Config中的全局配置
/// </summary>
/// <param name="url">异步通知回调地址例如https://www.test.com/callback </param>
/// <returns>本客户端,便于链式调用</returns>
public Client AsyncNotify(string url)
{
_kernel.InjectTextParam("notify_url", url);
return this;
}
/// <summary>
/// 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
/// </summary>
/// <param name="testUrl">后端系统测试地址</param>
/// <returns>本客户端,便于链式调用</returns>
public Client Route(string testUrl)
{
_kernel.InjectTextParam("ws_service_url", testUrl);
return this;
}
/// <summary>
/// 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
/// </summary>
/// <param name="key">业务请求参数名称biz_content下的字段名比如timeout_express</param>
/// <param name="value">
/// 业务请求参数的值一个可以序列化成JSON的对象
/// 如果该字段是一个字符串类型String、Price、Date在SDK中都是字符串请使用string储存
/// 如果该字段是一个数值型类型比如Number请使用long储存
/// 如果该字段是一个复杂类型请使用嵌套的Dictionary指定各下级字段的值
/// 如果该字段是一个数组请使用List储存各个值
/// 对于更复杂的情况也支持Dictionary和List的各种组合嵌套比如参数是值是个ListList中的每种类型是一个复杂对象
/// </param>
/// <returns>本客户端,便于链式调用</returns>
public Client Optional(string key, object value)
{
_kernel.InjectBizParam(key, value);
return this;
}
/// <summary>
/// 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
/// optional方法的批量版本
/// </summary>
/// <param name="optionalArgs">可选参数集合每个参数由key和value组成key和value的格式请参见optional方法的注释</param>
/// <returns>本客户端,便于链式调用</returns>
public Client BatchOptional(Dictionary<string, object> optionalArgs)
{
foreach (var pair in optionalArgs)
{
_kernel.InjectBizParam(pair.Key, pair.Value);
}
return this;
}
}
}

View File

@ -0,0 +1,37 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Marketing.TemplateMessage.Models
{
public class AlipayOpenAppMiniTemplatemessageSendResponse : TeaModel {
/// <summary>
/// 响应原始字符串
/// </summary>
[NameInMap("http_body")]
[Validation(Required=true)]
public string HttpBody { get; set; }
[NameInMap("code")]
[Validation(Required=true)]
public string Code { get; set; }
[NameInMap("msg")]
[Validation(Required=true)]
public string Msg { get; set; }
[NameInMap("sub_code")]
[Validation(Required=true)]
public string SubCode { get; set; }
[NameInMap("sub_msg")]
[Validation(Required=true)]
public string SubMsg { get; set; }
}
}