示例#1
0
        /// <summary>
        /// 订单退款查询
        /// </summary>
        /// <param name="model">查询信息</param>
        /// <returns></returns>
        public async Task <AlipayTradeFastpayRefundQueryResponse> RefundQuery(AlipayTradeFastpayRefundQueryModel input)
        {
            if (string.IsNullOrEmpty(input.OutRequestNo))
            {
                input.OutRequestNo = input.OutTradeNo;
            }

            var request = new AlipayTradeFastpayRefundQueryRequest();

            request.SetBizModel(input);

            AlipayTradeFastpayRefundQueryResponse response = await _alipayService.ExecuteAsync(request);

            return(response);
        }
示例#2
0
        public static bool AliPayRefundResult(string trade_no, string out_refund_no)
        {
            IAopClient client = new DefaultAopClient(AlipayConfig.mobile_gatewayUrl, AlipayConfig.mobile_app_id, AlipayConfig.mobile_private_key_value, "json", "1.0", AlipayConfig.sign_type, AlipayConfig.mobile_public_key_value, AlipayConfig.charset, false);
            AlipayTradeFastpayRefundQueryRequest request = new AlipayTradeFastpayRefundQueryRequest();

            request.BizContent = "{" +
                                 "\"out_trade_no\":\"" + trade_no + "\"," +
                                 "\"out_request_no\":\"" + out_refund_no + "\"" +
                                 "}";
            AlipayTradeFastpayRefundQueryResponse response = client.Execute(request);

            if (response.Code == "10000")
            {
                return(true);
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// 退款查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public RefundQueryResult RefundQuery(RefundDTO dto)
        {
            AlipayTradeRefundQueryDTO refundQueryDto = new AlipayTradeRefundQueryDTO();

            refundQueryDto.trade_no       = dto.OnlineTradeNo;
            refundQueryDto.out_trade_no   = dto.OutTradeNo;
            refundQueryDto.out_request_no = dto.OutRefundNo;

            AlipayTradeFastpayRefundQueryRequest request = new AlipayTradeFastpayRefundQueryRequest();

            request.BizContent = refundQueryDto.BuildJson();
            AlipayTradeFastpayRefundQueryResponse response = Execute(request);

            var result = new RefundQueryResult();

            result.SetAlipayResult(response);

            return(result);
        }
示例#4
0
        public IActionResult RefundQuery(string WIDout_trade_no, string WIDtrade_no, string WIDout_request_no)
        {
            var client = new DefaultAopClient(_settings.Value.gateway_url, _settings.Value.app_id,
                                              _settings.Value.private_key, _settings.Value.format, _settings.Value.version, _settings.Value.sign_type,
                                              _settings.Value.alipay_public_key, _settings.Value.charset, false);

            // 商户订单号,和交易号不能同时为空
            var out_trade_no = WIDout_trade_no;

            // 支付宝交易号,和商户订单号不能同时为空
            var trade_no = WIDtrade_no;

            // 请求退款接口时,传入的退款号,如果在退款时未传入该值,则该值为创建交易时的商户订单号,必填。
            var out_request_no = WIDout_request_no;

            var model = new AlipayTradeFastpayRefundQueryModel
            {
                OutTradeNo   = out_trade_no,
                TradeNo      = trade_no,
                OutRequestNo = out_request_no
            };

            var request = new AlipayTradeFastpayRefundQueryRequest();

            request.SetBizModel(model);

            AlipayTradeFastpayRefundQueryResponse response = null;

            try
            {
                response = client.Execute(request);
            }
            catch (Exception exp)
            {
                throw exp;
            }

            return(Content(response.Body));
        }