Example #1
0
        public ServiceResult <bool> CloseOrder(Order order)
        {
            AlipayTradeCloseModel model = new AlipayTradeCloseModel();

            model.OutTradeNo = order.ID;
            model.TradeNo    = order.PaymentID;

            AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();

            request.SetBizModel(model);

            var response      = _alipayService.Execute(request);
            var responseEntry = JObject.Parse(response.Body).GetValue("alipay_trade_close_response").ToObject <AliPaymentResponse>();
            var status        = responseEntry.msg.Equals("Success", StringComparison.OrdinalIgnoreCase);
            var result        = new ServiceResult <bool>
            {
                Result = status
            };

            if (!status)
            {
                result.RuleViolations.Add(new RuleViolation("Error", responseEntry.msg + (responseEntry.sub_msg ?? "")));
            }
            return(result);
        }
Example #2
0
        public JsonResult Query(string tradeno, string alipayTradeNo)
        {
            /*DefaultAopClient client = new DefaultAopClient(Config.Gatewayurl, Config.AppId, Config.PrivateKey, "json", "2.0",
             *              Config.SignType, Config.AlipayPublicKey, Config.CharSet, false);*/
            AlipayTradeQueryModel model = new AlipayTradeQueryModel
            {
                OutTradeNo = tradeno,
                TradeNo    = alipayTradeNo
            };

            AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();

            request.SetBizModel(model);

            var response = _alipayService.Execute(request);

            return(Json(response.Body));
        }