• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AlipayTradeAppPayRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.alipay.api.request.AlipayTradeAppPayRequest的典型用法代码示例。如果您正苦于以下问题:Java AlipayTradeAppPayRequest类的具体用法?Java AlipayTradeAppPayRequest怎么用?Java AlipayTradeAppPayRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AlipayTradeAppPayRequest类属于com.alipay.api.request包,在下文中一共展示了AlipayTradeAppPayRequest类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getAlipayAppPayInfo

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
private AlipayPrepayInfo getAlipayAppPayInfo(String tradeNo, String amount, String timeout, String productName, String productDesc, PaymentAccountInfoInterface accountInfo) {
    AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
    //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
    AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
    model.setBody(productDesc);
    model.setSubject(productName);
    model.setOutTradeNo(tradeNo);
    model.setTimeoutExpress(timeout);
    model.setTotalAmount(amount);
    model.setProductCode("QUICK_MSECURITY_PAY");
    request.setBizModel(model);
    request.setNotifyUrl(accountInfo.getAliNotifyUrl());

    //实例化客户端
    AlipayClient alipayClient = getAlipayClient(accountInfo);
    try {
        //这里和普通的接口调用不同,使用的是sdkExecute
        AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
        return new AlipayPrepayInfo(null, response.getBody());
    } catch (AlipayApiException e) {
        e.printStackTrace();
        logger.error("Alipay get app pay info failed!");
    }
    return null;
}
 
开发者ID:superkoh,项目名称:k-framework,代码行数:26,代码来源:AlipayServiceImpl.java


示例2: createAppOrder

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
/**
 * app支付
 * 
 * @param subject
 *            支付标题
 * @param body
 *            支付明细
 * @param price
 *            支付价格(元)
 * @param order
 *            系统订单号
 * @return
 */
public String createAppOrder(String subject, String body, String price, String order) {
	String result = "";
	AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
	AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
	model.setBody(body);
	model.setSubject(subject);
	model.setOutTradeNo(order);
	model.setTimeoutExpress("30m");
	model.setTotalAmount(price);
	request.setBizModel(model);
	request.setNotifyUrl(config.getString("NOTIFY_URL"));
	try {
		AlipayTradeAppPayResponse response = client.sdkExecute(request);
		result = response.getBody();
	} catch (AlipayApiException e) {
		e.printStackTrace();
	}

	return result;
}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:34,代码来源:AlipayUtil.java


示例3: appPayToResponse

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
/**
 * APP支付
 * https://doc.open.alipay.com/docs/doc.htm?treeId=54&articleId=106370&docType=1
 * @param model
 * @param notifyUrl
 * @return {AlipayTradeAppPayResponse}
 * @throws {AlipayApiException}
 */
public static AlipayTradeAppPayResponse appPayToResponse(AlipayTradeAppPayModel model, String notifyUrl) throws AlipayApiException{
	//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
	AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
	//SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
	request.setBizModel(model);
	request.setNotifyUrl(notifyUrl);
	//这里和普通的接口调用不同,使用的是sdkExecute
       AlipayTradeAppPayResponse response = AliPayApiConfigKit.getAliPayApiConfig().getAlipayClient().sdkExecute(request);
	return response;
}
 
开发者ID:Javen205,项目名称:IJPay,代码行数:19,代码来源:AliPayApi.java


示例4: appPay

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
/**
 * App 支付
 * @param model
 * @param notifyUrl
 * @return
 * @throws AlipayApiException
 */
