當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpStatusView.bind方法代碼示例

本文整理匯總了Java中net.ymate.platform.webmvc.view.impl.HttpStatusView.bind方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpStatusView.bind方法的具體用法?Java HttpStatusView.bind怎麽用?Java HttpStatusView.bind使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.ymate.platform.webmvc.view.impl.HttpStatusView的用法示例。


在下文中一共展示了HttpStatusView.bind方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: __doJsApi

import net.ymate.platform.webmvc.view.impl.HttpStatusView; //導入方法依賴的package包/類
/**
 * @param appId  微信公眾號應用ID
 * @param openId 微信用戶身份唯一標識
 * @param state  商品或訂單ID
 * @param attach 附加信息
 * @return 微信支付 -- JS_API模式
 * @throws Exception 可能產生的任何異常
 */
@RequestMapping(value = "/jsapi/{app_id}", method = {Type.HttpMethod.GET, Type.HttpMethod.POST})
public IView __doJsApi(@PathVariable("app_id") String appId,
                       @VRequried @RequestParam("open_id") String openId,
                       @VRequried @RequestParam String state,
                       @RequestParam String attach,
                       @RequestParam boolean debug) throws Exception {
    IWxPayEventHandler _eventHandler = WxPay.get().getModuleCfg().getEventHandler();
    if (_eventHandler != null) {
        WxPayAccountMeta _meta = WxPay.get().getModuleCfg().getAccountProvider().getAccount(appId);
        if (_meta != null) {
            WxPayUnifiedOrder _request = _eventHandler.buildUnifiedOrderRequest(_meta, IWxPay.TradeType.JSAPI, state, attach).openId(openId);
            WxPayUnifiedOrder.Response _response = _request.execute();
            //
            if (_response.checkReturnCode() && _response.checkResultCode() && (WxPay.get().getModuleCfg().isSignCheckDisabled() || _response.checkSignature(_meta.getMchKey()))) {
                // 封裝JSAPI初始化相關參數
                String _queryStr = StringUtils.trimToNull(WebContext.getRequest().getQueryString());
                String _currentURL = WebUtils.buildURL(WebContext.getRequest(), "payment/wxpay/jsapi/" + appId + (_queryStr == null ? "" : "?" + _queryStr), true);
                //
                String _timestamp = DateTimeUtils.currentTimeUTC() + "";
                String _nonceStr = WxPayBaseData.__doCreateNonceStr();
                String _config = __buildJsApiConfigStr(_meta.getAppId(), _eventHandler.getJsApiTicket(_meta.getAppId()), StringUtils.substringBefore(_currentURL, "#"), _timestamp, _nonceStr, debug);
                // 封裝基於JSAPI的支付調用相關參數
                Map<String, Object> _paramMap = new HashMap<String, Object>();
                _paramMap.put("appId", _meta.getAppId());
                _paramMap.put("timeStamp", _timestamp);
                _paramMap.put("nonceStr", _nonceStr);
                _paramMap.put("package", "prepay_id=" + _response.prepayId());
                _paramMap.put("signType", IWxPay.Const.SIGN_TYPE_MD5);
                _paramMap.put("paySign", WxPayBaseData.__doCreateSignature(_paramMap, _meta.getMchKey()));
                //
                return View.jspView(WxPay.get().getModuleCfg().getJsApiView())
                        .addAttribute("_config", _config)
                        .addAttribute("_data", _paramMap)
                        .addAttribute("_trade_no", state);
            }
        }
    }
    return HttpStatusView.bind(HttpServletResponse.SC_BAD_REQUEST);
}
 
開發者ID:suninformation,項目名稱:ymate-payment-v2,代碼行數:48,代碼來源:WxPayJsApiController.java

示例2: __doMWeb

import net.ymate.platform.webmvc.view.impl.HttpStatusView; //導入方法依賴的package包/類
@RequestMapping(value = "{app_id}/mweb", method = {Type.HttpMethod.GET, Type.HttpMethod.POST})
public IView __doMWeb(@PathVariable("app_id") String appId,
                      @VRequried @RequestParam String state,
                      @RequestParam String attach,
                      @RequestParam("redirect_url") String redirectUrl) throws Exception {
    IWxPayEventHandler _eventHandler = WxPay.get().getModuleCfg().getEventHandler();
    if (_eventHandler != null) {
        WxPayAccountMeta _meta = WxPay.get().getModuleCfg().getAccountProvider().getAccount(appId);
        if (_meta != null) {
            WxPayUnifiedOrder _request = _eventHandler.buildUnifiedOrderRequest(_meta, IWxPay.TradeType.MWEB, state, attach);
            WxPayUnifiedOrder.Response _response = _request.execute();
            //
            if (_response.checkReturnCode() && _response.checkResultCode() && (WxPay.get().getModuleCfg().isSignCheckDisabled() || _response.checkSignature(_meta.getMchKey()))) {
                if (StringUtils.isNotBlank(redirectUrl)) {
                    return View.redirectView(_response.mwebUrl() + "&redirect_url=" + WebUtils.encodeURL(redirectUrl));
                }
                return View.redirectView(_response.mwebUrl());
            }
        }
    }
    return HttpStatusView.bind(HttpServletResponse.SC_BAD_REQUEST);
}
 
