Ejemplo n.º 1
0
        /// <summary>
        /// 微信转账
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="config">配置</param>
        /// <returns>结果</returns>
        public static TransfersResult Transfers(TransfersRequest request, Config config)
        {
            TransfersResult       result = new TransfersResult();
            TransfersQueryRequest transfersQueryRequest = new TransfersQueryRequest
            {
                PartnerTradeNo = request.PartnerTradeNo
            };
            TransfersQueryResult transfersQueryResult = TransfersQuery(transfersQueryRequest, config);

            if (transfersQueryResult.Status == TransfersStatus.Success)
            {
                result.IsSuccess = TransfersStatus.Success;
                return(result);
            }
            if (transfersQueryResult.Status == TransfersStatus.Processing)
            {
                result.IsSuccess = TransfersStatus.Processing;
                return(result);
            }

            var requestStr = TenpayUtil.GetTransfersRequestXml(request, config);
            var response   = HttpHelp.PostXmlToUrl(Config.TransfersUrl, requestStr, config.GetTransfersCertPath(), config.GetPid());

            result = TenpayUtil.ConvertToTransfersResult(response);
            return(result);
        }