public static AlipayTradeAppPayResponse appPay(AlipayTradeAppPayModel model, String notifyUrl)
    throws AlipayApiException {
    // 实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
    AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
    // SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
    request.setBizModel(model);
    request.setNotifyUrl(notifyUrl);
    // 这里和普通的接口调用不同,使用的是sdkExecute
    AlipayTradeAppPayResponse response = AliPayConfig.build().getAlipayClient().sdkExecute(request);
    return response;
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:19,代码来源:AliPay.java


示例5: getSign

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
/**
 * 下单并获取支付签名
 * @param out_trade_no 商户订单号
 * @param subject 交易主题
 * @param body 交易详情
 * @param amount 交易金额
 * @param ip 客户端IP
 * @param timeout 订单失效时间
 * @param callBack 回调地址
 * @return 支付参数
 */
public static String getSign(String out_trade_no, String subject, String body, BigDecimal amount, String ip,
    String timeout, String callBack) {
    // 实例化客户端
    AlipayClient alipayClient = AliPayConfig.build().getAlipayClient();
    // 实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
    AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
    // SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
    AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
    model.setSubject(subject);
    model.setBody(body);
    model.setOutTradeNo(out_trade_no);
    model.setTimeoutExpress(timeout);
    model.setTotalAmount(amount.toString());
    model.setProductCode("QUICK_MSECURITY_PAY");
    request.setBizModel(model);
    request.setNotifyUrl(callBack);
    try {
        // 这里和普通的接口调用不同,使用的是sdkExecute
        AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
        logger.info(response.getBody());// 就是orderString 可以直接给客户端请求,无需再做处理。
        if (!response.isSuccess()) {
            throw new RuntimeException(response.getSubMsg());
        }
        return response.getBody();
    } catch (AlipayApiException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:40,代码来源:AlipayUtil.java


示例6: appPay

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
/**
 * App 支付
 * https://doc.open.alipay.com/docs/doc.htm?treeId=54&articleId=106370&docType=1
 * 
 * @param model
 * @param notifyUrl
 * @return
 * @throws AlipayApiException
 */
public static AlipayTradeAppPayResponse appPay(AlipayTradeAppPayModel model, String notifyUrl)
		throws AlipayApiException {
	// 实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
	AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
	// SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
	request.setBizModel(model);
	request.setNotifyUrl(notifyUrl);
	// 这里和普通的接口调用不同,使用的是sdkExecute
	AlipayTradeAppPayResponse response = AliPayConfig.build().getAlipayClient().sdkExecute(request);
	return response;
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:21,代码来源:AliPay.java


示例7: quickMsecurityPay

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
@Override
public String quickMsecurityPay(String key, String user, String subject, int amount, String billNo, String notice) {
    AlipayModel alipay = alipayDao.findByKey(key);
    String content = getBizContent(alipay.getAppId(), user, subject, amount, billNo, notice, "QUICK_MSECURITY_PAY");
    if (content == null)
        return null;

    AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
    request.setBizContent(content);
    String string = prepay(alipay, null, request);

    return string == null ? null : string.substring(string.indexOf('?') + 1, string.indexOf('>') - 1) + "&biz_content=" +
            coder.encodeUrl(string.substring(string.indexOf('{'), string.indexOf('}') + 1)
                    .replaceAll(""", "\""), null);
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:16,代码来源:AlipayServiceImpl.java


示例8: doAliPayMobileReq

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
/**
 * 支付宝APP支付,生产签名及请求支付宝的参数(注:不会向支付宝发请求)
 * 文档: https://docs.open.alipay.com/204/105465/
 * @param jsonParam
 * @return
 */
@RequestMapping(value = "/pay/channel/ali_mobile")
public String doAliPayMobileReq(@RequestParam String jsonParam) {
    String logPrefix = "【支付宝APP支付下单】";
    JSONObject paramObj = JSON.parseObject(new String(MyBase64.decode(jsonParam)));
    PayOrder payOrder = paramObj.getObject("payOrder", PayOrder.class);
    String payOrderId = payOrder.getPayOrderId();
    String mchId = payOrder.getMchId();
    String channelId = payOrder.getChannelId();
    MchInfo mchInfo = mchInfoService.selectMchInfo(mchId);
    String resKey = mchInfo == null ? "" : mchInfo.getResKey();
    if("".equals(resKey)) return XXPayUtil.makeRetFail(XXPayUtil.makeRetMap(PayConstant.RETURN_VALUE_FAIL, "", PayConstant.RETURN_VALUE_FAIL, PayEnum.ERR_0001));
    PayChannel payChannel = payChannelService.selectPayChannel(channelId, mchId);
    alipayConfig.init(payChannel.getParam());
    AlipayClient client = new DefaultAlipayClient(alipayConfig.getUrl(), alipayConfig.getApp_id(), alipayConfig.getRsa_private_key(), AlipayConfig.FORMAT, AlipayConfig.CHARSET, alipayConfig.getAlipay_public_key(), AlipayConfig.SIGNTYPE);
    AlipayTradeAppPayRequest alipay_request = new AlipayTradeAppPayRequest();
    // 封装请求支付信息
    AlipayTradeAppPayModel model=new AlipayTradeAppPayModel();
    model.setOutTradeNo(payOrderId);
    model.setSubject(payOrder.getSubject());
    model.setTotalAmount(AmountUtil.convertCent2Dollar(payOrder.getAmount().toString()));
    model.setBody(payOrder.getBody());
    model.setProductCode("QUICK_MSECURITY_PAY");
    alipay_request.setBizModel(model);
    // 设置异步通知地址
    alipay_request.setNotifyUrl(alipayConfig.getNotify_url());
    // 设置同步地址
    alipay_request.setReturnUrl(alipayConfig.getReturn_url());
    String payParams = null;
    try {
        payParams = client.sdkExecute(alipay_request).getBody();
    } catch (AlipayApiException e) {
        e.printStackTrace();
    }
    payOrderService.updateStatus4Ing(payOrderId, null);
    _log.info("{}生成请求支付宝数据,payParams={}", logPrefix, payParams);
    _log.info("###### 商户统一下单处理完成 ######");
    Map<String, Object> map = XXPayUtil.makeRetMap(PayConstant.RETURN_VALUE_SUCCESS, "", PayConstant.RETURN_VALUE_SUCCESS, null);
    map.put("payOrderId", payOrderId);
    map.put("payParams", payParams);
    return XXPayUtil.makeRetData(map, resKey);
}
 
开发者ID:ywtnhm,项目名称:pay-xxpay-master,代码行数:48,代码来源:PayChannel4AlipayController.java


示例9: doAliPayMobileReq

import com.alipay.api.request.AlipayTradeAppPayRequest; //导入依赖的package包/类
@Override
public Map doAliPayMobileReq(String jsonParam) {
    String logPrefix = "【支付宝APP支付下单】";
    BaseParam baseParam = JsonUtil.getObjectFromJson(jsonParam, BaseParam.class);
    Map<String, Object> bizParamMap = baseParam.getBizParamMap();
    if (ObjectValidUtil.isInvalid(bizParamMap)) {
        _log.warn("{}失败, {}. jsonParam={}", logPrefix, RetEnum.RET_PARAM_NOT_FOUND.getMessage(), jsonParam);
        return RpcUtil.createFailResult(baseParam, RetEnum.RET_PARAM_NOT_FOUND);
    }
    JSONObject payOrderObj = baseParam.isNullValue("payOrder") ? null : JSONObject.parseObject(bizParamMap.get("payOrder").toString());
    PayOrder payOrder = BeanConvertUtils.map2Bean(payOrderObj, PayOrder.class);
    if (ObjectValidUtil.isInvalid(payOrder)) {
        _log.warn("{}失败, {}. jsonParam={}", logPrefix, RetEnum.RET_PARAM_INVALID.getMessage(), jsonParam);
        return RpcUtil.createFailResult(baseParam, RetEnum.RET_PARAM_INVALID);
    }
    String payOrderId = payOrder.getPayOrderId();
    String mchId = payOrder.getMchId();
    String channelId = payOrder.getChannelId();
    PayChannel payChannel = super.baseSelectPayChannel(mchId, channelId);
    alipayConfig.init(payChannel.getParam());
    AlipayClient client = new DefaultAlipayClient(alipayConfig.getUrl(), alipayConfig.getApp_id(), alipayConfig.getRsa_private_key(), AlipayConfig.FORMAT, AlipayConfig.CHARSET, alipayConfig.getAlipay_public_key(), AlipayConfig.SIGNTYPE);
    AlipayTradeAppPayRequest alipay_request = new AlipayTradeAppPayRequest();
    // 封装请求支付信息
    AlipayTradeAppPayModel model=new AlipayTradeAppPayModel();
    model.setOutTradeNo(payOrderId);
    model.setSubject(payOrder.getSubject());
    model.setTotalAmount(AmountUtil.convertCent2Dollar(payOrder.getAmount().toString()));
    model.setBody(payOrder.getBody());
    model.setProductCode("QUICK_MSECURITY_PAY");
    alipay_request.setBizModel(model);
    // 设置异步通知地址
    alipay_request.setNotifyUrl(alipayConfig.getNotify_url());
    // 设置同步地址
    alipay_request.setReturnUrl(alipayConfig.getReturn_url());
    String payParams = null;
    try {
        payParams = client.sdkExecute(alipay_request).getBody();
    } catch (AlipayApiException e) {
        e.printStackTrace();
    }
    super.baseUpdateStatus4Ing(payOrderId, null);
    _log.info("{}生成请求支付宝数据,payParams={}", logPrefix, payParams);
    _log.info("###### 商户统一下单处理完成 ######");
    Map<String, Object> map = XXPayUtil.makeRetMap(PayConstant.RETURN_VALUE_SUCCESS, "", PayConstant.RETURN_VALUE_SUCCESS, null);
    map.put("payOrderId", payOrderId);
    map.put("payParams", payParams);
    return RpcUtil.createBizResult(baseParam, map);
}
 
开发者ID:ywtnhm,项目名称:pay-xxpay-master,代码行数:49,代码来源:PayChannel4AliServiceImpl.java



注:本文中的com.alipay.api.request.AlipayTradeAppPayRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AppInfo类代码示例发布时间:2022-05-22
下一篇:
Java DebuggerSession类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap