12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System.Threading.Tasks;
- using Alipay.AopSdk.Core;
- using Alipay.AopSdk.Core.Domain;
- using Alipay.AopSdk.Core.Request;
- using Newtonsoft.Json;
- namespace GxPress.Common.AliPay
- {
- public class PcPay
- {
-
-
-
-
-
-
-
-
- public string PayRequest(string tradeno, string subject, string totalAmout, string itemBody, string notifyUrl)
- {
- DefaultAopClient client = new DefaultAopClient(Config.Gatewayurl, Config.AppId, Config.PrivateKey, "json", "2.0",
- Config.SignType, Config.AlipayPublicKey, Config.CharSet, false);
-
- AlipayTradePagePayModel model = new AlipayTradePagePayModel();
- model.Body = itemBody;
- model.Subject = subject;
- model.TotalAmount = totalAmout;
- model.OutTradeNo = tradeno;
- model.ProductCode = "FAST_INSTANT_TRADE_PAY";
- AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
-
- request.SetReturnUrl(notifyUrl);
-
-
- request.SetNotifyUrl("https://apk.tederen.com/service/api/web/alipay/notify");
-
- request.SetBizModel(model);
- var response = client.SdkExecute(request);
-
-
- return (Config.Gatewayurl + "?" + response.Body);
- }
-
-
-
-
-
-
-
-
-
- public async Task<bool> Refund(string tradeno, string alipayTradeNo, string refundAmount, string refundReason, string refundNo)
- {
- DefaultAopClient client = new DefaultAopClient(Config.Gatewayurl, Config.AppId, Config.PrivateKey, "json", "2.0",
- Config.SignType, Config.AlipayPublicKey, Config.CharSet, false);
- AlipayTradeRefundModel model = new AlipayTradeRefundModel();
- model.OutTradeNo = tradeno;
- model.TradeNo = alipayTradeNo;
- model.RefundAmount = refundAmount;
- model.RefundReason = refundReason;
- model.OutRequestNo = refundNo;
- AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
- request.SetBizModel(model);
- var response = await client.ExecuteAsync(request);
- var jsonModel = JsonConvert.DeserializeObject<dynamic>(response.Body);
- return true;
- }
-
-
-
-
-
-
- public async Task<bool> OrderClose(string tradeno, string alipayTradeNo)
- {
- DefaultAopClient client = new DefaultAopClient(Config.Gatewayurl, Config.AppId, Config.PrivateKey, "json", "2.0",
- Config.SignType, Config.AlipayPublicKey, Config.CharSet, false);
- AlipayTradeCloseModel model = new AlipayTradeCloseModel();
- model.OutTradeNo = tradeno;
- model.TradeNo = alipayTradeNo;
- AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
- request.SetBizModel(model);
- var response = await client.ExecuteAsync(request);
- var jsonModel = JsonConvert.DeserializeObject<dynamic>(response.Body);
- return true;
- }
- }
- }
|