開發者ID:suninformation,項目名稱:ymate-payment-v2,代碼行數:23,代碼來源:WxPayMWebController.java

示例3: __doNativeStatic

import net.ymate.platform.webmvc.view.impl.HttpStatusView; //導入方法依賴的package包/類
@RequestMapping(value = "{app_id}/native/static", method = {Type.HttpMethod.GET, Type.HttpMethod.POST})
public IView __doNativeStatic(@PathVariable("app_id") String appId,
                              @VRequried @RequestParam String state,
                              @RequestParam String attach) throws Exception {
    IWxPayEventHandler _eventHandler = WxPay.get().getModuleCfg().getEventHandler();
    if (_eventHandler != null) {
        WxPayAccountMeta _meta = WxPay.get().getModuleCfg().getAccountProvider().getAccount(appId);
        if (_meta != null) {
            Map<String, Object> _paramMap = new HashMap<String, Object>();
            _paramMap.put(IWxPay.Const.APP_ID, _meta.getAppId());
            _paramMap.put(IWxPay.Const.MCH_ID, _meta.getMchId());
            _paramMap.put("time_stamp", DateTimeUtils.currentTimeUTC() + "");
            _paramMap.put(IWxPay.Const.NONCE_STR, WxPayBaseData.__doCreateNonceStr());
            _paramMap.put("product_id", state);
            _paramMap.put("sign", WxPayBaseData.__doCreateSignature(_paramMap, _meta.getMchKey()));
            //
            String _qrCodeData = WebUtils.encryptStr(WebContext.getRequest(), "weixin://wxpay/bizpayurl?".concat(ParamUtils.buildQueryParamStr(_paramMap, false, null)));
            return View.jspView(WxPay.get().getModuleCfg().getNativeView())
                    .addAttribute("_qrcode_data", _qrCodeData)
                    .addAttribute("_state", state)
                    .addAttribute("_attach", attach).addAttribute("_app_id", appId);
        }
    }
    return HttpStatusView.bind(HttpServletResponse.SC_BAD_REQUEST);
}
 
開發者ID:suninformation,項目名稱:ymate-payment-v2,代碼行數:26,代碼來源:WxPayNativeController.java

示例4: __doNativeDynamic

import net.ymate.platform.webmvc.view.impl.HttpStatusView; //導入方法依賴的package包/類
@RequestMapping(value = "{app_id}/native/dynamic", method = {Type.HttpMethod.GET, Type.HttpMethod.POST})
public IView __doNativeDynamic(@PathVariable("app_id") String appId,
                               @VRequried @RequestParam String state,
                               @RequestParam String attach) throws Exception {
    IWxPayEventHandler _eventHandler = WxPay.get().getModuleCfg().getEventHandler();
    if (_eventHandler != null) {
        WxPayAccountMeta _meta = WxPay.get().getModuleCfg().getAccountProvider().getAccount(appId);
        if (_meta != null) {
            WxPayUnifiedOrder _request = _eventHandler.buildUnifiedOrderRequest(_meta, IWxPay.TradeType.NATIVE, state, attach);
            WxPayUnifiedOrder.Response _response = _request.execute();
            //
            if (_response.checkReturnCode() && _response.checkResultCode() && (WxPay.get().getModuleCfg().isSignCheckDisabled() || _response.checkSignature(_meta.getMchKey()))) {
                String _qrCodeData = WebUtils.encryptStr(WebContext.getRequest(), _response.codeUrl());
                return View.jspView(WxPay.get().getModuleCfg().getNativeView())
                        .addAttribute("_qrcode_data", _qrCodeData)
                        .addAttribute("_state", state)
                        .addAttribute("_attach", attach).addAttribute("_app_id", appId);
            }
        }
    }
    return HttpStatusView.bind(HttpServletResponse.SC_BAD_REQUEST);
}
 
開發者ID:suninformation,項目名稱:ymate-payment-v2,代碼行數:23,代碼來源:WxPayNativeController.java

示例5: __doCallback

import net.ymate.platform.webmvc.view.impl.HttpStatusView; //導入方法依賴的package包/類
/**
 * @param appId 微信公眾號應用ID
 * @param state 商品或訂單ID
 * @return 同步回調(訂單狀態主動檢查)
 * @throws Exception 可能產生的任何異常
 */
