123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- 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);
- }
-
-
-
-
-
-
- public Client Agent(string appAuthToken)
- {
- _kernel.InjectTextParam("app_auth_token", appAuthToken);
- return this;
- }
-
-
-
-
-
- public Client Auth(string authToken)
- {
- _kernel.InjectTextParam("auth_token", authToken);
- return this;
- }
-
-
-
-
-
- public Client AsyncNotify(string url)
- {
- _kernel.InjectTextParam("notify_url", url);
- return this;
- }
-
-
-
-
-
- public Client Route(string testUrl)
- {
- _kernel.InjectTextParam("ws_service_url", testUrl);
- return this;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- public Client Optional(string key, object value)
- {
- _kernel.InjectBizParam(key, value);
- return this;
- }
-
-
-
-
-
-
- public Client BatchOptional(Dictionary<string, object> optionalArgs)
- {
- foreach (var pair in optionalArgs)
- {
- _kernel.InjectBizParam(pair.Key, pair.Value);
- }
- return this;
- }
- }
- }
|