当前位置: 首页>>代码示例>>Java>>正文


Java AlipayTradeRefundModel类代码示例

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


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

示例1: refund

import com.alipay.api.domain.AlipayTradeRefundModel; //导入依赖的package包/类
/**
 * 退款
 * @param outTradeNo 订单支付时传入的商户订单号,不能和 trade_no同时为空。
 * @param tradeNo 支付宝交易号,和商户订单号不能同时为空
 * @param outRequestNo 标识一次退款请求,同一笔交易多次退款需要保证唯一,如需部分退款,则此参数必传。
 * @param refundAmount 退款金额
 * @param refundReason 退款原因
 * @return 支付参数
 */
public static RefundResult refund(String outTradeNo, String tradeNo, String outRequestNo, BigDecimal refundAmount,
    String refundReason) {
    // 实例化客户端
    AlipayClient alipayClient = AliPayConfig.build().getAlipayClient();
    // 实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
    AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
    // SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
    AlipayTradeRefundModel model = new AlipayTradeRefundModel();
    model.setOutTradeNo(outTradeNo);
    model.setTradeNo(tradeNo);
    model.setRefundAmount(refundAmount.toString());
    model.setRefundReason(refundReason);
    model.setOutRequestNo(outRequestNo);
    request.setBizModel(model);
    try {
        // 这里和普通的接口调用不同,使用的是sdkExecute
        AlipayTradeRefundResponse response = alipayClient.execute(request);
        logger.info(response.getBody());
        if (!response.isSuccess()) {
            throw new RuntimeException(response.getSubMsg());
        }
        Map<?, ?> body = JSON.parseObject(response.getBody(), Map.class);
        Map<?, ?> result = JSON.parseObject(body.get("alipay_trade_refund_response").toString());
        return new RefundResult((String)result.get("trade_no"), outTradeNo, refundAmount.toString(),
            DateUtil.stringToDate((String)result.get("gmt_refund_pay")),
            "Y".equals(result.get("fund_change")) ? "1" : "2");
    } catch (AlipayApiException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:40,代码来源:AlipayUtil.java

示例2: tradeRefundToResponse

import com.alipay.api.domain.AlipayTradeRefundModel; //导入依赖的package包/类
public static AlipayTradeRefundResponse tradeRefundToResponse(AlipayTradeRefundModel model)
    throws AlipayApiException {
    AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
    request.setBizModel(model);
    return AliPayConfig.build().getAlipayClient().execute(request);
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:7,代码来源:AliPay.java

示例3: tradeRefundToResponse

import com.alipay.api.domain.AlipayTradeRefundModel; //导入依赖的package包/类
public static AlipayTradeRefundResponse tradeRefundToResponse(AlipayTradeRefundModel model)
		throws AlipayApiException {
	AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
	request.setBizModel(model);
	return AliPayConfig.build().getAlipayClient().execute(request);
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:7,代码来源:AliPay.java

示例4: tradeRefund

import com.alipay.api.domain.AlipayTradeRefundModel; //导入依赖的package包/类
/**
 * 退款
 * https://doc.open.alipay.com/docs/api.htm?spm=a219a.7395905.0.0.SAyEeI&docType=4&apiId=759
 * @param model
 * @return {String}
 * @throws {AlipayApiException}
 */
public static String tradeRefund(AlipayTradeRefundModel model) throws AlipayApiException{
	AlipayTradeRefundResponse response = tradeRefundToResponse(model);
	return response.getBody();
}
 
开发者ID:Javen205,项目名称:IJPay,代码行数:12,代码来源:AliPayApi.java

示例5: tradeRefundToResponse

import com.alipay.api.domain.AlipayTradeRefundModel; //导入依赖的package包/类
/**
 * 退款
 * @param model
 * @return {AlipayTradeRefundResponse}
 * @throws {AlipayApiException}
 */
public static AlipayTradeRefundResponse tradeRefundToResponse(AlipayTradeRefundModel model) throws AlipayApiException{
	AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
	request.setBizModel(model);
	return AliPayApiConfigKit.getAliPayApiConfig().getAlipayClient().execute(request);
}
 
开发者ID:Javen205,项目名称:IJPay,代码行数:12,代码来源:AliPayApi.java

示例6: tradeRefund

import com.alipay.api.domain.AlipayTradeRefundModel; //导入依赖的package包/类
/**
 * 退款
 * 
 * @param model content
 * @return
 * @throws AlipayApiException
 */
public static String tradeRefund(AlipayTradeRefundModel model) throws AlipayApiException {
    AlipayTradeRefundResponse response = tradeRefundToResponse(model);
    return response.getBody();
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:12,代码来源:AliPay.java

示例7: tradeRefund

import com.alipay.api.domain.AlipayTradeRefundModel; //导入依赖的package包/类
/**
 * 退款
 * https://doc.open.alipay.com/docs/api.htm?spm=a219a.7395905.0.0.SAyEeI&docType=4&apiId=759
 * 
 * @param content
 * @return
 * @throws AlipayApiException
 */
public static String tradeRefund(AlipayTradeRefundModel model) throws AlipayApiException {
	AlipayTradeRefundResponse response = tradeRefundToResponse(model);
	return response.getBody();
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:13,代码来源:AliPay.java


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