Java Code Examples for org.nutz.lang.util.NutMap#NEW

The following examples show how to use org.nutz.lang.util.NutMap#NEW . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WxApi2Impl.java    From nutzwx with Apache License 2.0 5 votes vote down vote up
@Override
public WxResp createQRTicket(long expire, Type type, int id) {
    if (type != Type.EVER || type != Type.TEMP) {// 非整形场景自动适配一下
        return createQRTicket(expire, type, id + "");
    }
    NutMap json = NutMap.NEW();
    json.put("expire_seconds", expire);
    json.put("action_name", type.getValue());
    NutMap action = NutMap.NEW();
    NutMap scene = NutMap.NEW();
    scene.put("scene_id", id);
    action.put("scene", scene);
    json.put("action_info", action);
    return postJson("/qrcode/create", json);
}
 
Example 2
Source File: WxApi2Impl.java    From nutzwx with Apache License 2.0 5 votes vote down vote up
@Override
public WxResp createQRTicket(long expire, Type type, String str) {
    NutMap json = NutMap.NEW();
    json.put("expire_seconds", expire);
    json.put("action_name", type.getValue());
    NutMap action = NutMap.NEW();
    NutMap scene = NutMap.NEW();
    scene.put("scene_str", str);
    action.put("scene", scene);
    json.put("action_info", action);
    return postJson("/qrcode/create", json);
}
 
Example 3
Source File: WxApi2Impl.java    From nutzwx with Apache License 2.0 5 votes vote down vote up
/**
 * 微信公众号JS支付
 *
 * @param key
 *            商户KEY
 * @param wxPayUnifiedOrder
 *            交易订单内容
 * @return
 */
@Override
public NutMap pay_jsapi(String key, WxPayUnifiedOrder wxPayUnifiedOrder) {
    NutMap map = this.pay_unifiedorder(key, wxPayUnifiedOrder);
    NutMap params = NutMap.NEW();
    params.put("appId", wxPayUnifiedOrder.getAppid());
    params.put("timeStamp", String.valueOf((int) (System.currentTimeMillis() / 1000)));
    params.put("nonceStr", R.UU32());
    params.put("package", "prepay_id=" + map.getString("prepay_id"));
    params.put("signType", "MD5");
    String sign = WxPaySign.createSign(key, params);
    params.put("paySign", sign);
    return params;
}