@RequestMapping(value = "{app_id}/callback", method = {Type.HttpMethod.GET, Type.HttpMethod.POST})
public IView __doCallback(@PathVariable("app_id") String appId, @VRequried @RequestParam String state) throws Exception {
    IWxPayEventHandler _eventHandler = WxPay.get().getModuleCfg().getEventHandler();
    if (_eventHandler != null) {
        if (_eventHandler.onReturnCallback(state)) {
            WxPayOrderQuery _query = WxPay.get().orderQuery(appId, null, state);
            WxPayOrderQuery.Response _response = _query.execute();
            _eventHandler.onNotifyReceived(_response);
            //
            return WebResult.SUCCESS().dataAttr("trade_state", _response.tradeState()).dataAttr("trade_state_desc", _response.tradeStateDesc()).toJSON();
        }
    }
    return HttpStatusView.bind(HttpServletResponse.SC_BAD_REQUEST);
}
 
開發者ID:suninformation,項目名稱:ymate-payment-v2,代碼行數:21,代碼來源:WxPayNotifyController.java

示例6: __doNotify

import net.ymate.platform.webmvc.view.impl.HttpStatusView; //導入方法依賴的package包/類
/**
 * @param notify 微信支付異步通知對象
 * @return 接收微信異步通知
 * @throws Exception 可能產生的任何異常
 */
@RequestMapping(value = "/notify", method = Type.HttpMethod.POST)
@RequestProcessor(WxPayRequestProcessor.class)
public IView __doNotify(@RequestParam WxPayNotifyResponse notify) throws Exception {
    IWxPayEventHandler _eventHandler = WxPay.get().getModuleCfg().getEventHandler();
    if (_eventHandler != null) {
        //
        Map<String, Object> _returnValues = new HashMap<String, Object>();
        //
        WxPayAccountMeta _meta = WxPay.get().getModuleCfg().getAccountProvider().getAccount(notify.appId());
        if (_meta != null) {
            try {
                if (!WxPay.get().getModuleCfg().isSignCheckDisabled() || notify.checkSignature(_meta.getMchKey())) {
                    if (StringUtils.isNotBlank(notify.productId())) {
                        WxPayUnifiedOrder _request = _eventHandler.buildUnifiedOrderRequest(_meta, IWxPay.TradeType.NATIVE, notify.productId(), notify.attach());
                        WxPayUnifiedOrder.Response _response = _request.execute();
                        if (_response.checkReturnCode() && _response.checkResultCode()) {
                            if (WxPay.get().getModuleCfg().isSignCheckDisabled() || _response.checkSignature(_meta.getMchKey())) {
                                _returnValues.put(IWxPay.Const.RETURN_CODE, IWxPay.ReturnCode.SUCCESS.name());
                                _returnValues.put(IWxPay.Const.RESULT_CODE, IWxPay.ResultCode.SUCCESS.name());
                                _returnValues.put(IWxPay.Const.APP_ID, _meta.getAppId());
                                _returnValues.put(IWxPay.Const.MCH_ID, _meta.getMchId());
                                _returnValues.put(IWxPay.Const.NONCE_STR, WxPayBaseData.__doCreateNonceStr());
                                _returnValues.put("prepay_id", _response.prepayId());
                                _returnValues.put("trade_type", IWxPay.TradeType.NATIVE.name());
                                _returnValues.put(IWxPay.Const.SIGN, WxPayBaseData.__doCreateSignature(_returnValues, _meta.getMchKey()));
                            } else {
                                _returnValues.put(IWxPay.Const.RETURN_CODE, IWxPay.ReturnCode.FAIL.name());
                                _returnValues.put(IWxPay.Const.RETURN_MSG, IWxPay.ErrCode.SIGNERROR.desc());
                            }
                        }
                    } else {
                        _eventHandler.onNotifyReceived(notify);
                        //
                        _returnValues.put(IWxPay.Const.RETURN_CODE, IWxPay.ReturnCode.SUCCESS.name());
                    }
                } else {
                    _returnValues.put(IWxPay.Const.RETURN_CODE, IWxPay.ReturnCode.FAIL.name());
                    _returnValues.put(IWxPay.Const.RETURN_MSG, IWxPay.ErrCode.SIGNERROR.desc());
                }
            } catch (Exception e) {
                _returnValues.put(IWxPay.Const.RETURN_CODE, IWxPay.ReturnCode.FAIL.name());
                if (e instanceof WxPayException) {
                    _returnValues.put(IWxPay.Const.RETURN_MSG, ((WxPayException) e).getErrMsg());
                } else {
                    _eventHandler.onExceptionCaught(RuntimeUtils.unwrapThrow(e));
                    _returnValues.put(IWxPay.Const.RETURN_MSG, IWxPay.ErrCode.SYSTEMERROR);
                }
            }
            String _returnStr = WxPayBaseData.__doBuildXML(_returnValues);
            _LOG.debug("WxPay Notify Response: [" + _returnStr + "]");
            return new TextView(_returnStr, "text/xml");
        }
    }
    return HttpStatusView.bind(HttpServletResponse.SC_BAD_REQUEST);
}
 
開發者ID:suninformation,項目名稱:ymate-payment-v2,代碼行數:61,代碼來源:WxPayNotifyController.java


注:本文中的net.ymate.platform.webmvc.view.impl.HttpStatusView.bind方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。