Beispiel #1
0
        public T Execute <T>(IAopRequest <T> request, string accessToken, string appAuthToken) where T : AopResponse
        {
            AlipayMobilePublicMultiMediaDownloadRequest multiMediaDownloadRequest = ((AlipayMobilePublicMultiMediaDownloadRequest)request);
            // 添加协议级请求参数
            AopDictionary txtParams = new AopDictionary(request.GetParameters());

            txtParams.Add(AlipayConstants.METHOD, request.GetApiName());
            txtParams.Add(AlipayConstants.VERSION, Version);
            txtParams.Add(AlipayConstants.APP_ID, appId);
            txtParams.Add(AlipayConstants.FORMAT, format);
            txtParams.Add(AlipayConstants.TIMESTAMP, DateTime.Now);
            txtParams.Add(AlipayConstants.ACCESS_TOKEN, accessToken);
            txtParams.Add(AlipayConstants.SIGN_TYPE, signType);
            txtParams.Add(AlipayConstants.TERMINAL_TYPE, request.GetTerminalType());
            txtParams.Add(AlipayConstants.TERMINAL_INFO, request.GetTerminalInfo());
            txtParams.Add(AlipayConstants.PROD_CODE, request.GetProdCode());

            if (!string.IsNullOrEmpty(appAuthToken))
            {
                txtParams.Add(AlipayConstants.APP_AUTH_TOKEN, appAuthToken);
            }


            // 添加签名参数
            txtParams.Add(AlipayConstants.SIGN, AopUtils.SignAopRequest(txtParams, privateKeyPem, charset, keyFromFile, signType));

            Stream      outStream = multiMediaDownloadRequest.stream;
            AopResponse rsp       = DoGet(txtParams, outStream);

            return((T)rsp);
        }
        public T Execute <T>(IAopRequest <T> request, string accessToken, string appAuthToken) where T : AopResponse
        {
            AlipayMobilePublicMultiMediaDownloadRequest alipayMobilePublicMultiMediaDownloadRequest = (AlipayMobilePublicMultiMediaDownloadRequest)request;
            AopDictionary aopDictionary = new AopDictionary(request.GetParameters());

            aopDictionary.Add("method", request.GetApiName());
            aopDictionary.Add("version", Version);
            aopDictionary.Add("app_id", appId);
            aopDictionary.Add("format", format);
            aopDictionary.Add("timestamp", DateTime.Now);
            aopDictionary.Add("auth_token", accessToken);
            aopDictionary.Add("sign_type", signType);
            aopDictionary.Add("terminal_type", request.GetTerminalType());
            aopDictionary.Add("terminal_info", request.GetTerminalInfo());
            aopDictionary.Add("prod_code", request.GetProdCode());
            if (!string.IsNullOrEmpty(appAuthToken))
            {
                aopDictionary.Add("app_auth_token", appAuthToken);
            }
            aopDictionary.Add("sign", AopUtils.SignAopRequest(aopDictionary, privateKeyPem, charset, signType));
            Stream      stream      = alipayMobilePublicMultiMediaDownloadRequest.stream;
            AopResponse aopResponse = DoGet(aopDictionary, stream);

            return((T)aopResponse);
        }