Example #1
0
        public string PayF2FNew(EAliPayApplication app, EUserInfo AgentUi, EStoreInfo storeInfo, string TotalAmount, out AliPayResult status)
        {
            string result      = "";
            bool   NeedControl = false;

            /*
             * IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance(AliPayConfig.serverUrl, AliPayConfig.appId, AliPayConfig.merchant_private_key, AliPayConfig.version,
             *             AliPayConfig.sign_type, AliPayConfig.alipay_public_key, AliPayConfig.charset);
             */
            IAopClient aliyapClient = new DefaultAopClient("https://openapi.alipay.com/gateway.do", app.AppId,
                                                           app.Merchant_Private_Key, "json", "1.0", "RSA2", app.Merchant_Public_key, "GBK", false);


            _handler = new F2FPayHandler();

            //if (AgentUi.UserRole == UserRole.Administrator)
            //    NeedControl = false;
            AlipayTradePrecreateResponse builder = _handler.BuildNew(app, storeInfo, AgentUi, TotalAmount, true, NeedControl);

            if (builder.Code == "10000")
            {
                result = _handler.CreateF2FQR(builder.QrCode);
                result = _handler.DeQR(result);
                status = AliPayResult.SUCCESS;
            }
            else
            {
                if (builder.Code == "20001")
                {
                    status = AliPayResult.AUTHERROR;
                    result = "授权错误!";
                }
                else
                {
                    result = "[Error Message]" + builder.Msg + "[Sub Msg]" + builder.SubMsg;
                    status = AliPayResult.FAILED;
                }
            }


            return(result);
        }
Example #2
0
        public string PayTest(EAliPayApplication app, EStoreInfo store, out AliPayResult status)
        {
            IAopClient aliyapClient = new DefaultAopClient("https://openapi.alipay.com/gateway.do", app.AppId,
                                                           app.Merchant_Private_Key, "json", "1.0", "RSA2", app.Merchant_Public_key, "GBK", false);


            _handler = new F2FPayHandler();
            EUserInfo ui = new EUserInfo();

            ui.Name = "Check Store";
            AlipayTradePrecreateResponse builder = _handler.BuildNew(app, store, ui, "1.00");

            if (builder.Code == "10000")
            {
                status = AliPayResult.SUCCESS;
            }
            else
            {
                status = AliPayResult.FAILED;
            }
            return(builder.Code);
        }