添加网站文件

This commit is contained in:
2025-12-22 13:59:40 +08:00
commit 117aaf83d1
19468 changed files with 2111999 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
// 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.Payment.App.Models;
namespace Alipay.EasySDK.Payment.App
{
public class Client
{
protected Alipay.EasySDK.Kernel.Client _kernel;
public Client(Alipay.EasySDK.Kernel.Client kernel)
{
this._kernel = kernel;
}
public AlipayTradeAppPayResponse Pay(string subject, string outTradeNo, string totalAmount)
{
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.trade.app.pay"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
};
Dictionary<string, string> textParams = new Dictionary<string, string>(){};
string sign = this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"));
Dictionary<string, string> response = new Dictionary<string, string>
{
{"body", this._kernel.GenerateOrderString(systemParams, bizParams, textParams, sign)},
};
return TeaModel.ToObject<AlipayTradeAppPayResponse>(response);
}
/// <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,21 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.App.Models
{
public class AlipayTradeAppPayResponse : TeaModel {
/// <summary>
/// 订单信息,字符串形式
/// </summary>
[NameInMap("body")]
[Validation(Required=true)]
public string Body { get; set; }
}
}

File diff suppressed because it is too large Load Diff

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.Payment.Common.Models
{
public class AlipayDataDataserviceBillDownloadurlQueryResponse : 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("bill_download_url")]
[Validation(Required=true)]
public string BillDownloadUrl { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Common.Models
{
public class AlipayTradeCancelResponse : 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("trade_no")]
[Validation(Required=true)]
public string TradeNo { get; set; }
[NameInMap("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("retry_flag")]
[Validation(Required=true)]
public string RetryFlag { get; set; }
[NameInMap("action")]
[Validation(Required=true)]
public string Action { get; set; }
[NameInMap("gmt_refund_pay")]
[Validation(Required=true)]
public string GmtRefundPay { get; set; }
[NameInMap("refund_settlement_id")]
[Validation(Required=true)]
public string RefundSettlementId { 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.Payment.Common.Models
{
public class AlipayTradeCloseResponse : 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("trade_no")]
[Validation(Required=true)]
public string TradeNo { get; set; }
[NameInMap("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { 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.Payment.Common.Models
{
public class AlipayTradeCreateResponse : 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("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("trade_no")]
[Validation(Required=true)]
public string TradeNo { get; set; }
}
}

View File

@@ -0,0 +1,109 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Common.Models
{
public class AlipayTradeFastpayRefundQueryResponse : 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("error_code")]
[Validation(Required=true)]
public string ErrorCode { get; set; }
[NameInMap("gmt_refund_pay")]
[Validation(Required=true)]
public string GmtRefundPay { get; set; }
[NameInMap("industry_sepc_detail")]
[Validation(Required=true)]
public string IndustrySepcDetail { get; set; }
[NameInMap("out_request_no")]
[Validation(Required=true)]
public string OutRequestNo { get; set; }
[NameInMap("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("present_refund_buyer_amount")]
[Validation(Required=true)]
public string PresentRefundBuyerAmount { get; set; }
[NameInMap("present_refund_discount_amount")]
[Validation(Required=true)]
public string PresentRefundDiscountAmount { get; set; }
[NameInMap("present_refund_mdiscount_amount")]
[Validation(Required=true)]
public string PresentRefundMdiscountAmount { get; set; }
[NameInMap("refund_amount")]
[Validation(Required=true)]
public string RefundAmount { get; set; }
[NameInMap("refund_charge_amount")]
[Validation(Required=true)]
public string RefundChargeAmount { get; set; }
[NameInMap("refund_detail_item_list")]
[Validation(Required=true)]
public List<TradeFundBill> RefundDetailItemList { get; set; }
[NameInMap("refund_reason")]
[Validation(Required=true)]
public string RefundReason { get; set; }
[NameInMap("refund_royaltys")]
[Validation(Required=true)]
public List<RefundRoyaltyResult> RefundRoyaltys { get; set; }
[NameInMap("refund_settlement_id")]
[Validation(Required=true)]
public string RefundSettlementId { get; set; }
[NameInMap("refund_status")]
[Validation(Required=true)]
public string RefundStatus { get; set; }
[NameInMap("send_back_fee")]
[Validation(Required=true)]
public string SendBackFee { get; set; }
[NameInMap("total_amount")]
[Validation(Required=true)]
public string TotalAmount { get; set; }
[NameInMap("trade_no")]
[Validation(Required=true)]
public string TradeNo { get; set; }
}
}

View File

@@ -0,0 +1,177 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Common.Models
{
public class AlipayTradeQueryResponse : 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("trade_no")]
[Validation(Required=true)]
public string TradeNo { get; set; }
[NameInMap("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("buyer_logon_id")]
[Validation(Required=true)]
public string BuyerLogonId { get; set; }
[NameInMap("trade_status")]
[Validation(Required=true)]
public string TradeStatus { get; set; }
[NameInMap("total_amount")]
[Validation(Required=true)]
public string TotalAmount { get; set; }
[NameInMap("trans_currency")]
[Validation(Required=true)]
public string TransCurrency { get; set; }
[NameInMap("settle_currency")]
[Validation(Required=true)]
public string SettleCurrency { get; set; }
[NameInMap("settle_amount")]
[Validation(Required=true)]
public string SettleAmount { get; set; }
[NameInMap("pay_currency")]
[Validation(Required=true)]
public string PayCurrency { get; set; }
[NameInMap("pay_amount")]
[Validation(Required=true)]
public string PayAmount { get; set; }
[NameInMap("settle_trans_rate")]
[Validation(Required=true)]
public string SettleTransRate { get; set; }
[NameInMap("trans_pay_rate")]
[Validation(Required=true)]
public string TransPayRate { get; set; }
[NameInMap("buyer_pay_amount")]
[Validation(Required=true)]
public string BuyerPayAmount { get; set; }
[NameInMap("point_amount")]
[Validation(Required=true)]
public string PointAmount { get; set; }
[NameInMap("invoice_amount")]
[Validation(Required=true)]
public string InvoiceAmount { get; set; }
[NameInMap("send_pay_date")]
[Validation(Required=true)]
public string SendPayDate { get; set; }
[NameInMap("receipt_amount")]
[Validation(Required=true)]
public string ReceiptAmount { get; set; }
[NameInMap("store_id")]
[Validation(Required=true)]
public string StoreId { get; set; }
[NameInMap("terminal_id")]
[Validation(Required=true)]
public string TerminalId { get; set; }
[NameInMap("fund_bill_list")]
[Validation(Required=true)]
public List<TradeFundBill> FundBillList { get; set; }
[NameInMap("store_name")]
[Validation(Required=true)]
public string StoreName { get; set; }
[NameInMap("buyer_user_id")]
[Validation(Required=true)]
public string BuyerUserId { get; set; }
[NameInMap("charge_amount")]
[Validation(Required=true)]
public string ChargeAmount { get; set; }
[NameInMap("charge_flags")]
[Validation(Required=true)]
public string ChargeFlags { get; set; }
[NameInMap("settlement_id")]
[Validation(Required=true)]
public string SettlementId { get; set; }
[NameInMap("trade_settle_info")]
[Validation(Required=true)]
public List<TradeSettleInfo> TradeSettleInfo { get; set; }
[NameInMap("auth_trade_pay_mode")]
[Validation(Required=true)]
public string AuthTradePayMode { get; set; }
[NameInMap("buyer_user_type")]
[Validation(Required=true)]
public string BuyerUserType { get; set; }
[NameInMap("mdiscount_amount")]
[Validation(Required=true)]
public string MdiscountAmount { get; set; }
[NameInMap("discount_amount")]
[Validation(Required=true)]
public string DiscountAmount { get; set; }
[NameInMap("buyer_user_name")]
[Validation(Required=true)]
public string BuyerUserName { get; set; }
[NameInMap("subject")]
[Validation(Required=true)]
public string Subject { get; set; }
[NameInMap("body")]
[Validation(Required=true)]
public string Body { get; set; }
[NameInMap("alipay_sub_merchant_id")]
[Validation(Required=true)]
public string AlipaySubMerchantId { get; set; }
[NameInMap("ext_infos")]
[Validation(Required=true)]
public string ExtInfos { get; set; }
}
}

View File

@@ -0,0 +1,97 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Common.Models
{
public class AlipayTradeRefundResponse : 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("trade_no")]
[Validation(Required=true)]
public string TradeNo { get; set; }
[NameInMap("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("buyer_logon_id")]
[Validation(Required=true)]
public string BuyerLogonId { get; set; }
[NameInMap("fund_change")]
[Validation(Required=true)]
public string FundChange { get; set; }
[NameInMap("refund_fee")]
[Validation(Required=true)]
public string RefundFee { get; set; }
[NameInMap("refund_currency")]
[Validation(Required=true)]
public string RefundCurrency { get; set; }
[NameInMap("gmt_refund_pay")]
[Validation(Required=true)]
public string GmtRefundPay { get; set; }
[NameInMap("refund_detail_item_list")]
[Validation(Required=true)]
public List<TradeFundBill> RefundDetailItemList { get; set; }
[NameInMap("store_name")]
[Validation(Required=true)]
public string StoreName { get; set; }
[NameInMap("buyer_user_id")]
[Validation(Required=true)]
public string BuyerUserId { get; set; }
[NameInMap("refund_preset_paytool_list")]
[Validation(Required=true)]
public List<PresetPayToolInfo> RefundPresetPaytoolList { get; set; }
[NameInMap("refund_settlement_id")]
[Validation(Required=true)]
public string RefundSettlementId { get; set; }
[NameInMap("present_refund_buyer_amount")]
[Validation(Required=true)]
public string PresentRefundBuyerAmount { get; set; }
[NameInMap("present_refund_discount_amount")]
[Validation(Required=true)]
public string PresentRefundDiscountAmount { get; set; }
[NameInMap("present_refund_mdiscount_amount")]
[Validation(Required=true)]
public string PresentRefundMdiscountAmount { 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.Payment.Common.Models
{
public class PresetPayToolInfo : TeaModel {
[NameInMap("amount")]
[Validation(Required=true)]
public List<string> Amount { get; set; }
[NameInMap("assert_type_code")]
[Validation(Required=true)]
public string AssertTypeCode { 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.Payment.Common.Models
{
public class RefundRoyaltyResult : TeaModel {
[NameInMap("refund_amount")]
[Validation(Required=true)]
public string RefundAmount { get; set; }
[NameInMap("royalty_type")]
[Validation(Required=true)]
public string RoyaltyType { get; set; }
[NameInMap("result_code")]
[Validation(Required=true)]
public string ResultCode { get; set; }
[NameInMap("trans_out")]
[Validation(Required=true)]
public string TransOut { get; set; }
[NameInMap("trans_out_email")]
[Validation(Required=true)]
public string TransOutEmail { get; set; }
[NameInMap("trans_in")]
[Validation(Required=true)]
public string TransIn { get; set; }
[NameInMap("trans_in_email")]
[Validation(Required=true)]
public string TransInEmail { 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.Payment.Common.Models
{
public class TradeFundBill : TeaModel {
[NameInMap("fund_channel")]
[Validation(Required=true)]
public string FundChannel { get; set; }
[NameInMap("bank_code")]
[Validation(Required=true)]
public string BankCode { get; set; }
[NameInMap("amount")]
[Validation(Required=true)]
public string Amount { get; set; }
[NameInMap("real_amount")]
[Validation(Required=true)]
public string RealAmount { get; set; }
[NameInMap("fund_type")]
[Validation(Required=true)]
public string FundType { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Common.Models
{
public class TradeSettleDetail : TeaModel {
[NameInMap("operation_type")]
[Validation(Required=true)]
public string OperationType { get; set; }
[NameInMap("operation_serial_no")]
[Validation(Required=true)]
public string OperationSerial_no { get; set; }
[NameInMap("operation_dt")]
[Validation(Required=true)]
public string OperationDt { get; set; }
[NameInMap("trans_out")]
[Validation(Required=true)]
public string TransOut { get; set; }
[NameInMap("trans_in")]
[Validation(Required=true)]
public string TransIn { get; set; }
[NameInMap("amount")]
[Validation(Required=true)]
public string Amount { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Common.Models
{
public class TradeSettleInfo : TeaModel {
[NameInMap("trade_settle_detail_list")]
[Validation(Required=true)]
public List<TradeSettleDetail> TradeSettleDetailList { get; set; }
}
}

View File

@@ -0,0 +1,536 @@
// 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.Payment.FaceToFace.Models;
namespace Alipay.EasySDK.Payment.FaceToFace
{
public class Client
{
protected Alipay.EasySDK.Kernel.Client _kernel;
public Client(Alipay.EasySDK.Kernel.Client kernel)
{
this._kernel = kernel;
}
public AlipayTradePayResponse Pay(string subject, string outTradeNo, string totalAmount, string authCode)
{
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.trade.pay"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
{"auth_code", authCode},
{"scene", "bar_code"},
};
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.trade.pay");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayTradePayResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayTradePayResponse>(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<AlipayTradePayResponse> PayAsync(string subject, string outTradeNo, string totalAmount, string authCode)
{
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.trade.pay"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
{"auth_code", authCode},
{"scene", "bar_code"},
};
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.trade.pay");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayTradePayResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayTradePayResponse>(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 AlipayTradePrecreateResponse PreCreate(string subject, string outTradeNo, string totalAmount)
{
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.trade.precreate"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
};
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.trade.precreate");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayTradePrecreateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayTradePrecreateResponse>(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<AlipayTradePrecreateResponse> PreCreateAsync(string subject, string outTradeNo, string totalAmount)
{
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.trade.precreate"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
};
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.trade.precreate");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayTradePrecreateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayTradePrecreateResponse>(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,165 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.FaceToFace.Models
{
public class AlipayTradePayResponse : 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("trade_no")]
[Validation(Required=true)]
public string TradeNo { get; set; }
[NameInMap("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("buyer_logon_id")]
[Validation(Required=true)]
public string BuyerLogonId { get; set; }
[NameInMap("settle_amount")]
[Validation(Required=true)]
public string SettleAmount { get; set; }
[NameInMap("pay_currency")]
[Validation(Required=true)]
public string PayCurrency { get; set; }
[NameInMap("pay_amount")]
[Validation(Required=true)]
public string PayAmount { get; set; }
[NameInMap("settle_trans_rate")]
[Validation(Required=true)]
public string SettleTransRate { get; set; }
[NameInMap("trans_pay_rate")]
[Validation(Required=true)]
public string TransPayRate { get; set; }
[NameInMap("total_amount")]
[Validation(Required=true)]
public string TotalAmount { get; set; }
[NameInMap("trans_currency")]
[Validation(Required=true)]
public string TransCurrency { get; set; }
[NameInMap("settle_currency")]
[Validation(Required=true)]
public string SettleCurrency { get; set; }
[NameInMap("receipt_amount")]
[Validation(Required=true)]
public string ReceiptAmount { get; set; }
[NameInMap("buyer_pay_amount")]
[Validation(Required=true)]
public string BuyerPayAmount { get; set; }
[NameInMap("point_amount")]
[Validation(Required=true)]
public string PointAmount { get; set; }
[NameInMap("invoice_amount")]
[Validation(Required=true)]
public string InvoiceAmount { get; set; }
[NameInMap("gmt_payment")]
[Validation(Required=true)]
public string GmtPayment { get; set; }
[NameInMap("fund_bill_list")]
[Validation(Required=true)]
public List<TradeFundBill> FundBillList { get; set; }
[NameInMap("card_balance")]
[Validation(Required=true)]
public string CardBalance { get; set; }
[NameInMap("store_name")]
[Validation(Required=true)]
public string StoreName { get; set; }
[NameInMap("buyer_user_id")]
[Validation(Required=true)]
public string BuyerUserId { get; set; }
[NameInMap("discount_goods_detail")]
[Validation(Required=true)]
public string DiscountGoodsDetail { get; set; }
[NameInMap("voucher_detail_list")]
[Validation(Required=true)]
public List<VoucherDetail> VoucherDetailList { get; set; }
[NameInMap("advance_amount")]
[Validation(Required=true)]
public string AdvanceAmount { get; set; }
[NameInMap("auth_trade_pay_mode")]
[Validation(Required=true)]
public string AuthTradePayMode { get; set; }
[NameInMap("charge_amount")]
[Validation(Required=true)]
public string ChargeAmount { get; set; }
[NameInMap("charge_flags")]
[Validation(Required=true)]
public string ChargeFlags { get; set; }
[NameInMap("settlement_id")]
[Validation(Required=true)]
public string SettlementId { get; set; }
[NameInMap("business_params")]
[Validation(Required=true)]
public string BusinessParams { get; set; }
[NameInMap("buyer_user_type")]
[Validation(Required=true)]
public string BuyerUserType { get; set; }
[NameInMap("mdiscount_amount")]
[Validation(Required=true)]
public string MdiscountAmount { get; set; }
[NameInMap("discount_amount")]
[Validation(Required=true)]
public string DiscountAmount { get; set; }
[NameInMap("buyer_user_name")]
[Validation(Required=true)]
public string BuyerUserName { 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.Payment.FaceToFace.Models
{
public class AlipayTradePrecreateResponse : 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("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("qr_code")]
[Validation(Required=true)]
public string QrCode { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.FaceToFace.Models
{
public class TradeFundBill : TeaModel {
[NameInMap("fund_channel")]
[Validation(Required=true)]
public string FundChannel { get; set; }
[NameInMap("bank_code")]
[Validation(Required=true)]
public string BankCode { get; set; }
[NameInMap("amount")]
[Validation(Required=true)]
public string Amount { get; set; }
[NameInMap("real_amount")]
[Validation(Required=true)]
public string RealAmount { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.FaceToFace.Models
{
public class VoucherDetail : TeaModel {
[NameInMap("id")]
[Validation(Required=true)]
public string Id { get; set; }
[NameInMap("name")]
[Validation(Required=true)]
public string Name { get; set; }
[NameInMap("type")]
[Validation(Required=true)]
public string Type { get; set; }
[NameInMap("amount")]
[Validation(Required=true)]
public string Amount { get; set; }
[NameInMap("merchant_contribute")]
[Validation(Required=true)]
public string MerchantContribute { get; set; }
[NameInMap("other_contribute")]
[Validation(Required=true)]
public string OtherContribute { get; set; }
[NameInMap("memo")]
[Validation(Required=true)]
public string Memo { get; set; }
[NameInMap("template_id")]
[Validation(Required=true)]
public string TemplateId { get; set; }
[NameInMap("purchase_buyer_contribute")]
[Validation(Required=true)]
public string PurchaseBuyerContribute { get; set; }
[NameInMap("purchase_merchant_contribute")]
[Validation(Required=true)]
public string PurchaseMerchantContribute { get; set; }
[NameInMap("purchase_ant_contribute")]
[Validation(Required=true)]
public string PurchaseAntContribute { get; set; }
}
}

View File

@@ -0,0 +1,324 @@
// 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.Payment.Huabei.Models;
namespace Alipay.EasySDK.Payment.Huabei
{
public class Client
{
protected Alipay.EasySDK.Kernel.Client _kernel;
public Client(Alipay.EasySDK.Kernel.Client kernel)
{
this._kernel = kernel;
}
public AlipayTradeCreateResponse Create(string subject, string outTradeNo, string totalAmount, string buyerId, HuabeiConfig extendParams)
{
extendParams.Validate();
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.trade.create"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
{"buyer_id", buyerId},
{"extend_params", extendParams},
};
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.trade.create");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayTradeCreateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayTradeCreateResponse>(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<AlipayTradeCreateResponse> CreateAsync(string subject, string outTradeNo, string totalAmount, string buyerId, HuabeiConfig extendParams)
{
extendParams.Validate();
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.trade.create"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
{"buyer_id", buyerId},
{"extend_params", extendParams},
};
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.trade.create");
if (this._kernel.IsCertMode())
{
if (this._kernel.Verify(respMap, this._kernel.ExtractAlipayPublicKey(this._kernel.GetAlipayCertSN(respMap))))
{
return TeaModel.ToObject<AlipayTradeCreateResponse>(this._kernel.ToRespModel(respMap));
}
}
else
{
if (this._kernel.Verify(respMap, this._kernel.GetConfig("alipayPublicKey")))
{
return TeaModel.ToObject<AlipayTradeCreateResponse>(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.Payment.Huabei.Models
{
public class AlipayTradeCreateResponse : 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("out_trade_no")]
[Validation(Required=true)]
public string OutTradeNo { get; set; }
[NameInMap("trade_no")]
[Validation(Required=true)]
public string TradeNo { 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.Payment.Huabei.Models
{
public class HuabeiConfig : TeaModel {
[NameInMap("hb_fq_num")]
[Validation(Required=true)]
public string HbFqNum { get; set; }
[NameInMap("hb_fq_seller_percent")]
[Validation(Required=true)]
public string HbFqSellerPercent { get; set; }
}
}

View File

@@ -0,0 +1,139 @@
// 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.Payment.Page.Models;
namespace Alipay.EasySDK.Payment.Page
{
public class Client
{
protected Alipay.EasySDK.Kernel.Client _kernel;
public Client(Alipay.EasySDK.Kernel.Client kernel)
{
this._kernel = kernel;
}
public AlipayTradePagePayResponse Pay(string subject, string outTradeNo, string totalAmount, string returnUrl)
{
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.trade.page.pay"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
{"product_code", "FAST_INSTANT_TRADE_PAY"},
};
Dictionary<string, string> textParams = new Dictionary<string, string>
{
{"return_url", returnUrl},
};
string sign = this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"));
Dictionary<string, string> response = new Dictionary<string, string>
{
{"body", this._kernel.GeneratePage("POST", systemParams, bizParams, textParams, sign)},
};
return TeaModel.ToObject<AlipayTradePagePayResponse>(response);
}
/// <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,21 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Page.Models
{
public class AlipayTradePagePayResponse : TeaModel {
/// <summary>
/// 订单信息Form表单形式
/// </summary>
[NameInMap("body")]
[Validation(Required=true)]
public string Body { get; set; }
}
}

View File

@@ -0,0 +1,140 @@
// 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.Payment.Wap.Models;
namespace Alipay.EasySDK.Payment.Wap
{
public class Client
{
protected Alipay.EasySDK.Kernel.Client _kernel;
public Client(Alipay.EasySDK.Kernel.Client kernel)
{
this._kernel = kernel;
}
public AlipayTradeWapPayResponse Pay(string subject, string outTradeNo, string totalAmount, string quitUrl, string returnUrl)
{
Dictionary<string, string> systemParams = new Dictionary<string, string>
{
{"method", "alipay.trade.wap.pay"},
{"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>
{
{"subject", subject},
{"out_trade_no", outTradeNo},
{"total_amount", totalAmount},
{"quit_url", quitUrl},
{"product_code", "QUICK_WAP_WAY"},
};
Dictionary<string, string> textParams = new Dictionary<string, string>
{
{"return_url", returnUrl},
};
string sign = this._kernel.Sign(systemParams, bizParams, textParams, this._kernel.GetConfig("merchantPrivateKey"));
Dictionary<string, string> response = new Dictionary<string, string>
{
{"body", this._kernel.GeneratePage("POST", systemParams, bizParams, textParams, sign)},
};
return TeaModel.ToObject<AlipayTradeWapPayResponse>(response);
}
/// <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,21 @@
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace Alipay.EasySDK.Payment.Wap.Models
{
public class AlipayTradeWapPayResponse : TeaModel {
/// <summary>
/// 订单信息Form表单形式
/// </summary>
[NameInMap("body")]
[Validation(Required=true)]
public string Body { get; set; }
}
}